Let's Talk Elections Tournament
ltetwiki
https://ltet.miraheze.org/wiki/Main_Page
MediaWiki 1.40.2
first-letter
Media
Special
Talk
User
User talk
Let's Talk Elections Tournament
Let's Talk Elections Tournament talk
File
File talk
MediaWiki
MediaWiki talk
Template
Template talk
Help
Help talk
Category
Category talk
Module
Module talk
Template:!-
10
225
442
2013-11-17T11:54:04Z
wikipedia>Mr. Stradivarius
0
Changed protection level of Template:!-: [[WP:High-risk templates|Highly visible template]]: reinstate full-protection - this should never be edited ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))
wikitext
text/x-wiki
|-<noinclude>
{{documentation}}
</noinclude>
19a1b27b5273caa6fd83a1208fb704afa9ee7c04
Template:Hatnote
10
66
125
2014-05-23T15:55:04Z
wikipedia>SMcCandlish
0
tweak
wikitext
text/x-wiki
<includeonly>{{#invoke:Hatnote|hatnote}}</includeonly><noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
4a1d1028d07c9056022807a96051e1c82cf2a1c7
Template:Pagetype
10
25
43
2014-07-09T08:29:38Z
wikipedia>Callanecc
0
Changed protection level of Template:Pagetype: [[WP:High-risk templates|Highly visible template]]: With more than 5.5 million transclusions and cascade protections this should be full protected as well ([Edit=Allow only administrators] (indefinite) [Move=
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:pagetype|main}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
b8e6aa66678cd57877ea2c607372a45070f030a7
Template:Strfind short
10
173
337
2014-08-31T23:39:01Z
wikipedia>Mr. Stradivarius
0
Changed protection level of Template:Strfind short: [[WP:High-risk templates|Highly visible template]] ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))
wikitext
text/x-wiki
{{#Invoke:String|find|source={{{1|}}}|{{{2}}}}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
f5475bb1d4bf09dc8dea7613cd4bc79847dafcbc
Module:Ns has subpages
828
78
147
2014-12-10T06:37:29Z
wikipedia>Mr. Stradivarius
0
Protected Module:Ns has subpages: [[WP:High-risk templates|High-risk Lua module]] ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))
Scribunto
text/plain
-- This module implements [[Template:Ns has subpages]].
-- While the template is fairly simple, this information is made available to
-- Lua directly, so using a module means that we don't have to update the
-- template as new namespaces are added.
local p = {}
function p._main(ns, frame)
-- Get the current namespace if we were not passed one.
if not ns then
ns = mw.title.getCurrentTitle().namespace
end
-- Look up the namespace table from mw.site.namespaces. This should work
-- for a majority of cases.
local nsTable = mw.site.namespaces[ns]
-- Try using string matching to get the namespace from page names.
-- Do a quick and dirty bad title check to try and make sure we do the same
-- thing as {{NAMESPACE}} in most cases.
if not nsTable and type(ns) == 'string' and not ns:find('[<>|%[%]{}]') then
local nsStripped = ns:gsub('^[_%s]*:', '')
nsStripped = nsStripped:gsub(':.*$', '')
nsTable = mw.site.namespaces[nsStripped]
end
-- If we still have no match then try the {{NAMESPACE}} parser function,
-- which should catch the remainder of cases. Don't use a mw.title object,
-- as this would increment the expensive function count for each new page
-- tested.
if not nsTable then
frame = frame or mw.getCurrentFrame()
local nsProcessed = frame:callParserFunction('NAMESPACE', ns)
nsTable = nsProcessed and mw.site.namespaces[nsProcessed]
end
return nsTable and nsTable.hasSubpages
end
function p.main(frame)
local ns = frame:getParent().args[1]
if ns then
ns = ns:match('^%s*(.-)%s*$') -- trim whitespace
ns = tonumber(ns) or ns
end
local hasSubpages = p._main(ns, frame)
return hasSubpages and 'yes' or ''
end
return p
e133068ba73738b16e1e3eba47735516a461eb5b
Template:Clear right
10
202
396
2015-02-09T15:14:22Z
wikipedia>Edokter
0
Fix
wikitext
text/x-wiki
{{Clear|right}}<noinclude>
{{Documentation|Template:Clear/doc}}
</noinclude>
12b36d3e1933e27905b1549e2e69366dc1c3c7b2
Template:Hlist
10
185
362
2015-07-04T15:13:14Z
wikipedia>Penwhale
0
Changed protection level of Template:Hlist: [[WP:High-risk templates|Highly visible template]] ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:list|horizontal}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
9e3824c2e3c0e0dbef2f37556ac0b994987fecf9
Template:Redirect template
10
247
486
2015-07-23T08:16:39Z
wikipedia>Paine Ellsworth
0
for correct appearance of documentation page on template page
wikitext
text/x-wiki
{{#invoke:Redirect template|main}}<noinclude>
{{Documentation}}</noinclude>
0b8db63883716ef3a4d3a9492f8571ae96028547
Template:Div col end
10
113
217
2015-10-03T15:58:07Z
wikipedia>NeilN
0
Changed protection level of Template:Div col end: per request at [[WP:RFPP]] ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))
wikitext
text/x-wiki
<includeonly></div></includeonly><noinclude>
{{Documentation|Template:Div col/doc}}
</noinclude>
78088d41c21d779e3722f220fcc9773dfbbc1e4f
Template:Nowrap
10
142
275
2015-11-28T10:13:53Z
wikipedia>Edokter
0
Adapt comment; edits inside noinclude blocks should not affect job queue, but won't kill parser either way.
wikitext
text/x-wiki
<span class="nowrap">{{{1}}}</span><noinclude>
{{documentation}}
<!-- Categories go on the /doc page; interwikis go to Wikidata. -->
</noinclude>
5d0dc6b6d89b37f4356242404f46138a4017f015
Template:Delink
10
44
81
2015-12-26T16:26:10Z
wikipedia>Frietjes
0
{{documentation}} does this
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:delink|delink}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
ccf86b4255142fffb206ab8240f36ed22e029d6a
Template:PAGENAMEBASE
10
152
295
2016-03-06T09:37:56Z
wikipedia>Cabayi
0
per edit request & discussion
wikitext
text/x-wiki
{{{{{|safesubst:}}}#Invoke:String|replace|{{{1|{{{{{|safesubst:}}}PAGENAME}}}}}|%s+%b()$||1|false}}<noinclude>
{{documentation}}
</noinclude>
f23a5d434cb5b0baac5e1f58e9ceef9118e6873f
Template:(!
10
215
422
2016-08-09T22:00:28Z
wikipedia>Renamed user mou89p43twvqcvm8ut9w3
0
Changed protection level of Template:(!: [[WP:High-risk templates|Highly visible template]] ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
<includeonly>{|</includeonly><noinclude><nowiki>{|</nowiki>{{Documentation}}
</noinclude>
f709d1f206330f000c28ae20e722426c750f9bd5
Template:Str left
10
199
390
2016-09-30T07:01:19Z
wikipedia>Ymblanter
0
Changed protection level of Template:Str left: [[WP:High-risk templates|Highly visible template]]: RFPP request ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
<includeonly>{{safesubst:padleft:|{{{2|1}}}|{{{1}}}}}</includeonly><noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
2048b0d7b35e156528655b1d090e8b5ffab3f400
Template:Both
10
146
283
2016-12-04T04:31:50Z
wikipedia>JJMC89
0
make subst'able
wikitext
text/x-wiki
{{SAFESUBST:<noinclude />#if:{{{1|}}}|{{SAFESUBST:<noinclude />#if:{{{2|}}}|1}}}}<noinclude>
{{documentation}}
</noinclude>
57c3c0ffa811a7f31c675b2d79aedf4382e9b88d
Template:Cite web
10
46
85
2016-12-05T05:36:52Z
wikipedia>Anthony Appleyard
0
Protected "[[Template:Cite web]]": restore old protection ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
<includeonly>{{#invoke:citation/CS1|citation
|CitationClass=web
}}</includeonly><noinclude>
{{documentation}}
</noinclude>
ea1b0f38afd9728a1cf9f2e3f540887a402fab8e
Template:See also
10
54
101
2017-02-02T05:40:25Z
wikipedia>Nihiltres
0
Updated from sandbox to use [[Module:Labelled list hatnote]]
wikitext
text/x-wiki
<includeonly>{{#invoke:Labelled list hatnote|labelledList|See also}}</includeonly><noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
74d2ab6a0df5605fbe2085c405925ec659be52b7
Module:ParameterCount
828
168
327
2017-02-11T14:32:57Z
wikipedia>Mr. Stradivarius
0
Protected "[[Module:ParameterCount]]": [[WP:High-risk templates|High-risk Lua module]]: 20,000+ transclusions ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
Scribunto
text/plain
-- This module produces a count of all the arguments passed to it.
local yesno = require('Module:Yesno')
-- Trim a string
local function trim(s)
return s:match('^%s*(.-)%s*$')
end
-- Test whether a string is blank
local function isBlank(s)
return not s:find('%S')
end
-- Tests whether a string is a valid positional key, and if so, returns it. If
-- the key is invalid, this returns nil.
local function isPositionalKey(s)
s = trim(s)
if s:find('^[1-9][0-9]*$') then
return tonumber(s)
end
end
-- Return the count of all arguments for which testFunc returns a truthy value.
local function count(args, testFunc)
local ret = 0
for key, val in pairs(args) do
if testFunc(key, val) then
ret = ret + 1
end
end
return ret
end
-- Check shared arguments and get the parent argument count.
local function main(frame, testFunc)
local blankifiedTestFunc
if yesno(frame.args.checkblanks) ~= false then
-- Extend the test function to check for blanks as well.
blankifiedTestFunc = function (key, val)
if not isBlank(val) then
return testFunc(key, val)
end
end
else
blankifiedTestFunc = testFunc
end
return count(frame:getParent().args, blankifiedTestFunc)
end
return {
-- Called with {{#invoke:ParameterCount|all}}
-- All specified parameters are counted, even those not supported by the
-- template.
all = function (frame)
return main(frame, function () return true end)
end,
-- Called with {{#invoke:ParameterCount|main}}
-- Users can specify a list of parameters to check, and a list of Lua
-- Ustring patterns to check each parameter against.
main = function (frame)
local args = frame.args
local keys, patterns = {}, {}
-- Get key list
for i, key in ipairs(args) do
local positionalKey = isPositionalKey(key)
if positionalKey then
keys[positionalKey] = true
else
keys[trim(key)] = true
end
end
-- Get patterns
do
local function getPattern(i)
local pattern = args['pattern' .. tostring(i)]
if pattern and pattern ~= '' then
return pattern
end
end
local i = 1
local pattern = getPattern(i)
while pattern do
patterns[i] = pattern
i = i + 1
pattern = getPattern(i)
end
end
-- Construct the test function
local testFunc = function (key, val)
if keys[key] then
return true
end
for i, pattern in ipairs(patterns) do
if mw.ustring.find(tostring(key), pattern) then
return true
end
end
return false
end
return main(frame, testFunc)
end
}
63e3811b7a17825c071b1920ce88af06bc1e778d
Template:-
10
211
414
2017-03-12T14:41:31Z
wikipedia>Paine Ellsworth
0
add [[WP:RCAT|rcat]]
wikitext
text/x-wiki
#REDIRECT [[Template:Clear]]
{{Redirect category shell|
{{R from modification}}
{{R from template shortcut}}
}}
3fb0b377ebee11659e4a3ba0034f60898dbc473f
Template:Smallsup
10
196
384
2017-03-25T12:38:47Z
wikipedia>Jo-Jo Eumerus
0
Changed protection level for "[[Template:Smallsup]]": Allowing template editors on some templates with full protection dating back to pre-[[WP:TPROT|TPROT]] times which aren't too often or too sensitively used. ([Edit=Require template editor access] (i...
wikitext
text/x-wiki
<includeonly><sup><small>{{{1}}}</small></sup></includeonly><noinclude>
{{Documentation}}
</noinclude>
c174fb3247218273210500118556feb9f3c76d5a
Template:Max
10
234
460
2017-03-25T16:04:13Z
wikipedia>Jo-Jo Eumerus
0
Changed protection level for "[[Template:Max]]": Allowing template editors on some templates with full protection dating back to pre-[[WP:TPROT]] times which aren't too often or too sensitively used. ([Edit=Require template editor access] (indefinite)...
wikitext
text/x-wiki
<includeonly>{{#invoke:Math|max}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
f052e3a9b5b08740be624045e49f31d86e09f0ad
Template:Fix/category
10
49
91
2017-04-08T20:24:09Z
wikipedia>Jo-Jo Eumerus
0
Changed protection level for "[[Template:Fix/category]]": [[WP:High-risk templates|Highly visible template]]: Allowing template editors ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
<noinclude>{{pp-template|small=yes}}</noinclude>{{{cat|[[Category:All pages needing cleanup]]}}}{{#if:{{{cat-date|}}}
|[[{{{cat-date}}} {{#if:{{{date|}}}
|from {{{date}}}
}}]]{{#if:{{{date|}}}
|{{#ifexist:{{{cat-date}}} from {{{date}}}|
|[[Category:Articles with invalid date parameter in template]]
}}
}}
}}{{#if:{{{cat2|}}}|{{{cat2}}}}}{{#if:{{{cat-date2|}}}
|[[{{{cat-date2}}} {{#if:{{{date|}}}
|from {{{date}}}
}}]]{{#if:{{{date|}}}
|{{#ifexist:{{{cat-date2}}} from {{{date}}}|
|[[Category:Articles with invalid date parameter in template]]
}}
}}
}}{{#if:{{{cat3|}}}|{{{cat3}}}}}{{#if:{{{cat-date3|}}}
|[[{{{cat-date3}}} {{#if:{{{date|}}}
|from {{{date}}}
}}]]{{#if:{{{date|}}}
|{{#ifexist:{{{cat-date3}}} from {{{date}}}|
|[[Category:Articles with invalid date parameter in template]]
}}
}}
}}
8f0a79cdee91c3d967a6d70cf7bfab4093b3d6ae
Template:Navbar
10
232
456
2017-04-22T18:49:17Z
wikipedia>Plastikspork
0
Closed
wikitext
text/x-wiki
<includeonly>{{#invoke:Navbar|navbar}}</includeonly><noinclude>
{{documentation}}
</noinclude>
868e3566b7e8a9a5a7f3dac75cac429c47de10d3
Template:Refend
10
53
99
2017-07-24T21:40:56Z
wikipedia>WOSlinker
0
remove </dl> since no <dl> in Template:Refbegin
wikitext
text/x-wiki
<includeonly></div></includeonly><noinclude>
{{template doc|Template:refbegin/doc}}
{{TemplateDataHeader}}
<templatedata>
{
"description": "Ends a reference lists started by {{refbegin}}.",
"params": {
}
}
</templatedata>
</noinclude>
ae41356c6aab3e8901a484fcb46ff4aa314f1bb9
Template:Cite book
10
50
93
2017-11-15T09:11:45Z
wikipedia>Salix alba
0
put TD in a collapse top / bottom section
wikitext
text/x-wiki
<includeonly>{{#invoke:citation/CS1|citation
|CitationClass=book
}}</includeonly><noinclude>
{{documentation}}
{{collapse top|TemplateData}}
{{Cite book/TemplateData}}
{{collapse bottom}}
</noinclude>
c474cbe5d051e08f516083d594207d449245c717
Template:UF-hcal
10
244
480
2018-01-19T00:34:07Z
wikipedia>Primefac
0
Protected "[[Template:UF-hcal]]": [[WP:SEMIPROT|semi-protection]] of high-usage templates to combat systematic vandalism ([Edit=Require autoconfirmed or confirmed access] (indefinite) [Move=Require autoconfirmed or confirmed access] (indefinite))
wikitext
text/x-wiki
{{Microformat message
| format = hCalendar
| data = event details
| subtemplates =
{{#if:{{{hide_subtemplates}}} |<noinclude>}}
Dates will only be included if you use {{tl|start date}} (for single dates) or {{tl|end date}}. Do not, however, use these templates [[Wikipedia:WikiProject Microformats/dates|if a date before 1583 CE is involved]].
To include URLs, use {{tl|URL}}.
{{#if:{{{hide_subtemplates}}} |</noinclude>}}
|attendee |contact |description |dtend |dtstart |location |organiser |summary |url |vevent
| nocollapse = on
}}<includeonly>{{#ifeq:{{SUBPAGENAME}}|doc | |{{#ifeq:{{SUBPAGENAME}}|sandbox | |[[Category:Templates generating hCalendars|{{PAGENAME}}]]}} }}</includeonly><noinclude>
{{Documentation |content={{Microformat message templates}}}}
[[Category:Microformat (uF) message templates]]
</noinclude>
f453b47f676a5c474e14155f7013b69b4716748b
Template:Remove first word
10
200
392
2018-02-13T20:10:27Z
wikipedia>WOSlinker
0
separate pp-template not needed
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:String|replace|source={{{1}}}|pattern=^[^{{{sep|%s}}}]*{{{sep|%s}}}*|replace=|plain=false}}<noinclude>{{Documentation}}</noinclude>
df7a9e692f68be1581be06af5f51eaed5483b4c8
Template:Yesno-no
10
114
219
2018-02-13T20:27:17Z
wikipedia>WOSlinker
0
separate pp-template not needed
wikitext
text/x-wiki
{{safesubst:<noinclude />yesno|{{{1}}}|yes={{{yes|yes}}}|no={{{no|no}}}|blank={{{blank|no}}}|¬={{{¬|no}}}|def={{{def|no}}}}}<noinclude>
{{Documentation|Template:Yesno/doc}}
<!--Categories go in the doc page referenced above; interwikis go in Wikidata.-->
</noinclude>
1ad7b7800da1b867ead8f6ff8cef76e6201b3b56
Template:Yesno-yes
10
184
360
2018-03-11T01:06:35Z
wikipedia>JJMC89
0
allow subst
wikitext
text/x-wiki
{{SAFESUBST:<noinclude />yesno|{{{1}}}|yes={{{yes|yes}}}|no={{{no|no}}}|blank={{{blank|yes}}}|¬={{{¬|yes}}}|def={{{def|yes}}}}}<noinclude>
{{Documentation|Template:Yesno/doc}}
<!--Categories go in the doc page referenced above; interwikis go in Wikidata.-->
</noinclude>
1644b79058ef2cece539a411edc164d98bb11ebe
Module:Distinguish
828
99
189
2018-04-01T10:06:10Z
wikipedia>Galobtter
0
fixed with text and selfref
Scribunto
text/plain
local mHatnote = require('Module:Hatnote')
local mHatlist = require('Module:Hatnote list')
local mArguments --initialize lazily
local mTableTools --initialize lazily
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local p = {}
function p.distinguish(frame)
mArguments = require('Module:Arguments')
mTableTools = require('Module:TableTools')
local args = mArguments.getArgs(frame)
local selfref = args.selfref
local text = args.text
args = mTableTools.compressSparseArray(args)
return p._distinguish(args, text, selfref)
end
function p._distinguish(args, text, selfref)
checkType("_distinguish", 1, args, 'table')
if #args == 0 and not text then return '' end
local text = string.format(
'Not to be confused with %s.',
text or mHatlist.orList(args, true)
)
hnOptions = {selfref = selfref}
return mHatnote._hatnote(text, hnOptions)
end
return p
0364d14af01fc656ad1d898c5036fbd12a7ca938
Template:Delink question hyphen-minus
10
217
426
2018-04-25T18:40:36Z
wikipedia>Ahecht
0
{{{1|}}}
wikitext
text/x-wiki
{{{{{|safesubst:}}}#invoke:MultiReplace|main|{{{1|}}}|%[%[ *([%?-]) *%]%]|%1|%[%[ *[%?-] *{{{{{|safesubst:}}}!}} *(.-) *%]%]|%1}}<noinclude>
{{documentation}}
</noinclude>
f342bb1e299a3bd5e482defa9cde3dd36ccf210e
Template:For loop
10
254
500
2018-07-23T22:55:18Z
wikipedia>Pppery
0
Merge complete
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:For loop|main}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
12b7b7010fe32f888e21bcdfa6a904fc8a925437
Template:Infobox
10
82
155
2018-08-15T18:33:36Z
wikipedia>Primefac
0
Undid revision 855063393 by [[Special:Contributions/Jdlrobson|Jdlrobson]] ([[User talk:Jdlrobson|talk]]) rather problematic change mentioned [[Template_talk:Infobox#Using_template_styles_to_reduce_technical_debt_inside_mobile_skin|on talk page]], reverting until it can be sorted
wikitext
text/x-wiki
{{#invoke:Infobox|infobox}}<includeonly>{{template other|{{#ifeq:{{PAGENAME}}|Infobox||{{#ifeq:{{str left|{{SUBPAGENAME}}|7}}|Infobox|[[Category:Infobox templates|{{remove first word|{{SUBPAGENAME}}}}]]}}}}|}}</includeonly><noinclude>
{{documentation}}
<!-- Categories go in the /doc subpage, and interwikis go in Wikidata. -->
</noinclude>
817a9f5b6524eced06a57bd1d5fd7179f9369bf2
Template:Nobold
10
86
163
2018-10-23T17:15:13Z
wikipedia>Frietjes
0
wikitext
text/x-wiki
<templatestyles src="Nobold/styles.css"/><span class="nobold">{{{1}}}</span><noinclude>
{{documentation}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS -->
</noinclude>
9c92b5951772bb26ca0fbe9256418b65e47700dd
Template:Flagdeco
10
218
428
2018-12-16T14:05:04Z
wikipedia>Frietjes
0
wikitext
text/x-wiki
<includeonly>{{#ifeq: {{Yesno-no|{{{noredlink|}}}}}|yes<!--
-->|<!--
#Check for existence of Template: Country data foo before invoking it
-->{{#ifexist: Template: Country data {{{1|}}}<!--
-->|<!--
# It exists, so proceed
-->{{country data {{{1|}}}|flagdeco/core|variant={{{variant|{{{2|}}}}}}|size={{{size|}}}}}<!--
-->|<!--
# It doesn't exist, so do nothing
-->}}<!--
-->|<!--
# DEFAULT call Template: Country data {{{1|}}}
# with no prior checks
-->{{country data {{{1|}}}|flagdeco/core|variant={{{variant|{{{2|}}}}}}|size={{{size|}}}}}<!--
# Track use where "Template:Country data Foo" does not exist
-->{{#ifexist: Template:Country data {{{1|}}}||{{namespace detect showall
| 1 =
| 2 = [[Category:Flagdeco with missing country data templates]]
| user = 1
| talk = 1
| other = 2
}}}}<!--
-->}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
2cd50bb91e18505de93484a7348c92b68745dbf9
Template:!)
10
214
420
2018-12-16T17:33:17Z
wikipedia>Amorymeltzer
0
Changed protection level for "[[Template:!)]]": [[WP:High-risk templates|Highly visible template]]: 200k+ transclusions ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
|}<noinclude>
{{Documentation}}
</noinclude>
4708392952b330b1c5bf605bc6fc76222b1609d2
Template:Category handler
10
37
67
2018-12-16T20:13:00Z
wikipedia>Amorymeltzer
0
Changed protection level for "[[Template:Category handler]]": [[WP:High-risk templates|Highly visible template]] ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
{{#invoke:Category handler|main}}<noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage, and interwikis to Wikidata. -->
</noinclude>
d14e9f545cf1833acbe174ae70b615c39b18cf63
Template:Template other
10
95
181
2018-12-16T22:06:25Z
wikipedia>Amorymeltzer
0
Changed protection level for "[[Template:Template other]]": [[WP:High-risk templates|Highly visible template]]: Transclusion count has increased dramatically ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
{{#switch:
<!--If no or empty "demospace" parameter then detect namespace-->
{{#if:{{{demospace|}}}
| {{lc: {{{demospace}}} }} <!--Use lower case "demospace"-->
| {{#ifeq:{{NAMESPACE}}|{{ns:Template}}
| template
| other
}}
}}
| template = {{{1|}}}
| other
| #default = {{{2|}}}
}}<!--End switch--><noinclude>
{{documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
06fb13d264df967b5232141067eb7d2b67372d76
Template:MONTHNUMBER
10
212
416
2018-12-17T15:25:23Z
wikipedia>Amorymeltzer
0
Changed protection level for "[[Template:MONTHNUMBER]]": Allow template editor access, see [[Template:MONTHNAME]] ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
<includeonly>{{#if:{{{1|}}}
|{{#switch:{{lc:{{{1}}}}}
|january|jan=1
|february|feb=2
|march|mar=3
|apr|april=4
|may=5
|june|jun=6
|july|jul=7
|august|aug=8
|september|sep|sept=9
|october|oct=10
|november|nov=11
|december|dec=12
|{{#ifexpr:{{{1}}}<0
|{{#ifexpr:(({{{1}}})round 0)!=({{{1}}})
|{{#expr:12-(((0.5-({{{1}}}))round 0)mod 12)}}
|{{#expr:12-(((11.5-({{{1}}}))round 0)mod 12)}}
}}
|{{#expr:(((10.5+{{{1}}})round 0)mod 12)+1}}
}}
}}
|Missing required parameter 1=''month''!
}}</includeonly><noinclude>
{{Documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
c2ade663b96231e493986cd17b454923da290098
Module:Separated entries
828
149
289
2018-12-17T20:54:33Z
wikipedia>Amorymeltzer
0
Changed protection level for "[[Module:Separated entries]]": [[WP:High-risk templates|High-risk Lua module]]: Over 2M transclusions ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
Scribunto
text/plain
-- This module takes positional parameters as input and concatenates them with
-- an optional separator. The final separator (the "conjunction") can be
-- specified independently, enabling natural-language lists like
-- "foo, bar, baz and qux". The starting parameter can also be specified.
local compressSparseArray = require('Module:TableTools').compressSparseArray
local p = {}
function p._main(args)
local separator = args.separator
-- Decode (convert to Unicode) HTML escape sequences, such as " " for space.
and mw.text.decode(args.separator) or ''
local conjunction = args.conjunction and mw.text.decode(args.conjunction) or separator
-- Discard values before the starting parameter.
local start = tonumber(args.start)
if start then
for i = 1, start - 1 do args[i] = nil end
end
-- Discard named parameters.
local values = compressSparseArray(args)
return mw.text.listToText(values, separator, conjunction)
end
local function makeInvokeFunction(separator, conjunction, first)
return function (frame)
local args = require('Module:Arguments').getArgs(frame)
args.separator = separator or args.separator
args.conjunction = conjunction or args.conjunction
args.first = first or args.first
return p._main(args)
end
end
p.main = makeInvokeFunction()
p.br = makeInvokeFunction('<br />')
p.comma = makeInvokeFunction(mw.message.new('comma-separator'):plain())
return p
e80231ff3de01afd7f62a94e0a34dc1e67504085
Module:Color contrast
828
197
386
2019-01-06T22:38:25Z
wikipedia>Johnuniq
0
fix unintended color2lum global error which is causing errors; clean whitespace
Scribunto
text/plain
--
-- This module implements
-- {{Color contrast ratio}}
-- {{Greater color contrast ratio}}
-- {{ColorToLum}}
-- {{RGBColorToLum}}
--
local p = {}
local HTMLcolor = mw.loadData( 'Module:Color contrast/colors' )
local function sRGB (v)
if (v <= 0.03928) then
v = v / 12.92
else
v = math.pow((v+0.055)/1.055, 2.4)
end
return v
end
local function rgbdec2lum(R, G, B)
if ( 0 <= R and R < 256 and 0 <= G and G < 256 and 0 <= B and B < 256 ) then
return 0.2126 * sRGB(R/255) + 0.7152 * sRGB(G/255) + 0.0722 * sRGB(B/255)
else
return ''
end
end
local function hsl2lum(h, s, l)
if ( 0 <= h and h < 360 and 0 <= s and s <= 1 and 0 <= l and l <= 1 ) then
local c = (1 - math.abs(2*l - 1))*s
local x = c*(1 - math.abs( math.fmod(h/60, 2) - 1) )
local m = l - c/2
local r, g, b = m, m, m
if( 0 <= h and h < 60 ) then
r = r + c
g = g + x
elseif( 60 <= h and h < 120 ) then
r = r + x
g = g + c
elseif( 120 <= h and h < 180 ) then
g = g + c
b = b + x
elseif( 180 <= h and h < 240 ) then
g = g + x
b = b + c
elseif( 240 <= h and h < 300 ) then
r = r + x
b = b + c
elseif( 300 <= h and h < 360 ) then
r = r + c
b = b + x
end
return rgbdec2lum(255*r, 255*g, 255*b)
else
return ''
end
end
local function color2lum(c)
if (c == nil) then
return ''
end
-- html '#' entity
c = c:gsub("#", "#")
-- whitespace
c = c:match( '^%s*(.-)[%s;]*$' )
-- unstrip nowiki strip markers
c = mw.text.unstripNoWiki(c)
-- lowercase
c = c:lower()
-- first try to look it up
local L = HTMLcolor[c]
if (L ~= nil) then
return L
end
-- convert from hsl
if mw.ustring.match(c,'^hsl%([%s]*[0-9][0-9%.]*[%s]*,[%s]*[0-9][0-9%.]*%%[%s]*,[%s]*[0-9][0-9%.]*%%[%s]*%)$') then
local h, s, l = mw.ustring.match(c,'^hsl%([%s]*([0-9][0-9%.]*)[%s]*,[%s]*([0-9][0-9%.]*)%%[%s]*,[%s]*([0-9][0-9%.]*)%%[%s]*%)$')
return hsl2lum(tonumber(h), tonumber(s)/100, tonumber(l)/100)
end
-- convert from rgb
if mw.ustring.match(c,'^rgb%([%s]*[0-9][0-9]*[%s]*,[%s]*[0-9][0-9]*[%s]*,[%s]*[0-9][0-9]*[%s]*%)$') then
local R, G, B = mw.ustring.match(c,'^rgb%([%s]*([0-9][0-9]*)[%s]*,[%s]*([0-9][0-9]*)[%s]*,[%s]*([0-9][0-9]*)[%s]*%)$')
return rgbdec2lum(tonumber(R), tonumber(G), tonumber(B))
end
-- convert from rgb percent
if mw.ustring.match(c,'^rgb%([%s]*[0-9][0-9%.]*%%[%s]*,[%s]*[0-9][0-9%.]*%%[%s]*,[%s]*[0-9][0-9%.]*%%[%s]*%)$') then
local R, G, B = mw.ustring.match(c,'^rgb%([%s]*([0-9][0-9%.]*)%%[%s]*,[%s]*([0-9][0-9%.]*)%%[%s]*,[%s]*([0-9][0-9%.]*)%%[%s]*%)$')
return rgbdec2lum(255*tonumber(R)/100, 255*tonumber(G)/100, 255*tonumber(B)/100)
end
-- remove leading # (if there is one) and whitespace
c = mw.ustring.match(c, '^[%s#]*([a-f0-9]*)[%s]*$')
-- split into rgb
local cs = mw.text.split(c or '', '')
if( #cs == 6 ) then
local R = 16*tonumber('0x' .. cs[1]) + tonumber('0x' .. cs[2])
local G = 16*tonumber('0x' .. cs[3]) + tonumber('0x' .. cs[4])
local B = 16*tonumber('0x' .. cs[5]) + tonumber('0x' .. cs[6])
return rgbdec2lum(R, G, B)
elseif ( #cs == 3 ) then
local R = 16*tonumber('0x' .. cs[1]) + tonumber('0x' .. cs[1])
local G = 16*tonumber('0x' .. cs[2]) + tonumber('0x' .. cs[2])
local B = 16*tonumber('0x' .. cs[3]) + tonumber('0x' .. cs[3])
return rgbdec2lum(R, G, B)
end
-- failure, return blank
return ''
end
-- This exports the function for use in other modules.
-- The colour is passed as a string.
function p._lum(color)
return color2lum(color)
end
function p._greatercontrast(args)
local bias = tonumber(args['bias'] or '0') or 0
local css = (args['css'] and args['css'] ~= '') and true or false
local v1 = color2lum(args[1] or '')
local c2 = args[2] or '#FFFFFF'
local v2 = color2lum(c2)
local c3 = args[3] or '#000000'
local v3 = color2lum(c3)
local ratio1 = -1;
local ratio2 = -1;
if (type(v1) == 'number' and type(v2) == 'number') then
ratio1 = (v2 + 0.05)/(v1 + 0.05)
ratio1 = (ratio1 < 1) and 1/ratio1 or ratio1
end
if (type(v1) == 'number' and type(v3) == 'number') then
ratio2 = (v3 + 0.05)/(v1 + 0.05)
ratio2 = (ratio2 < 1) and 1/ratio2 or ratio2
end
if css then
local c1 = args[1] or ''
if mw.ustring.match(c1, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') or
mw.ustring.match(c1, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') then
c1 = '#' .. c1
end
if mw.ustring.match(c2, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') or
mw.ustring.match(c2, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') then
c2 = '#' .. c2
end
if mw.ustring.match(v3, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') or
mw.ustring.match(v3, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') then
c3 = '#' .. c3
end
return 'background-color:' .. c1 .. '; color:' .. ((ratio1 > 0) and (ratio2 > 0) and ((ratio1 + bias > ratio2) and c2 or c3) or '') .. ';'
end
return (ratio1 > 0) and (ratio2 > 0) and ((ratio1 + bias > ratio2) and c2 or c3) or ''
end
function p._ratio(args)
local v1 = color2lum(args[1])
local v2 = color2lum(args[2])
if (type(v1) == 'number' and type(v2) == 'number') then
-- v1 should be the brighter of the two.
if v2 > v1 then
v1, v2 = v2, v1
end
return (v1 + 0.05)/(v2 + 0.05)
else
return args['error'] or '?'
end
end
function p._styleratio(args)
local style = (args[1] or ''):lower()
local bg, fg = 'white', 'black'
local lum_bg, lum_fg = 1, 0
if args[2] then
local lum = color2lum(args[2])
if lum ~= '' then bg, lum_bg = args[2], lum end
end
if args[3] then
local lum = color2lum(args[3])
if lum ~= '' then fg, lum_fg = args[3], lum end
end
local slist = mw.text.split(mw.ustring.gsub(mw.ustring.gsub(style or '', '&#[Xx]23;', '#'), '#', '#'), ';')
for k = 1,#slist do
local s = slist[k]
local k,v = s:match( '^[%s]*([^:]-):([^:]-)[%s;]*$' )
k = k or ''
v = v or ''
if (k:match('^[%s]*(background)[%s]*$') or k:match('^[%s]*(background%-color)[%s]*$')) then
local lum = color2lum(v)
if( lum ~= '' ) then bg, lum_bg = v, lum end
elseif (k:match('^[%s]*(color)[%s]*$')) then
local lum = color2lum(v)
if( lum ~= '' ) then bg, lum_fg = v, lum end
end
end
if lum_bg > lum_fg then
return (lum_bg + 0.05)/(lum_fg + 0.05)
else
return (lum_fg + 0.05)/(lum_bg + 0.05)
end
end
--[[
Use {{#invoke:Color contrast|somecolor}} directly or
{{#invoke:Color contrast}} from a wrapper template.
Parameters:
-- |1= — required; A color to check.
--]]
function p.lum(frame)
local color = frame.args[1] or frame:getParent().args[1]
return p._lum(color)
end
function p.ratio(frame)
local args = frame.args[1] and frame.args or frame:getParent().args
return p._ratio(args)
end
function p.styleratio(frame)
local args = frame.args[1] and frame.args or frame:getParent().args
return p._styleratio(args)
end
function p.greatercontrast(frame)
local args = frame.args[1] and frame.args or frame:getParent().args
return p._greatercontrast(args)
end
return p
1e399769117591366a63f62996c9a407077cc711
Module:Color contrast/colors
828
198
388
2019-01-24T12:30:11Z
wikipedia>Galobtter
0
Changed protection level for "[[Module:Color contrast/colors]]": [[WP:High-risk templates|High-risk Lua module]] ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
Scribunto
text/plain
return {
aliceblue = 0.92880068253475,
antiquewhite = 0.84646951707754,
aqua = 0.7874,
aquamarine = 0.8078549208338,
azure = 0.97265264954166,
beige = 0.8988459998705,
bisque = 0.80732327372979,
black = 0,
blanchedalmond = 0.85084439608156,
blue = 0.0722,
blueviolet = 0.12622014321946,
brown = 0.098224287876511,
burlywood = 0.51559844533893,
cadetblue = 0.29424681085422,
chartreuse = 0.76032025902623,
chocolate = 0.23898526114557,
coral = 0.37017930872924,
cornflowerblue = 0.30318641994179,
cornsilk = 0.93562110372965,
crimson = 0.16042199953026,
cyan = 0.7874,
darkblue = 0.018640801980939,
darkcyan = 0.20329317839046,
darkgoldenrod = 0.27264703559993,
darkgray = 0.39675523072563,
darkgreen = 0.091143429047575,
darkgrey = 0.39675523072563,
darkkhaki = 0.45747326349994,
darkmagenta = 0.07353047651207,
darkolivegreen = 0.12651920884889,
darkorange = 0.40016167026524,
darkorchid = 0.13413142174857,
darkred = 0.054889674531132,
darksalmon = 0.40541471563381,
darkseagreen = 0.43789249325969,
darkslateblue = 0.065792846227988,
darkslategray = 0.067608151928044,
darkslategrey = 0.067608151928044,
darkturquoise = 0.4874606277449,
darkviolet = 0.10999048339343,
deeppink = 0.23866895828276,
deepskyblue = 0.44481603395575,
dimgray = 0.14126329114027,
dimgrey = 0.14126329114027,
dodgerblue = 0.27442536991456,
firebrick = 0.10724525535015,
floralwhite = 0.95922484825004,
forestgreen = 0.18920812076002,
fuchsia = 0.2848,
gainsboro = 0.71569350050648,
ghostwhite = 0.94311261886323,
gold = 0.69860877428159,
goldenrod = 0.41919977809569,
gray = 0.2158605001139,
green = 0.15438342968146,
greenyellow = 0.80609472611453,
grey = 0.2158605001139,
honeydew = 0.96336535554782,
hotpink = 0.34658438169715,
indianred = 0.21406134963884,
indigo = 0.03107561486337,
ivory = 0.99071270600615,
khaki = 0.77012343394121,
lavender = 0.80318750514521,
lavenderblush = 0.90172748631046,
lawngreen = 0.73905893124963,
lemonchiffon = 0.94038992245622,
lightblue = 0.63709141280807,
lightcoral = 0.35522120733135,
lightcyan = 0.94587293494829,
lightgoldenrodyellow = 0.93348351018297,
lightgray = 0.65140563741982,
lightgreen = 0.69091979956865,
lightgrey = 0.65140563741982,
lightpink = 0.58566152734898,
lightsalmon = 0.4780675225206,
lightseagreen = 0.35050145117042,
lightskyblue = 0.56195637618331,
lightslategray = 0.23830165007287,
lightslategrey = 0.23830165007287,
lightsteelblue = 0.53983888284666,
lightyellow = 0.98161818392882,
lime = 0.7152,
limegreen = 0.44571042246098,
linen = 0.88357340984379,
magenta = 0.2848,
maroon = 0.045891942324215,
mediumaquamarine = 0.49389703310801,
mediumblue = 0.044077780212328,
mediumorchid = 0.21639251153773,
mediumpurple = 0.22905858091648,
mediumseagreen = 0.34393112338131,
mediumslateblue = 0.20284629471622,
mediumspringgreen = 0.70704308194184,
mediumturquoise = 0.5133827926448,
mediumvioletred = 0.14371899849357,
midnightblue = 0.02071786635086,
mintcream = 0.97834604947588,
mistyrose = 0.82183047859185,
moccasin = 0.80083000991567,
navajowhite = 0.76519682342785,
navy = 0.015585128108224,
oldlace = 0.91900633405549,
olive = 0.20027537200568,
olivedrab = 0.22593150951929,
orange = 0.4817026703631,
orangered = 0.25516243753416,
orchid = 0.31348806761439,
palegoldenrod = 0.78792647887614,
palegreen = 0.77936759006353,
paleturquoise = 0.76436077921714,
palevioletred = 0.28754994117889,
papayawhip = 0.87797100199835,
peachpuff = 0.74905589878251,
peru = 0.30113074877936,
pink = 0.63271070702466,
plum = 0.45734221587969,
powderblue = 0.68254586500605,
purple = 0.061477070432439,
rebeccapurple = 0.07492341159447,
red = 0.2126,
rosybrown = 0.32319457649407,
royalblue = 0.16663210743188,
saddlebrown = 0.097922285020521,
salmon = 0.36977241527596,
sandybrown = 0.46628543696283,
seagreen = 0.19734199706275,
seashell = 0.92737862206922,
sienna = 0.13697631337098,
silver = 0.52711512570581,
skyblue = 0.55291668518184,
slateblue = 0.14784278062136,
slategray = 0.20896704076536,
slategrey = 0.20896704076536,
snow = 0.96533341834849,
springgreen = 0.73052306068529,
steelblue = 0.20562642207625,
tan = 0.48237604163921,
teal = 0.16996855778968,
thistle = 0.56818401093733,
tomato = 0.30638612719415,
turquoise = 0.5895536427578,
violet = 0.40315452986676,
wheat = 0.74909702820482,
white = 1,
whitesmoke = 0.91309865179342,
yellow = 0.9278,
yellowgreen = 0.50762957208707,
}
6ae47fdb24de4eed5ec26d203faf5341a388987b
Template:Fmbox
10
79
149
2019-02-25T22:06:47Z
wikipedia>MusikAnimal
0
Changed protection level for "[[Template:Fmbox]]": [[Wikipedia:High-risk templates|High-risk template or module]]; used in system message ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
{{#invoke:Message box|fmbox}}<noinclude>
{{documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
dfb511d767bd2208627c0874ccf91faf6b8551cc
Template:Editnotice
10
80
151
2019-02-25T22:06:47Z
wikipedia>MusikAnimal
0
Changed protection level for "[[Template:Editnotice]]": [[Wikipedia:High-risk templates|High-risk template or module]]; used in system message ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
{{#ifeq:{{FULLROOTPAGENAME}}|Template:Editnotices
|{{Editnotice/notice
|expiry={{{expiry|¬}}}
|redirect={{{redirect|}}}
}}
}}{{#ifexpr:{{#ifeq:{{FULLROOTPAGENAME}}|Template:Editnotices
|1
|0
}}+{{#switch:{{{expiry|¬}}}
|indefinite = 1
|
|¬ = 1 <!-- Expiry not specified -->
|#default = {{#iferror:{{#time:U|{{{expiry}}}}}
|0 <!-- Invalid expiry time -->
|{{#ifexpr:{{#time:U|{{{expiry}}}}}-{{#time:U|{{CURRENTTIMESTAMP}}}}>0
|1 <!-- Notice current -->
|0 <!-- Notice expired -->
}}
}}
}}
|{{fmbox
|type = {{{type|editnotice}}}
|id = {{{id|}}}
|textstyle = {{{textstyle|}}}
|style = {{{style|}}}
|class = {{{class|}}}
|image = {{#if:{{{image|}}}
|{{#invoke:InfoboxImage|InfoboxImage|image={{{image}}}|size={{{imagesize|}}}|sizedefault=40x40px}}
|none
}}
|imageright= {{#if:{{{imageright|}}}
|{{#invoke:InfoboxImage|InfoboxImage|image={{{imageright}}}|size={{{imagerightsize|}}}|sizedefault=40x40px}}
}}
|text = {{#if:{{{header|}}}
|<div style="font-weight: bold; {{{headerstyle|}}}">{{{header}}}</div>
}}
{{{text|{{{1}}}}}}
}}
}}{{#ifeq:{{FULLROOTPAGENAME}}|Template:Editnotices|{{#switch:{{{expiry|¬}}}
|indefinite
|
|¬ = <!-- Expiry not specified -->
|#default = {{#iferror:{{#time:U|{{{expiry}}}}}
| <!-- Invalid expiry time -->
|{{#ifexpr:{{#time:U|{{{expiry}}}}}-{{#time:U|{{CURRENTTIMESTAMP}}}}>0
| <!-- Notice current -->
|[[Category:Expired editnotices]] <!-- Notice expired -->
}}
}}
}}
}}<noinclude>
{{documentation}}
</noinclude>
d491e59c5e20682ddd6f1997443ffdfb78730dc4
Template:Nobold/styles.css
10
87
165
2019-03-03T23:43:41Z
wikipedia>Pppery
0
Adding protection template
sanitized-css
text/css
/* {{pp-template}} */
/* Styling for Template:Nobold */
.nobold {
font-weight: normal;
}
83e5f0adacf8c7984251f1fd9d11ed82ebaadf03
Template:Mono/styles.css
10
273
538
2019-03-04T00:01:15Z
wikipedia>Pppery
0
Adding protection template
sanitized-css
text/css
/* {{pp-template}} */
.monospaced {
/* "monospace, monospace" per [[WP:MONO]] */
font-family: monospace, monospace;
}
cadfc2ad2e42cde230abf3e74ad418f7c4c71ab4
Template:Lua
10
131
253
2019-03-20T22:04:45Z
wikipedia>RMCD bot
0
Removing notice of move discussion
wikitext
text/x-wiki
<includeonly>{{#invoke:Lua banner|main}}</includeonly><noinclude>
{{Lua|Module:Lua banner}}
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
dba3962144dacd289dbc34f50fbe0a7bf6d7f2f7
Template:Clc
10
177
345
2019-04-24T04:30:59Z
wikipedia>JJMC89
0
actual template is in the category
wikitext
text/x-wiki
#REDIRECT [[Template:Category link with count]]
02280e2ab57b544236e11f913e3759c5781ca9d5
Module:ISO 3166
828
162
315
2019-04-28T16:52:10Z
wikipedia>Frietjes
0
restrict tracking to articlespace per request
Scribunto
text/plain
-- to enable us to replicate the current functioning of Country extract, we need to deal with:
-- 2 {{<name>}} DONE!
-- 3 [[<name>]] DONE!
-- 4 [[<name>|<junk>]] DONE!
-- 5 [[image:flag of <country>.[svg|gif|png|jpg]|\d+px]] DONE!
local p = {}
local getArgs = require("Module:Arguments").getArgs
local data = mw.loadData("Module:ISO 3166/data/National")
--[[----------F I N D N A M E----------]]-- -- Finds the name in the database
local function findname(code,cdata,qry)
local sqry = p.strip(qry)
if cdata["name"] and sqry==p.strip(cdata["name"])
or cdata["isoname"] and sqry==p.strip(cdata["isoname"])
or not cdata["nocode"] and sqry==code
or sqry==cdata["alpha3"] or sqry==cdata["numeric"]
then
return true
end
for _,tname in pairs(cdata["isonames"] or {}) do
if sqry==p.strip(tname) then
return true
end
end
for _,tname in pairs(cdata["altnames"] or {}) do
if sqry==p.strip(tname) then
return true
end
end
return false
end
--[[----------I S O N A M E----------]]-- -- Find the ISO name of a country/region
local function isoname(data,code,lang)
if data[code]["isonames"] then
local name = data[code]["isodisplaynames"] and data[code]["isodisplaynames"][lang]
or data[code]["isonames"][lang]
or data[code]["isodisplaynames"] and data[code]["isodisplaynames"][data[code]["defaultlang"] or data["defaultlang"]]
or data[code]["isonames"][data[code]["defaultlang"] or data["defaultlang"]]
or data[code]["isodisplaynames"] and data[code]["isodisplaynames"]["en"]
or data[code]["isonames"]["en"]
if name then return name end
for _,iname in pairs(data[code]["isonames"]) do return iname end
return data[code]["isodisplayname"] or data[code]["isoname"]
else
return data[code]["isodisplayname"] or data[code]["isoname"]
end
end
--[[----------S T R I P----------]]-- -- Removes junk from the input
function p.strip(text)
local accents = {["À"]="A",["Á"]="A",["Â"]="A",["Ã"]="A", -- accent list
["Ä"]="A",["Å"]="A",["Ç"]="C",["È"]="E",["É"]="E",
["Ê"]="E",["Ë"]="E",["Ì"]="I",["Í"]="I",["Î"]="I",
["Ï"]="I",["Ñ"]="N",["Ò"]="O",["Ó"]="O",["Ô"]="O",
["Õ"]="O",["Ö"]="O",["Ø"]="O",["Ù"]="U",["Ú"]="U",
["Û"]="U",["Ü"]="U",["Ý"]="Y"
}
local remove = {"NATION OF","COUNTRY OF","TERRITORY OF", -- text to be removed list
"FLAG OF","FLAG","KINGDOM OF","STATE OF"," STATE ",
"PROVINCE OF","PROVINCE","TERRITORY"
}
local patterns = {[".+:"]="",["|.+"]="",["%(.-%)"]="", -- patterns to follow (order may matter)
["%..*"]="",["^THE "]="",["%_"]=" ",["%-"]=" ",
["%d%d?%d?PX"]="",
}
text = mw.ustring.upper(text) -- Case insensitivity
text = mw.ustring.gsub(text,"[À-Ý]",accents) -- Deaccent
for pattern,value in pairs(patterns) do -- Follow patterns
text = mw.ustring.gsub(text,pattern,value)
end
for _,words in pairs(remove) do -- Remove unneeded words
text = mw.ustring.gsub(text,words,"")
end
text = mw.ustring.gsub(text,"%W","") -- Remove non alpha-numeric
return text
end
--[[----------P . C A L L S T R I P ---------]]-- -- Calls P.strip but using Module:Arguments
function p.callstrip(frame)
local args = getArgs(frame)
return p.strip(args[1]) or ""
end
--[[----------P . L U A C O D E---------]]-- -- Makes the ISO code of a country
function p.luacode(args)
if string.find(args[1] or '',"%-") then
args[1], args[2] = string.match(args[1] or '',"^([^%-]*)%-(.*)$")
end
if args[1] then args[1] = p.strip(args[1]) end
if args[2] then args[2] = p.strip(args[2]) end
if args["codetype"]=="3" then
args["codetype"]="alpha3"
end
local eot = args.error or ""
local catnocountry = (args.nocat and args.nocat == 'true') and ''
or '[[Category:Wikipedia page with obscure country]]'
local catnosubdivision = (args.nocat and args.nocat == 'true') and ''
or '[[Category:Wikipedia page with obscure subdivision]]'
if not args[1] then
if mw.title.getCurrentTitle().namespace ~= 0 then catnocountry = '' end
return catnocountry, '<span style="font-size:100%" class="error">"No parameter for the country given"</span>'
end
if not args[2] then --3166-1 code
for alpha2,cdata in pairs(data) do
if findname(alpha2,cdata,args[1]) then
if args["codetype"]=="numeric" or args["codetype"]=="alpha3" then
return cdata[args["codetype"]]
else
return alpha2
end
end
end
if mw.title.getCurrentTitle().namespace ~= 0 then catnocountry = '' end
return catnocountry
else --3166-2 code
for alpha2,cdata in pairs(data) do
if findname(alpha2,cdata,args[1]) then
if mw.ustring.match(alpha2,"GB") then -- For England, Wales etc.
alpha2 = "GB"
end
local sdata = mw.loadData("Module:ISO 3166/data/"..alpha2)
local empty = true
for scode,scdata in pairs(sdata) do
if type(scdata)=="table" then
empty = false
if findname(scode,scdata,args[2]) then
return alpha2.."-"..scode
end
end
end
if mw.title.getCurrentTitle().namespace ~= 0 then catnosubdivision = '' end
return catnosubdivision
end
end
if mw.title.getCurrentTitle().namespace ~= 0 then catnocountry = '' end
return catnocountry
end
end
--[[----------P . C O D E---------]]-- -- Calls P.Luacode but using Module:Arguments
function p.code(frame)
return p.luacode(getArgs(frame)) or ""
end
--[[----------P . N U M E R I C---------]]-- -- Calls P.Luacode but using Module:Arguments and setting it to output a numeric value
function p.numeric(frame)
local args = getArgs(frame)
args["codetype"]="numeric"
return p.luacode(args) or ""
end
--[[----------P . L U A N A M E---------]]-- -- Makes the ISO/common name of a country
function p.luaname(args)
local code1 = p.luacode(args)
local code2 = ''
if string.find(code1,"%-") then
code1, code2 = string.match(code1,"^([^%-]*)%-(.*)$")
end
if string.find(code1,"^%u%u$") then
if code2=="" then --3166-1 alpha-2 code
if data[code1] then
return (args.isoname or args.lang) and isoname(data,code1,args.lang)
or (data[code1]["displayname"] or data[code1]["name"])
else
return '[[Category:Wikipedia page with obscure country]]'
end
else --3166-2 code
local sdata
if data[code1] then
sdata = mw.loadData("Module:ISO 3166/data/"..code1)
else
return '[[Category:Wikipedia page with obscure country]]'
end
if sdata[code2] then
return (args.isoname or args.lang) and isoname(sdata,code2,args.lang)
or (sdata[code2]["displayname"] or sdata[code2]["name"])
else
return '[[Category:Wikipedia page with obscure country]]'
end
end
end
end
--[[----------P . N A M E---------]]-- -- Calls P.Luaname but using Module:Arguments
function p.name(frame)
return p.luaname(getArgs(frame)) or ""
end
--[[----------P . G E O C O O R D I N S E R T---------]]-- -- Wrapper for Module:Coordinates.coordinsert
function p.geocoordinsert(frame)
-- {{#invoke:ISO 3166|geocoordinsert|{{coord|...}}
-- |country=..|subdivision1=...|subdivision2=...
-- |type=...|scale=...|dim=...|source=...|globe=...
-- }}
local args = frame.args
local subdivisionqueried = false
local catnocountry = (args.nocat and args.nocat == 'true') and ''
or '[[Category:Wikipedia page with obscure country]]'
local catnosubdivision = (args.nocat and args.nocat == 'true') and ''
or '[[Category:Wikipedia page with obscure subdivision]]' or ''
local tracking = ''
local targs = {}
targs[1] = args[1] or ''
for i, v in pairs(args) do
if i == 'country' and not mw.ustring.find(targs[1], 'region:') then
local country = v
local k, region = 1, ''
-- look for a valid subdivision
while region == '' and k < 3 do
local subdivision = args['subdivision' .. k] or ''
if subdivision ~= '' then
region = p.luacode({country, subdivision, nocat = 'true'})
subdivisionqueried = true
end
k = k + 1
end
-- subdivision lookup failed or never attempted, try country only
if region == '' then
region = p.luacode({country, nocat = 'true'})
if mw.title.getCurrentTitle().namespace ~= 0 then catnocountry, catnosubdivision = '', '' end
if region == '' then
tracking = tracking .. catnocountry
elseif subdivisionqueried == true then
tracking = tracking .. catnosubdivision
end
end
-- something worked, add it to the targs
if region ~= '' then
targs[#targs + 1] = 'region:' .. region
end
elseif i == 'type' or i == 'scale' or i == 'dim'
or i == 'source' or i == 'globe' then
targs[#targs + 1] = i .. ':' .. v
end
end
-- call Module:Coordinates.coordinsert if there is something to insert
if #targs > 1 then
local coordinsert = require('Module:Coordinates').coordinsert
return coordinsert({args = targs}) .. tracking
end
-- otherwise, just return the coordinates
return targs[1] .. tracking
end
return p
6bc354f2610f29e712065cbe3ea814144fa3a600
Template:Infobox high court
10
246
484
2019-08-01T14:08:48Z
wikipedia>Trialpears
0
Redirected to [[Template:Infobox court]]
wikitext
text/x-wiki
#REDIRECT [[Template:Infobox court]]
{{R with history}}
06b1a159db599c59ddbd7b29ac962f43a87349a9
Template:Infobox person/height
10
158
307
2019-09-26T15:11:11Z
wikipedia>Frietjes
0
use lua version for efficiency and readability, passes all tests in the testscases so seems fine
wikitext
text/x-wiki
{{#invoke:person height|main}}<noinclude>
{{Documentation}}
</noinclude>
7e4749e2788885b5a8760fedb7cc278e9a60a85a
Template:Mono
10
271
534
2019-10-13T01:15:06Z
wikipedia>Izno
0
implement ifsubst
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>ifsubst|1=|2=<templatestyles src="Mono/styles.css" />}}<span class="monospaced">{{{2|{{{1}}}}}}</span><noinclude>
{{Documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
800f06823c02b03f8b9cf1e245ad8c4829cfe931
Template:Edit
10
274
540
2019-10-17T18:13:48Z
wikipedia>Wugapodes
0
Add support for tooltips per edit request on talk
wikitext
text/x-wiki
<span class="noprint plainlinks" title="{{#if:{{{tooltip|}}}|{{{tooltip}}}|Edit {{{1}}}}}">[{{fullurl:{{#if:{{{1|}}}|{{{1}}}|{{FULLPAGENAME}}}}|action=edit{{#if:{{{section|}}}|§ion={{{section}}}}}{{#if:{{{editintro|}}}|&editintro={{urlencode:{{{editintro}}}|wiki}}}}{{#if:{{{preload|}}}|&preload={{urlencode:{{{preload}}}|wiki}}}}{{#if:{{{preloadtitle|}}}|&preloadtitle={{urlencode:{{{preloadtitle}}}}}}}}} {{{2|edit}}}]</span><noinclude>
{{documentation}}
</noinclude>
20ae9613e64bbdd279f1d1c7a3d2ddf64d1b1b48
Template:Flagdeco/core
10
219
430
2019-10-22T23:20:36Z
wikipedia>S.A. Julio
0
/* top */adjusting for improved method to define custom flag sizes
wikitext
text/x-wiki
<span class="flagicon">[[File:{{{flag alias-{{{variant}}}|{{{flag alias}}}}}}|{{#if:{{{size|}}}|{{{size}}}|{{{size flag alias-{{{variant}}}|{{#if:{{{variant|}}}|23x15px|{{{size flag alias|23x15px}}}}}}}}}}|{{{border-{{{variant}}}|{{{border|border}}}}}} |alt=|link=]]</span><noinclude>{{documentation}}</noinclude>
42dea5caf343aa87e6e075eb1bec3aebe1f396b1
Template:Ombox
10
153
297
2020-04-01T06:12:36Z
wikipedia>MusikAnimal
0
1 revision imported
wikitext
text/x-wiki
{{#invoke:Message box|ombox}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
0e54065432d540737b9e56c4e3a8e7f74d4534ea
Module:Arguments
828
13
21
2020-04-01T06:12:40Z
wikipedia>MusikAnimal
0
1 revision imported
Scribunto
text/plain
-- This module provides easy processing of arguments passed to Scribunto from
-- #invoke. It is intended for use by other Lua modules, and should not be
-- called from #invoke directly.
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local arguments = {}
-- Generate four different tidyVal functions, so that we don't have to check the
-- options every time we call it.
local function tidyValDefault(key, val)
if type(val) == 'string' then
val = val:match('^%s*(.-)%s*$')
if val == '' then
return nil
else
return val
end
else
return val
end
end
local function tidyValTrimOnly(key, val)
if type(val) == 'string' then
return val:match('^%s*(.-)%s*$')
else
return val
end
end
local function tidyValRemoveBlanksOnly(key, val)
if type(val) == 'string' then
if val:find('%S') then
return val
else
return nil
end
else
return val
end
end
local function tidyValNoChange(key, val)
return val
end
local function matchesTitle(given, title)
local tp = type( given )
return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title
end
local translate_mt = { __index = function(t, k) return k end }
function arguments.getArgs(frame, options)
checkType('getArgs', 1, frame, 'table', true)
checkType('getArgs', 2, options, 'table', true)
frame = frame or {}
options = options or {}
--[[
-- Set up argument translation.
--]]
options.translate = options.translate or {}
if getmetatable(options.translate) == nil then
setmetatable(options.translate, translate_mt)
end
if options.backtranslate == nil then
options.backtranslate = {}
for k,v in pairs(options.translate) do
options.backtranslate[v] = k
end
end
if options.backtranslate and getmetatable(options.backtranslate) == nil then
setmetatable(options.backtranslate, {
__index = function(t, k)
if options.translate[k] ~= k then
return nil
else
return k
end
end
})
end
--[[
-- Get the argument tables. If we were passed a valid frame object, get the
-- frame arguments (fargs) and the parent frame arguments (pargs), depending
-- on the options set and on the parent frame's availability. If we weren't
-- passed a valid frame object, we are being called from another Lua module
-- or from the debug console, so assume that we were passed a table of args
-- directly, and assign it to a new variable (luaArgs).
--]]
local fargs, pargs, luaArgs
if type(frame.args) == 'table' and type(frame.getParent) == 'function' then
if options.wrappers then
--[[
-- The wrappers option makes Module:Arguments look up arguments in
-- either the frame argument table or the parent argument table, but
-- not both. This means that users can use either the #invoke syntax
-- or a wrapper template without the loss of performance associated
-- with looking arguments up in both the frame and the parent frame.
-- Module:Arguments will look up arguments in the parent frame
-- if it finds the parent frame's title in options.wrapper;
-- otherwise it will look up arguments in the frame object passed
-- to getArgs.
--]]
local parent = frame:getParent()
if not parent then
fargs = frame.args
else
local title = parent:getTitle():gsub('/sandbox$', '')
local found = false
if matchesTitle(options.wrappers, title) then
found = true
elseif type(options.wrappers) == 'table' then
for _,v in pairs(options.wrappers) do
if matchesTitle(v, title) then
found = true
break
end
end
end
-- We test for false specifically here so that nil (the default) acts like true.
if found or options.frameOnly == false then
pargs = parent.args
end
if not found or options.parentOnly == false then
fargs = frame.args
end
end
else
-- options.wrapper isn't set, so check the other options.
if not options.parentOnly then
fargs = frame.args
end
if not options.frameOnly then
local parent = frame:getParent()
pargs = parent and parent.args or nil
end
end
if options.parentFirst then
fargs, pargs = pargs, fargs
end
else
luaArgs = frame
end
-- Set the order of precedence of the argument tables. If the variables are
-- nil, nothing will be added to the table, which is how we avoid clashes
-- between the frame/parent args and the Lua args.
local argTables = {fargs}
argTables[#argTables + 1] = pargs
argTables[#argTables + 1] = luaArgs
--[[
-- Generate the tidyVal function. If it has been specified by the user, we
-- use that; if not, we choose one of four functions depending on the
-- options chosen. This is so that we don't have to call the options table
-- every time the function is called.
--]]
local tidyVal = options.valueFunc
if tidyVal then
if type(tidyVal) ~= 'function' then
error(
"bad value assigned to option 'valueFunc'"
.. '(function expected, got '
.. type(tidyVal)
.. ')',
2
)
end
elseif options.trim ~= false then
if options.removeBlanks ~= false then
tidyVal = tidyValDefault
else
tidyVal = tidyValTrimOnly
end
else
if options.removeBlanks ~= false then
tidyVal = tidyValRemoveBlanksOnly
else
tidyVal = tidyValNoChange
end
end
--[[
-- Set up the args, metaArgs and nilArgs tables. args will be the one
-- accessed from functions, and metaArgs will hold the actual arguments. Nil
-- arguments are memoized in nilArgs, and the metatable connects all of them
-- together.
--]]
local args, metaArgs, nilArgs, metatable = {}, {}, {}, {}
setmetatable(args, metatable)
local function mergeArgs(tables)
--[[
-- Accepts multiple tables as input and merges their keys and values
-- into one table. If a value is already present it is not overwritten;
-- tables listed earlier have precedence. We are also memoizing nil
-- values, which can be overwritten if they are 's' (soft).
--]]
for _, t in ipairs(tables) do
for key, val in pairs(t) do
if metaArgs[key] == nil and nilArgs[key] ~= 'h' then
local tidiedVal = tidyVal(key, val)
if tidiedVal == nil then
nilArgs[key] = 's'
else
metaArgs[key] = tidiedVal
end
end
end
end
end
--[[
-- Define metatable behaviour. Arguments are memoized in the metaArgs table,
-- and are only fetched from the argument tables once. Fetching arguments
-- from the argument tables is the most resource-intensive step in this
-- module, so we try and avoid it where possible. For this reason, nil
-- arguments are also memoized, in the nilArgs table. Also, we keep a record
-- in the metatable of when pairs and ipairs have been called, so we do not
-- run pairs and ipairs on the argument tables more than once. We also do
-- not run ipairs on fargs and pargs if pairs has already been run, as all
-- the arguments will already have been copied over.
--]]
metatable.__index = function (t, key)
--[[
-- Fetches an argument when the args table is indexed. First we check
-- to see if the value is memoized, and if not we try and fetch it from
-- the argument tables. When we check memoization, we need to check
-- metaArgs before nilArgs, as both can be non-nil at the same time.
-- If the argument is not present in metaArgs, we also check whether
-- pairs has been run yet. If pairs has already been run, we return nil.
-- This is because all the arguments will have already been copied into
-- metaArgs by the mergeArgs function, meaning that any other arguments
-- must be nil.
--]]
if type(key) == 'string' then
key = options.translate[key]
end
local val = metaArgs[key]
if val ~= nil then
return val
elseif metatable.donePairs or nilArgs[key] then
return nil
end
for _, argTable in ipairs(argTables) do
local argTableVal = tidyVal(key, argTable[key])
if argTableVal ~= nil then
metaArgs[key] = argTableVal
return argTableVal
end
end
nilArgs[key] = 'h'
return nil
end
metatable.__newindex = function (t, key, val)
-- This function is called when a module tries to add a new value to the
-- args table, or tries to change an existing value.
if type(key) == 'string' then
key = options.translate[key]
end
if options.readOnly then
error(
'could not write to argument table key "'
.. tostring(key)
.. '"; the table is read-only',
2
)
elseif options.noOverwrite and args[key] ~= nil then
error(
'could not write to argument table key "'
.. tostring(key)
.. '"; overwriting existing arguments is not permitted',
2
)
elseif val == nil then
--[[
-- If the argument is to be overwritten with nil, we need to erase
-- the value in metaArgs, so that __index, __pairs and __ipairs do
-- not use a previous existing value, if present; and we also need
-- to memoize the nil in nilArgs, so that the value isn't looked
-- up in the argument tables if it is accessed again.
--]]
metaArgs[key] = nil
nilArgs[key] = 'h'
else
metaArgs[key] = val
end
end
local function translatenext(invariant)
local k, v = next(invariant.t, invariant.k)
invariant.k = k
if k == nil then
return nil
elseif type(k) ~= 'string' or not options.backtranslate then
return k, v
else
local backtranslate = options.backtranslate[k]
if backtranslate == nil then
-- Skip this one. This is a tail call, so this won't cause stack overflow
return translatenext(invariant)
else
return backtranslate, v
end
end
end
metatable.__pairs = function ()
-- Called when pairs is run on the args table.
if not metatable.donePairs then
mergeArgs(argTables)
metatable.donePairs = true
end
return translatenext, { t = metaArgs }
end
local function inext(t, i)
-- This uses our __index metamethod
local v = t[i + 1]
if v ~= nil then
return i + 1, v
end
end
metatable.__ipairs = function (t)
-- Called when ipairs is run on the args table.
return inext, t, 0
end
return args
end
return arguments
3134ecce8429b810d445e29eae115e2ae4c36c53
Module:Category handler
828
38
69
2020-04-01T06:12:40Z
wikipedia>MusikAnimal
0
1 revision imported
Scribunto
text/plain
--------------------------------------------------------------------------------
-- --
-- CATEGORY HANDLER --
-- --
-- This module implements the {{category handler}} template in Lua, --
-- with a few improvements: all namespaces and all namespace aliases --
-- are supported, and namespace names are detected automatically for --
-- the local wiki. This module requires [[Module:Namespace detect]] --
-- and [[Module:Yesno]] to be available on the local wiki. It can be --
-- configured for different wikis by altering the values in --
-- [[Module:Category handler/config]], and pages can be blacklisted --
-- from categorisation by using [[Module:Category handler/blacklist]]. --
-- --
--------------------------------------------------------------------------------
-- Load required modules
local yesno = require('Module:Yesno')
-- Lazily load things we don't always need
local mShared, mappings
local p = {}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function trimWhitespace(s, removeBlanks)
if type(s) ~= 'string' then
return s
end
s = s:match('^%s*(.-)%s*$')
if removeBlanks then
if s ~= '' then
return s
else
return nil
end
else
return s
end
end
--------------------------------------------------------------------------------
-- CategoryHandler class
--------------------------------------------------------------------------------
local CategoryHandler = {}
CategoryHandler.__index = CategoryHandler
function CategoryHandler.new(data, args)
local obj = setmetatable({ _data = data, _args = args }, CategoryHandler)
-- Set the title object
do
local pagename = obj:parameter('demopage')
local success, titleObj
if pagename then
success, titleObj = pcall(mw.title.new, pagename)
end
if success and titleObj then
obj.title = titleObj
if titleObj == mw.title.getCurrentTitle() then
obj._usesCurrentTitle = true
end
else
obj.title = mw.title.getCurrentTitle()
obj._usesCurrentTitle = true
end
end
-- Set suppression parameter values
for _, key in ipairs{'nocat', 'categories'} do
local value = obj:parameter(key)
value = trimWhitespace(value, true)
obj['_' .. key] = yesno(value)
end
do
local subpage = obj:parameter('subpage')
local category2 = obj:parameter('category2')
if type(subpage) == 'string' then
subpage = mw.ustring.lower(subpage)
end
if type(category2) == 'string' then
subpage = mw.ustring.lower(category2)
end
obj._subpage = trimWhitespace(subpage, true)
obj._category2 = trimWhitespace(category2) -- don't remove blank values
end
return obj
end
function CategoryHandler:parameter(key)
local parameterNames = self._data.parameters[key]
local pntype = type(parameterNames)
if pntype == 'string' or pntype == 'number' then
return self._args[parameterNames]
elseif pntype == 'table' then
for _, name in ipairs(parameterNames) do
local value = self._args[name]
if value ~= nil then
return value
end
end
return nil
else
error(string.format(
'invalid config key "%s"',
tostring(key)
), 2)
end
end
function CategoryHandler:isSuppressedByArguments()
return
-- See if a category suppression argument has been set.
self._nocat == true
or self._categories == false
or (
self._category2
and self._category2 ~= self._data.category2Yes
and self._category2 ~= self._data.category2Negative
)
-- Check whether we are on a subpage, and see if categories are
-- suppressed based on our subpage status.
or self._subpage == self._data.subpageNo and self.title.isSubpage
or self._subpage == self._data.subpageOnly and not self.title.isSubpage
end
function CategoryHandler:shouldSkipBlacklistCheck()
-- Check whether the category suppression arguments indicate we
-- should skip the blacklist check.
return self._nocat == false
or self._categories == true
or self._category2 == self._data.category2Yes
end
function CategoryHandler:matchesBlacklist()
if self._usesCurrentTitle then
return self._data.currentTitleMatchesBlacklist
else
mShared = mShared or require('Module:Category handler/shared')
return mShared.matchesBlacklist(
self.title.prefixedText,
mw.loadData('Module:Category handler/blacklist')
)
end
end
function CategoryHandler:isSuppressed()
-- Find if categories are suppressed by either the arguments or by
-- matching the blacklist.
return self:isSuppressedByArguments()
or not self:shouldSkipBlacklistCheck() and self:matchesBlacklist()
end
function CategoryHandler:getNamespaceParameters()
if self._usesCurrentTitle then
return self._data.currentTitleNamespaceParameters
else
if not mappings then
mShared = mShared or require('Module:Category handler/shared')
mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData
end
return mShared.getNamespaceParameters(
self.title,
mappings
)
end
end
function CategoryHandler:namespaceParametersExist()
-- Find whether any namespace parameters have been specified.
-- We use the order "all" --> namespace params --> "other" as this is what
-- the old template did.
if self:parameter('all') then
return true
end
if not mappings then
mShared = mShared or require('Module:Category handler/shared')
mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData
end
for ns, params in pairs(mappings) do
for i, param in ipairs(params) do
if self._args[param] then
return true
end
end
end
if self:parameter('other') then
return true
end
return false
end
function CategoryHandler:getCategories()
local params = self:getNamespaceParameters()
local nsCategory
for i, param in ipairs(params) do
local value = self._args[param]
if value ~= nil then
nsCategory = value
break
end
end
if nsCategory ~= nil or self:namespaceParametersExist() then
-- Namespace parameters exist - advanced usage.
if nsCategory == nil then
nsCategory = self:parameter('other')
end
local ret = {self:parameter('all')}
local numParam = tonumber(nsCategory)
if numParam and numParam >= 1 and math.floor(numParam) == numParam then
-- nsCategory is an integer
ret[#ret + 1] = self._args[numParam]
else
ret[#ret + 1] = nsCategory
end
if #ret < 1 then
return nil
else
return table.concat(ret)
end
elseif self._data.defaultNamespaces[self.title.namespace] then
-- Namespace parameters don't exist, simple usage.
return self._args[1]
end
return nil
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p = {}
function p._exportClasses()
-- Used for testing purposes.
return {
CategoryHandler = CategoryHandler
}
end
function p._main(args, data)
data = data or mw.loadData('Module:Category handler/data')
local handler = CategoryHandler.new(data, args)
if handler:isSuppressed() then
return nil
end
return handler:getCategories()
end
function p.main(frame, data)
data = data or mw.loadData('Module:Category handler/data')
local args = require('Module:Arguments').getArgs(frame, {
wrappers = data.wrappers,
valueFunc = function (k, v)
v = trimWhitespace(v)
if type(k) == 'number' then
if v ~= '' then
return v
else
return nil
end
else
return v
end
end
})
return p._main(args, data)
end
return p
b74dd63857b24904ac452429b11213f18647471f
Module:Category handler/config
828
40
73
2020-04-01T06:12:40Z
wikipedia>MusikAnimal
0
1 revision imported
Scribunto
text/plain
--------------------------------------------------------------------------------
-- [[Module:Category handler]] configuration data --
-- Language-specific parameter names and values can be set here. --
-- For blacklist config, see [[Module:Category handler/blacklist]]. --
--------------------------------------------------------------------------------
local cfg = {} -- Don't edit this line.
--------------------------------------------------------------------------------
-- Start configuration data --
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Parameter names --
-- These configuration items specify custom parameter names. --
-- To add one extra name, you can use this format: --
-- --
-- foo = 'parameter name', --
-- --
-- To add multiple names, you can use this format: --
-- --
-- foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'}, --
--------------------------------------------------------------------------------
cfg.parameters = {
-- The nocat and categories parameter suppress
-- categorisation. They are used with Module:Yesno, and work as follows:
--
-- cfg.nocat:
-- Result of yesno() Effect
-- true Categorisation is suppressed
-- false Categorisation is allowed, and
-- the blacklist check is skipped
-- nil Categorisation is allowed
--
-- cfg.categories:
-- Result of yesno() Effect
-- true Categorisation is allowed, and
-- the blacklist check is skipped
-- false Categorisation is suppressed
-- nil Categorisation is allowed
nocat = 'nocat',
categories = 'categories',
-- The parameter name for the legacy "category2" parameter. This skips the
-- blacklist if set to the cfg.category2Yes value, and suppresses
-- categorisation if present but equal to anything other than
-- cfg.category2Yes or cfg.category2Negative.
category2 = 'category2',
-- cfg.subpage is the parameter name to specify how to behave on subpages.
subpage = 'subpage',
-- The parameter for data to return in all namespaces.
all = 'all',
-- The parameter name for data to return if no data is specified for the
-- namespace that is detected.
other = 'other',
-- The parameter name used to specify a page other than the current page;
-- used for testing and demonstration.
demopage = 'page',
}
--------------------------------------------------------------------------------
-- Parameter values --
-- These are set values that can be used with certain parameters. Only one --
-- value can be specified, like this: --
-- --
-- cfg.foo = 'value name' -- --
--------------------------------------------------------------------------------
-- The following settings are used with the cfg.category2 parameter. Setting
-- cfg.category2 to cfg.category2Yes skips the blacklist, and if cfg.category2
-- is present but equal to anything other than cfg.category2Yes or
-- cfg.category2Negative then it supresses cateogrisation.
cfg.category2Yes = 'yes'
cfg.category2Negative = '¬'
-- The following settings are used with the cfg.subpage parameter.
-- cfg.subpageNo is the value to specify to not categorise on subpages;
-- cfg.subpageOnly is the value to specify to only categorise on subpages.
cfg.subpageNo = 'no'
cfg.subpageOnly = 'only'
--------------------------------------------------------------------------------
-- Default namespaces --
-- This is a table of namespaces to categorise by default. The keys are the --
-- namespace numbers. --
--------------------------------------------------------------------------------
cfg.defaultNamespaces = {
[ 0] = true, -- main
[ 6] = true, -- file
[ 12] = true, -- help
[ 14] = true, -- category
[100] = true, -- portal
[108] = true, -- book
}
--------------------------------------------------------------------------------
-- Wrappers --
-- This is a wrapper template or a list of wrapper templates to be passed to --
-- [[Module:Arguments]]. --
--------------------------------------------------------------------------------
cfg.wrappers = 'Template:Category handler'
--------------------------------------------------------------------------------
-- End configuration data --
--------------------------------------------------------------------------------
return cfg -- Don't edit this line.
373cd107b13a5b00e6a1b7e66a749f12502c849d
Module:Category handler/data
828
39
71
2020-04-01T06:12:41Z
wikipedia>MusikAnimal
0
1 revision imported
Scribunto
text/plain
-- This module assembles data to be passed to [[Module:Category handler]] using
-- mw.loadData. This includes the configuration data and whether the current
-- page matches the title blacklist.
local data = require('Module:Category handler/config')
local mShared = require('Module:Category handler/shared')
local blacklist = require('Module:Category handler/blacklist')
local title = mw.title.getCurrentTitle()
data.currentTitleMatchesBlacklist = mShared.matchesBlacklist(
title.prefixedText,
blacklist
)
data.currentTitleNamespaceParameters = mShared.getNamespaceParameters(
title,
mShared.getParamMappings()
)
return data
abbc68048ff698e88dda06b64ecf384bbf583120
Module:Category handler/shared
828
41
75
2020-04-01T06:12:41Z
wikipedia>MusikAnimal
0
1 revision imported
Scribunto
text/plain
-- This module contains shared functions used by [[Module:Category handler]]
-- and its submodules.
local p = {}
function p.matchesBlacklist(page, blacklist)
for i, pattern in ipairs(blacklist) do
local match = mw.ustring.match(page, pattern)
if match then
return true
end
end
return false
end
function p.getParamMappings(useLoadData)
local dataPage = 'Module:Namespace detect/data'
if useLoadData then
return mw.loadData(dataPage).mappings
else
return require(dataPage).mappings
end
end
function p.getNamespaceParameters(titleObj, mappings)
-- We don't use title.nsText for the namespace name because it adds
-- underscores.
local mappingsKey
if titleObj.isTalkPage then
mappingsKey = 'talk'
else
mappingsKey = mw.site.namespaces[titleObj.namespace].name
end
mappingsKey = mw.ustring.lower(mappingsKey)
return mappings[mappingsKey] or {}
end
return p
d2d5de1a031e6ce97c242cbfa8afe7a92cb9eca5
Module:Namespace detect/config
828
29
51
2020-04-01T06:12:44Z
wikipedia>MusikAnimal
0
1 revision imported
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Namespace detect configuration data --
-- --
-- This module stores configuration data for Module:Namespace detect. Here --
-- you can localise the module to your wiki's language. --
-- --
-- To activate a configuration item, you need to uncomment it. This means --
-- that you need to remove the text "-- " at the start of the line. --
--------------------------------------------------------------------------------
local cfg = {} -- Don't edit this line.
--------------------------------------------------------------------------------
-- Parameter names --
-- These configuration items specify custom parameter names. Values added --
-- here will work in addition to the default English parameter names. --
-- To add one extra name, you can use this format: --
-- --
-- cfg.foo = 'parameter name' --
-- --
-- To add multiple names, you can use this format: --
-- --
-- cfg.foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'} --
--------------------------------------------------------------------------------
---- This parameter displays content for the main namespace:
-- cfg.main = 'main'
---- This parameter displays in talk namespaces:
-- cfg.talk = 'talk'
---- This parameter displays content for "other" namespaces (namespaces for which
---- parameters have not been specified):
-- cfg.other = 'other'
---- This parameter makes talk pages behave as though they are the corresponding
---- subject namespace. Note that this parameter is used with [[Module:Yesno]].
---- Edit that module to change the default values of "yes", "no", etc.
-- cfg.subjectns = 'subjectns'
---- This parameter sets a demonstration namespace:
-- cfg.demospace = 'demospace'
---- This parameter sets a specific page to compare:
cfg.demopage = 'page'
--------------------------------------------------------------------------------
-- Table configuration --
-- These configuration items allow customisation of the "table" function, --
-- used to generate a table of possible parameters in the module --
-- documentation. --
--------------------------------------------------------------------------------
---- The header for the namespace column in the wikitable containing the list of
---- possible subject-space parameters.
-- cfg.wikitableNamespaceHeader = 'Namespace'
---- The header for the wikitable containing the list of possible subject-space
---- parameters.
-- cfg.wikitableAliasesHeader = 'Aliases'
--------------------------------------------------------------------------------
-- End of configuration data --
--------------------------------------------------------------------------------
return cfg -- Don't edit this line.
0e4ff08d13c4b664d66b32c232deb129b77c1a56
Module:Namespace detect/data
828
28
49
2020-04-01T06:12:45Z
wikipedia>MusikAnimal
0
1 revision imported
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Namespace detect data --
-- This module holds data for [[Module:Namespace detect]] to be loaded per --
-- page, rather than per #invoke, for performance reasons. --
--------------------------------------------------------------------------------
local cfg = require('Module:Namespace detect/config')
local function addKey(t, key, defaultKey)
if key ~= defaultKey then
t[#t + 1] = key
end
end
-- Get a table of parameters to query for each default parameter name.
-- This allows wikis to customise parameter names in the cfg table while
-- ensuring that default parameter names will always work. The cfg table
-- values can be added as a string, or as an array of strings.
local defaultKeys = {
'main',
'talk',
'other',
'subjectns',
'demospace',
'demopage'
}
local argKeys = {}
for i, defaultKey in ipairs(defaultKeys) do
argKeys[defaultKey] = {defaultKey}
end
for defaultKey, t in pairs(argKeys) do
local cfgValue = cfg[defaultKey]
local cfgValueType = type(cfgValue)
if cfgValueType == 'string' then
addKey(t, cfgValue, defaultKey)
elseif cfgValueType == 'table' then
for i, key in ipairs(cfgValue) do
addKey(t, key, defaultKey)
end
end
cfg[defaultKey] = nil -- Free the cfg value as we don't need it any more.
end
local function getParamMappings()
--[[
-- Returns a table of how parameter names map to namespace names. The keys
-- are the actual namespace names, in lower case, and the values are the
-- possible parameter names for that namespace, also in lower case. The
-- table entries are structured like this:
-- {
-- [''] = {'main'},
-- ['wikipedia'] = {'wikipedia', 'project', 'wp'},
-- ...
-- }
--]]
local mappings = {}
local mainNsName = mw.site.subjectNamespaces[0].name
mainNsName = mw.ustring.lower(mainNsName)
mappings[mainNsName] = mw.clone(argKeys.main)
mappings['talk'] = mw.clone(argKeys.talk)
for nsid, ns in pairs(mw.site.subjectNamespaces) do
if nsid ~= 0 then -- Exclude main namespace.
local nsname = mw.ustring.lower(ns.name)
local canonicalName = mw.ustring.lower(ns.canonicalName)
mappings[nsname] = {nsname}
if canonicalName ~= nsname then
table.insert(mappings[nsname], canonicalName)
end
for _, alias in ipairs(ns.aliases) do
table.insert(mappings[nsname], mw.ustring.lower(alias))
end
end
end
return mappings
end
return {
argKeys = argKeys,
cfg = cfg,
mappings = getParamMappings()
}
d224f42a258bc308ef3ad8cc8686cd7a4f47d005
Module:Yesno
828
12
19
2020-04-01T06:27:55Z
wikipedia>MusikAnimal
0
Undid revision 948472533 by [[Special:Contributions/w>Vogone|w>Vogone]] ([[User talk:w>Vogone|talk]])
Scribunto
text/plain
-- Function allowing for consistent treatment of boolean-like wikitext input.
-- It works similarly to the template {{yesno}}.
return function (val, default)
-- If your wiki uses non-ascii characters for any of "yes", "no", etc., you
-- should replace "val:lower()" with "mw.ustring.lower(val)" in the
-- following line.
val = type(val) == 'string' and val:lower() or val
if val == nil then
return nil
elseif val == true
or val == 'yes'
or val == 'y'
or val == 'true'
or val == 't'
or val == 'on'
or tonumber(val) == 1
then
return true
elseif val == false
or val == 'no'
or val == 'n'
or val == 'false'
or val == 'f'
or val == 'off'
or tonumber(val) == 0
then
return false
else
return default
end
end
f767643e7d12126d020d88d662a3dd057817b9dc
Module:File link
828
102
195
2020-04-01T06:31:54Z
wikipedia>MusikAnimal
0
Undid revision 948472508 by [[Special:Contributions/w>IPad365|w>IPad365]] ([[User talk:w>IPad365|talk]])
Scribunto
text/plain
-- This module provides a library for formatting file wikilinks.
local yesno = require('Module:Yesno')
local checkType = require('libraryUtil').checkType
local p = {}
function p._main(args)
checkType('_main', 1, args, 'table')
-- This is basically libraryUtil.checkTypeForNamedArg, but we are rolling our
-- own function to get the right error level.
local function checkArg(key, val, level)
if type(val) ~= 'string' then
error(string.format(
"type error in '%s' parameter of '_main' (expected string, got %s)",
key, type(val)
), level)
end
end
local ret = {}
-- Adds a positional parameter to the buffer.
local function addPositional(key)
local val = args[key]
if not val then
return nil
end
checkArg(key, val, 4)
ret[#ret + 1] = val
end
-- Adds a named parameter to the buffer. We assume that the parameter name
-- is the same as the argument key.
local function addNamed(key)
local val = args[key]
if not val then
return nil
end
checkArg(key, val, 4)
ret[#ret + 1] = key .. '=' .. val
end
-- Filename
checkArg('file', args.file, 3)
ret[#ret + 1] = 'File:' .. args.file
-- Format
if args.format then
checkArg('format', args.format)
if args.formatfile then
checkArg('formatfile', args.formatfile)
ret[#ret + 1] = args.format .. '=' .. args.formatfile
else
ret[#ret + 1] = args.format
end
end
-- Border
if yesno(args.border) then
ret[#ret + 1] = 'border'
end
addPositional('location')
addPositional('alignment')
addPositional('size')
addNamed('upright')
addNamed('link')
addNamed('alt')
addNamed('page')
addNamed('class')
addNamed('lang')
addNamed('start')
addNamed('end')
addNamed('thumbtime')
addPositional('caption')
return string.format('[[%s]]', table.concat(ret, '|'))
end
function p.main(frame)
local origArgs = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:File link'
})
if not origArgs.file then
error("'file' parameter missing from [[Template:File link]]", 0)
end
-- Copy the arguments that were passed to a new table to avoid looking up
-- every possible parameter in the frame object.
local args = {}
for k, v in pairs(origArgs) do
-- Make _BLANK a special argument to add a blank parameter. For use in
-- conditional templates etc. it is useful for blank arguments to be
-- ignored, but we still need a way to specify them so that we can do
-- things like [[File:Example.png|link=]].
if v == '_BLANK' then
v = ''
end
args[k] = v
end
return p._main(args)
end
return p
66925f088d11530f2482f04181a3baaaa0ad3d0c
Template:Sandbox other
10
120
231
2020-04-03T00:08:09Z
wikipedia>Evad37
0
Also match subpage names beginning with "sandbox", per [[Template_talk:Sandbox_other#Template-protected_edit_request_on_28_March_2020|edit request]]
wikitext
text/x-wiki
{{#if:{{#ifeq:{{#invoke:String|sublength|s={{SUBPAGENAME}}|i=0|len=7}}|sandbox|1}}{{#ifeq:{{SUBPAGENAME}}|doc|1}}{{#invoke:String|match|{{PAGENAME}}|/sandbox/styles.css$|plain=false|nomatch=}}|{{{1|}}}|{{{2|}}}}}<!--
--><noinclude>{{documentation}}</noinclude>
91e4ae891d6b791615152c1fbc971414961ba872
Template:Tlf
10
123
237
2020-04-13T14:42:57Z
wikipedia>Primefac
0
Primefac moved page [[Template:Tlf]] to [[Template:Template link with link off]]: full name to indicate what it does
wikitext
text/x-wiki
#REDIRECT [[Template:Template link with link off]]
{{Redirect category shell|
{{R from move}}
}}
52759e1d3f7c9aa4a03d0b7d4f84f4c6adf53edf
Module:Category handler/blacklist
828
42
77
2020-04-18T08:48:05Z
wikipedia>Jo-Jo Eumerus
0
Per category talk page
Scribunto
text/plain
-- This module contains the blacklist used by [[Module:Category handler]].
-- Pages that match Lua patterns in this list will not be categorised unless
-- categorisation is explicitly requested.
return {
'^Main Page$', -- don't categorise the main page.
-- Don't categorise the following pages or their subpages.
-- "%f[/\0]" matches if the next character is "/" or the end of the string.
'^Wikipedia:Cascade%-protected items%f[/\0]',
'^User:UBX%f[/\0]', -- The userbox "template" space.
'^User talk:UBX%f[/\0]',
-- Don't categorise subpages of these pages, but allow
-- categorisation of the base page.
'^Wikipedia:Template index/.*$',
-- Don't categorise archives.
'/[aA]rchive',
"^Wikipedia:Administrators' noticeboard/IncidentArchive%d+$",
}
87469d7a9ef2a3c41b2bf04ae18f7c59a18fb855
Module:For loop
828
255
502
2020-05-22T07:38:08Z
wikipedia>Johnuniq
0
require [[Module:Template invocation]] only if required (see [[Template talk:Post-nominals#Use of Module:Template_invocation]]); clean whitespace, variables
Scribunto
text/plain
-- This module implements {{for loop}}.
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local p = {}
function p.main(frame)
local args = getArgs(frame, {
trim = false,
removeBlanks = false
})
return p._main(args)
end
function p._main(args)
local template = args['call'] or 'void'
local calltemplates = yesno(args.substall or "", true) or not mw.isSubsting()
local variableParam = args.pv
variableParam = tonumber(variableParam) or variableParam or 1 -- fix for positional parameters
local variableValPrefix = args.prefix or ''
local variableValPostfix = args.postfix or ''
local sep = args[1] or ''
local constantArgs = p.getConstants(args)
local variableVals = p.getVariableVals(args)
local result = ''
local addSeparator = false;
for _, v in ipairs(variableVals) do
v = mw.text.trim(v)
if #v > 0 or not yesno(args.skipBlanks) then
if addSeparator then
result = result .. sep
end
addSeparator = true;
local targs = constantArgs
targs[variableParam] = variableValPrefix .. v .. variableValPostfix
if calltemplates then
local output = p.callTemplate(template, targs)
if #mw.text.trim(output) == 0 then
addSeparator = false
end
result = result .. output
else
local makeTemplate = require('Module:Template invocation').invocation
result = result .. makeTemplate(template, targs)
end
end
end
return result
end
function p.getConstants(args)
local constantArgNums = p.getArgNums(args, 'pc', 'n')
local constantArgs = {}
for _, num in ipairs(constantArgNums) do
local keyArg = 'pc' .. tostring(num) .. 'n'
local valArg = 'pc' .. tostring(num) .. 'v'
local key = args[keyArg]
key = tonumber(key) or key
local value = args[valArg]
constantArgs[key] = value
end
return constantArgs
end
function p.getVariableVals(args)
local variableVals = {}
if args.start or args.stop or args.by then
if args[2] then
error("Both start/stop/by and numbered parameters specified")
end
local start = tonumber(args.start or 1)
local stop = tonumber(args.stop or 1)
local by = tonumber(args.by or 1)
for i = start, stop, by do
variableVals [#variableVals + 1] = i
end
else
for i, v in ipairs(args) do
if i ~= 1 then
variableVals[i - 1] = v
end
end
end
return variableVals
end
function p.getArgNums(args, prefix, suffix)
-- Returns a table containing the numbers of the arguments that exist
-- for the specified prefix and suffix.
local nums = {}
local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$'
for k, _ in pairs(args) do
local num = tostring(k):match(pattern)
if num then
nums[#nums + 1] = tonumber(num)
end
end
table.sort(nums)
return nums
end
function p.callTemplate(template, targs)
return mw.getCurrentFrame():expandTemplate{title = template, args = targs}
end
return p
4ed4682b1fd3fbf2bf0836b46dd19bc0363d40e2
Template:Sidebar
10
98
187
2020-06-04T02:43:13Z
wikipedia>Primefac
0
TFD closed as keep ([[WP:XFDC|XFDcloser]])
wikitext
text/x-wiki
{{#invoke:Sidebar|sidebar}}<noinclude>
{{documentation}}</noinclude>
ab2498000a99daf324f656b0badd187b4a3e2b42
Template:MONTHNAME
10
213
418
2020-06-10T21:21:03Z
wikipedia>Primefac
0
Reverted edits by [[Special:Contribs/Primefac|Primefac]] ([[User talk:Primefac|talk]]) to last version by Jo-Jo Eumerus
wikitext
text/x-wiki
<includeonly>{{#if:{{{1|}}}|{{#switch:{{MONTHNUMBER|{{{1}}}}}|1=January|2=February|3=March|4=April|5=May|6=June|7=July|8=August|9=September|10=October|11=November|12=December|Incorrect required parameter 1=''month''!}}|Missing required parameter 1=''month''!}}</includeonly><noinclude>
{{Documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
25327282f70efd1189b70245a0e23509f3bb65e6
Template:Disambiguation needed
10
68
129
2020-06-19T11:57:20Z
wikipedia>R'n'B
0
provide an internal link while dispenser's tool is unavailable
wikitext
text/x-wiki
{{ {{{|safesubst:}}}#invoke:Unsubst||date=__DATE__ |$B=
{{#if:{{{1|}}}
|[[{{{1}}}|<span>{{ #if:{{{2|}}} | {{{2|}}} | {{{1}}} }}</span>]]
}}{{Fix
|name=Disambiguation needed
|link=Wikipedia:WikiProject Disambiguation/Fixing links
|text=disambiguation needed
|title=Link needs disambiguation
|date={{{date|}}}
|cat-date=Category:Articles with links needing disambiguation
|cat=[[Category:All articles with links needing disambiguation]]
}}
}}<noinclude>
{{Documentation}}
</noinclude>
f14e8d2a26d12440c4bdf824986bef19595349c1
Template:SfnRef
10
56
105
2020-07-04T15:54:11Z
wikipedia>Ahecht
0
safesubst<noinclude />:
wikitext
text/x-wiki
{{safesubst<noinclude />:#invoke:Footnotes|sfnref}}<noinclude>
{{documentation}}
</noinclude>
56e03dd26fcd9edbe71a96b5c5c84198863b964b
Template:SDcat
10
33
59
2020-08-07T18:02:31Z
wikipedia>MusikBot II
0
Protected "[[Template:SDcat]]": [[Wikipedia:High-risk templates|High-risk template or module]] ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
<includeonly>{{#invoke:SDcat |setCat}}</includeonly><noinclude>
{{documentation}}
</noinclude>
8c6e8783ddb0dc699d6fb60370db97b73725b9a6
Template:Code
10
278
548
2020-08-09T22:30:02Z
wikipedia>Bsherr
0
adding comment
wikitext
text/x-wiki
{{#tag:syntaxhighlight|{{{code|{{{1}}}}}}|lang={{{lang|{{{2|text}}}}}}|class={{{class|}}}|id={{{id|}}}|style={{{style|}}}|inline=1}}<noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage, interwikis to Wikidata, not here -->
</noinclude>
5d9b1a0980efe1b02eb91bc717438a5ae4a5ee04
Module:SDcat
828
36
65
2020-08-16T17:20:37Z
wikipedia>RexxS
0
if no connection to Wikidata, then do nothing
Scribunto
text/plain
--[[
SDcat
Module to check whether local short description matches that on Wikidata
--]]
local p = {}
-------------------------------------------------------------------------------
--[[
setCat has the qid of a Wikidata entity passed as |qid=
(it defaults to the associated qid of the current article if omitted)
and the local short description passed as |sd=
It returns a category if there is an associated Wikidata entity.
It returns one of the following tracking categories, as appropriate:
* Category:Short description matches Wikidata (case-insensitive)
* Category:Short description is different from Wikidata
* Category:Short description with empty Wikidata description
For testing purposes, a link prefix |lp= may be set to ":" to make the categories visible.
--]]
-- function exported for use in other modules
-- (local short description, Wikidata entity-ID, link prefix)
p._setCat = function(sdesc, itemID, lp)
if not mw.wikibase then return nil end
if itemID == "" then itemID = nil end
-- Wikidata description field
local wdesc = (mw.wikibase.getDescription(itemID) or ""):lower()
if wdesc == "" then
return "[[" .. lp .. "Category:Short description with empty Wikidata description]]"
elseif wdesc == sdesc then
return "[[" .. lp .. "Category:Short description matches Wikidata]]"
else
return "[[" .. lp .. "Category:Short description is different from Wikidata]]"
end
end
-- function exported for call from #invoke
p.setCat = function(frame)
local args
if frame.args.sd then
args = frame.args
else
args = frame:getParent().args
end
-- local short description
local sdesc = mw.text.trim(args.sd or ""):lower()
-- Wikidata entity-ID
local itemID = mw.text.trim(args.qid or "")
-- link prefix, strip quotes
local lp = mw.text.trim(args.lp or ""):gsub('"', '')
return p._setCat(sdesc, itemID, lp)
end
return p
6c19ac0f72c79a618eb105808f74701376bb2b38
Template:Yesno
10
85
161
2020-08-28T03:15:17Z
wikipedia>Xaosflux
0
add additional paramerters, "t", "f" - requested on talk - worked in sandbox /testcases
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: {{{1|¬}}} }}
|no
|n
|f
|false
|off
|0 = {{{no|<!-- null -->}}}
| = {{{blank|{{{no|<!-- null -->}}}}}}
|¬ = {{{¬|}}}
|yes
|y
|t
|true
|on
|1 = {{{yes|yes}}}
|#default = {{{def|{{{yes|yes}}}}}}
}}<noinclude>
{{Documentation}}
</noinclude>
629c2937bc5cf7cfe13cd2a598582af832782399
Module:TNT
828
264
520
2020-08-30T07:28:25Z
wikipedia>Johnuniq
0
Changed protection level for "[[Module:TNT]]": [[WP:High-risk templates|High-risk Lua module]]: per request at [[WP:RFPP]] to match [[Module:Excerpt]] ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
Scribunto
text/plain
--
-- INTRO: (!!! DO NOT RENAME THIS PAGE !!!)
-- This module allows any template or module to be copy/pasted between
-- wikis without any translation changes. All translation text is stored
-- in the global Data:*.tab pages on Commons, and used everywhere.
--
-- SEE: https://www.mediawiki.org/wiki/Multilingual_Templates_and_Modules
--
-- ATTENTION:
-- Please do NOT rename this module - it has to be identical on all wikis.
-- This code is maintained at https://www.mediawiki.org/wiki/Module:TNT
-- Please do not modify it anywhere else, as it may get copied and override your changes.
-- Suggestions can be made at https://www.mediawiki.org/wiki/Module_talk:TNT
--
-- DESCRIPTION:
-- The "msg" function uses a Commons dataset to translate a message
-- with a given key (e.g. source-table), plus optional arguments
-- to the wiki markup in the current content language.
-- Use lang=xx to set language. Example:
--
-- {{#invoke:TNT | msg
-- | I18n/Template:Graphs.tab <!-- https://commons.wikimedia.org/wiki/Data:I18n/Template:Graphs.tab -->
-- | source-table <!-- uses a translation message with id = "source-table" -->
-- | param1 }} <!-- optional parameter -->
--
--
-- The "doc" function will generate the <templatedata> parameter documentation for templates.
-- This way all template parameters can be stored and localized in a single Commons dataset.
-- NOTE: "doc" assumes that all documentation is located in Data:Templatedata/* on Commons.
--
-- {{#invoke:TNT | doc | Graph:Lines }}
-- uses https://commons.wikimedia.org/wiki/Data:Templatedata/Graph:Lines.tab
-- if the current page is Template:Graph:Lines/doc
--
local p = {}
local i18nDataset = 'I18n/Module:TNT.tab'
-- Forward declaration of the local functions
local sanitizeDataset, loadData, link, formatMessage
function p.msg(frame)
local dataset, id
local params = {}
local lang = nil
for k, v in pairs(frame.args) do
if k == 1 then
dataset = mw.text.trim(v)
elseif k == 2 then
id = mw.text.trim(v)
elseif type(k) == 'number' then
table.insert(params, mw.text.trim(v))
elseif k == 'lang' and v ~= '_' then
lang = mw.text.trim(v)
end
end
return formatMessage(dataset, id, params, lang)
end
-- Identical to p.msg() above, but used from other lua modules
-- Parameters: name of dataset, message key, optional arguments
-- Example with 2 params: format('I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset')
function p.format(dataset, key, ...)
local checkType = require('libraryUtil').checkType
checkType('format', 1, dataset, 'string')
checkType('format', 2, key, 'string')
return formatMessage(dataset, key, {...})
end
-- Identical to p.msg() above, but used from other lua modules with the language param
-- Parameters: language code, name of dataset, message key, optional arguments
-- Example with 2 params: formatInLanguage('es', I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset')
function p.formatInLanguage(lang, dataset, key, ...)
local checkType = require('libraryUtil').checkType
checkType('formatInLanguage', 1, lang, 'string')
checkType('formatInLanguage', 2, dataset, 'string')
checkType('formatInLanguage', 3, key, 'string')
return formatMessage(dataset, key, {...}, lang)
end
-- Obsolete function that adds a 'c:' prefix to the first param.
-- "Sandbox/Sample.tab" -> 'c:Data:Sandbox/Sample.tab'
function p.link(frame)
return link(frame.args[1])
end
function p.doc(frame)
local dataset = 'Templatedata/' .. sanitizeDataset(frame.args[1])
return frame:extensionTag('templatedata', p.getTemplateData(dataset)) ..
formatMessage(i18nDataset, 'edit_doc', {link(dataset)})
end
function p.getTemplateData(dataset)
-- TODO: add '_' parameter once lua starts reindexing properly for "all" languages
local data = loadData(dataset)
local names = {}
for _, field in pairs(data.schema.fields) do
table.insert(names, field.name)
end
local params = {}
local paramOrder = {}
for _, row in pairs(data.data) do
local newVal = {}
local name = nil
for pos, val in pairs(row) do
local columnName = names[pos]
if columnName == 'name' then
name = val
else
newVal[columnName] = val
end
end
if name then
params[name] = newVal
table.insert(paramOrder, name)
end
end
-- Work around json encoding treating {"1":{...}} as an [{...}]
params['zzz123']=''
local json = mw.text.jsonEncode({
params=params,
paramOrder=paramOrder,
description=data.description
})
json = string.gsub(json,'"zzz123":"",?', "")
return json
end
-- Local functions
sanitizeDataset = function(dataset)
if not dataset then
return nil
end
dataset = mw.text.trim(dataset)
if dataset == '' then
return nil
elseif string.sub(dataset,-4) ~= '.tab' then
return dataset .. '.tab'
else
return dataset
end
end
loadData = function(dataset, lang)
dataset = sanitizeDataset(dataset)
if not dataset then
error(formatMessage(i18nDataset, 'error_no_dataset', {}))
end
-- Give helpful error to thirdparties who try and copy this module.
if not mw.ext or not mw.ext.data or not mw.ext.data.get then
error('Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:' .. dataset)
end
local data = mw.ext.data.get(dataset, lang)
if data == false then
if dataset == i18nDataset then
-- Prevent cyclical calls
error('Missing Commons dataset ' .. i18nDataset)
else
error(formatMessage(i18nDataset, 'error_bad_dataset', {link(dataset)}))
end
end
return data
end
-- Given a dataset name, convert it to a title with the 'commons:data:' prefix
link = function(dataset)
return 'c:Data:' .. mw.text.trim(dataset or '')
end
formatMessage = function(dataset, key, params, lang)
for _, row in pairs(loadData(dataset, lang).data) do
local id, msg = unpack(row)
if id == key then
local result = mw.message.newRawMessage(msg, unpack(params or {}))
return result:plain()
end
end
if dataset == i18nDataset then
-- Prevent cyclical calls
error('Invalid message key "' .. key .. '"')
else
error(formatMessage(i18nDataset, 'error_bad_msgkey', {key, link(dataset)}))
end
end
return p
9d0d10e54abd232c806dcabccaf03e52858634a1
Template:Increase
10
224
440
2020-09-08T22:54:27Z
wikipedia>Sdkb
0
adding size parameter, per talk
wikitext
text/x-wiki
[[File:Increase2.svg|{{{size|11px}}}|alt={{{1|Increase}}}|link=|{{{1|Increase}}}]]<noinclude>
{{documentation}}
</noinclude>
dac0cb099f2bf8616e0649249f7e4593a2bf54bd
Template:Subpage other
10
203
398
2020-09-10T16:00:23Z
wikipedia>Favonian
0
Changed protection level for "[[Template:Subpage other]]": [[WP:High-risk templates|Highly visible template]]: requested at [[WP:RFPP]] ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
{{#ifeq:{{SUBPAGENAME}}|{{ROOTPAGENAME}}|{{{2|}}}|{{{1|}}}}}<!--
--><noinclude>{{documentation}}</noinclude>
ebcb508ec39c25594f4151c4e32c01eeb5732f3d
Module:Effective protection level
828
101
193
2020-09-29T03:38:47Z
wikipedia>Jackmcbarn
0
bring in changes from sandbox
Scribunto
text/plain
local p = {}
-- Returns the permission required to perform a given action on a given title.
-- If no title is specified, the title of the page being displayed is used.
function p._main(action, pagename)
local title
if type(pagename) == 'table' and pagename.prefixedText then
title = pagename
elseif pagename then
title = mw.title.new(pagename)
else
title = mw.title.getCurrentTitle()
end
pagename = title.prefixedText
if action == 'autoreview' then
local level = mw.ext.FlaggedRevs.getStabilitySettings(title)
level = level and level.autoreview
if level == 'review' then
return 'reviewer'
elseif level ~= '' then
return level
else
return nil -- not '*'. a page not being PC-protected is distinct from it being PC-protected with anyone able to review. also not '', as that would mean PC-protected but nobody can review
end
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' and action ~= 'undelete' then
error( 'First parameter must be one of edit, move, create, upload, undelete, autoreview', 2 )
end
if title.namespace == 8 then -- MediaWiki namespace
if title.text:sub(-3) == '.js' or title.text:sub(-4) == '.css' or title.contentModel == 'javascript' or title.contentModel == 'css' then -- site JS or CSS page
return 'interfaceadmin'
else -- any non-JS/CSS MediaWiki page
return 'sysop'
end
elseif title.namespace == 2 and title.isSubpage then
if title.contentModel == 'javascript' or title.contentModel == 'css' then -- user JS or CSS page
return 'interfaceadmin'
elseif title.contentModel == 'json' then -- user JSON page
return 'sysop'
end
end
if action == 'undelete' then
return 'sysop'
end
local level = title.protectionLevels[action] and title.protectionLevels[action][1]
if level == 'sysop' or level == 'editprotected' then
return 'sysop'
elseif title.cascadingProtection.restrictions[action] and title.cascadingProtection.restrictions[action][1] then -- used by a cascading-protected page
return 'sysop'
elseif level == 'templateeditor' then
return 'templateeditor'
elseif action == 'move' then
local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move.
if blacklistentry and not blacklistentry.params.autoconfirmed then
return 'templateeditor'
elseif title.namespace == 6 then
return 'filemover'
elseif level == 'extendedconfirmed' then
return 'extendedconfirmed'
else
return 'autoconfirmed'
end
end
local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename)
if blacklistentry then
if not blacklistentry.params.autoconfirmed then
return 'templateeditor'
elseif level == 'extendedconfirmed' then
return 'extendedconfirmed'
else
return 'autoconfirmed'
end
elseif level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason
return 'autoconfirmed'
elseif level then
return level
elseif action == 'upload' then
return 'autoconfirmed'
elseif action == 'create' and title.namespace % 2 == 0 and title.namespace ~= 118 then -- You need to be registered, but not autoconfirmed, to create non-talk pages other than drafts
return 'user'
else
return '*'
end
end
setmetatable(p, { __index = function(t, k)
return function(frame)
return t._main(k, frame.args[1])
end
end })
return p
70256a489edf6be9808031b14a7e3ef3e025da97
Module:Infobox mapframe
828
252
496
2020-10-28T02:54:00Z
wikipedia>Evad37
0
only allow shapes/lines based on wikidata id if there is an id
Scribunto
text/plain
local mf = require('Module:Mapframe')
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local infoboxImage = require('Module:InfoboxImage').InfoboxImage
-- Defaults
local DEFAULT_FRAME_WIDTH = "270"
local DEFAULT_FRAME_HEIGHT = "200"
local DEFAULT_ZOOM = 10
local DEFAULT_GEOMASK_STROKE_WIDTH = "1"
local DEFAULT_GEOMASK_STROKE_COLOR = "#777777"
local DEFAULT_GEOMASK_FILL = "#888888"
local DEFAULT_GEOMASK_FILL_OPACITY = "0.5"
local DEFAULT_SHAPE_STROKE_WIDTH = "3"
local DEFAULT_SHAPE_STROKE_COLOR = "#FF0000"
local DEFAULT_SHAPE_FILL = "#606060"
local DEFAULT_SHAPE_FILL_OPACITY = "0.5"
local DEFAULT_LINE_STROKE_WIDTH = "5"
local DEFAULT_LINE_STROKE_COLOR = "#FF0000"
local DEFAULT_MARKER_COLOR = "#5E74F3"
-- Trim whitespace from args, and remove empty args
function trimArgs(argsTable)
local cleanArgs = {}
for key, val in pairs(argsTable) do
if type(val) == 'string' then
val = val:match('^%s*(.-)%s*$')
if val ~= '' then
cleanArgs[key] = val
end
else
cleanArgs[key] = val
end
end
return cleanArgs
end
function getBestStatement(item_id, property_id)
if not(item_id) or not(mw.wikibase.isValidEntityId(item_id)) or not(mw.wikibase.entityExists(item_id)) then
return false
end
local statements = mw.wikibase.getBestStatements(item_id, property_id)
if not statements or #statements == 0 then
return false
end
local hasNoValue = ( statements[1].mainsnak and statements[1].mainsnak.snaktype == 'novalue' )
if hasNoValue then
return false
end
return statements[1]
end
function hasWikidataProperty(item_id, property_id)
return getBestStatement(item_id, property_id) and true or false
end
function getStatementValue(statement)
return statement and statement.mainsnak and statement.mainsnak.datavalue and statement.mainsnak.datavalue.value or nil
end
function relatedEntity(item_id, property_id)
local value = getStatementValue( getBestStatement(item_id, property_id) )
return value and value.id or false
end
function idType(id)
if not id then
return nil
elseif mw.ustring.match(id, "[Pp]%d+") then
return "property"
elseif mw.ustring.match(id, "[Qq]%d+") then
return "item"
else
return nil
end
end
function getZoom(value, unit)
local length_km
if unit == 'km' then
length_km = tonumber(value)
elseif unit == 'mi' then
length_km = tonumber(value)*1.609344
elseif unit == 'km2' then
length_km = math.sqrt(tonumber(value))
elseif unit == 'mi2' then
length_km = math.sqrt(tonumber(value))*1.609344
end
-- max for zoom 2 is 6400km, for zoom 3 is 3200km, for zoom 4 is 1600km, etc
local zoom = math.floor(8 - (math.log10(length_km) - 2)/(math.log10(2)))
-- limit to values below 17
zoom = math.min(17, zoom)
-- take off 1 when calculated from area, to account for unusual shapes
if unit == 'km2' or unit == 'mi2' then
zoom = zoom - 1
end
-- minimum value is 1
return math.max(1, zoom)
end
function shouldAutoRun(frame)
-- Check if should be running
local explicitlyOn = yesno(mw.text.trim(frame.getParent(frame).args.mapframe or "")) -- true of false or nil
local onByDefault = (explicitlyOn == nil) and yesno(mw.text.trim(frame.args.onByDefault or ""), false) -- true or false
return explicitlyOn or onByDefault
end
function argsFromAuto(frame)
-- Get args from the frame (invoke call) and the parent (template call).
-- Frame arguments are default values which are overridden by parent values
-- when both are present
local args = getArgs(frame, {parentFirst = true})
-- Discard args not prefixed with "mapframe-", remove that prefix from those that remain
local fixedArgs = {}
for name, val in pairs(args) do
local fixedName = string.match(name, "^mapframe%-(.+)$" )
if fixedName then
fixedArgs[fixedName] = val
-- allow coord, coordinates, etc to be unprefixed
elseif name == "coordinates" or name == "coord" or name == "coordinate" and not fixedArgs.coord then
fixedArgs.coord = val
-- allow id, qid to be unprefixed, map to id (if not already present)
elseif name == "id" or name == "qid" and not fixedArgs.id then
fixedArgs.id = val
end
end
return fixedArgs
end
local p = {}
p.autocaption = function(frame)
if not shouldAutoRun(frame) then return "" end
local args = argsFromAuto(frame)
if args.caption then
return args.caption
elseif args.switcher then
return ""
end
local maskItem
local maskType = idType(args.geomask)
if maskType == 'item' then
maskItem = args.geomask
elseif maskType == "property" then
maskItem = relatedEntity(args.id or mw.wikibase.getEntityIdForCurrentPage(), args.geomask)
end
local maskItemLabel = maskItem and mw.wikibase.getLabel( maskItem )
return maskItemLabel and "Location in "..maskItemLabel or ""
end
function parseCustomWikitext(customWikitext)
-- infoboxImage will format an image if given wikitext containing an
-- image, or else pass through the wikitext unmodified
return infoboxImage({
args = {
image = customWikitext
}
})
end
p.auto = function(frame)
if not shouldAutoRun(frame) then return "" end
local args = argsFromAuto(frame)
if args.custom then
return frame:preprocess(parseCustomWikitext(args.custom))
end
local mapframe = p._main(args)
return frame:preprocess(mapframe)
end
p.main = function(frame)
local parent = frame.getParent(frame)
local parentArgs = parent.args
local mapframe = p._main(parentArgs)
return frame:preprocess(mapframe)
end
p._main = function(_config)
-- `config` is the args passed to this module
local config = trimArgs(_config)
-- Require wikidata item, or specified coords
local wikidataId = config.id or mw.wikibase.getEntityIdForCurrentPage()
if not(wikidataId) and not(config.coord) then
return ''
end
-- Require coords (specified or from wikidata), so that map will be centred somewhere
-- (P625 = coordinate location)
local hasCoordinates = hasWikidataProperty(wikidataId, 'P625') or config.coordinates or config.coord
if not hasCoordinates then
return ''
end
-- `args` is the arguments which will be passed to the mapframe module
local args = {}
-- Some defaults/overrides for infobox presentation
args.display = "inline"
args.frame = "yes"
args.plain = "yes"
args["frame-width"] = config["frame-width"] or config.width or DEFAULT_FRAME_WIDTH
args["frame-height"] = config["frame-height"] or config.height or DEFAULT_FRAME_HEIGHT
args["frame-align"] = "center"
args["frame-coord"] = config["frame-coordinates"] or config["frame-coord"] or ""
-- Note: config["coordinates"] or config["coord"] should not be used for the alignment of the frame;
-- see talk page ( https://en.wikipedia.org/wiki/Special:Diff/876492931 )
-- deprecated lat and long parameters
args["frame-lat"] = config["frame-lat"] or config["frame-latitude"] or ""
args["frame-long"] = config["frame-long"] or config["frame-longitude"] or ""
-- Calculate zoom from length or area (converted to km or km2)
if config.length_km then
args.zoom = getZoom(config.length_km, 'km')
elseif config.length_mi then
args.zoom = getZoom(config.length_mi, 'mi')
elseif config.area_km2 then
args.zoom = getZoom(config.area_km2, 'km2')
elseif config.area_mi2 then
args.zoom = getZoom(config.area_mi2, 'mi2')
else
args.zoom = config.zoom or DEFAULT_ZOOM
end
-- Conditionals: whether point, geomask should be shown
local hasOsmRelationId = hasWikidataProperty(wikidataId, 'P402') -- P402 is OSM relation ID
local shouldShowPointMarker;
if config.point == "on" then
shouldShowPointMarker = true
elseif config.point == "none" then
shouldShowPointMarker = false
else
shouldShowPointMarker = not(hasOsmRelationId) or (config.marker and config.marker ~= 'none') or (config.coordinates or config.coord)
end
local shouldShowShape = config.shape ~= 'none'
local shapeType = config.shape == 'inverse' and 'shape-inverse' or 'shape'
local shouldShowLine = config.line ~= 'none'
local maskItem
local useWikidata = wikidataId and true or false -- Use shapes/lines based on wikidata id, if there is one
-- But do not use wikidata when local coords are specified (and not turned off), unless explicitly set
if useWikidata and config.coord and shouldShowPointMarker then
useWikidata = config.wikidata and true or false
end
-- Switcher
if config.switcher == "zooms" then
-- switching between zoom levels
local maxZoom = math.max(tonumber(args.zoom), 3) -- what zoom would have otherwise been (if 3 or more, otherwise 3)
local minZoom = 1 -- completely zoomed out
local midZoom = math.floor((maxZoom + minZoom)/2) -- midway between maxn and min
args.switch = "zoomed in, zoomed midway, zoomed out"
args.zoom = string.format("SWITCH:%d,%d,%d", maxZoom, midZoom, minZoom)
elseif config.switcher == "auto" then
-- switching between P276 and P131 areas with recursive lookup, e.g. item's city,
-- that city's state, and that state's country
args.zoom = nil -- let kartographer determine the zoom
local maskLabels = {}
local maskItems = {}
local maskItemId = relatedEntity(wikidataId, "P276") or relatedEntity(wikidataId, "P131")
local maskLabel = mw.wikibase.getLabel(maskItemId)
while maskItemId and maskLabel and mw.text.trim(maskLabel) ~= "" do
table.insert(maskLabels, maskLabel)
table.insert(maskItems, maskItemId)
maskItemId = maskItemId and relatedEntity(maskItemId, "P131")
maskLabel = maskItemId and mw.wikibase.getLabel(maskItemId)
end
if #maskLabels > 1 then
args.switch = table.concat(maskLabels, "###")
maskItem = "SWITCH:" .. table.concat(maskItems, ",")
elseif #maskLabels == 1 then
maskItem = maskItemId[1]
end
elseif config.switcher == "geomasks" and config.geomask then
-- switching between items in geomask parameter
args.zoom = nil -- let kartographer determine the zoom
local separator = (mw.ustring.find(config.geomask, "###", 0, true ) and "###") or
(mw.ustring.find(config.geomask, ";", 0, true ) and ";") or ","
local pattern = "%s*"..separator.."%s*"
local maskItems = mw.text.split(mw.ustring.gsub(config.geomask, "SWITCH:", ""), pattern)
local maskLabels = {}
if #maskItems > 1 then
for i, item in ipairs(maskItems) do
table.insert(maskLabels, mw.wikibase.getLabel(item))
end
args.switch = table.concat(maskLabels, "###")
maskItem = "SWITCH:" .. table.concat(maskItems, ",")
end
end
-- resolve geomask item id (if not using geomask switcher)
if not maskItem then --
local maskType = idType(config.geomask)
if maskType == 'item' then
maskItem = config.geomask
elseif maskType == "property" then
maskItem = relatedEntity(wikidataId, config.geomask)
end
end
-- Keep track of arg numbering
local argNumber = ''
local function incrementArgNumber()
if argNumber == '' then
argNumber = 2
else
argNumber = argNumber + 1
end
end
-- Geomask
if maskItem then
args["type"..argNumber] = "shape-inverse"
args["id"..argNumber] = maskItem
args["stroke-width"..argNumber] = config["geomask-stroke-width"] or DEFAULT_GEOMASK_STROKE_WIDTH
args["stroke-color"..argNumber] = config["geomask-stroke-color"] or config["geomask-stroke-colour"] or DEFAULT_GEOMASK_STROKE_COLOR
args["fill"..argNumber] = config["geomask-fill"] or DEFAULT_GEOMASK_FILL
args["fill-opacity"..argNumber] = config["geomask-fill-opacity"] or DEFAULT_SHAPE_FILL_OPACITY
-- Let kartographer determine zoom and position, unless it is explicitly set in config
if not config.zoom and not config.switcher then
args.zoom = nil
args["frame-coord"] = nil
args["frame-lat"] = nil
args["frame-long"] = nil
local maskArea = getStatementValue( getBestStatement(maskItem, 'P2046') )
end
incrementArgNumber()
-- Hack to fix phab:T255932
if not args.zoom then
args["type"..argNumber] = "line"
args["id"..argNumber] = maskItem
args["stroke-width"..argNumber] = 0
incrementArgNumber()
end
end
-- Shape (or shape-inverse)
if useWikidata and shouldShowShape then
args["type"..argNumber] = shapeType
if config.id then args["id"..argNumber] = config.id end
args["stroke-width"..argNumber] = config["shape-stroke-width"] or config["stroke-width"] or DEFAULT_SHAPE_STROKE_WIDTH
args["stroke-color"..argNumber] = config["shape-stroke-color"] or config["shape-stroke-colour"] or config["stroke-color"] or config["stroke-colour"] or DEFAULT_SHAPE_STROKE_COLOR
args["fill"..argNumber] = config["shape-fill"] or DEFAULT_SHAPE_FILL
args["fill-opacity"..argNumber] = config["shape-fill-opacity"] or DEFAULT_SHAPE_FILL_OPACITY
incrementArgNumber()
end
-- Line
if useWikidata and shouldShowLine then
args["type"..argNumber] = "line"
if config.id then args["id"..argNumber] = config.id end
args["stroke-width"..argNumber] = config["line-stroke-width"] or config["stroke-width"] or DEFAULT_LINE_STROKE_WIDTH
args["stroke-color"..argNumber] = config["line-stroke-color"] or config["line-stroke-colour"] or config["stroke-color"] or config["stroke-colour"] or DEFAULT_LINE_STROKE_COLOR
incrementArgNumber()
end
-- Point
if shouldShowPointMarker then
args["type"..argNumber] = "point"
if config.id then args["id"..argNumber] = config.id end
if config.coord then args["coord"..argNumber] = config.coord end
if config.marker then args["marker"..argNumber] = config.marker end
args["marker-color"..argNumber] = config["marker-color"] or config["marker-colour"] or DEFAULT_MARKER_COLOR
incrementArgNumber()
end
local mapframe = args.switch and mf.multi(args) or mf._main(args)
local tracking = hasOsmRelationId and '' or '[[Category:Infobox mapframe without OSM relation ID on Wikidata]]'
return mapframe .. tracking
end
return p
d17ee86b24e6e7a955ec94561da65fe2a215b5a4
Module:For
828
156
303
2020-11-02T22:29:56Z
wikipedia>Andrybak
0
don't add talk pages and pages in the user namespace to [[:Category:Hatnote templates with errors]] – this is similar to [[Special:Diff/953627233/986768317|Module:Other uses of]] and [[Special:Diff/967664662|Module:Hatnote]]
Scribunto
text/plain
local mArguments --initialize lazily
local mHatlist = require('Module:Hatnote list')
local mHatnote = require('Module:Hatnote')
local yesNo = require('Module:Yesno')
local p = {}
--Implements {{For}} from the frame
--uses capitalized "For" to avoid collision with Lua reserved word "for"
function p.For (frame)
mArguments = require('Module:Arguments')
return p._For(mArguments.getArgs(frame))
end
--Implements {{For}} but takes a manual arguments table
function p._For (args)
local use = args[1]
if (not use) then
return mHatnote.makeWikitextError(
'no context parameter provided. Use {{other uses}} for "other uses" hatnotes.',
'Template:For#Errors',
args.category
)
end
local pages = {}
function two (a, b) return a, b, 1 end --lets us run ipairs from 2
for k, v in two(ipairs(args)) do table.insert(pages, v) end
local title = mw.title.getCurrentTitle()
local skipCat = title.isTalkPage or title.namespace == 2 --don't categorise talk pages and userspace
local oddCat = skipCat and '' or '[[Category:Hatnote templates using unusual parameters]]'
local category = yesNo(args.category)
return mHatnote._hatnote(
mHatlist.forSeeTableToString({{use = use, pages = pages}}),
{selfref = args.selfref}
) .. (
(use == 'other uses') and ((category == true) or (category == nil)) and
oddCat or ''
)
end
return p
2faf1bd8c657f3425af829cbde9733a936d8d4f4
Template:Start date
10
230
452
2020-11-05T01:49:22Z
wikipedia>Primefac
0
TFD closed as keep
wikitext
text/x-wiki
<includeonly>{{#if: {{{4|}}}
|{{#if: {{{5|}}}
|{{padleft:{{{4}}}|2|0}}:{{padleft:{{{5}}}|2|0}}{{#if: {{{6|}}}
|:{{padleft:{{{6}}}|2|0}} }}, }} }}<!--ABOVE FOR TIME; BELOW FOR DATE
-->{{#if: {{{1|}}}
|{{#if: {{{2|}}}
|{{#if: {{{3|}}}
|{{#if: {{{df|}}}|{{#expr:{{{3}}}}} {{MONTHNAME|{{{2}}}}}|{{MONTHNAME|{{{2}}}}} {{#expr:{{{3}}}}},}} {{{1}}}|{{MONTHNAME|{{{2}}}}} {{{1}}}}}|{{{1}}}}}}}{{#if: {{{7|}}}
| ({{#ifeq: {{{7}}}|Z|UTC|{{{7}}}}})}}<!-- BELOW FOR hCalendar
--><span style="display:none"> (<span class="bday dtstart published updated">{{#if: {{{1|}}}
| {{{1}}}{{#if: {{{2|}}}
| -{{padleft:{{{2}}}|2|0}}{{#if: {{{3|}}}
| -{{padleft:{{{3}}}|2|0}} }} }}<!--
-->{{#if: {{{4|}}}
| T{{padleft:{{{4}}}|2|0}}{{#if: {{{5|}}}
| :{{padleft:{{{5}}}|2|0}}{{#if: {{{6|}}}
| :{{padleft:{{{6}}}|2|0}} }} }} }} }}{{{7|}}}</span>)</span></includeonly><noinclude>
{{documentation}}
</noinclude>
2bdc464c20f7d568f3d482c9fb2d04f5d266f982
Module:Documentation/styles.css
828
119
229
2020-11-19T20:21:58Z
wikipedia>Izno
0
Changed protection level for "[[Module:Documentation/styles.css]]": actually match module ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
sanitized-css
text/css
/* {{pp|small=yes}} */
.documentation,
.documentation-metadata {
border: 1px solid #a2a9b1;
background-color: #ecfcf4;
clear: both;
}
.documentation {
margin: 1em 0 0 0;
padding: 1em;
}
.documentation-metadata {
margin: 0.2em 0; /* same margin left-right as .documentation */
font-style: italic;
padding: 0.4em 1em; /* same padding left-right as .documentation */
}
.documentation-startbox {
padding-bottom: 3px;
border-bottom: 1px solid #aaa;
margin-bottom: 1ex;
}
.documentation-heading {
font-weight: bold;
font-size: 125%;
}
.documentation-clear { /* Don't want things to stick out where they shouldn't. */
clear: both;
}
.documentation-toolbar {
font-style: normal;
font-size: 85%;
}
ce0e629c92e3d825ab9fd927fe6cc37d9117b6cb
Template:Tlg
10
242
476
2020-11-20T18:19:26Z
wikipedia>Primefac
0
Primefac moved page [[Template:Tlg]] to [[Template:Template link general]]: clearer name
wikitext
text/x-wiki
#REDIRECT [[Template:Template link general]]
{{Redirect category shell|
{{R from move}}
}}
707ce913a3ffa8193c9377c3ded7db7b72407500
Template:Tld
10
171
333
2020-11-20T18:52:18Z
wikipedia>Primefac
0
avoid redir
wikitext
text/x-wiki
#REDIRECT [[Template:Template link code]]
be5d6275ea41d83224503e05901f3405c82141f7
Template:Tlx
10
92
175
2020-11-20T18:53:35Z
wikipedia>Primefac
0
Primefac moved page [[Template:Tlx]] to [[Template:Template link expanded]] over redirect: expand name, make it more obvious
wikitext
text/x-wiki
#REDIRECT [[Template:Template link expanded]]
{{Redirect category shell|
{{R from move}}
}}
1fec988ceb46cb324af228aac45d7cd25fcc9008
Template:Template link expanded
10
93
177
2020-11-21T12:04:41Z
wikipedia>Primefac
0
update
wikitext
text/x-wiki
{{#Invoke:Template link general|main|code=on}}<noinclude>
{{Documentation|1=Template:Tlg/doc
|content = {{tlg/doc|tlx}}
}}
<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
6c99696fee02f1da368ed20d2504e19bc15b1c13
Template:Template link with link off
10
122
235
2020-11-21T12:06:17Z
wikipedia>Primefac
0
update
wikitext
text/x-wiki
<includeonly>{{#Invoke:Template link general|main|nowrap=yes|nolink=yes}}</includeonly><noinclude>
{{Documentation|1=Template:Tlg/doc
|content = {{tlg/doc|tlf}}
}}
<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
b099fea5d1f36b0b4b9cb253ad3a9f4e095f6851
Template:Template link code
10
170
331
2020-11-21T12:06:22Z
wikipedia>Primefac
0
update
wikitext
text/x-wiki
<includeonly>{{#Invoke:Template link general|main|nolink=yes|code=yes|nowrap=yes}}</includeonly><noinclude>
{{Documentation|1=Template:Tlg/doc
|content = {{tlg/doc|tlc}}
}}
<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
044f00ca1bfc10cb967c32e893043ccc6f739764
Template:Sfn
10
55
103
2021-01-14T23:46:10Z
wikipedia>Jonesey95
0
add undocumented "ignore-err" (which should be "ignore-error", no?) to error check per a note on my talk page
wikitext
text/x-wiki
<includeonly>{{#invoke:Footnotes|sfn|template=sfn}}</includeonly>{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using sfn with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Sfn]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | 2 | 3 | 4 | 5 | ignore-err | loc | p | page | pages | postscript | pp | ps | ref | Ref }}<noinclude>
{{documentation}}
</noinclude>
eab6519b2a87e18dc40f39343c71f5848977cc93
Template:Cot
10
284
560
2021-01-23T15:32:43Z
wikipedia>Elli
0
not needed
wikitext
text/x-wiki
#REDIRECT [[Template:Collapse top]]
{{Redirect category shell|
{{R from template shortcut}}
}}
708f8bf79aefbfe8ee62f4fa68561059be0372d2
Template:Tlc
10
259
510
2021-01-23T16:04:55Z
wikipedia>Elli
0
cats
wikitext
text/x-wiki
#REDIRECT [[Template:Template link code]]
{{Redirect category shell|
{{R from template shortcut}}
{{R from high-use template}}
{{R from move}}
}}
48ef4a029c0e27cccb1148a29fb8b7ccb211a4a2
Template:Tl
10
83
157
2021-02-12T22:03:00Z
wikipedia>Anthony Appleyard
0
Anthony Appleyard moved page [[Template:Tl]] to [[Template:Template link]]: [[Special:Permalink/1006428669|Requested]] by Buidhe at [[WP:RM/TR]]: RM closed as move
wikitext
text/x-wiki
#REDIRECT [[Template:Template link]]
{{Redirect category shell|
{{R from move}}
}}
d6593bb3b4a866249f55d0f34b047a71fe1f1529
Template:Div col
10
111
213
2021-02-14T23:20:57Z
wikipedia>Matt Fitzpatrick
0
whitelist parameter class
wikitext
text/x-wiki
<includeonly><templatestyles src="Div col/styles.css"/><!--
--><div class="div-col {{#ifeq:{{{small|}}}|yes|div-col-small}} {{#ifeq:{{{rules|}}}|yes|div-col-rules}} {{{class|}}}" <!--
-->{{#if:{{{colwidth|}}}{{{gap|}}}{{{style|}}}|<!--
-->style="{{#if:{{{colwidth|}}}|column-width: {{{colwidth}}};}}{{#if:{{{gap|}}}|column-gap: {{{gap}}};}}{{#if:{{{style|}}}|{{{style}}}}}"<!--
-->}}><!--
-->{{#if:{{{content|}}}|{{{content}}}</div>}}<!-- Inventory how many pages use small=yes
-->{{#ifeq:{{{small|}}}|yes|[[Category:Pages using div col with small parameter]]}}<!--
--></includeonly>{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using div col with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Div col]] with unknown parameter "_VALUE_"; use colwidth= to specify column size |ignoreblank=y | class | colwidth | content | gap | rules | small | style }}<noinclude>
{{Documentation}}
</noinclude>
6e84133dd867d6c701e7b161878cf66665bb7eb7
Template:Template link general
10
241
474
2021-02-20T18:40:07Z
wikipedia>Pppery
0
Make substable per edit request
wikitext
text/x-wiki
{{{{{|safesubst:}}}#Invoke:Template link general|main}}<noinclude>
{{Documentation}}
</noinclude>
9871d2f490eaedd832a0ae8016adbf807ddf7b71
Template:Reflist/styles.css
10
48
89
2021-03-08T23:00:26Z
wikipedia>Izno
0
Changed protection level for "[[Template:Reflist/styles.css]]": match parent ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
sanitized-css
text/css
/* {{pp|small=yes}} */
/* can we remove the font size declarations? .references gets a font-size in
* common.css that is always 90, and there is nothing else in reflist out in
* the wild. May affect column sizes.
*/
.reflist {
font-size: 90%; /* Default font-size */
margin-bottom: 0.5em;
list-style-type: decimal;
}
.reflist .references {
font-size: 100%; /* Reset font-size when nested in div.reflist */
margin-bottom: 0; /* Avoid double margin when nested in div.reflist */
list-style-type: inherit; /* Enable custom list style types */
}
/* columns-2 and columns-3 are legacy for "2 or more" column view from when the
* template was implemented with column-count.
*/
.reflist-columns-2 {
column-width: 30em;
}
.reflist-columns-3 {
column-width: 25em;
}
/* Reset top margin for lists embedded in columns */
.reflist-columns {
margin-top: 0.3em;
}
.reflist-columns ol {
margin-top: 0;
}
/* Avoid elements breaking between columns */
.reflist-columns li {
page-break-inside: avoid; /* Removed from CSS in favor of break-inside c. 2020 */
break-inside: avoid-column;
}
.reflist-upper-alpha {
list-style-type: upper-alpha;
}
.reflist-upper-roman {
list-style-type: upper-roman;
}
.reflist-lower-alpha {
list-style-type: lower-alpha;
}
.reflist-lower-greek {
list-style-type: lower-greek;
}
.reflist-lower-roman {
list-style-type: lower-roman;
}
531a26d48f0e7826c61f764cfb7d5fb200032c34
Module:Math
828
220
432
2021-03-11T22:23:48Z
wikipedia>Primefac
0
typo fix
Scribunto
text/plain
--[[
This module provides a number of basic mathematical operations.
]]
local yesno, getArgs -- lazily initialized
local p = {} -- Holds functions to be returned from #invoke, and functions to make available to other Lua modules.
local wrap = {} -- Holds wrapper functions that process arguments from #invoke. These act as intemediary between functions meant for #invoke and functions meant for Lua.
--[[
Helper functions used to avoid redundant code.
]]
local function err(msg)
-- Generates wikitext error messages.
return mw.ustring.format('<strong class="error">Formatting error: %s</strong>', msg)
end
local function unpackNumberArgs(args)
-- Returns an unpacked list of arguments specified with numerical keys.
local ret = {}
for k, v in pairs(args) do
if type(k) == 'number' then
table.insert(ret, v)
end
end
return unpack(ret)
end
local function makeArgArray(...)
-- Makes an array of arguments from a list of arguments that might include nils.
local args = {...} -- Table of arguments. It might contain nils or non-number values, so we can't use ipairs.
local nums = {} -- Stores the numbers of valid numerical arguments.
local ret = {}
for k, v in pairs(args) do
v = p._cleanNumber(v)
if v then
nums[#nums + 1] = k
args[k] = v
end
end
table.sort(nums)
for i, num in ipairs(nums) do
ret[#ret + 1] = args[num]
end
return ret
end
local function fold(func, ...)
-- Use a function on all supplied arguments, and return the result. The function must accept two numbers as parameters,
-- and must return a number as an output. This number is then supplied as input to the next function call.
local vals = makeArgArray(...)
local count = #vals -- The number of valid arguments
if count == 0 then return
-- Exit if we have no valid args, otherwise removing the first arg would cause an error.
nil, 0
end
local ret = table.remove(vals, 1)
for _, val in ipairs(vals) do
ret = func(ret, val)
end
return ret, count
end
--[[
Fold arguments by selectively choosing values (func should return when to choose the current "dominant" value).
]]
local function binary_fold(func, ...)
local value = fold((function(a, b) if func(a, b) then return a else return b end end), ...)
return value
end
--[[
random
Generate a random number
Usage:
{{#invoke: Math | random }}
{{#invoke: Math | random | maximum value }}
{{#invoke: Math | random | minimum value | maximum value }}
]]
function wrap.random(args)
local first = p._cleanNumber(args[1])
local second = p._cleanNumber(args[2])
return p._random(first, second)
end
function p._random(first, second)
math.randomseed(mw.site.stats.edits + mw.site.stats.pages + os.time() + math.floor(os.clock() * 1000000000))
-- math.random will throw an error if given an explicit nil parameter, so we need to use if statements to check the params.
if first and second then
if first <= second then -- math.random doesn't allow the first number to be greater than the second.
return math.random(first, second)
end
elseif first then
return math.random(first)
else
return math.random()
end
end
--[[
order
Determine order of magnitude of a number
Usage:
{{#invoke: Math | order | value }}
]]
function wrap.order(args)
local input_string = (args[1] or args.x or '0');
local input_number = p._cleanNumber(input_string);
if input_number == nil then
return err('order of magnitude input appears non-numeric')
else
return p._order(input_number)
end
end
function p._order(x)
if x == 0 then return 0 end
return math.floor(math.log10(math.abs(x)))
end
--[[
precision
Detemines the precision of a number using the string representation
Usage:
{{ #invoke: Math | precision | value }}
]]
function wrap.precision(args)
local input_string = (args[1] or args.x or '0');
local trap_fraction = args.check_fraction;
local input_number;
if not yesno then
yesno = require('Module:Yesno')
end
if yesno(trap_fraction, true) then -- Returns true for all input except nil, false, "no", "n", "0" and a few others. See [[Module:Yesno]].
local pos = string.find(input_string, '/', 1, true);
if pos ~= nil then
if string.find(input_string, '/', pos + 1, true) == nil then
local denominator = string.sub(input_string, pos+1, -1);
local denom_value = tonumber(denominator);
if denom_value ~= nil then
return math.log10(denom_value);
end
end
end
end
input_number, input_string = p._cleanNumber(input_string);
if input_string == nil then
return err('precision input appears non-numeric')
else
return p._precision(input_string)
end
end
function p._precision(x)
if type(x) == 'number' then
x = tostring(x)
end
x = string.upper(x)
local decimal = x:find('%.')
local exponent_pos = x:find('E')
local result = 0;
if exponent_pos ~= nil then
local exponent = string.sub(x, exponent_pos + 1)
x = string.sub(x, 1, exponent_pos - 1)
result = result - tonumber(exponent)
end
if decimal ~= nil then
result = result + string.len(x) - decimal
return result
end
local pos = string.len(x);
while x:byte(pos) == string.byte('0') do
pos = pos - 1
result = result - 1
if pos <= 0 then
return 0
end
end
return result
end
--[[
max
Finds the maximum argument
Usage:
{{#invoke:Math| max | value1 | value2 | ... }}
Note, any values that do not evaluate to numbers are ignored.
]]
function wrap.max(args)
return p._max(unpackNumberArgs(args))
end
function p._max(...)
local max_value = binary_fold((function(a, b) return a > b end), ...)
if max_value then
return max_value
end
end
--[[
median
Find the median of set of numbers
Usage:
{{#invoke:Math | median | number1 | number2 | ...}}
OR
{{#invoke:Math | median }}
]]
function wrap.median(args)
return p._median(unpackNumberArgs(args))
end
function p._median(...)
local vals = makeArgArray(...)
local count = #vals
table.sort(vals)
if count == 0 then
return 0
end
if p._mod(count, 2) == 0 then
return (vals[count/2] + vals[count/2+1])/2
else
return vals[math.ceil(count/2)]
end
end
--[[
min
Finds the minimum argument
Usage:
{{#invoke:Math| min | value1 | value2 | ... }}
OR
{{#invoke:Math| min }}
When used with no arguments, it takes its input from the parent
frame. Note, any values that do not evaluate to numbers are ignored.
]]
function wrap.min(args)
return p._min(unpackNumberArgs(args))
end
function p._min(...)
local min_value = binary_fold((function(a, b) return a < b end), ...)
if min_value then
return min_value
end
end
--[[
sum
Finds the sum
Usage:
{{#invoke:Math| sum | value1 | value2 | ... }}
OR
{{#invoke:Math| sum }}
Note, any values that do not evaluate to numbers are ignored.
]]
function wrap.sum(args)
return p._sum(unpackNumberArgs(args))
end
function p._sum(...)
local sums, count = fold((function(a, b) return a + b end), ...)
if not sums then
return 0
else
return sums
end
end
--[[
average
Finds the average
Usage:
{{#invoke:Math| average | value1 | value2 | ... }}
OR
{{#invoke:Math| average }}
Note, any values that do not evaluate to numbers are ignored.
]]
function wrap.average(args)
return p._average(unpackNumberArgs(args))
end
function p._average(...)
local sum, count = fold((function(a, b) return a + b end), ...)
if not sum then
return 0
else
return sum / count
end
end
--[[
round
Rounds a number to specified precision
Usage:
{{#invoke:Math | round | value | precision }}
--]]
function wrap.round(args)
local value = p._cleanNumber(args[1] or args.value or 0)
local precision = p._cleanNumber(args[2] or args.precision or 0)
if value == nil or precision == nil then
return err('round input appears non-numeric')
else
return p._round(value, precision)
end
end
function p._round(value, precision)
local rescale = math.pow(10, precision or 0);
return math.floor(value * rescale + 0.5) / rescale;
end
--[[
log10
returns the log (base 10) of a number
Usage:
{{#invoke:Math | log10 | x }}
]]
function wrap.log10(args)
return math.log10(args[1])
end
--[[
mod
Implements the modulo operator
Usage:
{{#invoke:Math | mod | x | y }}
--]]
function wrap.mod(args)
local x = p._cleanNumber(args[1])
local y = p._cleanNumber(args[2])
if not x then
return err('first argument to mod appears non-numeric')
elseif not y then
return err('second argument to mod appears non-numeric')
else
return p._mod(x, y)
end
end
function p._mod(x, y)
local ret = x % y
if not (0 <= ret and ret < y) then
ret = 0
end
return ret
end
--[[
gcd
Calculates the greatest common divisor of multiple numbers
Usage:
{{#invoke:Math | gcd | value 1 | value 2 | value 3 | ... }}
--]]
function wrap.gcd(args)
return p._gcd(unpackNumberArgs(args))
end
function p._gcd(...)
local function findGcd(a, b)
local r = b
local oldr = a
while r ~= 0 do
local quotient = math.floor(oldr / r)
oldr, r = r, oldr - quotient * r
end
if oldr < 0 then
oldr = oldr * -1
end
return oldr
end
local result, count = fold(findGcd, ...)
return result
end
--[[
precision_format
Rounds a number to the specified precision and formats according to rules
originally used for {{template:Rnd}}. Output is a string.
Usage:
{{#invoke: Math | precision_format | number | precision }}
]]
function wrap.precision_format(args)
local value_string = args[1] or 0
local precision = args[2] or 0
return p._precision_format(value_string, precision)
end
function p._precision_format(value_string, precision)
-- For access to Mediawiki built-in formatter.
local lang = mw.getContentLanguage();
local value
value, value_string = p._cleanNumber(value_string)
precision = p._cleanNumber(precision)
-- Check for non-numeric input
if value == nil or precision == nil then
return err('invalid input when rounding')
end
local current_precision = p._precision(value)
local order = p._order(value)
-- Due to round-off effects it is neccesary to limit the returned precision under
-- some circumstances because the terminal digits will be inaccurately reported.
if order + precision >= 14 then
if order + p._precision(value_string) >= 14 then
precision = 13 - order;
end
end
-- If rounding off, truncate extra digits
if precision < current_precision then
value = p._round(value, precision)
current_precision = p._precision(value)
end
local formatted_num = lang:formatNum(math.abs(value))
local sign
-- Use proper unary minus sign rather than ASCII default
if value < 0 then
sign = '−'
else
sign = ''
end
-- Handle cases requiring scientific notation
if string.find(formatted_num, 'E', 1, true) ~= nil or math.abs(order) >= 9 then
value = value * math.pow(10, -order)
current_precision = current_precision + order
precision = precision + order
formatted_num = lang:formatNum(math.abs(value))
else
order = 0;
end
formatted_num = sign .. formatted_num
-- Pad with zeros, if needed
if current_precision < precision then
local padding
if current_precision <= 0 then
if precision > 0 then
local zero_sep = lang:formatNum(1.1)
formatted_num = formatted_num .. zero_sep:sub(2,2)
padding = precision
if padding > 20 then
padding = 20
end
formatted_num = formatted_num .. string.rep('0', padding)
end
else
padding = precision - current_precision
if padding > 20 then
padding = 20
end
formatted_num = formatted_num .. string.rep('0', padding)
end
end
-- Add exponential notation, if necessary.
if order ~= 0 then
-- Use proper unary minus sign rather than ASCII default
if order < 0 then
order = '−' .. lang:formatNum(math.abs(order))
else
order = lang:formatNum(order)
end
formatted_num = formatted_num .. '<span style="margin:0 .15em 0 .25em">×</span>10<sup>' .. order .. '</sup>'
end
return formatted_num
end
--[[
divide
Implements the division operator
Usage:
{{#invoke:Math | divide | x | y | round= | precision= }}
--]]
function wrap.divide(args)
local x = args[1]
local y = args[2]
local round = args.round
local precision = args.precision
if not yesno then
yesno = require('Module:Yesno')
end
return p._divide(x, y, yesno(round), precision)
end
function p._divide(x, y, round, precision)
if y == nil or y == "" then
return err("Empty divisor")
elseif not tonumber(y) then
if type(y) == 'string' and string.sub(y, 1, 1) == '<' then
return y
else
return err("Not a number: " .. y)
end
elseif x == nil or x == "" then
return err("Empty dividend")
elseif not tonumber(x) then
if type(x) == 'string' and string.sub(x, 1, 1) == '<' then
return x
else
return err("Not a number: " .. x)
end
else
local z = x / y
if round then
return p._round(z, 0)
elseif precision then
return p._round(z, precision)
else
return z
end
end
end
--[[
Helper function that interprets the input numerically. If the
input does not appear to be a number, attempts evaluating it as
a parser functions expression.
]]
function p._cleanNumber(number_string)
if type(number_string) == 'number' then
-- We were passed a number, so we don't need to do any processing.
return number_string, tostring(number_string)
elseif type(number_string) ~= 'string' or not number_string:find('%S') then
-- We were passed a non-string or a blank string, so exit.
return nil, nil;
end
-- Attempt basic conversion
local number = tonumber(number_string)
-- If failed, attempt to evaluate input as an expression
if number == nil then
local success, result = pcall(mw.ext.ParserFunctions.expr, number_string)
if success then
number = tonumber(result)
number_string = tostring(number)
else
number = nil
number_string = nil
end
else
number_string = number_string:match("^%s*(.-)%s*$") -- String is valid but may contain padding, clean it.
number_string = number_string:match("^%+(.*)$") or number_string -- Trim any leading + signs.
if number_string:find('^%-?0[xX]') then
-- Number is using 0xnnn notation to indicate base 16; use the number that Lua detected instead.
number_string = tostring(number)
end
end
return number, number_string
end
--[[
Wrapper function that does basic argument processing. This ensures that all functions from #invoke can use either the current
frame or the parent frame, and it also trims whitespace for all arguments and removes blank arguments.
]]
local mt = { __index = function(t, k)
return function(frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
return wrap[k](getArgs(frame)) -- Argument processing is left to Module:Arguments. Whitespace is trimmed and blank arguments are removed.
end
end }
return setmetatable(p, mt)
2bbe734d898299f65412963a3c1782e9fcc4d9ca
Template:Template link
10
84
159
2021-03-25T19:03:22Z
wikipedia>Izno
0
[[Wikipedia:Templates for discussion/Log/2021 March 18#Template:Tlu]] closed as keep ([[WP:XFDC#4.0.11|XFDcloser]])
wikitext
text/x-wiki
{{[[Template:{{{1}}}|{{{1}}}]]}}<noinclude>{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
eabbec62efe3044a98ebb3ce9e7d4d43c222351d
Template:Has short description
10
188
368
2021-03-29T18:21:45Z
wikipedia>MusikBot II
0
Protected "[[Template:Has short description]]": [[Wikipedia:High-risk templates|High-risk template or module]] ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
{{#invoke:string2 |findpagetext |text={%{ *[Ss]hort description |plain=false |title={{{title|{{{1|}}} }}} }}<noinclude>
{{documentation}}
</noinclude>
87587209a436a4c02ef7564ffe868c4348cc6a3c
Template:Lua sidebar/styles.css
10
287
566
2021-04-24T04:27:37Z
wikipedia>Izno
0
max-width
sanitized-css
text/css
.lua-sidebar {
width: auto;
max-width: 22em;
}
9984d36eb49fae70dd00527c993784d775409a6b
Module:If preview/configuration
828
262
516
2021-05-05T18:56:00Z
wikipedia>Izno
0
Protected "[[Module:If preview/configuration]]": match parent ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
Scribunto
text/plain
--[[
We perform the actual check for whether this is a preview here since
preprocessing is relatively expensive.
]]
local frame = mw.getCurrentFrame()
local function is_preview()
local revision_id = frame:preprocess('{{REVISIONID}}')
-- {{REVISIONID}} is usually the empty string when previewed.
-- I don't know why we're checking for nil but hey, maybe someday things
-- would have broken
return revision_id == nil or revision_id == ''
end
local function templatestyles()
return frame:extensionTag{
name = 'templatestyles', args = { src = 'Module:If preview/styles.css' }
}
end
return {
preview = is_preview(),
templatestyles = templatestyles(),
warning_infrastructure = '%s<div class="preview-warning"><strong>Preview warning:</strong> %s</div>',
missing_warning = 'The template has no warning text. Please add a warning.'
}
3edc8897c51a61b9e710b2a4d9eb657b3c2f1034
Module:If preview/styles.css
828
263
518
2021-05-05T18:56:47Z
wikipedia>Izno
0
pp
sanitized-css
text/css
/* {{pp|small=yes}} */
.preview-warning {
font-style: italic;
/* @noflip */
padding-left: 1.6em;
margin-bottom: 0.5em;
color: red;
}
/* The templatestyles element inserts a link element before hatnotes.
* TODO: Remove link if/when WMF resolves T200206 */
.preview-warning + link + .preview-warning {
margin-top: -0.5em;
}
8b79ffc4853d424a805b084de00030e04bbd573e
Module:If preview
828
261
514
2021-05-05T19:01:42Z
wikipedia>Izno
0
merge in functionality from [[Module:Preview warning]] and add TemplateStyles, remove p.boolean as not necessary, move some stuff into a cfg page, and don't return temporaries in p.main, remove use
Scribunto
text/plain
local p = {}
local cfg = mw.loadData('Module:If preview/configuration')
--[[
main
This function returns either the first argument or second argument passed to
this module, depending on whether the page is being previewed.
]]
function p.main(frame)
if cfg.preview then
return frame.args[1] or ''
else
return frame.args[2] or ''
end
end
--[[
pmain
This function returns either the first argument or second argument passed to
this module's parent (i.e. template using this module), depending on whether it
is being previewed.
]]
function p.pmain(frame)
return p.main(frame:getParent())
end
local function warning_text(warning)
return mw.ustring.format(
cfg.warning_infrastructure,
cfg.templatestyles,
warning
)
end
function p._warning(args)
local warning = args[1] and args[1]:match('^%s*(.-)%s*$') or ''
if warning == '' then
return warning_text(cfg.missing_warning)
end
if not cfg.preview then return '' end
return warning_text(warning)
end
--[[
warning
This function returns a "preview warning", which is the first argument marked
up with HTML and some supporting text, depending on whether the page is being previewed.
disabled since we'll implement the template version in general
]]
--function p.warning(frame)
-- return p._warning(frame.args)
--end
--[[
warning, but for pass-through templates like {{preview warning}}
]]
function p.pwarning(frame)
return p._warning(frame:getParent().args)
end
return p
9a92196d0001b8016f2501aedfadcc3adcb974ef
Template:Endplainlist
10
282
556
2021-05-14T07:01:30Z
wikipedia>WOSlinker
0
fix lint
wikitext
text/x-wiki
<includeonly></div></includeonly><noinclude>
{{documentation|Template:Plainlist/doc}}
</noinclude>
d545c41582328dd4f197e2b1848c8ad7392b92e0
Template:Category link with count
10
133
257
2021-06-11T18:13:44Z
wikipedia>GKFX
0
Support wider range of (valid) input format
wikitext
text/x-wiki
[[:Category:{{#invoke:string|replace|1={{{1}}}|2=^:?[Cc]ategory:|3=|plain=false}}|<!--
-->{{#if:{{{name|}}}|{{{name}}}|Category:{{#invoke:string|replace|1={{{1}}}|2=^:?[Cc]ategory:|3=|plain=false}}}}<!--
-->]] ({{PAGESINCATEGORY:{{#invoke:string|replace|1={{{1}}}|2=^:?[Cc]ategory:|3=|plain=false}}|{{{2|all}}}}})<noinclude>
{{Documentation}}
</noinclude>
f93f1540b8c157703bd6d24ae35c35bef745981d
Template:Navbox
10
192
376
2021-06-26T18:05:09Z
wikipedia>Trialpears
0
Remove TfD notice as it wouldn't involve any changes to this template.
wikitext
text/x-wiki
<includeonly>{{#invoke:Navbox|navbox}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
fe9b964401f895918ee4fe078678f1722a3c41ec
Module:Hatnote/styles.css
828
63
119
2021-07-12T19:22:27Z
wikipedia>Izno
0
per my talk page
sanitized-css
text/css
/* {{pp|small=y}} */
.hatnote {
font-style: italic;
}
/* Limit structure CSS to divs because of [[Module:Hatnote inline]] */
div.hatnote {
/* @noflip */
padding-left: 1.6em;
margin-bottom: 0.5em;
}
.hatnote i {
font-style: normal;
}
/* The templatestyles element inserts a link element before hatnotes.
* TODO: Remove link if/when WMF resolves T200206 */
.hatnote + link + .hatnote {
margin-top: -0.5em;
}
44680ffd6e888866df2cdfa0341af9c7b97da94c
Template:For
10
154
299
2021-07-17T12:58:12Z
wikipedia>Plastikspork
0
[[Wikipedia:Templates for discussion/Log/2021 July 8#Template:For]] closed as do not merge ([[WP:XFDC#4.0.12|XFDcloser]])
wikitext
text/x-wiki
<includeonly>{{#invoke:For|For}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
3f70c0fa7cd736071e7c6e7dcd90ff3704df26bb
Template:Succession links
10
221
434
2021-07-30T01:00:27Z
wikipedia>Goszei
0
ensure proper display on mobile
wikitext
text/x-wiki
{{#if:{{{above|}}}
|<div class="{{{aboveclass|}}}" style="width:100%; text-align:center; {{{abovestyle|}}}">{{{above}}}</div>
}}{{#if:{{{center|}}}
|<!-- then
--><table style="width:100%; margin:1px; display:inline-table;"><tr>
<td style="text-align:left; vertical-align:{{{vertical-align|middle}}}; padding:0 0.5em 0 0;{{#if:{{{wide|}}}|width:45%;}}{{{leftstyle|}}}" class="noprint">{{#if:{{{left|}}}|{{#if:{{{noarrows|}}}||← }}{{Delink question hyphen-minus|{{{left|}}}}}{{#if:{{{bullets|}}}| '''·'''}}}}</td>
{{#if:{{{center|}}}|
<td style="text-align:center; vertical-align:{{{vertical-align|middle}}};; padding:0 1px;{{{centerstyle|}}}" class="{{{centerclass|}}}">{{{center|}}}</td>
}}
<td style="text-align:right; vertical-align:{{{vertical-align|middle}}};; padding:0 0 0 0.5em;{{#if:{{{wide|}}}|width:45%;}}{{{rightstyle|}}}" class="noprint">{{#if:{{{right|}}}|{{#if:{{{bullets|}}}|'''·''' }}{{Delink question hyphen-minus|{{{right|}}}}}{{#if:{{{noarrows|}}}|| →}}}}</td>
</tr></table>
|<!-- else
-->{{#if:{{{left|}}}{{{right|}}}|<div style="width:100%">{{#if:{{{left|}}}|
<div style="float: left; text-align:left;padding-right:0.5em;{{{leftstyle|}}}" class="noprint">{{#if:{{{noarrows|}}}||← }}{{{left|}}}</div>
}}{{#if:{{{right|}}}|
<div style="float: right; text-align:right;padding-left:0.5em;{{{rightstyle|}}}" class="noprint">{{{right|}}}{{#if:{{{noarrows|}}}|| →}}</div>
}}</div>}}
}}<noinclude>{{documentation}}</noinclude>
69440132c87bdda8349cd83cd55b1db88112e68f
Template:UF-hcard-org
10
208
408
2021-08-02T18:52:40Z
wikipedia>Sdkb
0
adding option to replace "start date and age" with just "start date"
wikitext
text/x-wiki
{{Microformat message
| format = hCard
| data = an organization's details
| subtemplates =
* Use {{#ifeq:{{yesno-yes|{{{age|}}}}}|yes|{{tl|Start date and age}}|{{tl|Start date}}}} for the date on which an organisation was "established", "founded", "opened" or otherwise started, [[Wikipedia:WikiProject Microformats/dates|unless that date is before 1583 CE]].
* Use {{tl|URL}} for an organisation's URL.
|adr |agent |category |country-name |extended-address |fn |geo |label |latitude |locality |longitude |nickname |note |org |region |street-address |url |vcard
| nocollapse = on
}}<includeonly>{{sandbox other||
[[Category:Templates generating hCards]]
}}</includeonly><noinclude>
{{Documentation |content={{Microformat message templates}}}}
[[Category:Microformat (uF) message templates]]
[[Category:Templates generating hCards| ]]
</noinclude>
631bc99cd046167681b6eb518559d92fc65a4920
Template:Q
10
280
552
2021-08-16T20:38:04Z
wikipedia>ToBeFree
0
Changed protection settings for "[[Template:Q]]": [[WP:High-risk templates|Highly visible template]] ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
#REDIRECT [[Template:Wikidata entity link]]
[[Category:Wikidata templates]]
{{Redirect category shell|
{{R from template shortcut}}
{{R from move}}
}}
7f19fdcb2b05d966cd3f0f5f540cf8fa37935869
Template:Linkless exists
10
166
323
2021-08-16T23:47:06Z
wikipedia>MusikAnimal
0
Changed protection settings for "[[Template:Linkless exists]]": [[WP:High-risk templates|Highly visible template]] ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
{{#if:{{PROTECTIONEXPIRY:edit|{{{1|}}}}}|{{{2|true}}}|{{{3|}}}}}<noinclude>{{documentation}}</noinclude>
1aa1e6e4f3589f452babd54a7c0bbc590dc2f96d
Template:Legend0
10
239
470
2021-08-17T01:13:05Z
wikipedia>MusikBot II
0
Changed protection settings for "[[Template:Legend0]]": [[Wikipedia:High-risk templates|High-risk template or module]] 5208 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require template editor access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
<span style="margin:0px; font-size:90%;"><span style="border:{{{border|none}}}; background-color:{{{1|none}}}; color:{{{1|none}}};"> </span> {{{2|}}}</span><noinclude>
{{Documentation}}
</noinclude>
203acdf585fd4adebf1c9cc5e3456b8ff52b182c
Template:R with history
10
249
490
2021-08-17T01:15:07Z
wikipedia>MusikBot II
0
Changed protection settings for "[[Template:R with history]]": [[Wikipedia:High-risk templates|High-risk template or module]] 6205 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
<noinclude>
{{This is a redirect/rcat}}
</noinclude>{{Redirect template
|id=R with history
|name=With history
|from=a page containing <span class="editlink plainlinks">[{{fullurl:{{FULLPAGENAMEE}}|action=history}} '''substantive page history''']</span>
|info=This page is kept as a redirect to preserve its former content and attributions. Please ''do not'' remove the tag that generates this text (unless the need to recreate content on this page has been demonstrated), nor delete this page.
** This template should <u>not</u> be used for redirects having some edit history but no meaningful content in their previous versions, nor for redirects created as a result of a [[Wikipedia:Merging|page merge]] (use {{tl|R from merge}} instead), nor for redirects from a title that forms a historic part of Wikipedia (use {{tl|R with old history}} instead).
|all category=Redirects with history
}}<noinclude>
<!-- Place categories on /doc subpage; interwikis go to Wikidata. -->
{{documentation}}
</noinclude>
07dccadc962922bd14bb65378f2f42f521b2ce8e
Module:Redirect
828
14
23
2021-09-10T07:46:37Z
wikipedia>Johnuniq
0
restore p.getTargetFromText which is used by [[Module:RfD]] which is causing "Lua error in Module:RfD at line 87: attempt to call upvalue 'getTargetFromText' (a nil value)"
Scribunto
text/plain
-- This module provides functions for getting the target of a redirect page.
local p = {}
-- Gets a mw.title object, using pcall to avoid generating script errors if we
-- are over the expensive function count limit (among other possible causes).
local function getTitle(...)
local success, titleObj = pcall(mw.title.new, ...)
if success then
return titleObj
else
return nil
end
end
-- Gets the name of a page that a redirect leads to, or nil if it isn't a
-- redirect.
function p.getTargetFromText(text)
local target = string.match(
text,
"^%s*#[Rr][Ee][Dd][Ii][Rr][Ee][Cc][Tt]%s*:?%s*%[%[([^%[%]|]-)%]%]"
) or string.match(
text,
"^%s*#[Rr][Ee][Dd][Ii][Rr][Ee][Cc][Tt]%s*:?%s*%[%[([^%[%]|]-)|[^%[%]]-%]%]"
)
return target and mw.uri.decode(target, 'PATH')
end
-- Gets the target of a redirect. If the page specified is not a redirect,
-- returns nil.
function p.getTarget(page, fulltext)
-- Get the title object. Both page names and title objects are allowed
-- as input.
local titleObj
if type(page) == 'string' or type(page) == 'number' then
titleObj = getTitle(page)
elseif type(page) == 'table' and type(page.getContent) == 'function' then
titleObj = page
else
error(string.format(
"bad argument #1 to 'getTarget'"
.. " (string, number, or title object expected, got %s)",
type(page)
), 2)
end
if not titleObj then
return nil
end
local targetTitle = titleObj.redirectTarget
if targetTitle then
if fulltext then
return targetTitle.fullText
else
return targetTitle.prefixedText
end
else
return nil
end
end
--[[
-- Given a single page name determines what page it redirects to and returns the
-- target page name, or the passed page name when not a redirect. The passed
-- page name can be given as plain text or as a page link.
--
-- Returns page name as plain text, or when the bracket parameter is given, as a
-- page link. Returns an error message when page does not exist or the redirect
-- target cannot be determined for some reason.
--]]
function p.luaMain(rname, bracket, fulltext)
if type(rname) ~= "string" or not rname:find("%S") then
return nil
end
bracket = bracket and "[[%s]]" or "%s"
rname = rname:match("%[%[(.+)%]%]") or rname
local target = p.getTarget(rname, fulltext)
local ret = target or rname
ret = getTitle(ret)
if ret then
if fulltext then
ret = ret.fullText
else
ret = ret.prefixedText
end
return bracket:format(ret)
else
return nil
end
end
-- Provides access to the luaMain function from wikitext.
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {frameOnly = true})
return p.luaMain(args[1], args.bracket, args.fulltext) or ''
end
-- Returns true if the specified page is a redirect, and false otherwise.
function p.luaIsRedirect(page)
local titleObj = getTitle(page)
if not titleObj then
return false
end
if titleObj.isRedirect then
return true
else
return false
end
end
-- Provides access to the luaIsRedirect function from wikitext, returning 'yes'
-- if the specified page is a redirect, and the blank string otherwise.
function p.isRedirect(frame)
local args = require('Module:Arguments').getArgs(frame, {frameOnly = true})
if p.luaIsRedirect(args[1]) then
return 'yes'
else
return ''
end
end
return p
a224c45940343d66f49a78b0a39b2045e2c45d20
Module:Sidebar/styles.css
828
110
211
2021-09-20T01:15:45Z
wikipedia>Goszei
0
self-rv, it's a little tight
sanitized-css
text/css
/* {{pp-template}} */
/* TODO: Invert width design to be "mobile first" */
.sidebar {
/* TODO: Ask if we should have max-width 22em instead */
width: 22em;
/* @noflip */
float: right;
/* @noflip */
clear: right;
/* @noflip */
margin: 0.5em 0 1em 1em;
background: #f8f9fa;
border: 1px solid #aaa;
padding: 0.2em;
text-align: center;
line-height: 1.4em;
font-size: 88%;
border-collapse: collapse;
/* Timeless has display: none on .nomobile at mobile resolutions, so we
* unhide it with display: table and let precedence and proximity win.
*/
display: table;
}
/* Unfortunately, so does Minerva desktop, except Minerva drops an
* !important on the declaration. So we have to be mean for Minerva users.
* Mobile removes the element entirely with `wgMFRemovableClasses` in
* https://github.com/wikimedia/operations-mediawiki-config/blob/master/
wmf-config/InitialiseSettings.php#L16992
* which is why displaying it categorically with display: table works.
* We don't really want to expose the generic user in the wild on mobile to have
* to deal with sidebars. (Maybe the ones with collapsible lists, so that
* might be an improvement. That is blocked on [[:phab:T111565]].)
*/
body.skin-minerva .sidebar {
display: table !important;
/* also, minerva is way too aggressive about other stylings on tables.
* TODO remove when this template gets moved to a div. plans on talk page.
* We always float right on Minerva because that's a lot of extra CSS
* otherwise. */
float: right !important;
margin: 0.5em 0 1em 1em !important;
}
.sidebar-subgroup {
width: 100%;
margin: 0;
border-spacing: 0;
}
.sidebar-left {
/* @noflip */
float: left;
/* @noflip */
clear: left;
/* @noflip */
margin: 0.5em 1em 1em 0;
}
.sidebar-none {
float: none;
clear: both;
/* @noflip */
margin: 0.5em 1em 1em 0;
}
.sidebar-outer-title {
padding: 0 0.4em 0.2em;
font-size: 125%;
line-height: 1.2em;
font-weight: bold;
}
.sidebar-top-image {
padding: 0.4em;
}
.sidebar-top-caption,
.sidebar-pretitle-with-top-image,
.sidebar-caption {
padding: 0.2em 0.4em 0;
line-height: 1.2em;
}
.sidebar-pretitle {
padding: 0.4em 0.4em 0;
line-height: 1.2em;
}
.sidebar-title,
.sidebar-title-with-pretitle {
padding: 0.2em 0.8em;
font-size: 145%;
line-height: 1.2em;
}
.sidebar-title-with-pretitle {
padding: 0.1em 0.4em;
}
.sidebar-image {
padding: 0.2em 0.4em 0.4em;
}
.sidebar-heading {
padding: 0.1em 0.4em;
}
.sidebar-content {
padding: 0 0.5em 0.4em;
}
.sidebar-content-with-subgroup {
padding: 0.1em 0.4em 0.2em;
}
.sidebar-above,
.sidebar-below {
padding: 0.3em 0.8em;
font-weight: bold;
}
.sidebar-collapse .sidebar-above,
.sidebar-collapse .sidebar-below {
border-top: 1px solid #aaa;
border-bottom: 1px solid #aaa;
}
.sidebar-navbar {
text-align: right;
font-size: 115%;
padding: 0 0.4em 0.4em;
}
.sidebar-list-title {
padding: 0 0.4em;
text-align: left;
font-weight: bold;
line-height: 1.6em;
font-size: 105%;
}
/* centered text with mw-collapsible headers is finicky */
.sidebar-list-title-c {
padding: 0 0.4em;
text-align: center;
margin: 0 3.3em;
}
@media (max-width: 720px) {
/* users have wide latitude to set arbitrary width and margin :(
"Super-specific" selector to prevent overriding this appearance by
lower level sidebars too */
body.mediawiki .sidebar {
width: 100% !important;
clear: both;
float: none !important; /* Remove when we div based; Minerva is dumb */
margin-left: 0 !important;
margin-right: 0 !important;
}
/* TODO: We might consider making all links wrap at small resolutions and then
* only introduce nowrap at higher resolutions. Do when we invert the media
* query.
*/
}
7d621b35a37807a103b59075851fe36201204ceb
Module:GetParameters
828
190
372
2021-10-07T13:22:34Z
wikipedia>Andrybak
0
drop misleading comment copy-pasted from [[Module:String]]
Scribunto
text/plain
local p = {}
--[[
Helper function that populates the argument list given that user may need to use a mix of
named and unnamed parameters. This is relevant because named parameters are not
identical to unnamed parameters due to string trimming, and when dealing with strings
we sometimes want to either preserve or remove that whitespace depending on the application.
]]
function p.getParameters( frame_args, arg_list )
local new_args = {};
local index = 1;
local value;
for i,arg in ipairs( arg_list ) do
value = frame_args[arg]
if value == nil then
value = frame_args[index];
index = index + 1;
end
new_args[arg] = value;
end
return new_args;
end
--[[
Helper Function to interpret boolean strings
]]
function p.getBoolean( boolean_str )
local boolean_value;
if type( boolean_str ) == 'string' then
boolean_str = boolean_str:lower();
if boolean_str == 'false' or boolean_str == 'no' or boolean_str == '0'
or boolean_str == '' then
boolean_value = false;
else
boolean_value = true;
end
elseif type( boolean_str ) == 'boolean' then
boolean_value = boolean_str;
else
error( 'No boolean value found' );
end
return boolean_value
end
function p.defined(frame)
local arg = mw.text.trim(frame.args[1])
--if arg == tostring(tonumber(arg)) then -- undesired result for '-0'
-- arg = tonumber(arg)
--end
--if mw.ustring.find(arg, '^%s*-?[1-9][0-9]*%s*$') ~= nil or arg == '0' then
-- arg = tonumber(arg)
--end
if mw.ustring.find(arg, '^-?[1-9][0-9]*$') ~= nil then
arg = tonumber(arg)
elseif arg == '0' then
arg = 0
end
return frame:getParent().args[arg] ~= nil
end
return p
00e952f0ee8f6ea68e990d589dfb15e7d4036623
Module:Unsubst
828
15
25
2021-10-08T18:22:16Z
wikipedia>Trappist the monk
0
sync from sandbox; see [[Module_talk:Unsubst#template_invocation_name_override|talk]];
Scribunto
text/plain
local checkType = require('libraryUtil').checkType
local p = {}
local BODY_PARAM = '$B'
local specialParams = {
['$params'] = 'parameter list',
['$aliases'] = 'parameter aliases',
['$flags'] = 'flags',
['$B'] = 'template content',
['$template-name'] = 'template invocation name override',
}
function p.main(frame, body)
-- If we are substing, this function returns a template invocation, and if
-- not, it returns the template body. The template body can be specified in
-- the body parameter, or in the template parameter defined in the
-- BODY_PARAM variable. This function can be called from Lua or from
-- #invoke.
-- Return the template body if we aren't substing.
if not mw.isSubsting() then
if body ~= nil then
return body
elseif frame.args[BODY_PARAM] ~= nil then
return frame.args[BODY_PARAM]
else
error(string.format(
"no template content specified (use parameter '%s' from #invoke)",
BODY_PARAM
), 2)
end
end
-- Sanity check for the frame object.
if type(frame) ~= 'table'
or type(frame.getParent) ~= 'function'
or not frame:getParent()
then
error(
"argument #1 to 'main' must be a frame object with a parent " ..
"frame available",
2
)
end
-- Find the invocation name.
local mTemplateInvocation = require('Module:Template invocation')
local name
if frame.args['$template-name'] and '' ~= frame.args['$template-name'] then
name = frame.args['$template-name'] -- override whatever the template name is with this name
else
name = mTemplateInvocation.name(frame:getParent():getTitle())
end
-- Combine passed args with passed defaults
local args = {}
if string.find( ','..(frame.args['$flags'] or '')..',', ',%s*override%s*,' ) then
for k, v in pairs( frame:getParent().args ) do
args[k] = v
end
for k, v in pairs( frame.args ) do
if not specialParams[k] then
if v == '__DATE__' then
v = mw.getContentLanguage():formatDate( 'F Y' )
end
args[k] = v
end
end
else
for k, v in pairs( frame.args ) do
if not specialParams[k] then
if v == '__DATE__' then
v = mw.getContentLanguage():formatDate( 'F Y' )
end
args[k] = v
end
end
for k, v in pairs( frame:getParent().args ) do
args[k] = v
end
end
-- Trim parameters, if not specified otherwise
if not string.find( ','..(frame.args['$flags'] or '')..',', ',%s*keep%-whitespace%s*,' ) then
for k, v in pairs( args ) do args[k] = mw.ustring.match(v, '^%s*(.*)%s*$') or '' end
end
-- Pull information from parameter aliases
local aliases = {}
if frame.args['$aliases'] then
local list = mw.text.split( frame.args['$aliases'], '%s*,%s*' )
for k, v in ipairs( list ) do
local tmp = mw.text.split( v, '%s*>%s*' )
aliases[tonumber(mw.ustring.match(tmp[1], '^[1-9][0-9]*$')) or tmp[1]] = ((tonumber(mw.ustring.match(tmp[2], '^[1-9][0-9]*$'))) or tmp[2])
end
end
for k, v in pairs( aliases ) do
if args[k] and ( not args[v] or args[v] == '' ) then
args[v] = args[k]
end
args[k] = nil
end
-- Remove empty parameters, if specified
if string.find( ','..(frame.args['$flags'] or '')..',', ',%s*remove%-empty%s*,' ) then
local tmp = 0
for k, v in ipairs( args ) do
if v ~= '' or ( args[k+1] and args[k+1] ~= '' ) or ( args[k+2] and args[k+2] ~= '' ) then
tmp = k
else
break
end
end
for k, v in pairs( args ) do
if v == '' then
if not (type(k) == 'number' and k < tmp) then args[k] = nil end
end
end
end
-- Order parameters
if frame.args['$params'] then
local params, tmp = mw.text.split( frame.args['$params'], '%s*,%s*' ), {}
for k, v in ipairs(params) do
v = tonumber(mw.ustring.match(v, '^[1-9][0-9]*$')) or v
if args[v] then tmp[v], args[v] = args[v], nil end
end
for k, v in pairs(args) do tmp[k], args[k] = args[k], nil end
args = tmp
end
return mTemplateInvocation.invocation(name, args)
end
p[''] = p.main -- For backwards compatibility
return p
7f01ffc8aa2ac4a4772f14c12e0b77e384ecabb6
Template:Module other
10
265
522
2021-10-20T19:50:22Z
wikipedia>MusikBot II
0
Changed protection settings for "[[Template:Module other]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 3570 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))
wikitext
text/x-wiki
{{#switch:
<!--If no or empty "demospace" parameter then detect namespace-->
{{#if:{{{demospace|}}}
| {{lc: {{{demospace}}} }} <!--Use lower case "demospace"-->
| {{#ifeq:{{NAMESPACE}}|{{ns:Module}}
| module
| other
}}
}}
| module = {{{1|}}}
| other
| #default = {{{2|}}}
}}<!--End switch--><noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
503694836c1b07142e63fd35d8be69ec8bb9ffe7
Template:Cite Legislation AU
10
257
506
2021-10-25T03:59:32Z
wikipedia>Taweetham
0
https
wikitext
text/x-wiki
{{ #switch: {{{2}}}
| act =
{{#ifeq: {{{5|0}}} | 0
| ''[https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/consol_act/{{{3}}}/ {{{4}}}]'' ({{{1}}})
| ''{{{4}}}'' ({{{1}}}) [https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/consol_act/{{{3}}}/s{{lc:{{{5}}}}}.html s {{{5}}}]
}}
| num_act =
{{#ifeq: {{{5|0}}} | 0
| ''[https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/num_act/{{{3}}}/ {{{4}}}]'' ({{{1}}})
| ''{{{4}}}'' ({{{1}}}) [https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/num_act/{{{3}}}/s{{lc:{{{5}}}}}.html s {{{5}}}]
}}
| hist_act =
{{#ifeq: {{{5|0}}} | 0
| ''[https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/hist_act/{{{3}}}.pdf {{{4}}}]'' ({{{1}}})
| ''{{{4}}}'' ({{{1}}}) [https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/hist_act/{{{3}}}.pdf s {{{5}}}]
}}
| reg =
{{#ifeq: {{{5|0}}} | 0
| ''[https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/consol_reg/{{{3}}}/ {{{4}}}]'' ({{{1}}})
| ''{{{4}}}'' ({{{1}}}) [https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/consol_reg/{{{3}}}/s{{lc:{{{5}}}}}.html r {{{5}}}]
}}
| num_reg =
{{#ifeq: {{{5|0}}} | 0
| ''[https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/num_reg/{{{3}}}/ {{{4}}}]'' ({{{1}}})
| ''{{{4}}}'' ({{{1}}}) [https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/num_reg/{{{3}}}/s{{lc:{{{5}}}}}.html r {{{5}}}]
}}
| bill = [https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/bill/{{{3}}} {{{4}}}] ({{{1}}})
| memo = [https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/bill_em/{{{3}}}/memo_{{{5|0}}}.html Explanatory Memorandum, {{{4}}}] ({{{1}}}) {{{5|}}}
| repealed_act =
{{#ifeq: {{{5|0}}} | 0
| ''[https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/repealed_act/{{{3}}}/ {{{4}}}]'' ({{{1}}})
| ''{{{4}}}'' ({{{1}}}) [https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/repealed_act/{{{3}}}/s{{lc:{{{5}}}}}.html s {{{5}}}]
}}
| repealed_reg =
{{#ifeq: {{{5|0}}} | 0
| ''[https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/repealed_reg/{{{3}}}/ {{{4}}}]'' ({{{1}}})
| ''{{{4}}}'' ({{{1}}}) [https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/repealed_reg/{{{3}}}/s{{lc:{{{5}}}}}.html r {{{5}}}]
}}
}}<noinclude>
{{documentation}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS -->
<templatedata>
{
"params": {
"1": {
"label": "Jurisdiction",
"description": "In all cases jurisdiction will be one of Cth (for federal legislation) or ACT, NSW, NT, Qld, SA, Tas, Vic or WA (for state and territory legislation).",
"type": "string",
"required": true
},
"2": {
"label": "Legislation type",
"description": "One of act, num_act, hist_act, reg, num_reg, bill, memo, repealed_act, repealed_reg",
"type": "string",
"required": true
},
"3": {
"label": "Short Name",
"description": "Appears in the AustLII URL",
"example": "ca1968133",
"required": true
},
"4": {
"label": "Title",
"description": "For the citation",
"example": "Copyright Act 1968",
"required": true
},
"5": {
"label": "Pinpoint reference",
"example": "41a"
}
},
"description": "This template produces links to a variety of different legislation resources located on the [[AustLII]] site. Formatting is designed to be in compliance with the [[Australian Guide to Legal Citation]].",
"paramOrder": [
"1",
"2",
"3",
"4",
"5"
]
}
</templatedata></noinclude>
b4da41f608b306c650b0314d6e46c047eb38c2c7
Module:Suppress categories
828
135
261
2021-10-26T17:25:37Z
wikipedia>MusikBot II
0
Changed protection settings for "[[Module:Suppress categories]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 2510 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))
Scribunto
text/plain
-- This is a simple module to strip categories from wikitext. It does
-- not support nested links or magic words like __TOC__, etc. Even so,
-- it should still handle most categories.
local p = {}
-- Detects if a category link is valid or not. If it is valid,
-- the function returns the blank string. If not, the input
-- is returned with no changes.
local function processCategory( all, submatch )
local beforePipe = mw.ustring.match( submatch, '^(.-)[%s_]*|[%s_]*.-$' )
beforePipe = beforePipe or submatch
if mw.ustring.match( beforePipe, '[%[%]<>{}%c\n]' ) then
return all
else
return ''
end
end
-- Preprocess the content if we aren't being called from #invoke,
-- and pass it to gsub to remove valid category links.
local function suppress( content, isPreprocessed )
if not isPreprocessed then
content = mw.getCurrentFrame():preprocess( content )
end
content = mw.ustring.gsub(
content,
'(%[%[[%s_]*[cC][aA][tT][eE][gG][oO][rR][yY][%s_]*:[%s_]*(.-)[%s_]*%]%])',
processCategory
)
return content
end
-- Get the content to suppress categories from, and find
-- whether the content has already been preprocessed. (If the
-- module is called from #invoke, it has been preprocessed already.)
function p.main( frame )
local content, isPreprocessed
if frame == mw.getCurrentFrame() then
content = frame:getParent().args[1]
if frame.args[1] then
content = frame.args[1]
end
isPreprocessed = true
else
content = frame
isPreprocessed = false
end
return suppress( content, isPreprocessed )
end
return p
0ec3903841c489357a879434c5dc23c11d182c78
Template:Refbegin/styles.css
10
52
97
2021-11-09T00:27:00Z
wikipedia>Izno
0
-.refbegin-100, used in just 100 of 200k articles. suitable alternative at [[template:Div col]]
sanitized-css
text/css
/* {{pp-template}} */
.refbegin {
font-size: 90%;
margin-bottom: 0.5em;
}
.refbegin-hanging-indents > ul {
margin-left: 0;
}
.refbegin-hanging-indents > ul > li {
margin-left: 0;
padding-left: 3.2em;
text-indent: -3.2em;
}
.refbegin-hanging-indents ul,
.refbegin-hanging-indents ul li {
list-style: none;
}
@media (max-width: 720px) {
.refbegin-hanging-indents > ul > li {
padding-left: 1.6em;
text-indent: -1.6em;
}
}
.refbegin-columns {
margin-top: 0.3em;
}
/* Reset top margin for lists embedded in columns */
.refbegin-columns ul {
margin-top: 0;
}
/* Avoid elements breaking between columns */
.refbegin-columns li {
page-break-inside: avoid; /* Removed from CSS in favor of break-inside c. 2020 */
break-inside: avoid-column;
}
287ba19370a7bfc842825711a05d34dae68d5f64
Template:Lua sidebar
10
286
564
2021-11-15T22:24:39Z
wikipedia>Izno
0
reduce expansion size slightly
wikitext
text/x-wiki
{{Sidebar
| class = lua-sidebar
| templatestyles = Template:Lua sidebar/styles.css
| title = Related pages
| content1 = {{plainlist}}
* [[Template:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}|Template]] {{#if:{{#invoke:redirect|isRedirect|Template talk:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}}}||([[Template talk:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}|talk]])}}
* [[Template:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}/sandbox|Template sandbox]]
* [[Template:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}/testcases|Template testcases]]
* [[Template:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}/doc|Template doc]]
* [[Special:PrefixIndex/Template:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}/|Template subpages]]
* [[Module:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}|Module]] {{#if:{{#invoke:redirect|isRedirect|Module talk:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}}}||([[Module talk:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}|talk]])}}
* [[Module:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}/sandbox|Module sandbox]]
* [[Module talk:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}/testcases|Module testcases]]
* [[Module:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}/doc|Module doc]]
* [[Special:PrefixIndex/Module:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}/|Module subpages]]
{{endplainlist}}
| content2 = {{{1|}}}
}}<noinclude>
{{Documentation}}
</noinclude>
f11e49d67a400d29f6d73720fea7eb5a273ab663
Template:Find country
10
174
339
2021-12-02T20:25:42Z
wikipedia>GKFX
0
No need to use {{Trim}} inside an if function, as they are already trimmed.
wikitext
text/x-wiki
<includeonly>{{#if: {{{1|}}}
| {{#invoke:Find country|main|string={{{1|}}}|match={{{match|}}}|nomatch={{{nomatch|}}}}}
}}</includeonly><noinclude>{{Documentation}}</noinclude>
87d8d8e45c6295e043512958d665ffbdf7819cc1
Template:Main other
10
31
55
2021-12-10T16:08:06Z
wikipedia>Xaosflux
0
<!-- Add categories to the /doc subpage; interwikis go to Wikidata, thank you! -->
wikitext
text/x-wiki
{{#switch:
<!--If no or empty "demospace" parameter then detect namespace-->
{{#if:{{{demospace|}}}
| {{lc: {{{demospace}}} }} <!--Use lower case "demospace"-->
| {{#ifeq:{{NAMESPACE}}|{{ns:0}}
| main
| other
}}
}}
| main = {{{1|}}}
| other
| #default = {{{2|}}}
}}<noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage; interwikis go to Wikidata, thank you! -->
</noinclude>
86ad907ffeea3cc545159e00cd1f2d6433946450
Module:Navbox/styles.css
828
195
382
2021-12-21T22:10:10Z
wikipedia>Izno
0
remove qualifications on th - this will remove styling from "hand-crafted" navboxes, but there's no other elegant way to deal with it. see talk page
sanitized-css
text/css
/* {{pp|small=y}} */
.navbox {
box-sizing: border-box;
border: 1px solid #a2a9b1;
width: 100%;
clear: both;
font-size: 88%;
text-align: center;
padding: 1px;
margin: 1em auto 0; /* Prevent preceding content from clinging to navboxes */
}
.navbox .navbox {
margin-top: 0; /* No top margin for nested navboxes */
}
.navbox + .navbox, /* TODO: remove first line after transclusions have updated */
.navbox + .navbox-styles + .navbox {
margin-top: -1px; /* Single pixel border between adjacent navboxes */
}
.navbox-inner,
.navbox-subgroup {
width: 100%;
}
.navbox-group,
.navbox-title,
.navbox-abovebelow {
padding: 0.25em 1em;
line-height: 1.5em;
text-align: center;
}
.navbox-group {
white-space: nowrap;
/* @noflip */
text-align: right;
}
.navbox,
.navbox-subgroup {
background-color: #fdfdfd;
}
.navbox-list {
line-height: 1.5em;
border-color: #fdfdfd; /* Must match background color */
}
.navbox-list-with-group {
text-align: left;
border-left-width: 2px;
border-left-style: solid;
}
/* cell spacing for navbox cells */
/* Borders above 2nd, 3rd, etc. rows */
/* TODO: figure out how to replace tr as structure;
* with div structure it should be just a matter of first-child */
tr + tr > .navbox-abovebelow,
tr + tr > .navbox-group,
tr + tr > .navbox-image,
tr + tr > .navbox-list {
border-top: 2px solid #fdfdfd; /* Must match background color */
}
.navbox-title {
background-color: #ccf; /* Level 1 color */
}
.navbox-abovebelow,
.navbox-group,
.navbox-subgroup .navbox-title {
background-color: #ddf; /* Level 2 color */
}
.navbox-subgroup .navbox-group,
.navbox-subgroup .navbox-abovebelow {
background-color: #e6e6ff; /* Level 3 color */
}
.navbox-even {
background-color: #f7f7f7;
}
.navbox-odd {
background-color: transparent;
}
/* TODO: figure out how to remove reliance on td as structure */
.navbox .hlist td dl,
.navbox .hlist td ol,
.navbox .hlist td ul,
.navbox td.hlist dl,
.navbox td.hlist ol,
.navbox td.hlist ul {
padding: 0.125em 0;
}
.navbox .navbar {
display: block;
font-size: 100%;
}
.navbox-title .navbar {
/* @noflip */
float: left;
/* @noflip */
text-align: left;
/* @noflip */
margin-right: 0.5em;
}
e80b0d7a5770e6e105dab832deb6c37a5245ebc6
Template:Ifsubst
10
272
536
2022-01-02T08:48:20Z
wikipedia>Dinoguy1000
0
fix "|=foo" bug
wikitext
text/x-wiki
{{ safesubst:<noinclude/>#if:{{{demo|}}}
|{{ safesubst:<noinclude/>#ifeq:{{{demo}}} |no
|{{{no|{{{2|}}}}}}
|{{{yes|{{{1|}}}}}}
}}
|{{ safesubst:<noinclude/>#ifeq:{{ safesubst:<noinclude/>NAMESPACE}}|{{NAMESPACE}}
|{{{no|{{{2|}}}}}}
|{{{yes|{{{1|}}}}}}
}}}}<noinclude>
{{Documentation}}
</noinclude>
38e667b5df326086489bf557a5f7c4e43393af78
Template:FULLROOTPAGENAME
10
76
143
2022-01-02T08:54:02Z
wikipedia>Dinoguy1000
0
fix "|=foo" bug
wikitext
text/x-wiki
{{ safesubst:<noinclude/>#if: {{ safesubst:<noinclude/>Ns has subpages | {{ safesubst:<noinclude/>#if:{{{1|}}}|{{ safesubst:<noinclude/>NAMESPACE:{{{1}}}}}|{{ safesubst:<noinclude/>NAMESPACE}}}} }}
| {{ safesubst:<noinclude/>#titleparts:{{ safesubst:<noinclude/>#if:{{{1|}}}|{{{1}}}|{{ safesubst:<noinclude/>FULLPAGENAME}}}}|1}}
| {{ safesubst:<noinclude/>#if:{{{1|}}}|{{{1}}}|{{ safesubst:<noinclude/>FULLPAGENAME}}}}
}}<noinclude>
{{documentation}}
</noinclude>
fd0c4e7050dded2d50e5df405e6e5e31dd0d46ac
Module:Navbar/styles.css
828
105
201
2022-01-03T23:12:15Z
wikipedia>Izno
0
navbar styles that were moved to parent templates
sanitized-css
text/css
/* {{pp|small=yes}} */
.navbar {
display: inline;
font-size: 88%;
font-weight: normal;
}
.navbar-collapse {
float: left;
text-align: left;
}
.navbar-boxtext {
word-spacing: 0;
}
.navbar ul {
display: inline-block;
white-space: nowrap;
line-height: inherit;
}
.navbar-brackets::before {
margin-right: -0.125em;
content: '[ ';
}
.navbar-brackets::after {
margin-left: -0.125em;
content: ' ]';
}
.navbar li {
word-spacing: -0.125em;
}
.navbar a > span,
.navbar a > abbr {
text-decoration: inherit;
}
.navbar-mini abbr {
font-variant: small-caps;
border-bottom: none;
text-decoration: none;
cursor: inherit;
}
.navbar-ct-full {
font-size: 114%;
margin: 0 7em;
}
.navbar-ct-mini {
font-size: 114%;
margin: 0 4em;
}
9d4056f949b4f0b159e3d40dfb1a5f01e72f9571
Module:Infobox/styles.css
828
89
169
2022-01-18T15:18:00Z
wikipedia>Jdlrobson
0
Fix [[phab:T281642]], a pet peeve of mine. This copies across styles from [[MediaWiki:Minerva.css]]
sanitized-css
text/css
/* {{pp|small=y}} */
/*
* This TemplateStyles sheet deliberately does NOT include the full set of
* infobox styles. We are still working to migrate all of the manual
* infoboxes. See [[MediaWiki talk:Common.css/to do#Infobox]]
* DO NOT ADD THEM HERE
*/
/*
* not strictly certain these styles are necessary since the modules now
* exclusively output infobox-subbox or infobox, not both
* just replicating the module faithfully
*/
.infobox-subbox {
padding: 0;
border: none;
margin: -3px;
width: auto;
min-width: 100%;
font-size: 100%;
clear: none;
float: none;
background-color: transparent;
}
.infobox-3cols-child {
margin: auto;
}
.infobox .navbar {
font-size: 100%;
}
/* T281642 */
body.skin-minerva .infobox-header,
body.skin-minerva .infobox-subheader,
body.skin-minerva .infobox-above,
body.skin-minerva .infobox-title,
body.skin-minerva .infobox-image,
body.skin-minerva .infobox-full-data,
body.skin-minerva .infobox-below {
text-align: center;
}
e8de6d96f4fde53afc4a6b0fed534405ab59b0a7
Template:Detect singular
10
176
343
2022-01-19T08:38:01Z
wikipedia>MSGJ
0
Changed protection settings for "[[Template:Detect singular]]": template protection should be adaquate ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
{{#invoke:Detect singular|main}}<noinclude>
{{documentation}}
</noinclude>
0dd1507d935296f20a354173ba876d010a9ed72b
Module:Citation/CS1/Utilities
828
19
33
2022-01-22T14:11:16Z
wikipedia>Trappist the monk
0
update per [[Wikipedia:Village_pump_(proposals)#rfc:_shall_we_update_cs1/2?|RfC]];
Scribunto
text/plain
local z = {
error_cats_t = {}; -- for categorizing citations that contain errors
error_ids_t = {}; -- list of error identifiers; used to prevent duplication of certain errors; local to this module
error_msgs_t = {}; -- sequence table of error messages
maint_cats_t = {}; -- for categorizing citations that aren't erroneous per se, but could use a little work
prop_cats_t = {}; -- for categorizing citations based on certain properties, language of source for instance
prop_keys_t = {}; -- for adding classes to the citation's <cite> tag
};
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
]]
local cfg; -- table of tables imported from selected Module:Citation/CS1/Configuration
--[[--------------------------< I S _ S E T >------------------------------------------------------------------
Returns true if argument is set; false otherwise. Argument is 'set' when it exists (not nil) or when it is not an empty string.
]]
local function is_set (var)
return not (var == nil or var == '');
end
--[[--------------------------< I N _ A R R A Y >--------------------------------------------------------------
Whether needle is in haystack
]]
local function in_array (needle, haystack)
if needle == nil then
return false;
end
for n, v in ipairs (haystack) do
if v == needle then
return n;
end
end
return false;
end
--[[--------------------------< H A S _ A C C E P T _ A S _ W R I T T E N >------------------------------------
When <str> is wholly wrapped in accept-as-written markup, return <str> without markup and true; return <str> and false else
with allow_empty = false, <str> must have at least one character inside the markup
with allow_empty = true, <str> the markup frame can be empty like (()) to distinguish an empty template parameter from the specific condition "has no applicable value" in citation-context.
After further evaluation the two cases might be merged at a later stage, but should be kept separated for now.
]]
local function has_accept_as_written (str, allow_empty)
if not is_set (str) then
return str, false;
end
local count;
if true == allow_empty then
str, count = str:gsub ('^%(%((.*)%)%)$', '%1'); -- allows (()) to be an empty set
else
str, count = str:gsub ('^%(%((.+)%)%)$', '%1');
end
return str, 0 ~= count;
end
--[[--------------------------< S U B S T I T U T E >----------------------------------------------------------
Populates numbered arguments in a message string using an argument table. <args> may be a single string or a
sequence table of multiple strings.
]]
local function substitute (msg, args)
return args and mw.message.newRawMessage (msg, args):plain() or msg;
end
--[[--------------------------< E R R O R _ C O M M E N T >----------------------------------------------------
Wraps error messages with CSS markup according to the state of hidden. <content> may be a single string or a
sequence table of multiple strings.
]]
local function error_comment (content, hidden)
return substitute (hidden and cfg.presentation['hidden-error'] or cfg.presentation['visible-error'], content);
end
--[[--------------------------< H Y P H E N _ T O _ D A S H >--------------------------------------------------
Converts a hyphen to a dash under certain conditions. The hyphen must separate
like items; unlike items are returned unmodified. These forms are modified:
letter - letter (A - B)
digit - digit (4-5)
digit separator digit - digit separator digit (4.1-4.5 or 4-1-4-5)
letterdigit - letterdigit (A1-A5) (an optional separator between letter and
digit is supported – a.1-a.5 or a-1-a-5)
digitletter - digitletter (5a - 5d) (an optional separator between letter and
digit is supported – 5.a-5.d or 5-a-5-d)
any other forms are returned unmodified.
str may be a comma- or semicolon-separated list
]]
local function hyphen_to_dash (str)
if not is_set (str) then
return str;
end
local accept; -- boolean
str = str:gsub ("(%(%(.-%)%))", function(m) return m:gsub(",", ","):gsub(";", ";") end) -- replace commas and semicolons in accept-as-written markup with similar unicode characters so they'll be ignored during the split
str = str:gsub ('&[nm]dash;', {['–'] = '–', ['—'] = '—'}); -- replace — and – entities with their characters; semicolon mucks up the text.split
str = str:gsub ('-', '-'); -- replace HTML numeric entity with hyphen character
str = str:gsub (' ', ' '); -- replace entity with generic keyboard space character
local out = {};
local list = mw.text.split (str, '%s*[,;]%s*'); -- split str at comma or semicolon separators if there are any
for _, item in ipairs (list) do -- for each item in the list
item, accept = has_accept_as_written (item); -- remove accept-this-as-written markup when it wraps all of item
if not accept and mw.ustring.match (item, '^%w*[%.%-]?%w+%s*[%-–—]%s*%w*[%.%-]?%w+$') then -- if a hyphenated range or has endash or emdash separators
if item:match ('^%a+[%.%-]?%d+%s*%-%s*%a+[%.%-]?%d+$') or -- letterdigit hyphen letterdigit (optional separator between letter and digit)
item:match ('^%d+[%.%-]?%a+%s*%-%s*%d+[%.%-]?%a+$') or -- digitletter hyphen digitletter (optional separator between digit and letter)
item:match ('^%d+[%.%-]%d+%s*%-%s*%d+[%.%-]%d+$') or -- digit separator digit hyphen digit separator digit
item:match ('^%d+%s*%-%s*%d+$') or -- digit hyphen digit
item:match ('^%a+%s*%-%s*%a+$') then -- letter hyphen letter
item = item:gsub ('(%w*[%.%-]?%w+)%s*%-%s*(%w*[%.%-]?%w+)', '%1–%2'); -- replace hyphen, remove extraneous space characters
else
item = mw.ustring.gsub (item, '%s*[–—]%s*', '–'); -- for endash or emdash separated ranges, replace em with en, remove extraneous whitespace
end
end
table.insert (out, item); -- add the (possibly modified) item to the output table
end
local temp_str = ''; -- concatenate the output table into a comma separated string
temp_str, accept = has_accept_as_written (table.concat (out, ', ')); -- remove accept-this-as-written markup when it wraps all of concatenated out
if accept then
temp_str = has_accept_as_written (str); -- when global markup removed, return original str; do it this way to suppress boolean second return value
return temp_str:gsub(",", ","):gsub(";", ";");
else
return temp_str:gsub(",", ","):gsub(";", ";"); -- else, return assembled temp_str
end
end
--[=[-------------------------< M A K E _ W I K I L I N K >----------------------------------------------------
Makes a wikilink; when both link and display text is provided, returns a wikilink in the form [[L|D]]; if only
link is provided (or link and display are the same), returns a wikilink in the form [[L]]; if neither are
provided or link is omitted, returns an empty string.
]=]
local function make_wikilink (link, display)
if not is_set (link) then return '' end
if is_set (display) and link ~= display then
return table.concat ({'[[', link, '|', display, ']]'});
else
return table.concat ({'[[', link, ']]'});
end
end
--[[--------------------------< S E T _ M E S S A G E >----------------------------------------------------------
Sets an error message using the ~/Configuration error_conditions{} table along with arguments supplied in the function
call, inserts the resulting message in z.error_msgs_t{} sequence table, and returns the error message.
<error_id> – key value for appropriate error handler in ~/Configuration error_conditions{} table
<arguments> – may be a single string or a sequence table of multiple strings to be subsititued into error_conditions[error_id].message
<raw> – boolean
true – causes this function to return the error message not wrapped in visible-error, hidden-error span tag;
returns error_conditions[error_id].hidden as a second return value
does not add message to z.error_msgs_t sequence table
false, nil – adds message wrapped in visible-error, hidden-error span tag to z.error_msgs_t
returns the error message wrapped in visible-error, hidden-error span tag; there is no second return value
<prefix> – string to be prepended to <message> -- TODO: remove support for these unused(?) arguments?
<suffix> – string to be appended to <message>
TODO: change z.error_cats_t and z.maint_cats_t to have the form cat_name = true? this to avoid dups without having to have an extra table
]]
local added_maint_cats = {} -- list of maintenance categories that have been added to z.maint_cats_t; TODO: figure out how to delete this table
local function set_message (error_id, arguments, raw, prefix, suffix)
local error_state = cfg.error_conditions[error_id];
prefix = prefix or '';
suffix = suffix or '';
if error_state == nil then
error (cfg.messages['undefined_error'] .. ': ' .. error_id); -- because missing error handler in Module:Citation/CS1/Configuration
elseif is_set (error_state.category) then
if error_state.message then -- when error_state.message defined, this is an error message
table.insert (z.error_cats_t, error_state.category);
else
if not added_maint_cats[error_id] then
added_maint_cats[error_id] = true; -- note that we've added this category
table.insert (z.maint_cats_t, substitute (error_state.category, arguments)); -- make cat name then add to table
end
return; -- because no message, nothing more to do
end
end
local message = substitute (error_state.message, arguments);
message = table.concat (
{
message,
' (',
make_wikilink (
table.concat (
{
cfg.messages['help page link'],
'#',
error_state.anchor
}),
cfg.messages['help page label']),
')'
});
z.error_ids_t[error_id] = true;
if z.error_ids_t['err_citation_missing_title'] and -- if missing-title error already noted
in_array (error_id, {'err_bare_url_missing_title', 'err_trans_missing_title'}) then -- and this error is one of these
return '', false; -- don't bother because one flavor of missing title is sufficient
end
message = table.concat ({prefix, message, suffix});
if true == raw then
return message, error_state.hidden; -- return message not wrapped in visible-error, hidden-error span tag
end
message = error_comment (message, error_state.hidden); -- wrap message in visible-error, hidden-error span tag
table.insert (z.error_msgs_t, message); -- add it to the messages sequence table
return message; -- and done; return value generally not used but is used as a flag in various functions of ~/Identifiers
end
--[[-------------------------< I S _ A L I A S _ U S E D >-----------------------------------------------------
This function is used by select_one() to determine if one of a list of alias parameters is in the argument list
provided by the template.
Input:
args – pointer to the arguments table from calling template
alias – one of the list of possible aliases in the aliases lists from Module:Citation/CS1/Configuration
index – for enumerated parameters, identifies which one
enumerated – true/false flag used to choose how enumerated aliases are examined
value – value associated with an alias that has previously been selected; nil if not yet selected
selected – the alias that has previously been selected; nil if not yet selected
error_list – list of aliases that are duplicates of the alias already selected
Returns:
value – value associated with alias we selected or that was previously selected or nil if an alias not yet selected
selected – the alias we selected or the alias that was previously selected or nil if an alias not yet selected
]]
local function is_alias_used (args, alias, index, enumerated, value, selected, error_list)
if enumerated then -- is this a test for an enumerated parameters?
alias = alias:gsub ('#', index); -- replace '#' with the value in index
else
alias = alias:gsub ('#', ''); -- remove '#' if it exists
end
if is_set (args[alias]) then -- alias is in the template's argument list
if value ~= nil and selected ~= alias then -- if we have already selected one of the aliases
local skip;
for _, v in ipairs (error_list) do -- spin through the error list to see if we've added this alias
if v == alias then
skip = true;
break; -- has been added so stop looking
end
end
if not skip then -- has not been added so
table.insert (error_list, alias); -- add error alias to the error list
end
else
value = args[alias]; -- not yet selected an alias, so select this one
selected = alias;
end
end
return value, selected; -- return newly selected alias, or previously selected alias
end
--[[--------------------------< A D D _ M A I N T _ C A T >------------------------------------------------------
Adds a category to z.maint_cats_t using names from the configuration file with additional text if any.
To prevent duplication, the added_maint_cats table lists the categories by key that have been added to z.maint_cats_t.
]]
local function add_maint_cat (key, arguments)
if not added_maint_cats [key] then
added_maint_cats [key] = true; -- note that we've added this category
table.insert (z.maint_cats_t, substitute (cfg.maint_cats [key], arguments)); -- make name then add to table
end
end
--[[--------------------------< A D D _ P R O P _ C A T >--------------------------------------------------------
Adds a category to z.prop_cats_t using names from the configuration file with additional text if any.
foreign_lang_source and foreign_lang_source_2 keys have a language code appended to them so that multiple languages
may be categorized but multiples of the same language are not categorized.
added_prop_cats is a table declared in page scope variables above
]]
local added_prop_cats = {}; -- list of property categories that have been added to z.prop_cats_t
local function add_prop_cat (key, arguments, key_modifier)
local key_modified = key .. ((key_modifier and key_modifier) or ''); -- modify <key> with <key_modifier> if present and not nil
if not added_prop_cats [key_modified] then
added_prop_cats [key_modified] = true; -- note that we've added this category
table.insert (z.prop_cats_t, substitute (cfg.prop_cats [key], arguments)); -- make name then add to table
table.insert (z.prop_keys_t, 'cs1-prop-' .. key); -- convert key to class for use in the citation's <cite> tag
end
end
--[[--------------------------< S A F E _ F O R _ I T A L I C S >----------------------------------------------
Protects a string that will be wrapped in wiki italic markup '' ... ''
Note: We cannot use <i> for italics, as the expected behavior for italics specified by ''...'' in the title is that
they will be inverted (i.e. unitalicized) in the resulting references. In addition, <i> and '' tend to interact
poorly under Mediawiki's HTML tidy.
]]
local function safe_for_italics (str)
if not is_set (str) then return str end
if str:sub (1, 1) == "'" then str = "<span></span>" .. str; end
if str:sub (-1, -1) == "'" then str = str .. "<span></span>"; end
return str:gsub ('\n', ' '); -- Remove newlines as they break italics.
end
--[[--------------------------< W R A P _ S T Y L E >----------------------------------------------------------
Applies styling to various parameters. Supplied string is wrapped using a message_list configuration taking one
argument; protects italic styled parameters. Additional text taken from citation_config.presentation - the reason
this function is similar to but separate from wrap_msg().
]]
local function wrap_style (key, str)
if not is_set (str) then
return "";
elseif in_array (key, {'italic-title', 'trans-italic-title'}) then
str = safe_for_italics (str);
end
return substitute (cfg.presentation[key], {str});
end
--[[--------------------------< M A K E _ S E P _ L I S T >------------------------------------------------------------
make a separated list of items using provided separators.
<sep_list> - typically '<comma><space>'
<sep_list_pair> - typically '<space>and<space>'
<sep_list_end> - typically '<comma><space>and<space>' or '<comma><space>&<space>'
defaults to cfg.presentation['sep_list'], cfg.presentation['sep_list_pair'], and cfg.presentation['sep_list_end']
if <sep_list_end> is specified, <sep_list> and <sep_list_pair> must also be supplied
]]
local function make_sep_list (count, list_seq, sep_list, sep_list_pair, sep_list_end)
local list = '';
if not sep_list then -- set the defaults
sep_list = cfg.presentation['sep_list'];
sep_list_pair = cfg.presentation['sep_list_pair'];
sep_list_end = cfg.presentation['sep_list_end'];
end
if 2 >= count then
list = table.concat (list_seq, sep_list_pair); -- insert separator between two items; returns list_seq[1] then only one item
elseif 2 < count then
list = table.concat (list_seq, sep_list, 1, count - 1); -- concatenate all but last item with plain list separator
list = table.concat ({list, list_seq[count]}, sep_list_end); -- concatenate last item onto end of <list> with final separator
end
return list;
end
--[[--------------------------< S E L E C T _ O N E >----------------------------------------------------------
Chooses one matching parameter from a list of parameters to consider. The list of parameters to consider is just
names. For parameters that may be enumerated, the position of the numerator in the parameter name is identified
by the '#' so |author-last1= and |author1-last= are represented as 'author-last#' and 'author#-last'.
Because enumerated parameter |<param>1= is an alias of |<param>= we must test for both possibilities.
Generates an error if more than one match is present.
]]
local function select_one (args, aliases_list, error_condition, index)
local value = nil; -- the value assigned to the selected parameter
local selected = ''; -- the name of the parameter we have chosen
local error_list = {};
if index ~= nil then index = tostring(index); end
for _, alias in ipairs (aliases_list) do -- for each alias in the aliases list
if alias:match ('#') then -- if this alias can be enumerated
if '1' == index then -- when index is 1 test for enumerated and non-enumerated aliases
value, selected = is_alias_used (args, alias, index, false, value, selected, error_list); -- first test for non-enumerated alias
end
value, selected = is_alias_used (args, alias, index, true, value, selected, error_list); -- test for enumerated alias
else
value, selected = is_alias_used (args, alias, index, false, value, selected, error_list); -- test for non-enumerated alias
end
end
if #error_list > 0 and 'none' ~= error_condition then -- for cases where this code is used outside of extract_names()
for i, v in ipairs (error_list) do
error_list[i] = wrap_style ('parameter', v);
end
table.insert (error_list, wrap_style ('parameter', selected));
set_message (error_condition, {make_sep_list (#error_list, error_list)});
end
return value, selected;
end
--[=[-------------------------< R E M O V E _ W I K I _ L I N K >----------------------------------------------
Gets the display text from a wikilink like [[A|B]] or [[B]] gives B
The str:gsub() returns either A|B froma [[A|B]] or B from [[B]] or B from B (no wikilink markup).
In l(), l:gsub() removes the link and pipe (if they exist); the second :gsub() trims whitespace from the label
if str was wrapped in wikilink markup. Presumably, this is because without wikimarkup in str, there is no match
in the initial gsub, the replacement function l() doesn't get called.
]=]
local function remove_wiki_link (str)
return (str:gsub ("%[%[([^%[%]]*)%]%]", function(l)
return l:gsub ("^[^|]*|(.*)$", "%1" ):gsub ("^%s*(.-)%s*$", "%1");
end));
end
--[=[-------------------------< I S _ W I K I L I N K >--------------------------------------------------------
Determines if str is a wikilink, extracts, and returns the wikilink type, link text, and display text parts.
If str is a complex wikilink ([[L|D]]):
returns wl_type 2 and D and L from [[L|D]];
if str is a simple wikilink ([[D]])
returns wl_type 1 and D from [[D]] and L as empty string;
if not a wikilink:
returns wl_type 0, str as D, and L as empty string.
trims leading and trailing whitespace and pipes from L and D ([[L|]] and [[|D]] are accepted by MediaWiki and
treated like [[D]]; while [[|D|]] is not accepted by MediaWiki, here, we accept it and return D without the pipes).
]=]
local function is_wikilink (str)
local D, L
local wl_type = 2; -- assume that str is a complex wikilink [[L|D]]
if not str:match ('^%[%[[^%]]+%]%]$') then -- is str some sort of a wikilink (must have some sort of content)
return 0, str, ''; -- not a wikilink; return wl_type as 0, str as D, and empty string as L
end
L, D = str:match ('^%[%[([^|]+)|([^%]]+)%]%]$'); -- get L and D from [[L|D]]
if not is_set (D) then -- if no separate display
D = str:match ('^%[%[([^%]]*)|*%]%]$'); -- get D from [[D]] or [[D|]]
wl_type = 1;
end
D = mw.text.trim (D, '%s|'); -- trim white space and pipe characters
return wl_type, D, L or '';
end
--[[--------------------------< S T R I P _ A P O S T R O P H E _ M A R K U P >--------------------------------
Strip wiki italic and bold markup from argument so that it doesn't contaminate COinS metadata.
This function strips common patterns of apostrophe markup. We presume that editors who have taken the time to
markup a title have, as a result, provided valid markup. When they don't, some single apostrophes are left behind.
Returns the argument without wiki markup and a number; the number is more-or-less meaningless except as a flag
to indicate that markup was replaced; do not rely on it as an indicator of how many of any kind of markup was
removed; returns the argument and nil when no markup removed
]]
local function strip_apostrophe_markup (argument)
if not is_set (argument) then
return argument, nil; -- no argument, nothing to do
end
if nil == argument:find ( "''", 1, true ) then -- Is there at least one double apostrophe? If not, exit.
return argument, nil;
end
local flag;
while true do
if argument:find ("'''''", 1, true) then -- bold italic (5)
argument, flag = argument:gsub ("%'%'%'%'%'", ""); -- remove all instances of it
elseif argument:find ("''''", 1, true) then -- italic start and end without content (4)
argument, flag=argument:gsub ("%'%'%'%'", "");
elseif argument:find ("'''", 1, true) then -- bold (3)
argument, flag=argument:gsub ("%'%'%'", "");
elseif argument:find ("''", 1, true) then -- italic (2)
argument, flag = argument:gsub ("%'%'", "");
else
break;
end
end
return argument, flag; -- done
end
--[[--------------------------< S E T _ S E L E C T E D _ M O D U L E S >--------------------------------------
Sets local cfg table to same (live or sandbox) as that used by the other modules.
]]
local function set_selected_modules (cfg_table_ptr)
cfg = cfg_table_ptr;
end
--[[--------------------------< E X P O R T S >----------------------------------------------------------------
]]
return {
add_maint_cat = add_maint_cat, -- exported functions
add_prop_cat = add_prop_cat,
error_comment = error_comment,
has_accept_as_written = has_accept_as_written,
hyphen_to_dash = hyphen_to_dash,
in_array = in_array,
is_set = is_set,
is_wikilink = is_wikilink,
make_sep_list = make_sep_list,
make_wikilink = make_wikilink,
remove_wiki_link = remove_wiki_link,
safe_for_italics = safe_for_italics,
select_one = select_one,
set_message = set_message,
set_selected_modules = set_selected_modules,
strip_apostrophe_markup = strip_apostrophe_markup,
substitute = substitute,
wrap_style = wrap_style,
z = z, -- exported table
}
b006801b48981b2987f20fc09cbe0dfda525e044
Module:TableTools
828
91
173
2022-01-31T13:08:18Z
wikipedia>MSGJ
0
updates/fixes requested by [[User:Uzume]]
Scribunto
text/plain
------------------------------------------------------------------------------------
-- TableTools --
-- --
-- This module includes a number of functions for dealing with Lua tables. --
-- It is a meta-module, meant to be called from other Lua modules, and should not --
-- be called directly from #invoke. --
------------------------------------------------------------------------------------
local libraryUtil = require('libraryUtil')
local p = {}
-- Define often-used variables and functions.
local floor = math.floor
local infinity = math.huge
local checkType = libraryUtil.checkType
local checkTypeMulti = libraryUtil.checkTypeMulti
------------------------------------------------------------------------------------
-- isPositiveInteger
--
-- This function returns true if the given value is a positive integer, and false
-- if not. Although it doesn't operate on tables, it is included here as it is
-- useful for determining whether a given table key is in the array part or the
-- hash part of a table.
------------------------------------------------------------------------------------
function p.isPositiveInteger(v)
return type(v) == 'number' and v >= 1 and floor(v) == v and v < infinity
end
------------------------------------------------------------------------------------
-- isNan
--
-- This function returns true if the given number is a NaN value, and false if
-- not. Although it doesn't operate on tables, it is included here as it is useful
-- for determining whether a value can be a valid table key. Lua will generate an
-- error if a NaN is used as a table key.
------------------------------------------------------------------------------------
function p.isNan(v)
return type(v) == 'number' and v ~= v
end
------------------------------------------------------------------------------------
-- shallowClone
--
-- This returns a clone of a table. The value returned is a new table, but all
-- subtables and functions are shared. Metamethods are respected, but the returned
-- table will have no metatable of its own.
------------------------------------------------------------------------------------
function p.shallowClone(t)
checkType('shallowClone', 1, t, 'table')
local ret = {}
for k, v in pairs(t) do
ret[k] = v
end
return ret
end
------------------------------------------------------------------------------------
-- removeDuplicates
--
-- This removes duplicate values from an array. Non-positive-integer keys are
-- ignored. The earliest value is kept, and all subsequent duplicate values are
-- removed, but otherwise the array order is unchanged.
------------------------------------------------------------------------------------
function p.removeDuplicates(arr)
checkType('removeDuplicates', 1, arr, 'table')
local isNan = p.isNan
local ret, exists = {}, {}
for _, v in ipairs(arr) do
if isNan(v) then
-- NaNs can't be table keys, and they are also unique, so we don't need to check existence.
ret[#ret + 1] = v
else
if not exists[v] then
ret[#ret + 1] = v
exists[v] = true
end
end
end
return ret
end
------------------------------------------------------------------------------------
-- numKeys
--
-- This takes a table and returns an array containing the numbers of any numerical
-- keys that have non-nil values, sorted in numerical order.
------------------------------------------------------------------------------------
function p.numKeys(t)
checkType('numKeys', 1, t, 'table')
local isPositiveInteger = p.isPositiveInteger
local nums = {}
for k in pairs(t) do
if isPositiveInteger(k) then
nums[#nums + 1] = k
end
end
table.sort(nums)
return nums
end
------------------------------------------------------------------------------------
-- affixNums
--
-- This takes a table and returns an array containing the numbers of keys with the
-- specified prefix and suffix. For example, for the table
-- {a1 = 'foo', a3 = 'bar', a6 = 'baz'} and the prefix "a", affixNums will return
-- {1, 3, 6}.
------------------------------------------------------------------------------------
function p.affixNums(t, prefix, suffix)
checkType('affixNums', 1, t, 'table')
checkType('affixNums', 2, prefix, 'string', true)
checkType('affixNums', 3, suffix, 'string', true)
local function cleanPattern(s)
-- Cleans a pattern so that the magic characters ()%.[]*+-?^$ are interpreted literally.
return s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1')
end
prefix = prefix or ''
suffix = suffix or ''
prefix = cleanPattern(prefix)
suffix = cleanPattern(suffix)
local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$'
local nums = {}
for k in pairs(t) do
if type(k) == 'string' then
local num = mw.ustring.match(k, pattern)
if num then
nums[#nums + 1] = tonumber(num)
end
end
end
table.sort(nums)
return nums
end
------------------------------------------------------------------------------------
-- numData
--
-- Given a table with keys like {"foo1", "bar1", "foo2", "baz2"}, returns a table
-- of subtables in the format
-- {[1] = {foo = 'text', bar = 'text'}, [2] = {foo = 'text', baz = 'text'}}.
-- Keys that don't end with an integer are stored in a subtable named "other". The
-- compress option compresses the table so that it can be iterated over with
-- ipairs.
------------------------------------------------------------------------------------
function p.numData(t, compress)
checkType('numData', 1, t, 'table')
checkType('numData', 2, compress, 'boolean', true)
local ret = {}
for k, v in pairs(t) do
local prefix, num = mw.ustring.match(tostring(k), '^([^0-9]*)([1-9][0-9]*)$')
if num then
num = tonumber(num)
local subtable = ret[num] or {}
if prefix == '' then
-- Positional parameters match the blank string; put them at the start of the subtable instead.
prefix = 1
end
subtable[prefix] = v
ret[num] = subtable
else
local subtable = ret.other or {}
subtable[k] = v
ret.other = subtable
end
end
if compress then
local other = ret.other
ret = p.compressSparseArray(ret)
ret.other = other
end
return ret
end
------------------------------------------------------------------------------------
-- compressSparseArray
--
-- This takes an array with one or more nil values, and removes the nil values
-- while preserving the order, so that the array can be safely traversed with
-- ipairs.
------------------------------------------------------------------------------------
function p.compressSparseArray(t)
checkType('compressSparseArray', 1, t, 'table')
local ret = {}
local nums = p.numKeys(t)
for _, num in ipairs(nums) do
ret[#ret + 1] = t[num]
end
return ret
end
------------------------------------------------------------------------------------
-- sparseIpairs
--
-- This is an iterator for sparse arrays. It can be used like ipairs, but can
-- handle nil values.
------------------------------------------------------------------------------------
function p.sparseIpairs(t)
checkType('sparseIpairs', 1, t, 'table')
local nums = p.numKeys(t)
local i = 0
local lim = #nums
return function ()
i = i + 1
if i <= lim then
local key = nums[i]
return key, t[key]
else
return nil, nil
end
end
end
------------------------------------------------------------------------------------
-- size
--
-- This returns the size of a key/value pair table. It will also work on arrays,
-- but for arrays it is more efficient to use the # operator.
------------------------------------------------------------------------------------
function p.size(t)
checkType('size', 1, t, 'table')
local i = 0
for _ in pairs(t) do
i = i + 1
end
return i
end
local function defaultKeySort(item1, item2)
-- "number" < "string", so numbers will be sorted before strings.
local type1, type2 = type(item1), type(item2)
if type1 ~= type2 then
return type1 < type2
elseif type1 == 'table' or type1 == 'boolean' or type1 == 'function' then
return tostring(item1) < tostring(item2)
else
return item1 < item2
end
end
------------------------------------------------------------------------------------
-- keysToList
--
-- Returns an array of the keys in a table, sorted using either a default
-- comparison function or a custom keySort function.
------------------------------------------------------------------------------------
function p.keysToList(t, keySort, checked)
if not checked then
checkType('keysToList', 1, t, 'table')
checkTypeMulti('keysToList', 2, keySort, {'function', 'boolean', 'nil'})
end
local arr = {}
local index = 1
for k in pairs(t) do
arr[index] = k
index = index + 1
end
if keySort ~= false then
keySort = type(keySort) == 'function' and keySort or defaultKeySort
table.sort(arr, keySort)
end
return arr
end
------------------------------------------------------------------------------------
-- sortedPairs
--
-- Iterates through a table, with the keys sorted using the keysToList function.
-- If there are only numerical keys, sparseIpairs is probably more efficient.
------------------------------------------------------------------------------------
function p.sortedPairs(t, keySort)
checkType('sortedPairs', 1, t, 'table')
checkType('sortedPairs', 2, keySort, 'function', true)
local arr = p.keysToList(t, keySort, true)
local i = 0
return function ()
i = i + 1
local key = arr[i]
if key ~= nil then
return key, t[key]
else
return nil, nil
end
end
end
------------------------------------------------------------------------------------
-- isArray
--
-- Returns true if the given value is a table and all keys are consecutive
-- integers starting at 1.
------------------------------------------------------------------------------------
function p.isArray(v)
if type(v) ~= 'table' then
return false
end
local i = 0
for _ in pairs(v) do
i = i + 1
if v[i] == nil then
return false
end
end
return true
end
------------------------------------------------------------------------------------
-- isArrayLike
--
-- Returns true if the given value is iterable and all keys are consecutive
-- integers starting at 1.
------------------------------------------------------------------------------------
function p.isArrayLike(v)
if not pcall(pairs, v) then
return false
end
local i = 0
for _ in pairs(v) do
i = i + 1
if v[i] == nil then
return false
end
end
return true
end
------------------------------------------------------------------------------------
-- invert
--
-- Transposes the keys and values in an array. For example, {"a", "b", "c"} ->
-- {a = 1, b = 2, c = 3}. Duplicates are not supported (result values refer to
-- the index of the last duplicate) and NaN values are ignored.
------------------------------------------------------------------------------------
function p.invert(arr)
checkType("invert", 1, arr, "table")
local isNan = p.isNan
local map = {}
for i, v in ipairs(arr) do
if not isNan(v) then
map[v] = i
end
end
return map
end
------------------------------------------------------------------------------------
-- listToSet
--
-- Creates a set from the array part of the table. Indexing the set by any of the
-- values of the array returns true. For example, {"a", "b", "c"} ->
-- {a = true, b = true, c = true}. NaN values are ignored as Lua considers them
-- never equal to any value (including other NaNs or even themselves).
------------------------------------------------------------------------------------
function p.listToSet(arr)
checkType("listToSet", 1, arr, "table")
local isNan = p.isNan
local set = {}
for _, v in ipairs(arr) do
if not isNan(v) then
set[v] = true
end
end
return set
end
------------------------------------------------------------------------------------
-- deepCopy
--
-- Recursive deep copy function. Preserves identities of subtables.
------------------------------------------------------------------------------------
local function _deepCopy(orig, includeMetatable, already_seen)
-- Stores copies of tables indexed by the original table.
already_seen = already_seen or {}
local copy = already_seen[orig]
if copy ~= nil then
return copy
end
if type(orig) == 'table' then
copy = {}
for orig_key, orig_value in pairs(orig) do
copy[_deepCopy(orig_key, includeMetatable, already_seen)] = _deepCopy(orig_value, includeMetatable, already_seen)
end
already_seen[orig] = copy
if includeMetatable then
local mt = getmetatable(orig)
if mt ~= nil then
local mt_copy = _deepCopy(mt, includeMetatable, already_seen)
setmetatable(copy, mt_copy)
already_seen[mt] = mt_copy
end
end
else -- number, string, boolean, etc
copy = orig
end
return copy
end
function p.deepCopy(orig, noMetatable, already_seen)
checkType("deepCopy", 3, already_seen, "table", true)
return _deepCopy(orig, not noMetatable, already_seen)
end
------------------------------------------------------------------------------------
-- sparseConcat
--
-- Concatenates all values in the table that are indexed by a number, in order.
-- sparseConcat{a, nil, c, d} => "acd"
-- sparseConcat{nil, b, c, d} => "bcd"
------------------------------------------------------------------------------------
function p.sparseConcat(t, sep, i, j)
local arr = {}
local arr_i = 0
for _, v in p.sparseIpairs(t) do
arr_i = arr_i + 1
arr[arr_i] = v
end
return table.concat(arr, sep, i, j)
end
------------------------------------------------------------------------------------
-- length
--
-- Finds the length of an array, or of a quasi-array with keys such as "data1",
-- "data2", etc., using an exponential search algorithm. It is similar to the
-- operator #, but may return a different value when there are gaps in the array
-- portion of the table. Intended to be used on data loaded with mw.loadData. For
-- other tables, use #.
-- Note: #frame.args in frame object always be set to 0, regardless of the number
-- of unnamed template parameters, so use this function for frame.args.
------------------------------------------------------------------------------------
function p.length(t, prefix)
-- requiring module inline so that [[Module:Exponential search]] which is
-- only needed by this one function doesn't get millions of transclusions
local expSearch = require("Module:Exponential search")
checkType('length', 1, t, 'table')
checkType('length', 2, prefix, 'string', true)
return expSearch(function (i)
local key
if prefix then
key = prefix .. tostring(i)
else
key = i
end
return t[key] ~= nil
end) or 0
end
------------------------------------------------------------------------------------
-- inArray
--
-- Returns true if valueToFind is a member of the array, and false otherwise.
------------------------------------------------------------------------------------
function p.inArray(arr, valueToFind)
checkType("inArray", 1, arr, "table")
-- if valueToFind is nil, error?
for _, v in ipairs(arr) do
if v == valueToFind then
return true
end
end
return false
end
return p
085e7094ac84eb0132ee65822cf3f69cd8ba3d81
Template:Short description/lowercasecheck
10
32
57
2022-02-12T16:35:05Z
wikipedia>ToBeFree
0
Changed protection settings for "[[Template:Short description/lowercasecheck]]": 4 million transclusions, through [[Template:Short description]] ([[WP:HRT]]) ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
{{#ifeq:<!--test first character for lower-case letter-->{{#invoke:string|find|1={{{1|}}}|2=^%l|plain=false}}|1
|<!-- first character is a lower case letter; test against whitelist
-->{{#switch: {{First word|{{{1|}}}}}<!--begin whitelist-->
|c. <!--for circa-->
|gTLD
|iMac
|iOS
|iOS,
|iPad
|iPhone
|iTunes
|macOS
|none
|pH
|pH-dependent=<!-- end whitelist; short description starts with an allowed lower-case string; whitelist matched; do nothing -->
|#default=<!-- apply category to track lower-case short descriptions -->{{main other|[[Category:Pages with lower-case short description|{{trim|{{{1|}}}}}]]}}{{Testcases other|{{red|CATEGORY APPLIED}}}}<!-- end whitelist test -->}}
|<!-- short description does not start with lower-case letter; do nothing; end lower-case test -->
}}<noinclude>
{{documentation}}
</noinclude>
9a6d4db14b74614625fd234b4f8ee3c8e1a235c0
Module:Check for unknown parameters
828
34
61
2022-02-21T05:24:13Z
wikipedia>BusterD
0
Changed protection settings for "[[Module:Check for unknown parameters]]": [[WP:High-risk templates|Highly visible template]]; requested at [[WP:RfPP]] ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
Scribunto
text/plain
-- This module may be used to compare the arguments passed to the parent
-- with a list of arguments, returning a specified result if an argument is
-- not on the list
local p = {}
local function trim(s)
return s:match('^%s*(.-)%s*$')
end
local function isnotempty(s)
return s and s:match('%S')
end
local function clean(text)
-- Return text cleaned for display and truncated if too long.
-- Strip markers are replaced with dummy text representing the original wikitext.
local pos, truncated
local function truncate(text)
if truncated then
return ''
end
if mw.ustring.len(text) > 25 then
truncated = true
text = mw.ustring.sub(text, 1, 25) .. '...'
end
return mw.text.nowiki(text)
end
local parts = {}
for before, tag, remainder in text:gmatch('([^\127]*)\127[^\127]*%-(%l+)%-[^\127]*\127()') do
pos = remainder
table.insert(parts, truncate(before) .. '<' .. tag .. '>...</' .. tag .. '>')
end
table.insert(parts, truncate(text:sub(pos or 1)))
return table.concat(parts)
end
function p._check(args, pargs)
if type(args) ~= "table" or type(pargs) ~= "table" then
-- TODO: error handling
return
end
-- create the list of known args, regular expressions, and the return string
local knownargs = {}
local regexps = {}
for k, v in pairs(args) do
if type(k) == 'number' then
v = trim(v)
knownargs[v] = 1
elseif k:find('^regexp[1-9][0-9]*$') then
table.insert(regexps, '^' .. v .. '$')
end
end
-- loop over the parent args, and make sure they are on the list
local ignoreblank = isnotempty(args['ignoreblank'])
local showblankpos = isnotempty(args['showblankpositional'])
local values = {}
for k, v in pairs(pargs) do
if type(k) == 'string' and knownargs[k] == nil then
local knownflag = false
for _, regexp in ipairs(regexps) do
if mw.ustring.match(k, regexp) then
knownflag = true
break
end
end
if not knownflag and ( not ignoreblank or isnotempty(v) ) then
table.insert(values, clean(k))
end
elseif type(k) == 'number' and knownargs[tostring(k)] == nil then
local knownflag = false
for _, regexp in ipairs(regexps) do
if mw.ustring.match(tostring(k), regexp) then
knownflag = true
break
end
end
if not knownflag and ( showblankpos or isnotempty(v) ) then
table.insert(values, k .. ' = ' .. clean(v))
end
end
end
-- add results to the output tables
local res = {}
if #values > 0 then
local unknown_text = args['unknown'] or 'Found _VALUE_, '
if mw.getCurrentFrame():preprocess( "{{REVISIONID}}" ) == "" then
local preview_text = args['preview']
if isnotempty(preview_text) then
preview_text = require('Module:If preview')._warning({preview_text})
elseif preview == nil then
preview_text = unknown_text
end
unknown_text = preview_text
end
for _, v in pairs(values) do
-- Fix odd bug for | = which gets stripped to the empty string and
-- breaks category links
if v == '' then v = ' ' end
-- avoid error with v = 'example%2' ("invalid capture index")
local r = unknown_text:gsub('_VALUE_', {_VALUE_ = v})
table.insert(res, r)
end
end
return table.concat(res)
end
function p.check(frame)
local args = frame.args
local pargs = frame:getParent().args
return p._check(args, pargs)
end
return p
93db6d115d4328d2a5148bb42959105e367b663e
Template:Wikidata entity link
10
281
554
2022-02-22T17:47:17Z
wikipedia>Uzume
0
simplify and always uppercase
wikitext
text/x-wiki
<includeonly>{{#if:{{{1|}}}
| {{#switch:{{padleft:|1|{{uc:{{{1}}}}}}}
| Q | P = [[d:Special:EntityPage/{{uc:{{{1}}}}}|{{#invoke:wd|label|{{uc:{{{1}}}}}}} <small>({{uc:{{{1}}}}})</small>]]
| #default = [[d:Special:EntityPage/Q{{uc:{{{1}}}}}|{{#invoke:wd|label|Q{{uc:{{{1}}}}}}} <small>(Q{{uc:{{{1|}}}}})</small>]]
}}
| {{#if:{{#invoke:wd|label|raw}}
| [[d:Special:EntityPage/{{#invoke:wd|label|raw}}|{{#invoke:wd|label}} <small>({{#invoke:wd|label|raw}})</small>]]
| <small>(no entity)</small>
}}
}}</includeonly><noinclude>{{Documentation}}</noinclude>
3eaf99f5fdf869bc08932bb8eda9eba23858c9c8
Module:Effective protection expiry
828
100
191
2022-02-23T10:59:29Z
wikipedia>Xaosflux
0
Changed protection settings for "[[Module:Effective protection expiry]]": used in the mediawiki interface / match [[Module:Effective protection level]] ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
Scribunto
text/plain
local p = {}
-- Returns the expiry of a restriction of an action on a given title, or unknown if it cannot be known.
-- If no title is specified, the title of the page being displayed is used.
function p._main(action, pagename)
local title
if type(pagename) == 'table' and pagename.prefixedText then
title = pagename
elseif pagename then
title = mw.title.new(pagename)
else
title = mw.title.getCurrentTitle()
end
pagename = title.prefixedText
if action == 'autoreview' then
local stabilitySettings = mw.ext.FlaggedRevs.getStabilitySettings(title)
return stabilitySettings and stabilitySettings.expiry or 'unknown'
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then
error( 'First parameter must be one of edit, move, create, upload, autoreview', 2 )
end
local rawExpiry = mw.getCurrentFrame():callParserFunction('PROTECTIONEXPIRY', action, pagename)
if rawExpiry == 'infinity' then
return 'infinity'
elseif rawExpiry == '' then
return 'unknown'
else
local year, month, day, hour, minute, second = rawExpiry:match(
'^(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)$'
)
if year then
return string.format(
'%s-%s-%sT%s:%s:%s',
year, month, day, hour, minute, second
)
else
error('internal error in Module:Effective protection expiry; malformed expiry timestamp')
end
end
end
setmetatable(p, { __index = function(t, k)
return function(frame)
return t._main(k, frame.args[1])
end
end })
return p
9a8c58dc2667232ed08a9b206a5d89ca8150312b
Template:Ns has subpages
10
77
145
2022-03-02T10:43:18Z
wikipedia>Trialpears
0
Changed protection settings for "[[Template:Ns has subpages]]": [[WP:High-risk templates|Highly visible template]] ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:Ns has subpages|main}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
060d2d01af26cb67fd90a7c346a0d2d5e450a040
Template:Title disambig text
10
147
285
2022-03-08T02:00:55Z
wikipedia>Neveselbert
0
safesubst
wikitext
text/x-wiki
{{safesubst<noinclude/>:#invoke:String|match|{{{1|{{PAGENAME}}}}}|%s%((.-%)?)%)||-1|ignore_errors=true}}<noinclude>
{{Documentation}}
</noinclude>
09be4d07c948b00ed15066030e4a7029dd966c0a
Module:Template link general
828
94
179
2022-03-08T08:30:51Z
wikipedia>Primefac
0
update from sandbox - fixes to _show_result and adding _expand
Scribunto
text/plain
-- This implements Template:Tlg
local getArgs = require('Module:Arguments').getArgs
local p = {}
-- Is a string non-empty?
local function _ne(s)
return s ~= nil and s ~= ""
end
local nw = mw.text.nowiki
local function addTemplate(s)
local i, _ = s:find(':', 1, true)
if i == nil then
return 'Template:' .. s
end
local ns = s:sub(1, i - 1)
if ns == '' or mw.site.namespaces[ns] then
return s
else
return 'Template:' .. s
end
end
local function trimTemplate(s)
local needle = 'template:'
if s:sub(1, needle:len()):lower() == needle then
return s:sub(needle:len() + 1)
else
return s
end
end
local function linkTitle(args)
if _ne(args.nolink) then
return args['1']
end
local titleObj
local titlePart = '[['
if args['1'] then
-- This handles :Page and other NS
titleObj = mw.title.new(args['1'], 'Template')
else
titleObj = mw.title.getCurrentTitle()
end
titlePart = titlePart .. (titleObj ~= nil and titleObj.fullText or
addTemplate(args['1']))
local textPart = args.alttext
if not _ne(textPart) then
if titleObj ~= nil then
textPart = titleObj:inNamespace("Template") and args['1'] or titleObj.fullText
else
-- redlink
textPart = args['1']
end
end
if _ne(args.subst) then
-- HACK: the ns thing above is probably broken
textPart = 'subst:' .. textPart
end
if _ne(args.brace) then
textPart = nw('{{') .. textPart .. nw('}}')
elseif _ne(args.braceinside) then
textPart = nw('{') .. textPart .. nw('}')
end
titlePart = titlePart .. '|' .. textPart .. ']]'
if _ne(args.braceinside) then
titlePart = nw('{') .. titlePart .. nw('}')
end
return titlePart
end
function p.main(frame)
local args = getArgs(frame, {
trim = true,
removeBlanks = false
})
return p._main(args)
end
function p._main(args)
local bold = _ne(args.bold) or _ne(args.boldlink) or _ne(args.boldname)
local italic = _ne(args.italic) or _ne(args.italics)
local dontBrace = _ne(args.brace) or _ne(args.braceinside)
local code = _ne(args.code) or _ne(args.tt)
local show_result = _ne(args._show_result)
local expand = _ne(args._expand)
-- Build the link part
local titlePart = linkTitle(args)
if bold then titlePart = "'''" .. titlePart .. "'''" end
if _ne(args.nowrapname) then titlePart = '<span class="nowrap">' .. titlePart .. '</span>' end
-- Build the arguments
local textPart = ""
local textPartBuffer = "|"
local codeArguments = {}
local codeArgumentsString = ""
local i = 2
local j = 1
while args[i] do
local val = args[i]
if val ~= "" then
if _ne(args.nowiki) then
-- Unstrip nowiki tags first because calling nw on something that already contains nowiki tags will
-- mangle the nowiki strip marker and result in literal UNIQ...QINU showing up
val = nw(mw.text.unstripNoWiki(val))
end
local k, v = string.match(val, "(.*)=(.*)")
if not k then
codeArguments[j] = val
j = j + 1
else
codeArguments[k] = v
end
codeArgumentsString = codeArgumentsString .. textPartBuffer .. val
if italic then
val = '<span style="font-style:italic;">' .. val .. '</span>'
end
textPart = textPart .. textPartBuffer .. val
end
i = i + 1
end
-- final wrap
local ret = titlePart .. textPart
if not dontBrace then ret = nw('{{') .. ret .. nw('}}') end
if _ne(args.a) then ret = nw('*') .. ' ' .. ret end
if _ne(args.kbd) then ret = '<kbd>' .. ret .. '</kbd>' end
if code then
ret = '<code>' .. ret .. '</code>'
elseif _ne(args.plaincode) then
ret = '<code style="border:none;background:transparent;">' .. ret .. '</code>'
end
if _ne(args.nowrap) then ret = '<span class="nowrap">' .. ret .. '</span>' end
--[[ Wrap as html??
local span = mw.html.create('span')
span:wikitext(ret)
--]]
if _ne(args.debug) then ret = ret .. '\n<pre>' .. mw.text.encode(mw.dumpObject(args)) .. '</pre>' end
if show_result then
local result = mw.getCurrentFrame():expandTemplate{title = addTemplate(args[1]), args = codeArguments}
ret = ret .. " → " .. result
end
if expand then
local query = mw.text.encode('{{' .. addTemplate(args[1]) .. string.gsub(codeArgumentsString, textPartBuffer, "|") .. '}}')
local url = mw.uri.fullUrl('special:ExpandTemplates', 'wpInput=' .. query)
mw.log()
ret = ret .. " [" .. tostring(url) .. "]"
end
return ret
end
return p
c7307fa3959d308a2dd7fd2f5009c1ce6db3d122
Template:Tt
10
279
550
2022-03-19T17:59:52Z
wikipedia>MusikBot II
0
Protected "[[Template:Tt]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 250 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require autoconfirmed or confirmed access] (indefinite))
wikitext
text/x-wiki
#REDIRECT [[Template:Mono]]
a7a3647ba0499a71e399c9dd87e77998307f51bf
Template:Documentation
10
116
223
2022-03-29T02:14:34Z
wikipedia>Bsherr
0
consistent with new substitution template format
wikitext
text/x-wiki
{{#invoke:documentation|main|_content={{ {{#invoke:documentation|contentTitle}}}}}}<noinclude>
<!-- Add categories to the /doc subpage -->
</noinclude>
9e62b964e96c4e3d478edecbfcb3c0338ae8a276
Template:If empty
10
186
364
2022-04-03T20:56:41Z
wikipedia>Wugapodes
0
Changed protection settings for "[[Template:If empty]]": [[WP:High-risk templates|Highly visible template]]: used on 2 million pages and permanently cascade protected; matches module protection ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:If empty|main}}<noinclude>{{Documentation}}</noinclude>
745940b7bdde8a1585c887ee4ee5ce81d98461a4
Module:String2
828
189
370
2022-05-14T12:03:50Z
wikipedia>GKFX
0
Copy changes by [[User:Tholme]] from [[Module:String2/sandbox]] per edit request.
Scribunto
text/plain
local p = {}
p.trim = function(frame)
return mw.text.trim(frame.args[1] or "")
end
p.sentence = function (frame)
-- {{lc:}} is strip-marker safe, string.lower is not.
frame.args[1] = frame:callParserFunction('lc', frame.args[1])
return p.ucfirst(frame)
end
p.ucfirst = function (frame )
local s = mw.text.trim( frame.args[1] or "" )
local s1 = ""
-- if it's a list chop off and (store as s1) everything up to the first <li>
local lipos = mw.ustring.find(s, "<li>" )
if lipos then
s1 = mw.ustring.sub(s, 1, lipos + 3)
s = mw.ustring.sub(s, lipos + 4)
end
-- s1 is either "" or the first part of the list markup, so we can continue
-- and prepend s1 to the returned string
local letterpos
if mw.ustring.find(s, "^%[%[[^|]+|[^%]]+%]%]") then
-- this is a piped wikilink, so we capitalise the text, not the pipe
local _
_, letterpos = mw.ustring.find(s, "|%W*%w") -- find the first letter after the pipe
else
letterpos = mw.ustring.find(s, '%w')
end
if letterpos then
local first = mw.ustring.sub(s, 1, letterpos - 1)
local letter = mw.ustring.sub(s, letterpos, letterpos)
local rest = mw.ustring.sub(s, letterpos + 1)
return s1 .. first .. mw.ustring.upper(letter) .. rest
else
return s1 .. s
end
end
p.title = function (frame )
-- http://grammar.yourdictionary.com/capitalization/rules-for-capitalization-in-titles.html
-- recommended by The U.S. Government Printing Office Style Manual:
-- "Capitalize all words in titles of publications and documents,
-- except a, an, the, at, by, for, in, of, on, to, up, and, as, but, or, and nor."
local alwayslower = {['a'] = 1, ['an'] = 1, ['the'] = 1,
['and'] = 1, ['but'] = 1, ['or'] = 1, ['for'] = 1,
['nor'] = 1, ['on'] = 1, ['in'] = 1, ['at'] = 1, ['to'] = 1,
['from'] = 1, ['by'] = 1, ['of'] = 1, ['up'] = 1 }
local res = ''
local s = mw.text.trim( frame.args[1] or "" )
local words = mw.text.split( s, " ")
for i, s in ipairs(words) do
-- {{lc:}} is strip-marker safe, string.lower is not.
s = frame:callParserFunction('lc', s)
if i == 1 or alwayslower[s] ~= 1 then
s = mw.getContentLanguage():ucfirst(s)
end
words[i] = s
end
return table.concat(words, " ")
end
-- findlast finds the last item in a list
-- the first unnamed parameter is the list
-- the second, optional unnamed parameter is the list separator (default = comma space)
-- returns the whole list if separator not found
p.findlast = function(frame)
local s = mw.text.trim( frame.args[1] or "" )
local sep = frame.args[2] or ""
if sep == "" then sep = ", " end
local pattern = ".*" .. sep .. "(.*)"
local a, b, last = s:find(pattern)
if a then
return last
else
return s
end
end
-- stripZeros finds the first number and strips leading zeros (apart from units)
-- e.g "0940" -> "940"; "Year: 0023" -> "Year: 23"; "00.12" -> "0.12"
p.stripZeros = function(frame)
local s = mw.text.trim(frame.args[1] or "")
local n = tonumber( string.match( s, "%d+" ) ) or ""
s = string.gsub( s, "%d+", n, 1 )
return s
end
-- nowiki ensures that a string of text is treated by the MediaWiki software as just a string
-- it takes an unnamed parameter and trims whitespace, then removes any wikicode
p.nowiki = function(frame)
local str = mw.text.trim(frame.args[1] or "")
return mw.text.nowiki(str)
end
-- split splits text at boundaries specified by separator
-- and returns the chunk for the index idx (starting at 1)
-- #invoke:String2 |split |text |separator |index |true/false
-- #invoke:String2 |split |txt=text |sep=separator |idx=index |plain=true/false
-- if plain is false/no/0 then separator is treated as a Lua pattern - defaults to plain=true
p.split = function(frame)
local args = frame.args
if not(args[1] or args.txt) then args = frame:getParent().args end
local txt = args[1] or args.txt or ""
if txt == "" then return nil end
local sep = (args[2] or args.sep or ""):gsub('"', '')
local idx = tonumber(args[3] or args.idx) or 1
local plain = (args[4] or args.plain or "true"):sub(1,1)
plain = (plain ~= "f" and plain ~= "n" and plain ~= "0")
local splittbl = mw.text.split( txt, sep, plain )
if idx < 0 then idx = #splittbl + idx + 1 end
return splittbl[idx]
end
-- val2percent scans through a string, passed as either the first unnamed parameter or |txt=
-- it converts each number it finds into a percentage and returns the resultant string.
p.val2percent = function(frame)
local args = frame.args
if not(args[1] or args.txt) then args = frame:getParent().args end
local txt = mw.text.trim(args[1] or args.txt or "")
if txt == "" then return nil end
local function v2p (x)
x = (tonumber(x) or 0) * 100
if x == math.floor(x) then x = math.floor(x) end
return x .. "%"
end
txt = txt:gsub("%d[%d%.]*", v2p) -- store just the string
return txt
end
-- one2a scans through a string, passed as either the first unnamed parameter or |txt=
-- it converts each occurrence of 'one ' into either 'a ' or 'an ' and returns the resultant string.
p.one2a = function(frame)
local args = frame.args
if not(args[1] or args.txt) then args = frame:getParent().args end
local txt = mw.text.trim(args[1] or args.txt or "")
if txt == "" then return nil end
txt = txt:gsub(" one ", " a "):gsub("^one", "a"):gsub("One ", "A "):gsub("a ([aeiou])", "an %1"):gsub("A ([aeiou])", "An %1")
return txt
end
-- findpagetext returns the position of a piece of text in a page
-- First positional parameter or |text is the search text
-- Optional parameter |title is the page title, defaults to current page
-- Optional parameter |plain is either true for plain search (default) or false for Lua pattern search
-- Optional parameter |nomatch is the return value when no match is found; default is nil
p._findpagetext = function(args)
-- process parameters
local nomatch = args.nomatch or ""
if nomatch == "" then nomatch = nil end
--
local text = mw.text.trim(args[1] or args.text or "")
if text == "" then return nil end
--
local title = args.title or ""
local titleobj
if title == "" then
titleobj = mw.title.getCurrentTitle()
else
titleobj = mw.title.new(title)
end
--
local plain = args.plain or ""
if plain:sub(1, 1) == "f" then plain = false else plain = true end
-- get the page content and look for 'text' - return position or nomatch
local content = titleobj and titleobj:getContent()
return content and mw.ustring.find(content, text, 1, plain) or nomatch
end
p.findpagetext = function(frame)
local args = frame.args
local pargs = frame:getParent().args
for k, v in pairs(pargs) do
args[k] = v
end
if not (args[1] or args.text) then return nil end
-- just the first value
return (p._findpagetext(args))
end
-- returns the decoded url. Inverse of parser function {{urlencode:val|TYPE}}
-- Type is:
-- QUERY decodes + to space (default)
-- PATH does no extra decoding
-- WIKI decodes _ to space
p._urldecode = function(url, type)
url = url or ""
type = (type == "PATH" or type == "WIKI") and type
return mw.uri.decode( url, type )
end
-- {{#invoke:String2|urldecode|url=url|type=type}}
p.urldecode = function(frame)
return mw.uri.decode( frame.args.url, frame.args.type )
end
-- what follows was merged from Module:StringFunc
-- helper functions
p._GetParameters = require('Module:GetParameters')
-- Argument list helper function, as per Module:String
p._getParameters = p._GetParameters.getParameters
-- Escape Pattern helper function so that all characters are treated as plain text, as per Module:String
function p._escapePattern( pattern_str)
return mw.ustring.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" )
end
-- Helper Function to interpret boolean strings, as per Module:String
p._getBoolean = p._GetParameters.getBoolean
--[[
Strip
This function Strips characters from string
Usage:
{{#invoke:String2|strip|source_string|characters_to_strip|plain_flag}}
Parameters
source: The string to strip
chars: The pattern or list of characters to strip from string, replaced with ''
plain: A flag indicating that the chars should be understood as plain text. defaults to true.
Leading and trailing whitespace is also automatically stripped from the string.
]]
function p.strip( frame )
local new_args = p._getParameters( frame.args, {'source', 'chars', 'plain'} )
local source_str = new_args['source'] or ''
local chars = new_args['chars'] or '' or 'characters'
source_str = mw.text.trim(source_str)
if source_str == '' or chars == '' then
return source_str
end
local l_plain = p._getBoolean( new_args['plain'] or true )
if l_plain then
chars = p._escapePattern( chars )
end
local result
result = mw.ustring.gsub(source_str, "["..chars.."]", '')
return result
end
--[[
Match any
Returns the index of the first given pattern to match the input. Patterns must be consecutively numbered.
Returns the empty string if nothing matches for use in {{#if:}}
Usage:
{{#invoke:String2|matchAll|source=123 abc|456|abc}} returns '2'.
Parameters:
source: the string to search
plain: A flag indicating that the patterns should be understood as plain text. defaults to true.
1, 2, 3, ...: the patterns to search for
]]
function p.matchAny(frame)
local source_str = frame.args['source'] or error('The source parameter is mandatory.')
local l_plain = p._getBoolean( frame.args['plain'] or true )
for i = 1, math.huge do
local pattern = frame.args[i]
if not pattern then return '' end
if mw.ustring.find(source_str, pattern, 1, l_plain) then
return tostring(i)
end
end
end
--[[--------------------------< H Y P H E N _ T O _ D A S H >--------------------------------------------------
Converts a hyphen to a dash under certain conditions. The hyphen must separate
like items; unlike items are returned unmodified. These forms are modified:
letter - letter (A - B)
digit - digit (4-5)
digit separator digit - digit separator digit (4.1-4.5 or 4-1-4-5)
letterdigit - letterdigit (A1-A5) (an optional separator between letter and
digit is supported – a.1-a.5 or a-1-a-5)
digitletter - digitletter (5a - 5d) (an optional separator between letter and
digit is supported – 5.a-5.d or 5-a-5-d)
any other forms are returned unmodified.
str may be a comma- or semicolon-separated list
]]
function p.hyphen_to_dash( str, spacing )
if (str == nil or str == '') then
return str
end
local accept
str = mw.text.decode(str, true ) -- replace html entities with their characters; semicolon mucks up the text.split
local out = {}
local list = mw.text.split (str, '%s*[,;]%s*') -- split str at comma or semicolon separators if there are any
for _, item in ipairs (list) do -- for each item in the list
item = mw.text.trim(item) -- trim whitespace
item, accept = item:gsub ('^%(%((.+)%)%)$', '%1')
if accept == 0 and mw.ustring.match (item, '^%w*[%.%-]?%w+%s*[%-–—]%s*%w*[%.%-]?%w+$') then -- if a hyphenated range or has endash or emdash separators
if item:match ('^%a+[%.%-]?%d+%s*%-%s*%a+[%.%-]?%d+$') or -- letterdigit hyphen letterdigit (optional separator between letter and digit)
item:match ('^%d+[%.%-]?%a+%s*%-%s*%d+[%.%-]?%a+$') or -- digitletter hyphen digitletter (optional separator between digit and letter)
item:match ('^%d+[%.%-]%d+%s*%-%s*%d+[%.%-]%d+$') or -- digit separator digit hyphen digit separator digit
item:match ('^%d+%s*%-%s*%d+$') or -- digit hyphen digit
item:match ('^%a+%s*%-%s*%a+$') then -- letter hyphen letter
item = item:gsub ('(%w*[%.%-]?%w+)%s*%-%s*(%w*[%.%-]?%w+)', '%1–%2') -- replace hyphen, remove extraneous space characters
else
item = mw.ustring.gsub (item, '%s*[–—]%s*', '–') -- for endash or emdash separated ranges, replace em with en, remove extraneous whitespace
end
end
table.insert (out, item) -- add the (possibly modified) item to the output table
end
local temp_str = table.concat (out, ',' .. spacing) -- concatenate the output table into a comma separated string
temp_str, accept = temp_str:gsub ('^%(%((.+)%)%)$', '%1') -- remove accept-this-as-written markup when it wraps all of concatenated out
if accept ~= 0 then
temp_str = str:gsub ('^%(%((.+)%)%)$', '%1') -- when global markup removed, return original str; do it this way to suppress boolean second return value
end
return temp_str
end
function p.hyphen2dash( frame )
local str = frame.args[1] or ''
local spacing = frame.args[2] or ' ' -- space is part of the standard separator for normal spacing (but in conjunction with templates r/rp/ran we may need a narrower spacing
return p.hyphen_to_dash(str, spacing)
end
-- Similar to [[Module:String#endswith]]
function p.startswith(frame)
return (frame.args[1]:sub(1, frame.args[2]:len()) == frame.args[2]) and 'yes' or ''
end
return p
418f407ee2454811910e333a13523afc975fa40c
Template:Module rating
10
266
524
2022-06-03T15:10:23Z
wikipedia>The Anome
0
Reverted edits by [[Special:Contribs/Dawn PScLim|Dawn PScLim]] ([[User talk:Dawn PScLim|talk]]) to last version by Alexis Jazz
wikitext
text/x-wiki
<includeonly>{{#ifeq:{{SUBPAGENAME}}|doc|<!--do not show protection level of the module on the doc page, use the second and optionally third parameter if the doc page is also protected -->{{#if:{{{2|}}}|{{Pp|{{{2}}}|action={{{3|}}}}}}}|{{Module other|{{ombox
| type = notice
| image = {{#switch: {{{1|}}}
| pre-alpha | prealpha | pa = [[File:Ambox warning blue construction.svg|40x40px|link=|alt=Pre-alpha]]
| alpha | a = [[File:Alpha lowercase.svg|26x26px|link=|alt=Alpha]]
| beta | b = [[File:Greek lc beta.svg|40x40px|link=|alt=Beta]]
| release | r | general | g = [[File:Green check.svg|40x40px|link=|alt=Ready for use]]
| protected | protect | p = [[File:{{#switch:{{#invoke:Effective protection level|edit|{{#switch:{{SUBPAGENAME}}|doc|sandbox={{FULLBASEPAGENAME}}|{{FULLPAGENAME}}}}}}|autoconfirmed=Semi|extendedconfirmed=Extended|accountcreator|templateeditor=Template|#default=Full}}-protection-shackle.svg|40x40px|link=|alt=Protected]]
| semiprotected | semiprotect | semi =[[File:Semi-protection-shackle.svg|40x40px|link=|alt=Semi-protected]]
}}
| style =
| textstyle =
| text = {{#switch: {{{1|}}}
| pre-alpha | prealpha | pa = This module is rated as [[:Category:Modules in pre-alpha development|pre-alpha]]. It is unfinished, and may or may not be in active development. It should not be used from article namespace pages. Modules remain pre-alpha until the original editor (or someone who takes one over if it is abandoned for some time) is satisfied with the basic structure.<!--
-->{{#switch: {{SUBPAGENAME}}|doc|sandbox=<!-- No category for /doc or /sandbox subpages -->
| {{#ifeq: {{{nocat|}}} | true | <!-- No category if user sets nocat=true --> | [[Category:Modules in pre-alpha development|{{PAGENAME}}]] }}
}}
| alpha | a = This module is rated as [[:Category:Modules in alpha|alpha]]. It is ready for third-party input, and may be used on a few pages to see if problems arise, but should be watched. Suggestions for new features or changes in their input and output mechanisms are welcome.<!--
-->{{#switch: {{SUBPAGENAME}}|doc|sandbox=<!-- No category for /doc or /sandbox subpages -->
| {{#ifeq: {{{nocat|}}} | true | <!-- No category if user sets nocat=true --> | [[Category:Modules in alpha|{{PAGENAME}}]] }}
}}
| beta | b = This module is rated as [[:Category:Modules in beta|beta]], and is ready for widespread use. It is still new and should be used with some caution to ensure the results are as expected.<!--
-->{{#switch: {{SUBPAGENAME}}|doc|sandbox=<!-- No category for /doc or /sandbox subpages -->
| {{#ifeq: {{{nocat|}}} | true | <!-- No category if user sets nocat=true --> | [[Category:Modules in beta|{{PAGENAME}}]] }}
}}
| release | r | general | g = This module is rated as [[:Category:Modules for general use|ready for general use]]. It has reached a mature form and is thought to be relatively bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by [[Wikipedia:Template sandbox and test cases|sandbox testing]] rather than repeated trial-and-error editing.<!--
-->{{#switch: {{SUBPAGENAME}}|doc|sandbox=<!-- No category for /doc or /sandbox subpages -->
| {{#ifeq: {{{nocat|}}} | true | <!-- No category if user sets nocat=true --> | [[Category:Modules for general use|{{PAGENAME}}]] }}
}}
| protected | protect | p = This module is [[:Category:Modules subject to page protection|subject to page protection]]. It is a [[Wikipedia:High-risk templates|highly visible module]] in use by a very large number of pages, or is [[Wikipedia:Substitution|substituted]] very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is [[Wikipedia:Protection policy|protected]] from editing.<!--
-->{{#switch: {{SUBPAGENAME}}|doc|sandbox=<!-- No category for /doc or /sandbox subpages -->
| {{#ifeq: {{{nocat|}}} | true | <!-- No category if user sets nocat=true --> | [[Category:Modules subject to page protection|{{PAGENAME}}]] }}
}}
| semiprotected | semiprotect | semi = This module is [[:Category:Modules subject to page protection|subject to page protection]]. It is a [[Wikipedia:High-risk templates|highly visible module]] in use by a very large number of pages, or is [[Wikipedia:Substitution|substituted]] very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is [[WP:SEMI|semi-protected]] from editing.<!--
-->{{#switch: {{SUBPAGENAME}}|doc|sandbox=<!-- No category for /doc or /sandbox subpages -->
| {{#ifeq: {{{nocat|}}} | true | <!-- No category if user sets nocat=true --> | [[Category:Modules subject to page protection|{{PAGENAME}}]] }}
}}
| #default = {{error|Module rating is invalid or not specified.}}
}}
}}|{{error|Error: {{tl|Module rating}} must be placed in the Module namespace.}} [[Category:Pages with templates in the wrong namespace]]|demospace={{{demospace|<noinclude>module</noinclude>}}}}}}}</includeonly><noinclude>
{{module rating|release|nocat=true|demospace=module}}
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go in Wikidata. -->
</noinclude>
bbd244b3ea2e13ec4c1c810ae44f2f3789a93efc
Module:Labelled list hatnote
828
65
123
2022-06-08T23:33:35Z
wikipedia>Nihiltres
0
Fixed iteration-and-removal bug
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Labelled list --
-- --
-- This module does the core work of creating a hatnote composed of a list --
-- prefixed by a colon-terminated label, i.e. "LABEL: [andList of pages]", --
-- for {{see also}} and similar templates. --
--------------------------------------------------------------------------------
local mHatnote = require('Module:Hatnote')
local mHatlist = require('Module:Hatnote list')
local mArguments --initialize lazily
local yesno --initialize lazily
local p = {}
-- Defaults global to this module
local defaults = {
label = 'See also', --Final fallback for label argument
labelForm = '%s: %s',
prefixes = {'label', 'label ', 'l'},
template = 'Module:Labelled list hatnote'
}
-- Localizable message strings
local msg = {
errorSuffix = '#Errors',
noInputWarning = 'no page names specified',
noOutputWarning =
"'''[[%s]] — no output: none of the target pages exist.'''"
}
-- Helper function that pre-combines display parameters into page arguments.
-- Also compresses sparse arrays, as a desirable side-effect.
function p.preprocessDisplays (args, prefixes)
-- Prefixes specify which parameters, in order, to check for display options
-- They each have numbers auto-appended, e.g. 'label1', 'label 1', & 'l1'
prefixes = prefixes or defaults.prefixes
local indices = {}
local sparsePages = {}
for k, v in pairs(args) do
if type(k) == 'number' then
indices[#indices + 1] = k
local display
for i = 1, #prefixes do
display = args[prefixes[i] .. k]
if display then break end
end
sparsePages[k] = display and
string.format('%s|%s', string.gsub(v, '|.*$', ''), display) or v
end
end
table.sort(indices)
local pages = {}
for k, v in ipairs(indices) do pages[#pages + 1] = sparsePages[v] end
return pages
end
--Helper function to get a page target from a processed page string
--e.g. "Page|Label" → "Page" or "Target" → "Target"
local function getTarget(pagename)
local pipe = string.find(pagename, '|')
return string.sub(pagename, 0, pipe and pipe - 1 or nil)
end
-- Produces a labelled pages-list hatnote.
-- The main frame (template definition) takes 1 or 2 arguments, for a singular
-- and (optionally) plural label respectively:
-- * {{#invoke:Labelled list hatnote|labelledList|Singular label|Plural label}}
-- The resulting template takes pagename & label parameters normally.
function p.labelledList (frame)
mArguments = require('Module:Arguments')
yesno = require('Module:Yesno')
local labels = {frame.args[1] or defaults.label}
labels[2] = frame.args[2] or labels[1]
labels[3] = frame.args[3] --no defaulting
labels[4] = frame.args[4] --no defaulting
local template = frame:getParent():getTitle()
local args = mArguments.getArgs(frame, {parentOnly = true})
local pages = p.preprocessDisplays(args)
local options = {
category = yesno(args.category),
extraclasses = frame.args.extraclasses,
ifexists = yesno(frame.args.ifexists),
namespace = frame.args.namespace or args.namespace,
selfref = yesno(frame.args.selfref or args.selfref),
template = template
}
return p._labelledList(pages, labels, options)
end
function p._labelledList (pages, labels, options)
if options.ifexists then
for k = #pages, 1, -1 do --iterate backwards to allow smooth removals
local v = pages[k]
local title = mw.title.new(getTarget(v), namespace)
if (v == '') or title == nil or not title.exists then
table.remove(pages, k)
end
end
end
labels = labels or {}
label = (#pages == 1 and labels[1] or labels[2]) or defaults.label
for k, v in pairs(pages) do
if mHatnote.findNamespaceId(v) ~= 0 then
label =
(
#pages == 1 and
(labels[3] or labels[1] or defaults.label) or
(labels[4] or labels[2] or defaults.label)
) or defaults.label
end
end
if #pages == 0 then
if options.ifexists then
mw.addWarning(
string.format(
msg.noOutputWarning, options.template or defaults.template
)
)
return ''
else
return mHatnote.makeWikitextError(
msg.noInputWarning,
(options.template or defaults.template) .. msg.errorSuffix,
options.category
)
end
end
local text = string.format(
options.labelForm or defaults.labelForm,
label,
mHatlist.andList(pages, true)
)
local hnOptions = {
extraclasses = options.extraclasses,
selfref = options.selfref
}
return mHatnote._hatnote(text, hnOptions)
end
return p
b7a8ba27cf6195e6427701b94e8d2acad3c40a21
Template:Reflist
10
47
87
2022-06-11T17:42:16Z
wikipedia>Izno
0
correct my error per [[Template talk:Reflist#liststyle and group]]
wikitext
text/x-wiki
<templatestyles src="Reflist/styles.css" /><div class="reflist <!--
-->{{#if:{{{1|}}}{{{colwidth|}}}|reflist-columns references-column-width}} <!--
-->{{#switch:{{{liststyle|{{{group|}}}}}}|upper-alpha|upper-roman|lower-alpha|lower-greek|lower-roman=reflist-{{{liststyle|{{{group}}}}}}}} <!--
-->{{#if:{{{1|}}}|{{#iferror:{{#ifexpr: {{{1|1}}} > 1 }}||{{#switch:{{{1|}}}|1=|2=reflist-columns-2|#default=reflist-columns-3}} }}}}" <!-- end class
-->{{#if: {{{1|}}}<!-- start style -->
| {{#iferror: {{#ifexpr: {{{1|1}}} > 1 }} |style="column-width: {{{1}}};"}}
| {{#if: {{{colwidth|}}}|style="column-width: {{{colwidth}}};"}}
}}>
{{#tag:references|{{{refs|}}}|group={{{group|}}}|responsive={{#if:{{{1|}}}{{{colwidth|}}}|0|1}}}}</div>{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using reflist with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Reflist]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | colwidth | group | liststyle | refs }}<noinclude>
{{Documentation}}
</noinclude>
8c65cc88272db6c0f5cf2b49f84d3e460e60ee5f
Template:Clear
10
96
183
2022-06-13T15:31:11Z
wikipedia>Xaosflux
0
Changed protection settings for "[[Template:Clear]]": [[WP:High-risk templates|Highly visible template]]: 3MM+ uses ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
<div style="clear:{{{1|both}}};"></div><noinclude>
{{documentation}}
</noinclude>
38bab3e3d7fbd3d6800d46556e60bc6bac494d72
Module:Uses TemplateStyles/config
828
269
530
2022-06-16T15:10:06Z
wikipedia>Pppery
0
Matching reality rather than 2018 me's wishful thinking
Scribunto
text/plain
local cfg = {} -- Don’t touch this line.
-- Subpage blacklist: these subpages will not be categorized (except for the
-- error category, which is always added if there is an error).
-- For example “Template:Foo/doc” matches the `doc = true` rule, so it will have
-- no categories. “Template:Foo” and “Template:Foo/documentation” match no rules,
-- so they *will* have categories. All rules should be in the
-- ['<subpage name>'] = true,
-- format.
cfg['subpage_blacklist'] = {
['doc'] = true,
['sandbox'] = true,
['sandbox2'] = true,
['testcases'] = true,
}
-- Sandbox title: if the stylesheet’s title is <template>/<stylesheet>.css, the
-- stylesheet’s sandbox is expected to be at <template>/<sandbox_title>/<stylesheet>.css
-- Set to nil to disable sandbox links.
cfg['sandbox_title'] = 'sandbox'
-- Error category: this category is added if the module call contains errors
-- (e.g. no stylesheet listed). A category name without namespace, or nil
-- to disable categorization (not recommended).
cfg['error_category'] = 'Uses TemplateStyles templates with errors'
-- Default category: this category is added if no custom category is specified
-- in module/template call. A category name without namespace, or nil
-- to disable categorization.
cfg['default_category'] = 'Templates using TemplateStyles'
-- Protection conflict category: this category is added if the protection level
-- of any stylesheet is lower than the protection level of the template. A category name
-- without namespace, or nil to disable categorization (not recommended).
cfg['protection_conflict_category'] = 'Templates using TemplateStyles with a different protection level'
-- Hierarchy of protection levels, used to determine whether one protection level is lower
-- than another and thus should populate protection_conflict_category. No protection is treated as zero
cfg['protection_hierarchy'] = {
autoconfirmed = 1,
extendedconfirmed = 2,
templateeditor = 3,
sysop = 4
}
-- Padlock pattern: Lua pattern to search on protected stylesheets for, or nil
-- to disable padlock check.
cfg['padlock_pattern'] = '{{pp-'
-- Missing padlock category: this category is added if a protected stylesheet
-- doesn’t contain any padlock template (specified by the above Lua pattern).
-- A category name without namespace (no nil allowed) if the pattern is not nil,
-- unused (and thus may be nil) otherwise.
cfg['missing_padlock_category'] = 'Templates using TemplateStyles without padlocks'
return cfg -- Don’t touch this line.
58e7a37c44f6ea3f6b8af54a559d696cc7256493
Module:Uses TemplateStyles
828
268
528
2022-06-16T15:13:38Z
wikipedia>Pppery
0
Matching reality rather than 2018 me's wishful thinking
Scribunto
text/plain
local yesno = require('Module:Yesno')
local mList = require('Module:List')
local mTableTools = require('Module:TableTools')
local mMessageBox = require('Module:Message box')
local TNT = require('Module:TNT')
local p = {}
local function format(msg, ...)
return TNT.format('I18n/Uses TemplateStyles', msg, ...)
end
local function getConfig()
return mw.loadData('Module:Uses TemplateStyles/config')
end
local function renderBox(tStyles)
local boxArgs = {
type = 'notice',
small = true,
image = string.format('[[File:Farm-Fresh css add.svg|32px|alt=%s]]', format('logo-alt'))
}
if #tStyles < 1 then
boxArgs.text = string.format('<strong class="error">%s</strong>', format('error-emptylist'))
else
local cfg = getConfig()
local tStylesLinks = {}
for i, ts in ipairs(tStyles) do
local link = string.format('[[:%s]]', ts)
local sandboxLink = nil
local tsTitle = mw.title.new(ts)
if tsTitle and cfg['sandbox_title'] then
local tsSandboxTitle = mw.title.new(string.format(
'%s:%s/%s/%s', tsTitle.nsText, tsTitle.baseText, cfg['sandbox_title'], tsTitle.subpageText))
if tsSandboxTitle and tsSandboxTitle.exists then
sandboxLink = format('sandboxlink', link, ':' .. tsSandboxTitle.prefixedText)
end
end
tStylesLinks[i] = sandboxLink or link
end
local tStylesList = mList.makeList('bulleted', tStylesLinks)
boxArgs.text = format(
mw.title.getCurrentTitle():inNamespaces(828,829) and 'header-module' or 'header-template') ..
'\n' .. tStylesList
end
return mMessageBox.main('mbox', boxArgs)
end
local function renderTrackingCategories(args, tStyles, titleObj)
if yesno(args.nocat) then
return ''
end
local cfg = getConfig()
local cats = {}
-- Error category
if #tStyles < 1 and cfg['error_category'] then
cats[#cats + 1] = cfg['error_category']
end
-- TemplateStyles category
titleObj = titleObj or mw.title.getCurrentTitle()
if (titleObj.namespace == 10 or titleObj.namespace == 828)
and not cfg['subpage_blacklist'][titleObj.subpageText]
then
local category = args.category or cfg['default_category']
if category then
cats[#cats + 1] = category
end
if not yesno(args.noprotcat) and (cfg['protection_conflict_category'] or cfg['padlock_pattern']) then
local currentProt = titleObj.protectionLevels["edit"] and titleObj.protectionLevels["edit"][1] or nil
local addedLevelCat = false
local addedPadlockCat = false
for i, ts in ipairs(tStyles) do
local tsTitleObj = mw.title.new(ts)
local tsProt = tsTitleObj.protectionLevels["edit"] and tsTitleObj.protectionLevels["edit"][1] or nil
if cfg['padlock_pattern'] and tsProt and not addedPadlockCat then
local content = tsTitleObj:getContent()
if not content:find(cfg['padlock_pattern']) then
cats[#cats + 1] = cfg['missing_padlock_category']
addedPadlockCat = true
end
end
if cfg['protection_conflict_category'] and currentProt and tsProt ~= currentProt and not addedLevelCat then
currentProt = cfg['protection_hierarchy'][currentProt] or 0
tsProt = cfg['protection_hierarchy'][tsProt] or 0
if tsProt < currentProt then
addedLevelCat = true
cats[#cats + 1] = cfg['protection_conflict_category']
end
end
end
end
end
for i, cat in ipairs(cats) do
cats[i] = string.format('[[Category:%s]]', cat)
end
return table.concat(cats)
end
function p._main(args, cfg)
local tStyles = mTableTools.compressSparseArray(args)
local box = renderBox(tStyles)
local trackingCategories = renderTrackingCategories(args, tStyles)
return box .. trackingCategories
end
function p.main(frame)
local origArgs = frame:getParent().args
local args = {}
for k, v in pairs(origArgs) do
v = v:match('^%s*(.-)%s*$')
if v ~= '' then
args[k] = v
end
end
return p._main(args)
end
return p
71ca57c37849f38e3c5ee30061bdae730963e48e
Module:Message box/fmbox.css
828
81
153
2022-07-09T19:12:22Z
wikipedia>Izno
0
fmbox never outputs this class
sanitized-css
text/css
/* {{pp|small=y}} */
.fmbox {
clear: both;
margin: 0.2em 0;
width: 100%;
border: 1px solid #a2a9b1;
background-color: #f8f9fa; /* Default "system" gray */
box-sizing: border-box;
}
.fmbox-warning {
border: 1px solid #bb7070; /* Dark pink */
background-color: #ffdbdb; /* Pink */
}
.fmbox-editnotice {
background-color: transparent;
}
.fmbox .mbox-text {
border: none;
/* @noflip */
padding: 0.25em 0.9em;
width: 100%;
}
.fmbox .mbox-image {
border: none;
/* @noflip */
padding: 2px 0 2px 0.9em;
text-align: center;
}
.fmbox .mbox-imageright {
border: none;
/* @noflip */
padding: 2px 0.9em 2px 0;
text-align: center;
}
.fmbox .mbox-invalid-type {
text-align: center;
}
fca0f5e4b400e4a2ab158b219c52822451211d66
Template:Generic template demo
10
178
347
2022-07-10T21:03:19Z
wikipedia>Aidan9382
0
+{{R semiprotected}}
wikitext
text/x-wiki
#REDIRECT [[Template:Parameter names example]]
{{R semiprotected}}
[[Category:Wikipedia utility templates]]
[[Category:Template namespace templates]]
[[Category:Documentation assistance templates]]
22f645541f749cfd0eeffdee734b51b284103400
Module:Message box/ombox.css
828
139
269
2022-07-11T18:40:17Z
wikipedia>Izno
0
and move mbox-small to 720px here as well
sanitized-css
text/css
/* {{pp|small=y}} */
.ombox {
margin: 4px 0;
border-collapse: collapse;
border: 1px solid #a2a9b1; /* Default "notice" gray */
background-color: #f8f9fa;
box-sizing: border-box;
}
/* For the "small=yes" option. */
.ombox.mbox-small {
font-size: 88%;
line-height: 1.25em;
}
.ombox-speedy {
border: 2px solid #b32424; /* Red */
background-color: #fee7e6; /* Pink */
}
.ombox-delete {
border: 2px solid #b32424; /* Red */
}
.ombox-content {
border: 1px solid #f28500; /* Orange */
}
.ombox-style {
border: 1px solid #fc3; /* Yellow */
}
.ombox-move {
border: 1px solid #9932cc; /* Purple */
}
.ombox-protection {
border: 2px solid #a2a9b1; /* Gray-gold */
}
.ombox .mbox-text {
border: none;
/* @noflip */
padding: 0.25em 0.9em;
width: 100%;
}
.ombox .mbox-image {
border: none;
/* @noflip */
padding: 2px 0 2px 0.9em;
text-align: center;
}
.ombox .mbox-imageright {
border: none;
/* @noflip */
padding: 2px 0.9em 2px 0;
text-align: center;
}
/* An empty narrow cell */
.ombox .mbox-empty-cell {
border: none;
padding: 0;
width: 1px;
}
.ombox .mbox-invalid-type {
text-align: center;
}
@media (min-width: 720px) {
.ombox {
margin: 4px 10%;
}
.ombox.mbox-small {
/* @noflip */
clear: right;
/* @noflip */
float: right;
/* @noflip */
margin: 4px 0 4px 1em;
width: 238px;
}
}
8fe3df4bb607e699eab2dbd23bd4a1a446391002
Module:Text
828
157
305
2022-07-21T16:43:48Z
wikipedia>Hike395
0
update date
Scribunto
text/plain
local yesNo = require("Module:Yesno")
local Text = { serial = "2022-07-21",
suite = "Text" }
--[=[
Text utilities
]=]
-- local globals
local PatternCJK = false
local PatternCombined = false
local PatternLatin = false
local PatternTerminated = false
local QuoteLang = false
local QuoteType = false
local RangesLatin = false
local SeekQuote = false
local function initLatinData()
if not RangesLatin then
RangesLatin = { { 7, 687 },
{ 7531, 7578 },
{ 7680, 7935 },
{ 8194, 8250 } }
end
if not PatternLatin then
local range
PatternLatin = "^["
for i = 1, #RangesLatin do
range = RangesLatin[ i ]
PatternLatin = PatternLatin ..
mw.ustring.char( range[ 1 ], 45, range[ 2 ] )
end -- for i
PatternLatin = PatternLatin .. "]*$"
end
end
local function initQuoteData()
-- Create quote definitions
if not QuoteLang then
QuoteLang =
{ af = "bd",
ar = "la",
be = "labd",
bg = "bd",
ca = "la",
cs = "bd",
da = "bd",
de = "bd",
dsb = "bd",
et = "bd",
el = "lald",
en = "ld",
es = "la",
eu = "la",
-- fa = "la",
fi = "rd",
fr = "laSPC",
ga = "ld",
he = "ldla",
hr = "bd",
hsb = "bd",
hu = "bd",
hy = "labd",
id = "rd",
is = "bd",
it = "ld",
ja = "x300C",
ka = "bd",
ko = "ld",
lt = "bd",
lv = "bd",
nl = "ld",
nn = "la",
no = "la",
pl = "bdla",
pt = "lald",
ro = "bdla",
ru = "labd",
sk = "bd",
sl = "bd",
sq = "la",
sr = "bx",
sv = "rd",
th = "ld",
tr = "ld",
uk = "la",
zh = "ld",
["de-ch"] = "la",
["en-gb"] = "lsld",
["en-us"] = "ld",
["fr-ch"] = "la",
["it-ch"] = "la",
["pt-br"] = "ldla",
["zh-tw"] = "x300C",
["zh-cn"] = "ld" }
end
if not QuoteType then
QuoteType =
{ bd = { { 8222, 8220 }, { 8218, 8217 } },
bdla = { { 8222, 8220 }, { 171, 187 } },
bx = { { 8222, 8221 }, { 8218, 8217 } },
la = { { 171, 187 }, { 8249, 8250 } },
laSPC = { { 171, 187 }, { 8249, 8250 }, true },
labd = { { 171, 187 }, { 8222, 8220 } },
lald = { { 171, 187 }, { 8220, 8221 } },
ld = { { 8220, 8221 }, { 8216, 8217 } },
ldla = { { 8220, 8221 }, { 171, 187 } },
lsld = { { 8216, 8217 }, { 8220, 8221 } },
rd = { { 8221, 8221 }, { 8217, 8217 } },
x300C = { { 0x300C, 0x300D },
{ 0x300E, 0x300F } } }
end
end -- initQuoteData()
local function fiatQuote( apply, alien, advance )
-- Quote text
-- Parameter:
-- apply -- string, with text
-- alien -- string, with language code
-- advance -- number, with level 1 or 2
local r = apply and tostring(apply) or ""
alien = alien or "en"
advance = tonumber(advance) or 0
local suite
initQuoteData()
local slang = alien:match( "^(%l+)-" )
suite = QuoteLang[alien] or slang and QuoteLang[slang] or QuoteLang["en"]
if suite then
local quotes = QuoteType[ suite ]
if quotes then
local space
if quotes[ 3 ] then
space = " "
else
space = ""
end
quotes = quotes[ advance ]
if quotes then
r = mw.ustring.format( "%s%s%s%s%s",
mw.ustring.char( quotes[ 1 ] ),
space,
apply,
space,
mw.ustring.char( quotes[ 2 ] ) )
end
else
mw.log( "fiatQuote() " .. suite )
end
end
return r
end -- fiatQuote()
Text.char = function ( apply, again, accept )
-- Create string from codepoints
-- Parameter:
-- apply -- table (sequence) with numerical codepoints, or nil
-- again -- number of repetitions, or nil
-- accept -- true, if no error messages to be appended
-- Returns: string
local r = ""
apply = type(apply) == "table" and apply or {}
again = math.floor(tonumber(again) or 1)
if again < 1 then
return ""
end
local bad = { }
local codes = { }
for _, v in ipairs( apply ) do
local n = tonumber(v)
if not n or (n < 32 and n ~= 9 and n ~= 10) then
table.insert(bad, tostring(v))
else
table.insert(codes, math.floor(n))
end
end
if #bad > 0 then
if not accept then
r = tostring( mw.html.create( "span" )
:addClass( "error" )
:wikitext( "bad codepoints: " .. table.concat( bad, " " )) )
end
return r
end
if #codes > 0 then
r = mw.ustring.char( unpack( codes ) )
if again > 1 then
r = r:rep(again)
end
end
return r
end -- Text.char()
local function trimAndFormat(args, fmt)
local result = {}
if type(args) ~= 'table' then
args = {args}
end
for _, v in ipairs(args) do
v = mw.text.trim(tostring(v))
if v ~= "" then
table.insert(result,fmt and mw.ustring.format(fmt, v) or v)
end
end
return result
end
Text.concatParams = function ( args, apply, adapt )
-- Concat list items into one string
-- Parameter:
-- args -- table (sequence) with numKey=string
-- apply -- string (optional); separator (default: "|")
-- adapt -- string (optional); format including "%s"
-- Returns: string
local collect = { }
return table.concat(trimAndFormat(args,adapt), apply or "|")
end -- Text.concatParams()
Text.containsCJK = function ( s )
-- Is any CJK code within?
-- Parameter:
-- s -- string
-- Returns: true, if CJK detected
s = s and tostring(s) or ""
if not patternCJK then
patternCJK = mw.ustring.char( 91,
4352, 45, 4607,
11904, 45, 42191,
43072, 45, 43135,
44032, 45, 55215,
63744, 45, 64255,
65072, 45, 65103,
65381, 45, 65500,
131072, 45, 196607,
93 )
end
return mw.ustring.find( s, patternCJK ) ~= nil
end -- Text.containsCJK()
Text.removeDelimited = function (s, prefix, suffix)
-- Remove all text in s delimited by prefix and suffix (inclusive)
-- Arguments:
-- s = string to process
-- prefix = initial delimiter
-- suffix = ending delimiter
-- Returns: stripped string
s = s and tostring(s) or ""
prefix = prefix and tostring(prefix) or ""
suffix = suffix and tostring(suffix) or ""
local prefixLen = mw.ustring.len(prefix)
local suffixLen = mw.ustring.len(suffix)
if prefixLen == 0 or suffixLen == 0 then
return s
end
local i = s:find(prefix, 1, true)
local r = s
local j
while i do
j = r:find(suffix, i + prefixLen)
if j then
r = r:sub(1, i - 1)..r:sub(j+suffixLen)
else
r = r:sub(1, i - 1)
end
i = r:find(prefix, 1, true)
end
return r
end
Text.getPlain = function ( adjust )
-- Remove wikisyntax from string, except templates
-- Parameter:
-- adjust -- string
-- Returns: string
local r = Text.removeDelimited(adjust,"<!--","-->")
r = r:gsub( "(</?%l[^>]*>)", "" )
:gsub( "'''", "" )
:gsub( "''", "" )
:gsub( " ", " " )
return r
end -- Text.getPlain()
Text.isLatinRange = function (s)
-- Are characters expected to be latin or symbols within latin texts?
-- Arguments:
-- s = string to analyze
-- Returns: true, if valid for latin only
s = s and tostring(s) or "" --- ensure input is always string
initLatinData()
return mw.ustring.match(s, PatternLatin) ~= nil
end -- Text.isLatinRange()
Text.isQuote = function ( s )
-- Is this character any quotation mark?
-- Parameter:
-- s = single character to analyze
-- Returns: true, if s is quotation mark
s = s and tostring(s) or ""
if s == "" then
return false
end
if not SeekQuote then
SeekQuote = mw.ustring.char( 34, -- "
39, -- '
171, -- laquo
187, -- raquo
8216, -- lsquo
8217, -- rsquo
8218, -- sbquo
8220, -- ldquo
8221, -- rdquo
8222, -- bdquo
8249, -- lsaquo
8250, -- rsaquo
0x300C, -- CJK
0x300D, -- CJK
0x300E, -- CJK
0x300F ) -- CJK
end
return mw.ustring.find( SeekQuote, s, 1, true ) ~= nil
end -- Text.isQuote()
Text.listToText = function ( args, adapt )
-- Format list items similar to mw.text.listToText()
-- Parameter:
-- args -- table (sequence) with numKey=string
-- adapt -- string (optional); format including "%s"
-- Returns: string
return mw.text.listToText(trimAndFormat(args, adapt))
end -- Text.listToText()
Text.quote = function ( apply, alien, advance )
-- Quote text
-- Parameter:
-- apply -- string, with text
-- alien -- string, with language code, or nil
-- advance -- number, with level 1 or 2, or nil
-- Returns: quoted string
apply = apply and tostring(apply) or ""
local mode, slang
if type( alien ) == "string" then
slang = mw.text.trim( alien ):lower()
else
slang = mw.title.getCurrentTitle().pageLanguage
if not slang then
-- TODO FIXME: Introduction expected 2017-04
slang = mw.language.getContentLanguage():getCode()
end
end
if advance == 2 then
mode = 2
else
mode = 1
end
return fiatQuote( mw.text.trim( apply ), slang, mode )
end -- Text.quote()
Text.quoteUnquoted = function ( apply, alien, advance )
-- Quote text, if not yet quoted and not empty
-- Parameter:
-- apply -- string, with text
-- alien -- string, with language code, or nil
-- advance -- number, with level 1 or 2, or nil
-- Returns: string; possibly quoted
local r = mw.text.trim( apply and tostring(apply) or "" )
local s = mw.ustring.sub( r, 1, 1 )
if s ~= "" and not Text.isQuote( s, advance ) then
s = mw.ustring.sub( r, -1, 1 )
if not Text.isQuote( s ) then
r = Text.quote( r, alien, advance )
end
end
return r
end -- Text.quoteUnquoted()
Text.removeDiacritics = function ( adjust )
-- Remove all diacritics
-- Parameter:
-- adjust -- string
-- Returns: string; all latin letters should be ASCII
-- or basic greek or cyrillic or symbols etc.
local cleanup, decomposed
if not PatternCombined then
PatternCombined = mw.ustring.char( 91,
0x0300, 45, 0x036F,
0x1AB0, 45, 0x1AFF,
0x1DC0, 45, 0x1DFF,
0xFE20, 45, 0xFE2F,
93 )
end
decomposed = mw.ustring.toNFD( adjust and tostring(adjust) or "" )
cleanup = mw.ustring.gsub( decomposed, PatternCombined, "" )
return mw.ustring.toNFC( cleanup )
end -- Text.removeDiacritics()
Text.sentenceTerminated = function ( analyse )
-- Is string terminated by dot, question or exclamation mark?
-- Quotation, link termination and so on granted
-- Parameter:
-- analyse -- string
-- Returns: true, if sentence terminated
local r
if not PatternTerminated then
PatternTerminated = mw.ustring.char( 91,
12290,
65281,
65294,
65311 )
.. "!%.%?…][\"'%]‹›«»‘’“”]*$"
end
if mw.ustring.find( analyse, PatternTerminated ) then
r = true
else
r = false
end
return r
end -- Text.sentenceTerminated()
Text.ucfirstAll = function ( adjust)
-- Capitalize all words
-- Arguments:
-- adjust = string to adjust
-- Returns: string with all first letters in upper case
adjust = adjust and tostring(adjust) or ""
local r = mw.text.decode(adjust,true)
local i = 1
local c, j, m
m = (r ~= adjust)
r = " "..r
while i do
i = mw.ustring.find( r, "%W%l", i )
if i then
j = i + 1
c = mw.ustring.upper( mw.ustring.sub( r, j, j ) )
r = string.format( "%s%s%s",
mw.ustring.sub( r, 1, i ),
c,
mw.ustring.sub( r, i + 2 ) )
i = j
end
end -- while i
r = r:sub( 2 )
if m then
r = mw.text.encode(r)
end
return r
end -- Text.ucfirstAll()
Text.uprightNonlatin = function ( adjust )
-- Ensure non-italics for non-latin text parts
-- One single greek letter might be granted
-- Precondition:
-- adjust -- string
-- Returns: string with non-latin parts enclosed in <span>
local r
initLatinData()
if mw.ustring.match( adjust, PatternLatin ) then
-- latin only, horizontal dashes, quotes
r = adjust
else
local c
local j = false
local k = 1
local m = false
local n = mw.ustring.len( adjust )
local span = "%s%s<span dir='auto' style='font-style:normal'>%s</span>"
local flat = function ( a )
-- isLatin
local range
for i = 1, #RangesLatin do
range = RangesLatin[ i ]
if a >= range[ 1 ] and a <= range[ 2 ] then
return true
end
end -- for i
end -- flat()
local focus = function ( a )
-- char is not ambivalent
local r = ( a > 64 )
if r then
r = ( a < 8192 or a > 8212 )
else
r = ( a == 38 or a == 60 ) -- '&' '<'
end
return r
end -- focus()
local form = function ( a )
return string.format( span,
r,
mw.ustring.sub( adjust, k, j - 1 ),
mw.ustring.sub( adjust, j, a ) )
end -- form()
r = ""
for i = 1, n do
c = mw.ustring.codepoint( adjust, i, i )
if focus( c ) then
if flat( c ) then
if j then
if m then
if i == m then
-- single greek letter.
j = false
end
m = false
end
if j then
local nx = i - 1
local s = ""
for ix = nx, 1, -1 do
c = mw.ustring.sub( adjust, ix, ix )
if c == " " or c == "(" then
nx = nx - 1
s = c .. s
else
break -- for ix
end
end -- for ix
r = form( nx ) .. s
j = false
k = i
end
end
elseif not j then
j = i
if c >= 880 and c <= 1023 then
-- single greek letter?
m = i + 1
else
m = false
end
end
elseif m then
m = m + 1
end
end -- for i
if j and ( not m or m < n ) then
r = form( n )
else
r = r .. mw.ustring.sub( adjust, k )
end
end
return r
end -- Text.uprightNonlatin()
Text.test = function ( about )
local r
if about == "quote" then
initQuoteData()
r = { }
r.QuoteLang = QuoteLang
r.QuoteType = QuoteType
end
return r
end -- Text.test()
-- Export
local p = { }
for _, func in ipairs({'containsCJK','isLatinRange','isQuote','sentenceTerminated'}) do
p[func] = function (frame)
return Text[func]( frame.args[ 1 ] or "" ) and "1" or ""
end
end
for _, func in ipairs({'getPlain','removeDiacritics','ucfirstAll','uprightNonlatin'}) do
p[func] = function (frame)
return Text[func]( frame.args[ 1 ] or "" )
end
end
function p.char( frame )
local params = frame:getParent().args
local story = params[ 1 ]
local codes, lenient, multiple
if not story then
params = frame.args
story = params[ 1 ]
end
if story then
local items = mw.text.split( mw.text.trim(story), "%s+" )
if #items > 0 then
local j
lenient = (yesNo(params.errors) == false)
codes = { }
multiple = tonumber( params[ "*" ] )
for _, v in ipairs( items ) do
j = tonumber((v:sub( 1, 1 ) == "x" and "0" or "") .. v)
table.insert( codes, j or v )
end
end
end
return Text.char( codes, multiple, lenient )
end
function p.concatParams( frame )
local args
local template = frame.args.template
if type( template ) == "string" then
template = mw.text.trim( template )
template = ( template == "1" )
end
if template then
args = frame:getParent().args
else
args = frame.args
end
return Text.concatParams( args,
frame.args.separator,
frame.args.format )
end
function p.listToFormat(frame)
local lists = {}
local pformat = frame.args["format"]
local sep = frame.args["sep"] or ";"
-- Parameter parsen: Listen
for k, v in pairs(frame.args) do
local knum = tonumber(k)
if knum then lists[knum] = v end
end
-- Listen splitten
local maxListLen = 0
for i = 1, #lists do
lists[i] = mw.text.split(lists[i], sep)
if #lists[i] > maxListLen then maxListLen = #lists[i] end
end
-- Ergebnisstring generieren
local result = ""
local result_line = ""
for i = 1, maxListLen do
result_line = pformat
for j = 1, #lists do
result_line = mw.ustring.gsub(result_line, "%%s", lists[j][i], 1)
end
result = result .. result_line
end
return result
end
function p.listToText( frame )
local args
local template = frame.args.template
if type( template ) == "string" then
template = mw.text.trim( template )
template = ( template == "1" )
end
if template then
args = frame:getParent().args
else
args = frame.args
end
return Text.listToText( args, frame.args.format )
end
function p.quote( frame )
local slang = frame.args[2]
if type( slang ) == "string" then
slang = mw.text.trim( slang )
if slang == "" then
slang = false
end
end
return Text.quote( frame.args[ 1 ] or "",
slang,
tonumber( frame.args[3] ) )
end
function p.quoteUnquoted( frame )
local slang = frame.args[2]
if type( slang ) == "string" then
slang = mw.text.trim( slang )
if slang == "" then
slang = false
end
end
return Text.quoteUnquoted( frame.args[ 1 ] or "",
slang,
tonumber( frame.args[3] ) )
end
function p.zip(frame)
local lists = {}
local seps = {}
local defaultsep = frame.args["sep"] or ""
local innersep = frame.args["isep"] or ""
local outersep = frame.args["osep"] or ""
-- Parameter parsen
for k, v in pairs(frame.args) do
local knum = tonumber(k)
if knum then lists[knum] = v else
if string.sub(k, 1, 3) == "sep" then
local sepnum = tonumber(string.sub(k, 4))
if sepnum then seps[sepnum] = v end
end
end
end
-- sofern keine expliziten Separatoren angegeben sind, den Standardseparator verwenden
for i = 1, math.max(#seps, #lists) do
if not seps[i] then seps[i] = defaultsep end
end
-- Listen splitten
local maxListLen = 0
for i = 1, #lists do
lists[i] = mw.text.split(lists[i], seps[i])
if #lists[i] > maxListLen then maxListLen = #lists[i] end
end
local result = ""
for i = 1, maxListLen do
if i ~= 1 then result = result .. outersep end
for j = 1, #lists do
if j ~= 1 then result = result .. innersep end
result = result .. (lists[j][i] or "")
end
end
return result
end
function p.failsafe()
return Text.serial
end
p.Text = function ()
return Text
end -- p.Text
return p
07f1fc4d39342fd92bdae1c5463bbfede7eeda1a
Template:Para
10
115
221
2022-07-22T08:06:17Z
wikipedia>TheDJ
0
breakup super long words, so we do not overflow the viewport.
wikitext
text/x-wiki
<code class="tpl-para" style="word-break:break-word;{{SAFESUBST:<noinclude />#if:{{{plain|}}}|border: none; background-color: inherit;}} {{SAFESUBST:<noinclude />#if:{{{plain|}}}{{{mxt|}}}{{{green|}}}{{{!mxt|}}}{{{red|}}}|color: {{SAFESUBST:<noinclude />#if:{{{mxt|}}}{{{green|}}}|#006400|{{SAFESUBST:<noinclude />#if:{{{!mxt|}}}{{{red|}}}|#8B0000|inherit}}}};}} {{SAFESUBST:<noinclude />#if:{{{style|}}}|{{{style}}}}}">|{{SAFESUBST:<noinclude />#if:{{{1|}}}|{{{1}}}=}}{{{2|}}}</code><noinclude>
{{Documentation}}
<!--Categories and interwikis go near the bottom of the /doc subpage.-->
</noinclude>
06006deea2ed5d552aab61b4332321ab749ae7e8
Module:ISO 3166/data/National
828
163
317
2022-07-28T05:06:29Z
wikipedia>Paine Ellsworth
0
per edit request on talk page - include "U.S." initialism
Scribunto
text/plain
return {
["AD"] = {alpha3="AND",numeric="020",name="Andorra"},
["AE"] = {alpha3="ARE",numeric="784",name="United Arab Emirates",altnames={"UAE"}},
["AF"] = {alpha3="AFG",numeric="004",name="Afghanistan"},
["AG"] = {alpha3="ATG",numeric="028",name="Antigua and Barbuda"},
["AI"] = {alpha3="AIA",numeric="660",name="Anguilla"},
["AL"] = {alpha3="ALB",numeric="008",name="Albania"},
["AM"] = {alpha3="ARM",numeric="051",name="Armenia"},
["AO"] = {alpha3="AGO",numeric="024",name="Angola"},
["AQ"] = {alpha3="ATA",numeric="010",name="Antarctica"},
["AR"] = {alpha3="ARG",numeric="032",name="Argentina"},
["AS"] = {alpha3="ASM",numeric="016",name="American Samoa"},
["AT"] = {alpha3="AUT",numeric="040",name="Austria"},
["AU"] = {alpha3="AUS",numeric="036",name="Australia"},
["AW"] = {alpha3="ABW",numeric="533",name="Aruba"},
["AX"] = {alpha3="ALA",numeric="248",name="Åland Islands",altnames={"Aland Islands","Åland","Aland"}},
["AZ"] = {alpha3="AZE",numeric="031",name="Azerbaijan"},
["BA"] = {alpha3="BIH",numeric="070",name="Bosnia and Herzegovina",altnames={"Bosnia"}},
["BB"] = {alpha3="BRB",numeric="052",name="Barbados"},
["BD"] = {alpha3="BGD",numeric="050",name="Bangladesh"},
["BE"] = {alpha3="BEL",numeric="056",name="Belgium"},
["BF"] = {alpha3="BFA",numeric="854",name="Burkina Faso"},
["BG"] = {alpha3="BGR",numeric="100",name="Bulgaria"},
["BH"] = {alpha3="BHR",numeric="048",name="Bahrain"},
["BI"] = {alpha3="BDI",numeric="108",name="Burundi"},
["BJ"] = {alpha3="BEN",numeric="204",name="Benin"},
["BL"] = {alpha3="BLM",numeric="652",name="Saint Barthélemy",altnames={"St Barthelemy"}},
["BM"] = {alpha3="BMU",numeric="060",name="Bermuda"},
["BN"] = {alpha3="BRN",numeric="096",name="Brunei",isoname="Brunei Darussalam"},
["BO"] = {alpha3="BOL",numeric="068",name="Bolivia",isoname="Bolivia (Plurinational State of)"},
["BQ"] = {alpha3="BES",numeric="535",name="Caribbean Netherlands",isoname="Bonaire, Sint Eustatius and Saba"},
["BR"] = {alpha3="BRA",numeric="076",name="Brazil"},
["BS"] = {alpha3="BHS",numeric="044",name="Bahamas"},
["BT"] = {alpha3="BTN",numeric="064",name="Bhutan"},
["BV"] = {alpha3="BVT",numeric="074",name="Bouvet Island"},
["BW"] = {alpha3="BWA",numeric="072",name="Botswana"},
["BY"] = {alpha3="BLR",numeric="112",name="Belarus"},
["BZ"] = {alpha3="BLZ",numeric="084",name="Belize"},
["CA"] = {alpha3="CAN",numeric="124",name="Canada"},
["CC"] = {alpha3="CCK",numeric="166",name="Cocos (Keeling) Islands",altnames={"Cocos Islands","Keeling Islands"}},
["CD"] = {alpha3="COD",numeric="180",name="Democratic Republic of the Congo",isoname="Congo, Democratic Republic of the",altnames={"Congo-Kinshasa","DRC","DR Congo"}},
["CF"] = {alpha3="CAF",numeric="140",name="Central African Republic",altnames={"CAR"}},
["CG"] = {alpha3="COG",numeric="178",name="Republic of the Congo",isoname="Congo",altnames={"Congo-Brazzaville"}},
["CH"] = {alpha3="CHE",numeric="756",name="Switzerland"},
["CI"] = {alpha3="CIV",numeric="384",name="Côte d'Ivoire",altnames={"Ivory Coast"}},
["CK"] = {alpha3="COK",numeric="184",name="Cook Islands"},
["CL"] = {alpha3="CHL",numeric="152",name="Chile"},
["CM"] = {alpha3="CMR",numeric="120",name="Cameroon"},
["CN"] = {alpha3="CHN",numeric="156",name="China",altnames={"People's Republic of China","PRC"}},
["CO"] = {alpha3="COL",numeric="170",name="Colombia"},
["CR"] = {alpha3="CRI",numeric="188",name="Costa Rica"},
["CU"] = {alpha3="CUB",numeric="192",name="Cuba"},
["CV"] = {alpha3="CPV",numeric="132",name="Cabo Verde",altnames={"Cape Verde"}},
["CW"] = {alpha3="CUW",numeric="531",name="Curaçao",altnames={"Curacao"}},
["CX"] = {alpha3="CXR",numeric="162",name="Christmas Island"},
["CY"] = {alpha3="CYP",numeric="196",name="Cyprus"},
["CZ"] = {alpha3="CZE",numeric="203",name="Czech Republic",isoname="Czechia"},
["DE"] = {alpha3="DEU",numeric="276",name="Germany"},
["DJ"] = {alpha3="DJI",numeric="262",name="Djibouti"},
["DK"] = {alpha3="DNK",numeric="208",name="Denmark"},
["DM"] = {alpha3="DMA",numeric="212",name="Dominica"},
["DO"] = {alpha3="DOM",numeric="214",name="Dominican Republic"},
["DZ"] = {alpha3="DZA",numeric="012",name="Algeria"},
["EC"] = {alpha3="ECU",numeric="218",name="Ecuador"},
["EE"] = {alpha3="EST",numeric="233",name="Estonia"},
["EG"] = {alpha3="EGY",numeric="818",name="Egypt"},
["EH"] = {alpha3="ESH",numeric="732",name="Western Sahara"},
["ER"] = {alpha3="ERI",numeric="232",name="Eritrea"},
["ES"] = {alpha3="ESP",numeric="724",name="Spain"},
["ET"] = {alpha3="ETH",numeric="231",name="Ethiopia"},
["FI"] = {alpha3="FIN",numeric="246",name="Finland"},
["FJ"] = {alpha3="FJI",numeric="242",name="Fiji"},
["FK"] = {alpha3="FLK",numeric="238",name="Falkland Islands",isoname="Falkland Islands (Malvinas)",altnames={"Falklands","Islas Malvinas","Malvinas","Malvinas Islands"}},
["FM"] = {alpha3="FSM",numeric="583",name="Federated States of Micronesia",isoname="Micronesia (Federated States of)",altnames={"Micronesia"}},
["FO"] = {alpha3="FRO",numeric="234",name="Faroe Islands",altnames={"Faroer","Faeroer"}},
["FR"] = {alpha3="FRA",numeric="250",name="France"},
["GA"] = {alpha3="GAB",numeric="266",name="Gabon"},
["GB"] = {alpha3="GBR",numeric="826",name="United Kingdom",isoname="United Kingdom of Great Britain and Northern Ireland",altnames={"UK","Great Britain"}},
["GB-ENG"] = {alpha3="ENG",numeric="000",name="England"}, --Considered to be a country
["GB-NIR"] = {alpha3="NIR",numeric="000",name="Northern Ireland"}, --Considered to be a country
["GB-SCT"] = {alpha3="SCT",numeric="000",name="Scotland"}, --Considered to be a country
["GB-WLS"] = {alpha3="WLS",numeric="000",name="Wales"}, --Considered to be a country
["GB-EAW"] = {alpha3="EAW",numeric="000",name="England and Wales"}, --Considered to be a country
["GD"] = {alpha3="GRD",numeric="308",name="Grenada"},
["GE"] = {alpha3="GEO",numeric="268",name="Georgia"},
["GF"] = {alpha3="GUF",numeric="254",name="French Guiana"},
["GG"] = {alpha3="GGY",numeric="831",name="Guernsey"},
["GH"] = {alpha3="GHA",numeric="288",name="Ghana"},
["GI"] = {alpha3="GIB",numeric="292",name="Gibraltar"},
["GL"] = {alpha3="GRL",numeric="304",name="Greenland"},
["GM"] = {alpha3="GMB",numeric="270",name="Gambia"},
["GN"] = {alpha3="GIN",numeric="324",name="Guinea"},
["GP"] = {alpha3="GLP",numeric="312",name="Guadeloupe"},
["GQ"] = {alpha3="GNQ",numeric="226",name="Equatorial Guinea"},
["GR"] = {alpha3="GRC",numeric="300",name="Greece"},
["GS"] = {alpha3="SGS",numeric="239",name="South Georgia and the South Sandwich Islands"},
["GT"] = {alpha3="GTM",numeric="320",name="Guatemala"},
["GU"] = {alpha3="GUM",numeric="316",name="Guam"},
["GW"] = {alpha3="GNB",numeric="624",name="Guinea-Bissau"},
["GY"] = {alpha3="GUY",numeric="328",name="Guyana"},
["HK"] = {alpha3="HKG",numeric="344",name="Hong Kong",altnames={"Hong Kong SAR","HKSAR"}},
["HM"] = {alpha3="HMD",numeric="334",name="Heard Island and McDonald Islands",altnames={"Heard and McDonald Islands"}},
["HN"] = {alpha3="HND",numeric="340",name="Honduras"},
["HR"] = {alpha3="HRV",numeric="191",name="Croatia"},
["HT"] = {alpha3="HTI",numeric="332",name="Haiti"},
["HU"] = {alpha3="HUN",numeric="348",name="Hungary"},
["ID"] = {alpha3="IDN",numeric="360",name="Indonesia"},
["IE"] = {alpha3="IRL",numeric="372",name="Ireland",altnames={"Republic of Ireland"}},
["IL"] = {alpha3="ISR",numeric="376",name="Israel"},
["IM"] = {alpha3="IMN",numeric="833",name="Isle of Man"},
["IN"] = {alpha3="IND",numeric="356",name="India"},
["IO"] = {alpha3="IOT",numeric="086",name="British Indian Ocean Territory"},
["IQ"] = {alpha3="IRQ",numeric="368",name="Iraq"},
["IR"] = {alpha3="IRN",numeric="364",name="Iran",isoname="Iran (Islamic Republic of)"},
["IS"] = {alpha3="ISL",numeric="352",name="Iceland"},
["IT"] = {alpha3="ITA",numeric="380",name="Italy"},
["JE"] = {alpha3="JEY",numeric="832",name="Jersey"},
["JM"] = {alpha3="JAM",numeric="388",name="Jamaica"},
["JO"] = {alpha3="JOR",numeric="400",name="Jordan"},
["JP"] = {alpha3="JPN",numeric="392",name="Japan"},
["KE"] = {alpha3="KEN",numeric="404",name="Kenya"},
["KG"] = {alpha3="KGZ",numeric="417",name="Kyrgyzstan"},
["KH"] = {alpha3="KHM",numeric="116",name="Cambodia"},
["KI"] = {alpha3="KIR",numeric="296",name="Kiribati"},
["KM"] = {alpha3="COM",numeric="174",name="Comoros"},
["KN"] = {alpha3="KNA",numeric="659",name="Saint Kitts and Nevis",altnames={"St Kitts and Nevis"}},
["KP"] = {alpha3="PRK",numeric="408",name="North Korea",isoname="Korea (Democratic People's Republic of)",altnames={"Democratic People's Republic of Korea"}},
["KR"] = {alpha3="KOR",numeric="410",name="South Korea",isoname="Korea, Republic of",altnames={"Republic of Korea"}},
["KW"] = {alpha3="KWT",numeric="414",name="Kuwait"},
["KY"] = {alpha3="CYM",numeric="136",name="Cayman Islands"},
["KZ"] = {alpha3="KAZ",numeric="398",name="Kazakhstan"},
["LA"] = {alpha3="LAO",numeric="418",name="Laos",isoname="Lao People's Democratic Republic"},
["LB"] = {alpha3="LBN",numeric="422",name="Lebanon"},
["LC"] = {alpha3="LCA",numeric="662",name="Saint Lucia",altnames={"St Lucia"}},
["LI"] = {alpha3="LIE",numeric="438",name="Liechtenstein"},
["LK"] = {alpha3="LKA",numeric="144",name="Sri Lanka"},
["LR"] = {alpha3="LBR",numeric="430",name="Liberia"},
["LS"] = {alpha3="LSO",numeric="426",name="Lesotho"},
["LT"] = {alpha3="LTU",numeric="440",name="Lithuania"},
["LU"] = {alpha3="LUX",numeric="442",name="Luxembourg"},
["LV"] = {alpha3="LVA",numeric="428",name="Latvia"},
["LY"] = {alpha3="LBY",numeric="434",name="Libya"},
["MA"] = {alpha3="MAR",numeric="504",name="Morocco"},
["MC"] = {alpha3="MCO",numeric="492",name="Monaco"},
["MD"] = {alpha3="MDA",numeric="498",name="Moldova",isoname="Moldova, Republic of"},
["ME"] = {alpha3="MNE",numeric="499",name="Montenegro"},
["MF"] = {alpha3="MAF",numeric="663",name="Saint-Martin",isoname="Saint Martin (French part)",altnames={"St Martin","St Martin (French part)","Collectivity of Saint Martin","Collectivity of St Martin"}},
["MG"] = {alpha3="MDG",numeric="450",name="Madagascar"},
["MH"] = {alpha3="MHL",numeric="584",name="Marshall Islands"},
["MK"] = {alpha3="MKD",numeric="807",name="North Macedonia",altnames={"Republic of North Macedonia","Macedonia","Republic of Macedonia","Macedonia, the former Yugoslav Republic of"}},
["ML"] = {alpha3="MLI",numeric="466",name="Mali"},
["MM"] = {alpha3="MMR",numeric="104",name="Myanmar",altnames={"Burma"}},
["MN"] = {alpha3="MNG",numeric="496",name="Mongolia"},
["MO"] = {alpha3="MAC",numeric="446",name="Macau",isoname="Macao",altnames={"Macau SAR","Macao SAR"}},
["MP"] = {alpha3="MNP",numeric="580",name="Northern Mariana Islands"},
["MQ"] = {alpha3="MTQ",numeric="474",name="Martinique"},
["MR"] = {alpha3="MRT",numeric="478",name="Mauritania"},
["MS"] = {alpha3="MSR",numeric="500",name="Montserrat"},
["MT"] = {alpha3="MLT",numeric="470",name="Malta"},
["MU"] = {alpha3="MUS",numeric="480",name="Mauritius"},
["MV"] = {alpha3="MDV",numeric="462",name="Maldives"},
["MW"] = {alpha3="MWI",numeric="454",name="Malawi"},
["MX"] = {alpha3="MEX",numeric="484",name="Mexico"},
["MY"] = {alpha3="MYS",numeric="458",name="Malaysia"},
["MZ"] = {alpha3="MOZ",numeric="508",name="Mozambique"},
["NA"] = {alpha3="NAM",numeric="516",name="Namibia"},
["NC"] = {alpha3="NCL",numeric="540",name="New Caledonia"},
["NE"] = {alpha3="NER",numeric="562",name="Niger"},
["NF"] = {alpha3="NFK",numeric="574",name="Norfolk Island"},
["NG"] = {alpha3="NGA",numeric="566",name="Nigeria"},
["NI"] = {alpha3="NIC",numeric="558",name="Nicaragua"},
["NL"] = {alpha3="NLD",numeric="528",name="Netherlands"},
["NO"] = {alpha3="NOR",numeric="578",name="Norway"},
["NP"] = {alpha3="NPL",numeric="524",name="Nepal"},
["NR"] = {alpha3="NRU",numeric="520",name="Nauru"},
["NU"] = {alpha3="NIU",numeric="570",name="Niue"},
["NZ"] = {alpha3="NZL",numeric="554",name="New Zealand",altnames={"Aotearoa"}},
["OM"] = {alpha3="OMN",numeric="512",name="Oman"},
["PA"] = {alpha3="PAN",numeric="591",name="Panama"},
["PE"] = {alpha3="PER",numeric="604",name="Peru"},
["PF"] = {alpha3="PYF",numeric="258",name="French Polynesia"},
["PG"] = {alpha3="PNG",numeric="598",name="Papua New Guinea"},
["PH"] = {alpha3="PHL",numeric="608",name="Philippines"},
["PK"] = {alpha3="PAK",numeric="586",name="Pakistan"},
["PL"] = {alpha3="POL",numeric="616",name="Poland"},
["PM"] = {alpha3="SPM",numeric="666",name="Saint Pierre and Miquelon",altnames={"St Pierre and Miquelon"}},
["PN"] = {alpha3="PCN",numeric="612",name="Pitcairn"},
["PR"] = {alpha3="PRI",numeric="630",name="Puerto Rico"},
["PS"] = {alpha3="PSE",numeric="275",name="Palestine",isoname="Palestine, State of",altnames={"State of Palestine"}},
["PT"] = {alpha3="PRT",numeric="620",name="Portugal"},
["PW"] = {alpha3="PLW",numeric="585",name="Palau"},
["PY"] = {alpha3="PRY",numeric="600",name="Paraguay"},
["QA"] = {alpha3="QAT",numeric="634",name="Qatar"},
["RE"] = {alpha3="REU",numeric="638",name="Réunion"},
["RO"] = {alpha3="ROU",numeric="642",name="Romania"},
["RS"] = {alpha3="SRB",numeric="688",name="Serbia"},
["RU"] = {alpha3="RUS",numeric="643",name="Russia",isoname="Russian Federation"},
["RW"] = {alpha3="RWA",numeric="646",name="Rwanda"},
["SA"] = {alpha3="SAU",numeric="682",name="Saudi Arabia"},
["SB"] = {alpha3="SLB",numeric="090",name="Solomon Islands"},
["SC"] = {alpha3="SYC",numeric="690",name="Seychelles"},
["SD"] = {alpha3="SDN",numeric="729",name="Sudan"},
["SE"] = {alpha3="SWE",numeric="752",name="Sweden"},
["SG"] = {alpha3="SGP",numeric="702",name="Singapore"},
["SH"] = {alpha3="SHN",numeric="654",name="Saint Helena, Ascension and Tristan da Cunha"},
["SI"] = {alpha3="SVN",numeric="705",name="Slovenia"},
["SJ"] = {alpha3="SJM",numeric="744",name="Svalbard and Jan Mayen"},
["SK"] = {alpha3="SVK",numeric="703",name="Slovakia"},
["SL"] = {alpha3="SLE",numeric="694",name="Sierra Leone"},
["SM"] = {alpha3="SMR",numeric="674",name="San Marino"},
["SN"] = {alpha3="SEN",numeric="686",name="Senegal"},
["SO"] = {alpha3="SOM",numeric="706",name="Somalia"},
["SR"] = {alpha3="SUR",numeric="740",name="Suriname"},
["SS"] = {alpha3="SSD",numeric="728",name="South Sudan"},
["ST"] = {alpha3="STP",numeric="678",name="São Tomé and Príncipe",isoname="Sao Tome and Principe",altnames={"Democratic Republic of Sao Tome and Principe"}},
["SV"] = {alpha3="SLV",numeric="222",name="El Salvador"},
["SX"] = {alpha3="SXM",numeric="534",name="Sint Maarten",isoname="Sint Maarten (Dutch part)",altnames={"St Maarten","Saint Martin (Dutch part)","St Martin (Dutch part)"}},
["SY"] = {alpha3="SYR",numeric="760",name="Syria",isoname="Syrian Arab Republic"},
["SZ"] = {alpha3="SWZ",numeric="748",name="Eswatini",altnames={"Swaziland"}},
["TC"] = {alpha3="TCA",numeric="796",name="Turks and Caicos Islands"},
["TD"] = {alpha3="TCD",numeric="148",name="Chad"},
["TF"] = {alpha3="ATF",numeric="260",name="French Southern and Antarctic Lands",isoname="French Southern Territories"},
["TG"] = {alpha3="TGO",numeric="768",name="Togo"},
["TH"] = {alpha3="THA",numeric="764",name="Thailand"},
["TJ"] = {alpha3="TJK",numeric="762",name="Tajikistan"},
["TK"] = {alpha3="TKL",numeric="772",name="Tokelau"},
["TL"] = {alpha3="TLS",numeric="626",name="Timor-Leste",altnames={"East Timor"}},
["TM"] = {alpha3="TKM",numeric="795",name="Turkmenistan"},
["TN"] = {alpha3="TUN",numeric="788",name="Tunisia"},
["TO"] = {alpha3="TON",numeric="776",name="Tonga"},
["TR"] = {alpha3="TUR",numeric="792",name="Turkey",isoname="Türkiye"},
["TT"] = {alpha3="TTO",numeric="780",name="Trinidad and Tobago"},
["TV"] = {alpha3="TUV",numeric="798",name="Tuvalu"},
["TW"] = {alpha3="TWN",numeric="158",name="Taiwan",isoname="Taiwan, Province of China",altnames={"Republic of China"}},
["TZ"] = {alpha3="TZA",numeric="834",name="Tanzania",isoname="Tanzania, United Republic of"},
["UA"] = {alpha3="UKR",numeric="804",name="Ukraine"},
["UG"] = {alpha3="UGA",numeric="800",name="Uganda"},
["UM"] = {alpha3="UMI",numeric="581",name="United States Minor Outlying Islands"},
["US"] = {alpha3="USA",numeric="840",name="United States",isoname="United States of America",altnames={"US","USA","U.S."}},
["UY"] = {alpha3="URY",numeric="858",name="Uruguay"},
["UZ"] = {alpha3="UZB",numeric="860",name="Uzbekistan"},
["VA"] = {alpha3="VAT",numeric="336",name="Vatican City",isoname="Holy See",altnames={"Holy See (Vatican City State)","Vatican City State"}},
["VC"] = {alpha3="VCT",numeric="670",name="Saint Vincent and the Grenadines",altnames={"St Vincent and the Grenadines"}},
["VE"] = {alpha3="VEN",numeric="862",name="Venezuela",isoname="Venezuela (Bolivarian Republic of)"},
["VG"] = {alpha3="VGB",numeric="092",name="British Virgin Islands",isoname="Virgin Islands (British)",altnames={"UK Virgin Islands","BVI"}},
["VI"] = {alpha3="VIR",numeric="850",name="United States Virgin Islands",isoname="Virgin Islands (U.S.)",altnames={"US Virgin Islands","USVI"}},
["VN"] = {alpha3="VNM",numeric="704",name="Vietnam",isoname="Viet Nam"},
["VU"] = {alpha3="VUT",numeric="548",name="Vanuatu"},
["WF"] = {alpha3="WLF",numeric="876",name="Wallis and Futuna"},
["WS"] = {alpha3="WSM",numeric="882",name="Samoa"},
["YE"] = {alpha3="YEM",numeric="887",name="Yemen"},
["YT"] = {alpha3="MYT",numeric="175",name="Mayotte"},
["ZA"] = {alpha3="ZAF",numeric="710",name="South Africa"},
["ZM"] = {alpha3="ZMB",numeric="894",name="Zambia"},
["ZW"] = {alpha3="ZWE",numeric="716",name="Zimbabwe"}
}
1ae753fe1fa53ce062b0a008dbc9778d589666f0
Template:ISO 3166 code
10
161
313
2022-08-09T02:50:13Z
wikipedia>Neveselbert
0
safesubst
wikitext
text/x-wiki
{{safesubst<noinclude/>:#invoke:ISO 3166|code|{{{1}}}|{{{2|}}}}}<noinclude>
{{Documentation|content={{ISO 3166 conversion template doc}}}}
</noinclude>
06f8325798ef5cb3ed4eb035d562ab9f8656cc6c
Template:Country2nationality
10
160
311
2022-08-09T02:51:23Z
wikipedia>Neveselbert
0
safesubst
wikitext
text/x-wiki
<includeonly>{{safesubst<noinclude/>:#ifeq:{{safesubst<noinclude/>:#invoke:String|len|s={{safesubst<noinclude/>:ISO 3166 code|{{{1}}}}}}}|2|{{safesubst<noinclude/>:Iso2nationality| {{safesubst<noinclude/>:ISO 3166 code|{{{1}}}}} }}| {{safesubst<noinclude/>:#if:{{{1|}}}| {{safesubst<noinclude/>:#switch: {{{1}}} | England = English | Scotland = Scottish | Wales = Welsh | Catalonia = Catalan | Kosovo = Kosovan }}}}}}</includeonly><noinclude>
{{documentation}}
</noinclude>
9c6b20fc59b2033477fb4dea0ffd1984bd673368
Module:Find country
828
175
341
2022-08-09T10:48:32Z
wikipedia>Neveselbert
0
'US', 'U.S.',
Scribunto
text/plain
--[[ v1.00
Test the string against the list of countries/continents.
Return the first word which matches a country/continent name ...
unless the "match=" parameter specifies a different match.
If there is no match, then return an empty string ... unless
the "nomatch" parameter specifies something different
]]
local getArgs = require('Module:Arguments').getArgs
local p = {}
-- config
local nomatch = ""
local matchnum = 1
local countryList = {
'South Africa',
'the Central African Republic',
'Central African Republic',
'Africa',
'Antarctica',
'Central Asia',
'South Asia',
'South East Asia',
'Southeast Asia',
'Asia',
'the Caribbean',
'Caribbean',
'Eurasia',
'Europe',
'the Middle East',
'Middle East',
'Central America',
'North America',
'South America',
'Oceania',
'the Americas',
'Afghanistan',
'Albania',
'Algeria',
'American Samoa',
'Andorra',
'Angola',
'Anguilla',
'Antigua and Barbuda',
'Argentina',
'Armenia',
'Aruba',
'Australia',
'the Austrian Empire',
'Austrian Empire',
'Austria-Hungary',
'Austria',
'Azerbaijan',
'the Bahamas',
'Bahamas',
'Bahrain',
'Bangladesh',
'Barbados',
'Belarus',
'Belgium',
'Belize',
'Benin',
'Bermuda',
'Bhutan',
'Bolivia',
'Bosnia and Herzegovina',
'Botswana',
'Brazil',
'Brunei Darussalam',
'Brunei',
'Bulgaria',
'Burkina Faso',
'Burundi',
'Cambodia',
'Cameroon',
'Canada',
'Cape Verde',
'the Cayman Islands',
'Cayman Islands',
'Chad',
'Chile',
"the People's Republic of China",
"People's Republic of China",
'China PR',
'PR China',
'China',
'Colombia',
'Comoros',
'the Republic of the Congo',
'the Democratic Republic of the Congo',
'Democratic Republic of the Congo',
'Congo DR',
'DR Congo',
'DRC',
'the Congo',
'Congo',
'Cook Islands',
'Costa Rica',
'Croatia',
'Cuba',
'Curaçao',
'Curacao',
'Cyprus',
'the Czech Republic',
'Czech Republic',
'Czechia',
'Denmark',
'Djibouti',
'the Dominican Republic',
'Dominican Republic',
'Dominica',
'East Timor',
'Timor-Leste',
'Ecuador',
'Egypt',
'El Salvador',
'England',
'Eritrea',
'Estonia',
'Eswatini',
'Ethiopia',
'the Falkland Islands',
'Falkland Islands',
'the Faroe Islands',
'Faroe Islands',
'Fiji',
'Finland',
'France',
'Gabon',
'the Gambia',
'Gambia',
'Georgia',
'Germany',
'Ghana',
'Gibraltar',
'Great Britain',
'Britain',
'Greece',
'Grenada',
'Guam',
'Guatemala',
'Papua New Guinea',
'Equatorial Guinea',
'Guinea-Bissau',
'Guinea',
'Guyana',
'Haiti',
'Honduras',
'Hong Kong',
'Hungary',
'Iceland',
'India',
'Indonesia',
'Iran',
'Iraq',
'Northern Ireland',
'the Republic of Ireland',
'Republic of Ireland',
'Ireland',
'Israel',
'Italy',
'Ivory Coast',
"Côte d'Ivoire",
'Jamaica',
'Japan',
'Jordan',
'Kazakhstan',
'Kenya',
'Kiribati',
'Kosovo',
'the Republic of Kosovo',
'Republic of Kosovo',
'Kuwait',
'Kyrgyzstan',
'the Kyrgyz Republic',
'Kyrgyz Republic',
"the Lao People's Democratic Republic",
"Lao People's Democratic Republic",
'Laos',
'Latvia',
'Lebanon',
'Lesotho',
'Liberia',
'Libya',
'Liechtenstein',
'Lithuania',
'Luxembourg',
'Macau',
'the Republic of Macedonia',
'Republic of Macedonia',
'North Macedonia',
'Macedonia',
'Madagascar',
'Malawi',
'Malaysia',
'the Maldives',
'Maldives',
'Mali',
'Malta',
'the Marshall Islands',
'Marshall Islands',
'Mauritania',
'Mauritius',
'Mexico',
'the Federated States of Micronesia',
'Federated States of Micronesia',
'Micronesia',
'FSM',
'Moldova',
'Monaco',
'Mongolia',
'Montenegro',
'Montserrat',
'Morocco',
'Mozambique',
'Myanmar',
'Namibia',
'Nauru',
'Nepal',
'the Netherlands',
'Netherlands',
'New Caledonia',
'New Zealand',
'Nicaragua',
'Nigeria',
'Niger',
'North Korea',
"the People's Democratic Republic of Korea",
"the Democratic People's Republic of Korea",
"Democratic People's Republic of Korea",
"People's Democratic Republic of Korea",
'DPR Korea',
'Korea DPR',
'Norway',
'Oman',
'the Ottoman Empire',
'Ottoman Empire',
'Ottoman Egypt',
'Pakistan',
'Palau',
'Mandatory Palestine',
'Palestine',
'the Palestinian territories',
'Palestinian territories',
'Panama',
'Paraguay',
'Peru',
'the Philippines',
'Philippines',
'Poland',
'Portugal',
'Puerto Rico',
'the Spanish Virgin Islands',
'Spanish Virgin Islands',
'Qatar',
'Romania',
'the Russian Empire',
'Russian Empire',
'the Russian Federation',
'Russian Federation',
'Russia',
'Rwanda',
'Saint Kitts and Nevis',
'Saint Lucia',
'Saint Vincent and the Grenadines',
'Western Samoa',
'Samoa',
'San Marino',
'São Tomé and Príncipe',
'São Tomé and Príncipe',
'Sao Tome and Principe',
'Saudi Arabia',
'Scotland',
'Senegal',
'Serbia',
'Seychelles',
'Sierra Leone',
'Singapore',
'Slovakia',
'Slovenia',
'the Solomon Islands',
'Solomon Islands',
'Somalia',
'South Korea',
'the Republic of Korea',
'Korea Republic',
'South Sudan',
'Sudan',
'Spain',
'Sri Lanka',
'Suriname',
'Swaziland',
'Sweden',
'Switzerland',
'Syria',
'Tahiti',
'the Republic of China',
'Republic of China',
'Taiwan',
'Tajikistan',
'Tanzania',
'Thailand',
'Togo',
'Tonga',
'Trinidad and Tobago',
'Trinidad',
'Tobago',
'Tunisia',
'Turkey',
'Turkmenistan',
'Turks and Caicos Islands',
'Tuvalu',
'Uganda',
'Ukraine',
'the United Arab Emirates',
'the UAE',
'the U.A.E.',
'United Arab Emirates',
'UAE',
'U.A.E.',
'the United Kingdom',
'United Kingdom',
'the UK',
'the U.K.',
'UK',
'U.K.',
'the United States of America',
'the United States',
'the USA',
'the U.S.A.',
'United States of America',
'United States',
'US',
'U.S.',
'USA',
'U.S.A.',
'America',
'Uruguay',
'Uzbekistan',
'Vanuatu',
'Venezuela',
'Vietnam',
'the British Virgin Islands',
'British Virgin Islands',
'UK Virgin Islands',
'U.K. Virgin Islands',
'the United States Virgin Islands',
'the US Virgin Islands',
'the U.S. Virgin Islands',
'United States Virgin Islands',
'US Virgin Islands',
'U.S. Virgin Islands',
'the Virgin Islands',
'Virgin Islands',
'Wales',
'Yemen',
'Zambia',
'Zimbabwe',
'Find country/testcases'
}
-- returns the name of a country that is found in the string
-- ... or an empty string if there is no match
function findcountryinstring(str)
nMatches = 0
myMatches ={}
str=" " .. str:gsub("^%s*(.-)%s*$", "%1") .. " "
-- check agaist each country
-- if there is a match, then return that country
for i, thiscountry in ipairs(countryList) do
if mw.ustring.find(str, thiscountry) then
nMatches = nMatches + 1
myMatches[nMatches] = thiscountry
end
end
if (nMatches == 0) then
-- none of the title words matches a whole country
return nomatch
end
if ((matchnum >= 1) and (matchnum <= nMatches)) then
return myMatches[matchnum]
end
if (matchnum < 0) then
matchnum = matchnum + 1 -- so that -1 is the last match etc
if ((matchnum + nMatches) >= 1) then
return myMatches[matchnum + nMatches]
end
end
-- if we get here, we have not found a match at the position specified by "matchnum"
return nomatch
end
function p.main(frame)
local args = getArgs(frame)
return p._main(args)
end
function p._main(args)
if (args['nomatch'] ~= nil) then
nomatch = args['nomatch']
end
-- by default, we return the first match
-- but the optional "C" paarmeter sets the "matchnum" variable, which
-- * for a positive matchnum "n", returns the nth match if it exists
-- * for a positive matchnum "n", returns (if it exists) the nth match
-- counting backwards from the end.
-- So "match=-1" returns the last match
-- and "match=-3" returns the 3rd-last match
if (args['match'] ~= nil) then
matchnum = tonumber(args['match'])
if ((matchnum == nil) or (matchnum == 0)) then
matchnum = 1
end
end
-- by default, we use the current page
-- but if the "string=" parameters is supplied, we use that
-- so we try the parameter first
thispagename = nil
if ((args['string'] ~= nil) and (args['string'] ~= "")) then
-- we have a non-empty "string" parameter, so we use it
thisstring = args['string']
else
-- get the page title
thispage = mw.title.getCurrentTitle()
thisstring = thispage.text;
end
-- now check the pagename to try to find a country
result = findcountryinstring(thisstring)
if (result == "") then
return nomatch
end
return result
end
return p
c15468102dad4b0bd85392d3ecf49bcb6e12c324
Template:Count
10
169
329
2022-08-11T14:32:42Z
wikipedia>Neveselbert
0
cr.
wikitext
text/x-wiki
{{safesubst<noinclude/>:#ifexpr:{{safesubst<noinclude/>:#invoke:ParameterCount|main|pattern1=^[%d]+$}}>0|{{safesubst<noinclude/>:#invoke:ParameterCount|main|pattern1=^[%d]+$}}|{{{base|0}}}}}<noinclude>{{documentation}}</noinclude>
ccdb0aa784669ceae716044a9267ac7c4dea7283
Template:Fix
10
43
79
2022-08-19T21:02:28Z
wikipedia>Izno
0
per request
wikitext
text/x-wiki
{{#switch:{{{subst|¬}}}
|¬={{category handler
|template=[[Category:Templates needing substitution checking]]
|nocat={{{nocat|<noinclude>true</noinclude>}}}
}}
|SUBST=[[Category:Pages with incorrectly substituted templates]]
}}{{Category handler
|main={{Fix/category
|cat-date={{{cat-date|}}}
|cat={{{cat|}}}
|cat-date2={{{cat-date2|}}}
|cat2={{{cat2|}}}
|cat-date3={{{cat-date3|}}}
|cat3={{{cat3|}}}
|date={{{date|}}}
}}
|template={{#if:{{{name|}}}|{{#ifeq:{{{name}}}|{{ROOTPAGENAME}}||{{#if:{{{date|}}}||[[Category:Templates including undated clean-up tags]]}}}}}}
|subpage=no
}}{{#if:{{{text|}}}
|<sup class="noprint Inline-Template {{{class|}}}" style="white-space:nowrap;">[<i>{{#if:{{{pre-text|}}}
|{{{pre-text}}} 
}}[[{{{link|Wikipedia:Cleanup}}}|<span title="{{#invoke:string|replace|source={{delink|1={{{title|{{{link|Wikipedia:Cleanup}}}}}}{{#if:{{{date|}}}| ({{{date}}})}}}}|pattern=" |replace=" |plain=true}}">{{{text|}}}</span>]]{{#if:{{{post-text|}}}
| {{{post-text}}}
}}</i>]</sup>|{{{special|}}}
}}<noinclude>
{{Documentation}}
<!-- Add cats and interwikis to the /doc subpage, not here! -->
</noinclude>
64d5219edf0f07567b3006bfc9681f9408b164b0
Template:Collapse bottom
10
165
321
2022-08-21T18:03:39Z
wikipedia>MSGJ
0
Undid revision 1105766128 by [[Special:Contributions/MSGJ|MSGJ]] ([[User talk:MSGJ|talk]]) - did not work
wikitext
text/x-wiki
<includeonly>|}</div></includeonly><noinclude>
{{Documentation|Template:Collapse top/doc}}
<!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS -->
</noinclude>
64b210e8ab0882b262da50e9fbccf2132bc34fab
Template:Post-nominals
10
251
494
2022-09-04T00:10:43Z
wikipedia>Pppery
0
Add tracking cat per edit request
wikitext
text/x-wiki
<span class="noexcerpt nowraplinks" style="font-size:{{{size|85%}}}; font-weight:normal;"><!--
-->{{if empty|{{{unlinked|}}}|{{{list|}}}|{{{post-noms|}}}|{{for loop|{{#if:{{{sep|}}}{{{commas|}}}|<span style="font-size:14px;>,</span>}} |call=post-nominals/{{{country|CAN}}}|{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|{{{7|}}}|{{{8|}}}|{{{9|}}}|{{{10|}}}|{{{11|}}}|{{{12|}}}|{{{13|}}}|{{{14|}}}|{{{15|}}}|{{{16|}}}|{{{17|}}}|{{{18|}}}|{{{19|}}}|{{{20|}}}|skipBlanks=yes}}}}<!--
--></span><!--
-->{{#if:{{{country|{{{unlinked|{{{list|{{{post-noms|<noinclude>1</noinclude>}}}}}}}}}}}}||[[Category:Pages using Template:Post-nominals with missing parameters]]}}<!--
-->{{#if:{{{unlinked|{{{list|{{{post-noms|}}}}}}}}}|[[Category:Pages using Template:Post-nominals with customized linking]]
}}<noinclude>{{Documentation}}</noinclude>
2b89288bd9d53136ad548b8a601c1bf4f69e8daf
Module:Hatnote
828
62
117
2022-09-05T18:18:32Z
wikipedia>Nihiltres
0
Reordered helper functions (first by export status, then alphabetically) and migrated p.quote upstream from [[Module:Redirect hatnote]] (includes contributions by Tamzin and Nihiltres)
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Module:Hatnote --
-- --
-- This module produces hatnote links and links to related articles. It --
-- implements the {{hatnote}} and {{format link}} meta-templates and includes --
-- helper functions for other Lua hatnote modules. --
--------------------------------------------------------------------------------
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg
local mArguments -- lazily initialise [[Module:Arguments]]
local yesno -- lazily initialise [[Module:Yesno]]
local formatLink -- lazily initialise [[Module:Format link]] ._formatLink
local p = {}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function getArgs(frame)
-- Fetches the arguments from the parent frame. Whitespace is trimmed and
-- blanks are removed.
mArguments = require('Module:Arguments')
return mArguments.getArgs(frame, {parentOnly = true})
end
local function removeInitialColon(s)
-- Removes the initial colon from a string, if present.
return s:match('^:?(.*)')
end
function p.defaultClasses(inline)
-- Provides the default hatnote classes as a space-separated string; useful
-- for hatnote-manipulation modules like [[Module:Hatnote group]].
return
(inline == 1 and 'hatnote-inline' or 'hatnote') .. ' ' ..
'navigation-not-searchable'
end
function p.disambiguate(page, disambiguator)
-- Formats a page title with a disambiguation parenthetical,
-- i.e. "Example" → "Example (disambiguation)".
checkType('disambiguate', 1, page, 'string')
checkType('disambiguate', 2, disambiguator, 'string', true)
disambiguator = disambiguator or 'disambiguation'
return mw.ustring.format('%s (%s)', page, disambiguator)
end
function p.findNamespaceId(link, removeColon)
-- Finds the namespace id (namespace number) of a link or a pagename. This
-- function will not work if the link is enclosed in double brackets. Colons
-- are trimmed from the start of the link by default. To skip colon
-- trimming, set the removeColon parameter to false.
checkType('findNamespaceId', 1, link, 'string')
checkType('findNamespaceId', 2, removeColon, 'boolean', true)
if removeColon ~= false then
link = removeInitialColon(link)
end
local namespace = link:match('^(.-):')
if namespace then
local nsTable = mw.site.namespaces[namespace]
if nsTable then
return nsTable.id
end
end
return 0
end
function p.makeWikitextError(msg, helpLink, addTrackingCategory, title)
-- Formats an error message to be returned to wikitext. If
-- addTrackingCategory is not false after being returned from
-- [[Module:Yesno]], and if we are not on a talk page, a tracking category
-- is added.
checkType('makeWikitextError', 1, msg, 'string')
checkType('makeWikitextError', 2, helpLink, 'string', true)
yesno = require('Module:Yesno')
title = title or mw.title.getCurrentTitle()
-- Make the help link text.
local helpText
if helpLink then
helpText = ' ([[' .. helpLink .. '|help]])'
else
helpText = ''
end
-- Make the category text.
local category
if not title.isTalkPage -- Don't categorise talk pages
and title.namespace ~= 2 -- Don't categorise userspace
and yesno(addTrackingCategory) ~= false -- Allow opting out
then
category = 'Hatnote templates with errors'
category = mw.ustring.format(
'[[%s:%s]]',
mw.site.namespaces[14].name,
category
)
else
category = ''
end
return mw.ustring.format(
'<strong class="error">Error: %s%s.</strong>%s',
msg,
helpText,
category
)
end
local curNs = mw.title.getCurrentTitle().namespace
p.missingTargetCat =
--Default missing target category, exported for use in related modules
((curNs == 0) or (curNs == 14)) and
'Articles with hatnote templates targeting a nonexistent page' or nil
function p.quote(title)
--Wraps titles in quotation marks. If the title starts/ends with a quotation
--mark, kerns that side as with {{-'}}
local quotationMarks = {
["'"]=true, ['"']=true, ['“']=true, ["‘"]=true, ['”']=true, ["’"]=true
}
local quoteLeft, quoteRight = -- Test if start/end are quotation marks
quotationMarks[string.sub(title, 1, 1)],
quotationMarks[string.sub(title, -1, -1)]
if quoteLeft or quoteRight then
title = mw.html.create("span"):wikitext(title)
end
if quoteLeft then title:css("padding-left", "0.15em") end
if quoteRight then title:css("padding-right", "0.15em") end
return '"' .. tostring(title) .. '"'
end
--------------------------------------------------------------------------------
-- Hatnote
--
-- Produces standard hatnote text. Implements the {{hatnote}} template.
--------------------------------------------------------------------------------
function p.hatnote(frame)
local args = getArgs(frame)
local s = args[1]
if not s then
return p.makeWikitextError(
'no text specified',
'Template:Hatnote#Errors',
args.category
)
end
return p._hatnote(s, {
extraclasses = args.extraclasses,
selfref = args.selfref
})
end
function p._hatnote(s, options)
checkType('_hatnote', 1, s, 'string')
checkType('_hatnote', 2, options, 'table', true)
options = options or {}
local inline = options.inline
local hatnote = mw.html.create(inline == 1 and 'span' or 'div')
local extraclasses
if type(options.extraclasses) == 'string' then
extraclasses = options.extraclasses
end
hatnote
:attr('role', 'note')
:addClass(p.defaultClasses(inline))
:addClass(extraclasses)
:addClass(options.selfref and 'selfref' or nil)
:wikitext(s)
return mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Module:Hatnote/styles.css' }
} .. tostring(hatnote)
end
return p
3ae1ed7094c5005ca0896395ec9a587287a0bef1
Template:Infobox mapframe/doc/parameters
10
288
568
2022-09-08T16:19:59Z
wikipedia>Dinoguy1000
0
use the "style=" parameter on {{Navbar}} instead of the weird {{Float}} template
wikitext
text/x-wiki
<noinclude>{{Documentation}}</noinclude><includeonly>{{navbar|Template:Infobox mapframe/doc/parameters|plain=y|style=float: right;}}</includeonly><nowiki></nowiki>
*Basic parameters:{{#if:{{{noprefix|}}}||<nowiki></nowiki>
**'''mapframe''' – Specify yes or no to show or hide the map, overriding the default. ''Default:'' {{{mapframe|no}}}
**'''mapframe-caption''' – Caption for the map. ''Default'': {{{mapframe-caption|''blank'' (or if {{para|mapframe-geomask}} is set, "Location in {{kbd|geomask's label}}")}}}
**'''mapframe-custom''' – Use a custom map instead of the automatic mapframe. Specify either a {{tlx|maplink}} template, or another template that generates a mapframe map, or an image name. If used, the subsequent mapframe parameters will be ignored. ''Default'': ''not specified''}}
**{{#if:{{{noprefix|}}}|'''id'''|'''mapframe-id''' or '''id''' or '''qid'''}} – Id (Q-number) of Wikidata item to use. ''Default:'' ''item for current page''
**{{#if:{{{noprefix|}}}||'''mapframe-coordinates''' or '''mapframe-coord''' or}} '''coordinates''' or '''coord''' – Coordinates to use, instead of any on Wikidata. Use the {{tl|Coord}} template, e.g. {{para|coord|2={{tlx|Coord|12.34|N|56.78|E}}}}. ''Default:'' ''coordinates from Wikidata''
**'''{{#if:{{{noprefix|}}}||mapframe-}}wikidata''' – Set to {{code|yes}} to show shape/line features from the wikidata item, if any, when {{para|coord}} is set. ''Default:'' {{{mapframe-wikidata|''not specified''}}}
*Customise which features are displayed:
**'''{{#if:{{{noprefix|}}}||mapframe-}}shape''' – Turn off display of shape feature by setting to {{code|none}}. Use an inverse shape (geomask) instead of a regular shape by setting to {{code|inverse}}. ''Default:'' {{{mapframe-shape|''not specified''}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}point''' – Turn off display of point feature by setting to {{code|none}}. Force point marker to be displayed by setting to {{code|on}}. ''Default:'' {{{mapframe-point|''not specified''}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}line''' – Turn off display of line feature by setting to {{code|none}}. ''Default:'' {{{mapframe-line|''not specified''}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}geomask''' – Wikidata item to use as a geomask (everything outside the boundary is shaded darker). Can either be a specific Wikidata item (Q-number), or a property that specifies the item to use (e.g. <code>P17</code> for {{Q|P17}}, <code>P131</code> for {{Q|P131}}). ''Default:'' {{{mapframe-marker|''not specified''}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}switcher''' – set to {{code|auto}} or {{code|geomasks}} or {{code|zooms}} to enable [[Template:Switcher]]-style switching between multiple mapframes. ''Default:'' {{{mapframe-switcher|''not specified''}}}
***{{code|auto}} – switch geomasks found in {{Q|P276}} and {{Q|P131}} statements on the page's Wikidata item, searching recursively. E.g. an item's city, that city's state, and that state's country.
***{{code|geomasks}} – switch between the geomasks specified as a comma-separated list of Wikidata items (Q-numbers) in the '''{{#if:{{{noprefix|}}}||mapframe-}}geomask''' parameter
***{{code|zooms}} – switch between "zoomed in"/"zoomed midway"/"zoomed out", where "zoomed in" is the default zoom (with a minimum of {{code|3}}), "zoomed out" is {{code|1}}, and "zoomed midway" is the average
*Other optional parameters:
**'''{{#if:{{{noprefix|}}}||mapframe-}}frame-width''' or '''{{#if:{{{noprefix|}}}||mapframe-}}width''' – Frame width. ''Default:'' {{{mapframe-frame-width|270}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}frame-height''' or '''{{#if:{{{noprefix|}}}||mapframe-}}height''' – Frame height. ''Default:'' {{{mapframe-frame-height|200}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}shape-fill''' – Color used to fill shape features. ''Default:'' {{{mapframe-shape-fill|#606060}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}shape-fill-opacity''' – Opacity level of shape fill, a number between 0 and 1. ''Default:'' {{{mapframe-shape-fill-opacity|0.5}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}stroke-color''' or '''{{#if:{{{noprefix|}}}||mapframe-}}stroke-colour''' – Color of line features, and outlines of shape features. ''Default:'' {{{mapframe-stroke-color|{{{mapframe-stroke-colour|#ff0000}}}}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}stroke-width''' – Width of line features, and outlines of shape features; default is "5". ''Default:'' {{{mapframe-stroke-width|5}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}marker''' – Marker symbol to use for coordinates; see [[mw:Help:Extension:Kartographer/Icons]] for options. ''Default:'' {{{mapframe-marker|''not specified (i.e. blank)''}}}
***Can also be set to {{code|blank}} to override any default marker symbol
**'''{{#if:{{{noprefix|}}}||mapframe-}}marker-color''' or '''{{#if:{{{noprefix|}}}||mapframe-}}marker-colour''' – Background color for the marker. ''Default:'' {{{mapframe-marker-color|{{{mapframe-marker-colour|#5E74F3}}}}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}geomask-stroke-color''' or '''{{#if:{{{noprefix|}}}||mapframe-}}geomask-stroke-colour''' – Color of outline of geomask shape. ''Default:'' {{{mapframe-geomask-stroke-color|{{{mapframe-geomask-stroke-colour|#555555}}}}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}geomask-stroke-width''' – Width of outline of geomask shape. ''Default:'' {{{mapframe-geomask-stroke-width|2}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}geomask-fill''' – Color used to fill outside geomask features. ''Default:'' {{{mapframe-geomask-fill|#606060}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}geomask-fill-opacity''' – Opacity level of fill outside geomask features, a number between 0 and 1. ''Default:'' {{{mapframe-geomask-fill-opacity|0.5}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}zoom''' – Set the zoom level, from "1" (map of earth) to "18" (maximum zoom in), to be used if the zoom level cannot be determined automatically from object length or area. ''Default:'' {{{mapframe-zoom|10}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}length_km {{nobold|or}} {{#if:{{{noprefix|}}}||mapframe-}}length_mi {{nobold|or}} {{#if:{{{noprefix|}}}||mapframe-}}area_km2 {{nobold|or}} {{#if:{{{noprefix|}}}||mapframe-}}area_mi2''' – Determine zoom level by passing in object's length (in kilometres or miles) or area (in square kilometres or square miles). ''Default:'' ''not specified''
**'''{{#if:{{{noprefix|}}}||mapframe-}}frame-coordinates''' or '''{{#if:{{{noprefix|}}}||mapframe-}}frame-coord''' – Alternate latitude and longitude coordinates for initial placement of map, using {{tl|coord}}. ''Default:'' ''derived from item coordinates''{{#if:{{{deprecated|}}}|<nowiki></nowiki>
*Deprecated parameters
**{{gray|1='''{{#if:{{{noprefix|}}}||mapframe-}}frame-lat''' or '''{{#if:{{{noprefix|}}}||mapframe-}}frame-latitude'''}} – Alternate latitude coordinate for initial placement of map; default is derived from item coordinates
**{{gray|1='''{{#if:{{{noprefix|}}}||mapframe-}}frame-long''' or '''{{#if:{{{noprefix|}}}||mapframe-}}frame-longitude'''}} – Alternate longitude coordinate for initial placement of map; default is derived from item coordinates
}}
cff45f38e77371fef06f83bec6bdbffebc880c3f
Module:Format link
828
61
115
2022-10-04T13:37:11Z
wikipedia>Pppery
0
Avoid Lua erroring when we run out of expensive parser function calls
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Format link
--
-- Makes a wikilink from the given link and display values. Links are escaped
-- with colons if necessary, and links to sections are detected and displayed
-- with " § " as a separator rather than the standard MediaWiki "#". Used in
-- the {{format link}} template.
--------------------------------------------------------------------------------
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg
local mArguments -- lazily initialise [[Module:Arguments]]
local mError -- lazily initialise [[Module:Error]]
local yesno -- lazily initialise [[Module:Yesno]]
local p = {}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function getArgs(frame)
-- Fetches the arguments from the parent frame. Whitespace is trimmed and
-- blanks are removed.
mArguments = require('Module:Arguments')
return mArguments.getArgs(frame, {parentOnly = true})
end
local function removeInitialColon(s)
-- Removes the initial colon from a string, if present.
return s:match('^:?(.*)')
end
local function maybeItalicize(s, shouldItalicize)
-- Italicize s if s is a string and the shouldItalicize parameter is true.
if s and shouldItalicize then
return '<i>' .. s .. '</i>'
else
return s
end
end
local function parseLink(link)
-- Parse a link and return a table with the link's components.
-- These components are:
-- - link: the link, stripped of any initial colon (always present)
-- - page: the page name (always present)
-- - section: the page name (may be nil)
-- - display: the display text, if manually entered after a pipe (may be nil)
link = removeInitialColon(link)
-- Find whether a faux display value has been added with the {{!}} magic
-- word.
local prePipe, display = link:match('^(.-)|(.*)$')
link = prePipe or link
-- Find the page, if it exists.
-- For links like [[#Bar]], the page will be nil.
local preHash, postHash = link:match('^(.-)#(.*)$')
local page
if not preHash then
-- We have a link like [[Foo]].
page = link
elseif preHash ~= '' then
-- We have a link like [[Foo#Bar]].
page = preHash
end
-- Find the section, if it exists.
local section
if postHash and postHash ~= '' then
section = postHash
end
return {
link = link,
page = page,
section = section,
display = display,
}
end
local function formatDisplay(parsed, options)
-- Formats a display string based on a parsed link table (matching the
-- output of parseLink) and an options table (matching the input options for
-- _formatLink).
local page = maybeItalicize(parsed.page, options.italicizePage)
local section = maybeItalicize(parsed.section, options.italicizeSection)
if (not section) then
return page
elseif (not page) then
return mw.ustring.format('§ %s', section)
else
return mw.ustring.format('%s § %s', page, section)
end
end
local function missingArgError(target)
mError = require('Module:Error')
return mError.error{message =
'Error: no link or target specified! ([[' .. target .. '#Errors|help]])'
}
end
--------------------------------------------------------------------------------
-- Main functions
--------------------------------------------------------------------------------
function p.formatLink(frame)
-- The formatLink export function, for use in templates.
yesno = require('Module:Yesno')
local args = getArgs(frame)
local link = args[1] or args.link
local target = args[3] or args.target
if not (link or target) then
return missingArgError('Template:Format link')
end
return p._formatLink{
link = link,
display = args[2] or args.display,
target = target,
italicizePage = yesno(args.italicizepage),
italicizeSection = yesno(args.italicizesection),
categorizeMissing = args.categorizemissing
}
end
function p._formatLink(options)
-- The formatLink export function, for use in modules.
checkType('_formatLink', 1, options, 'table')
local function check(key, expectedType) --for brevity
checkTypeForNamedArg(
'_formatLink', key, options[key], expectedType or 'string', true
)
end
check('link')
check('display')
check('target')
check('italicizePage', 'boolean')
check('italicizeSection', 'boolean')
check('categorizeMissing')
-- Normalize link and target and check that at least one is present
if options.link == '' then options.link = nil end
if options.target == '' then options.target = nil end
if not (options.link or options.target) then
return missingArgError('Module:Format link')
end
local parsed = parseLink(options.link)
local display = options.display or parsed.display
local catMissing = options.categorizeMissing
local category = ''
-- Find the display text
if not display then display = formatDisplay(parsed, options) end
-- Handle the target option if present
if options.target then
local parsedTarget = parseLink(options.target)
parsed.link = parsedTarget.link
parsed.page = parsedTarget.page
end
-- Test if page exists if a diagnostic category is specified
if catMissing and (mw.ustring.len(catMissing) > 0) then
local title = nil
if parsed.page then title = mw.title.new(parsed.page) end
if title and (not title.isExternal) then
local success, exists = pcall(function() return title.exists end)
if success and not exists then
category = mw.ustring.format('[[Category:%s]]', catMissing)
end
end
end
-- Format the result as a link
if parsed.link == display then
return mw.ustring.format('[[:%s]]%s', parsed.link, category)
else
return mw.ustring.format('[[:%s|%s]]%s', parsed.link, display, category)
end
end
--------------------------------------------------------------------------------
-- Derived convenience functions
--------------------------------------------------------------------------------
function p.formatPages(options, pages)
-- Formats an array of pages using formatLink and the given options table,
-- and returns it as an array. Nil values are not allowed.
local ret = {}
for i, page in ipairs(pages) do
ret[i] = p._formatLink{
link = page,
categorizeMissing = options.categorizeMissing,
italicizePage = options.italicizePage,
italicizeSection = options.italicizeSection
}
end
return ret
end
return p
1253bdd2683ee4badc33856bfd5499b09a7dca1f
Template:Cob
10
283
558
2022-10-07T15:01:20Z
wikipedia>DatGuy
0
+r from template shortcut
wikitext
text/x-wiki
#REDIRECT [[Template:Collapse bottom]]
{{Redirect category shell|
{{R from template shortcut}}
}}
1cd16c56552caeb938d794d973d1a13c885f7830
Module:Protection banner
828
106
203
2022-10-21T08:07:11Z
wikipedia>WOSlinker
0
use require('strict') instead of require('Module:No globals')
Scribunto
text/plain
-- This module implements {{pp-meta}} and its daughter templates such as
-- {{pp-dispute}}, {{pp-vandalism}} and {{pp-sock}}.
-- Initialise necessary modules.
require('strict')
local makeFileLink = require('Module:File link')._main
local effectiveProtectionLevel = require('Module:Effective protection level')._main
local effectiveProtectionExpiry = require('Module:Effective protection expiry')._main
local yesno = require('Module:Yesno')
-- Lazily initialise modules and objects we don't always need.
local getArgs, makeMessageBox, lang
-- Set constants.
local CONFIG_MODULE = 'Module:Protection banner/config'
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function makeCategoryLink(cat, sort)
if cat then
return string.format(
'[[%s:%s|%s]]',
mw.site.namespaces[14].name,
cat,
sort
)
end
end
-- Validation function for the expiry and the protection date
local function validateDate(dateString, dateType)
if not lang then
lang = mw.language.getContentLanguage()
end
local success, result = pcall(lang.formatDate, lang, 'U', dateString)
if success then
result = tonumber(result)
if result then
return result
end
end
error(string.format(
'invalid %s: %s',
dateType,
tostring(dateString)
), 4)
end
local function makeFullUrl(page, query, display)
return string.format(
'[%s %s]',
tostring(mw.uri.fullUrl(page, query)),
display
)
end
-- Given a directed graph formatted as node -> table of direct successors,
-- get a table of all nodes reachable from a given node (though always
-- including the given node).
local function getReachableNodes(graph, start)
local toWalk, retval = {[start] = true}, {}
while true do
-- Can't use pairs() since we're adding and removing things as we're iterating
local k = next(toWalk) -- This always gets the "first" key
if k == nil then
return retval
end
toWalk[k] = nil
retval[k] = true
for _,v in ipairs(graph[k]) do
if not retval[v] then
toWalk[v] = true
end
end
end
end
--------------------------------------------------------------------------------
-- Protection class
--------------------------------------------------------------------------------
local Protection = {}
Protection.__index = Protection
Protection.supportedActions = {
edit = true,
move = true,
autoreview = true,
upload = true
}
Protection.bannerConfigFields = {
'text',
'explanation',
'tooltip',
'alt',
'link',
'image'
}
function Protection.new(args, cfg, title)
local obj = {}
obj._cfg = cfg
obj.title = title or mw.title.getCurrentTitle()
-- Set action
if not args.action then
obj.action = 'edit'
elseif Protection.supportedActions[args.action] then
obj.action = args.action
else
error(string.format(
'invalid action: %s',
tostring(args.action)
), 3)
end
-- Set level
obj.level = args.demolevel or effectiveProtectionLevel(obj.action, obj.title)
if not obj.level or (obj.action == 'move' and obj.level == 'autoconfirmed') then
-- Users need to be autoconfirmed to move pages anyway, so treat
-- semi-move-protected pages as unprotected.
obj.level = '*'
end
-- Set expiry
local effectiveExpiry = effectiveProtectionExpiry(obj.action, obj.title)
if effectiveExpiry == 'infinity' then
obj.expiry = 'indef'
elseif effectiveExpiry ~= 'unknown' then
obj.expiry = validateDate(effectiveExpiry, 'expiry date')
end
-- Set reason
if args[1] then
obj.reason = mw.ustring.lower(args[1])
if obj.reason:find('|') then
error('reasons cannot contain the pipe character ("|")', 3)
end
end
-- Set protection date
if args.date then
obj.protectionDate = validateDate(args.date, 'protection date')
end
-- Set banner config
do
obj.bannerConfig = {}
local configTables = {}
if cfg.banners[obj.action] then
configTables[#configTables + 1] = cfg.banners[obj.action][obj.reason]
end
if cfg.defaultBanners[obj.action] then
configTables[#configTables + 1] = cfg.defaultBanners[obj.action][obj.level]
configTables[#configTables + 1] = cfg.defaultBanners[obj.action].default
end
configTables[#configTables + 1] = cfg.masterBanner
for i, field in ipairs(Protection.bannerConfigFields) do
for j, t in ipairs(configTables) do
if t[field] then
obj.bannerConfig[field] = t[field]
break
end
end
end
end
return setmetatable(obj, Protection)
end
function Protection:isUserScript()
-- Whether the page is a user JavaScript or CSS page.
local title = self.title
return title.namespace == 2 and (
title.contentModel == 'javascript' or title.contentModel == 'css'
)
end
function Protection:isProtected()
return self.level ~= '*'
end
function Protection:shouldShowLock()
-- Whether we should output a banner/padlock
return self:isProtected() and not self:isUserScript()
end
-- Whether this page needs a protection category.
Protection.shouldHaveProtectionCategory = Protection.shouldShowLock
function Protection:isTemporary()
return type(self.expiry) == 'number'
end
function Protection:makeProtectionCategory()
if not self:shouldHaveProtectionCategory() then
return ''
end
local cfg = self._cfg
local title = self.title
-- Get the expiry key fragment.
local expiryFragment
if self.expiry == 'indef' then
expiryFragment = self.expiry
elseif type(self.expiry) == 'number' then
expiryFragment = 'temp'
end
-- Get the namespace key fragment.
local namespaceFragment = cfg.categoryNamespaceKeys[title.namespace]
if not namespaceFragment and title.namespace % 2 == 1 then
namespaceFragment = 'talk'
end
-- Define the order that key fragments are tested in. This is done with an
-- array of tables containing the value to be tested, along with its
-- position in the cfg.protectionCategories table.
local order = {
{val = expiryFragment, keypos = 1},
{val = namespaceFragment, keypos = 2},
{val = self.reason, keypos = 3},
{val = self.level, keypos = 4},
{val = self.action, keypos = 5}
}
--[[
-- The old protection templates used an ad-hoc protection category system,
-- with some templates prioritising namespaces in their categories, and
-- others prioritising the protection reason. To emulate this in this module
-- we use the config table cfg.reasonsWithNamespacePriority to set the
-- reasons for which namespaces have priority over protection reason.
-- If we are dealing with one of those reasons, move the namespace table to
-- the end of the order table, i.e. give it highest priority. If not, the
-- reason should have highest priority, so move that to the end of the table
-- instead.
--]]
table.insert(order, table.remove(order, self.reason and cfg.reasonsWithNamespacePriority[self.reason] and 2 or 3))
--[[
-- Define the attempt order. Inactive subtables (subtables with nil "value"
-- fields) are moved to the end, where they will later be given the key
-- "all". This is to cut down on the number of table lookups in
-- cfg.protectionCategories, which grows exponentially with the number of
-- non-nil keys. We keep track of the number of active subtables with the
-- noActive parameter.
--]]
local noActive, attemptOrder
do
local active, inactive = {}, {}
for i, t in ipairs(order) do
if t.val then
active[#active + 1] = t
else
inactive[#inactive + 1] = t
end
end
noActive = #active
attemptOrder = active
for i, t in ipairs(inactive) do
attemptOrder[#attemptOrder + 1] = t
end
end
--[[
-- Check increasingly generic key combinations until we find a match. If a
-- specific category exists for the combination of key fragments we are
-- given, that match will be found first. If not, we keep trying different
-- key fragment combinations until we match using the key
-- "all-all-all-all-all".
--
-- To generate the keys, we index the key subtables using a binary matrix
-- with indexes i and j. j is only calculated up to the number of active
-- subtables. For example, if there were three active subtables, the matrix
-- would look like this, with 0 corresponding to the key fragment "all", and
-- 1 corresponding to other key fragments.
--
-- j 1 2 3
-- i
-- 1 1 1 1
-- 2 0 1 1
-- 3 1 0 1
-- 4 0 0 1
-- 5 1 1 0
-- 6 0 1 0
-- 7 1 0 0
-- 8 0 0 0
--
-- Values of j higher than the number of active subtables are set
-- to the string "all".
--
-- A key for cfg.protectionCategories is constructed for each value of i.
-- The position of the value in the key is determined by the keypos field in
-- each subtable.
--]]
local cats = cfg.protectionCategories
for i = 1, 2^noActive do
local key = {}
for j, t in ipairs(attemptOrder) do
if j > noActive then
key[t.keypos] = 'all'
else
local quotient = i / 2 ^ (j - 1)
quotient = math.ceil(quotient)
if quotient % 2 == 1 then
key[t.keypos] = t.val
else
key[t.keypos] = 'all'
end
end
end
key = table.concat(key, '|')
local attempt = cats[key]
if attempt then
return makeCategoryLink(attempt, title.text)
end
end
return ''
end
function Protection:isIncorrect()
local expiry = self.expiry
return not self:shouldHaveProtectionCategory()
or type(expiry) == 'number' and expiry < os.time()
end
function Protection:isTemplateProtectedNonTemplate()
local action, namespace = self.action, self.title.namespace
return self.level == 'templateeditor'
and (
(action ~= 'edit' and action ~= 'move')
or (namespace ~= 10 and namespace ~= 828)
)
end
function Protection:makeCategoryLinks()
local msg = self._cfg.msg
local ret = {self:makeProtectionCategory()}
if self:isIncorrect() then
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-incorrect'],
self.title.text
)
end
if self:isTemplateProtectedNonTemplate() then
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-template'],
self.title.text
)
end
return table.concat(ret)
end
--------------------------------------------------------------------------------
-- Blurb class
--------------------------------------------------------------------------------
local Blurb = {}
Blurb.__index = Blurb
Blurb.bannerTextFields = {
text = true,
explanation = true,
tooltip = true,
alt = true,
link = true
}
function Blurb.new(protectionObj, args, cfg)
return setmetatable({
_cfg = cfg,
_protectionObj = protectionObj,
_args = args
}, Blurb)
end
-- Private methods --
function Blurb:_formatDate(num)
-- Formats a Unix timestamp into dd Month, YYYY format.
lang = lang or mw.language.getContentLanguage()
local success, date = pcall(
lang.formatDate,
lang,
self._cfg.msg['expiry-date-format'] or 'j F Y',
'@' .. tostring(num)
)
if success then
return date
end
end
function Blurb:_getExpandedMessage(msgKey)
return self:_substituteParameters(self._cfg.msg[msgKey])
end
function Blurb:_substituteParameters(msg)
if not self._params then
local parameterFuncs = {}
parameterFuncs.CURRENTVERSION = self._makeCurrentVersionParameter
parameterFuncs.EDITREQUEST = self._makeEditRequestParameter
parameterFuncs.EXPIRY = self._makeExpiryParameter
parameterFuncs.EXPLANATIONBLURB = self._makeExplanationBlurbParameter
parameterFuncs.IMAGELINK = self._makeImageLinkParameter
parameterFuncs.INTROBLURB = self._makeIntroBlurbParameter
parameterFuncs.INTROFRAGMENT = self._makeIntroFragmentParameter
parameterFuncs.PAGETYPE = self._makePagetypeParameter
parameterFuncs.PROTECTIONBLURB = self._makeProtectionBlurbParameter
parameterFuncs.PROTECTIONDATE = self._makeProtectionDateParameter
parameterFuncs.PROTECTIONLEVEL = self._makeProtectionLevelParameter
parameterFuncs.PROTECTIONLOG = self._makeProtectionLogParameter
parameterFuncs.TALKPAGE = self._makeTalkPageParameter
parameterFuncs.TOOLTIPBLURB = self._makeTooltipBlurbParameter
parameterFuncs.TOOLTIPFRAGMENT = self._makeTooltipFragmentParameter
parameterFuncs.VANDAL = self._makeVandalTemplateParameter
self._params = setmetatable({}, {
__index = function (t, k)
local param
if parameterFuncs[k] then
param = parameterFuncs[k](self)
end
param = param or ''
t[k] = param
return param
end
})
end
msg = msg:gsub('${(%u+)}', self._params)
return msg
end
function Blurb:_makeCurrentVersionParameter()
-- A link to the page history or the move log, depending on the kind of
-- protection.
local pagename = self._protectionObj.title.prefixedText
if self._protectionObj.action == 'move' then
-- We need the move log link.
return makeFullUrl(
'Special:Log',
{type = 'move', page = pagename},
self:_getExpandedMessage('current-version-move-display')
)
else
-- We need the history link.
return makeFullUrl(
pagename,
{action = 'history'},
self:_getExpandedMessage('current-version-edit-display')
)
end
end
function Blurb:_makeEditRequestParameter()
local mEditRequest = require('Module:Submit an edit request')
local action = self._protectionObj.action
local level = self._protectionObj.level
-- Get the edit request type.
local requestType
if action == 'edit' then
if level == 'autoconfirmed' then
requestType = 'semi'
elseif level == 'extendedconfirmed' then
requestType = 'extended'
elseif level == 'templateeditor' then
requestType = 'template'
end
end
requestType = requestType or 'full'
-- Get the display value.
local display = self:_getExpandedMessage('edit-request-display')
return mEditRequest._link{type = requestType, display = display}
end
function Blurb:_makeExpiryParameter()
local expiry = self._protectionObj.expiry
if type(expiry) == 'number' then
return self:_formatDate(expiry)
else
return expiry
end
end
function Blurb:_makeExplanationBlurbParameter()
-- Cover special cases first.
if self._protectionObj.title.namespace == 8 then
-- MediaWiki namespace
return self:_getExpandedMessage('explanation-blurb-nounprotect')
end
-- Get explanation blurb table keys
local action = self._protectionObj.action
local level = self._protectionObj.level
local talkKey = self._protectionObj.title.isTalkPage and 'talk' or 'subject'
-- Find the message in the explanation blurb table and substitute any
-- parameters.
local explanations = self._cfg.explanationBlurbs
local msg
if explanations[action][level] and explanations[action][level][talkKey] then
msg = explanations[action][level][talkKey]
elseif explanations[action][level] and explanations[action][level].default then
msg = explanations[action][level].default
elseif explanations[action].default and explanations[action].default[talkKey] then
msg = explanations[action].default[talkKey]
elseif explanations[action].default and explanations[action].default.default then
msg = explanations[action].default.default
else
error(string.format(
'could not find explanation blurb for action "%s", level "%s" and talk key "%s"',
action,
level,
talkKey
), 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeImageLinkParameter()
local imageLinks = self._cfg.imageLinks
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if imageLinks[action][level] then
msg = imageLinks[action][level]
elseif imageLinks[action].default then
msg = imageLinks[action].default
else
msg = imageLinks.edit.default
end
return self:_substituteParameters(msg)
end
function Blurb:_makeIntroBlurbParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('intro-blurb-expiry')
else
return self:_getExpandedMessage('intro-blurb-noexpiry')
end
end
function Blurb:_makeIntroFragmentParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('intro-fragment-expiry')
else
return self:_getExpandedMessage('intro-fragment-noexpiry')
end
end
function Blurb:_makePagetypeParameter()
local pagetypes = self._cfg.pagetypes
return pagetypes[self._protectionObj.title.namespace]
or pagetypes.default
or error('no default pagetype defined', 8)
end
function Blurb:_makeProtectionBlurbParameter()
local protectionBlurbs = self._cfg.protectionBlurbs
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if protectionBlurbs[action][level] then
msg = protectionBlurbs[action][level]
elseif protectionBlurbs[action].default then
msg = protectionBlurbs[action].default
elseif protectionBlurbs.edit.default then
msg = protectionBlurbs.edit.default
else
error('no protection blurb defined for protectionBlurbs.edit.default', 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeProtectionDateParameter()
local protectionDate = self._protectionObj.protectionDate
if type(protectionDate) == 'number' then
return self:_formatDate(protectionDate)
else
return protectionDate
end
end
function Blurb:_makeProtectionLevelParameter()
local protectionLevels = self._cfg.protectionLevels
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if protectionLevels[action][level] then
msg = protectionLevels[action][level]
elseif protectionLevels[action].default then
msg = protectionLevels[action].default
elseif protectionLevels.edit.default then
msg = protectionLevels.edit.default
else
error('no protection level defined for protectionLevels.edit.default', 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeProtectionLogParameter()
local pagename = self._protectionObj.title.prefixedText
if self._protectionObj.action == 'autoreview' then
-- We need the pending changes log.
return makeFullUrl(
'Special:Log',
{type = 'stable', page = pagename},
self:_getExpandedMessage('pc-log-display')
)
else
-- We need the protection log.
return makeFullUrl(
'Special:Log',
{type = 'protect', page = pagename},
self:_getExpandedMessage('protection-log-display')
)
end
end
function Blurb:_makeTalkPageParameter()
return string.format(
'[[%s:%s#%s|%s]]',
mw.site.namespaces[self._protectionObj.title.namespace].talk.name,
self._protectionObj.title.text,
self._args.section or 'top',
self:_getExpandedMessage('talk-page-link-display')
)
end
function Blurb:_makeTooltipBlurbParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('tooltip-blurb-expiry')
else
return self:_getExpandedMessage('tooltip-blurb-noexpiry')
end
end
function Blurb:_makeTooltipFragmentParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('tooltip-fragment-expiry')
else
return self:_getExpandedMessage('tooltip-fragment-noexpiry')
end
end
function Blurb:_makeVandalTemplateParameter()
return mw.getCurrentFrame():expandTemplate{
title="vandal-m",
args={self._args.user or self._protectionObj.title.baseText}
}
end
-- Public methods --
function Blurb:makeBannerText(key)
-- Validate input.
if not key or not Blurb.bannerTextFields[key] then
error(string.format(
'"%s" is not a valid banner config field',
tostring(key)
), 2)
end
-- Generate the text.
local msg = self._protectionObj.bannerConfig[key]
if type(msg) == 'string' then
return self:_substituteParameters(msg)
elseif type(msg) == 'function' then
msg = msg(self._protectionObj, self._args)
if type(msg) ~= 'string' then
error(string.format(
'bad output from banner config function with key "%s"'
.. ' (expected string, got %s)',
tostring(key),
type(msg)
), 4)
end
return self:_substituteParameters(msg)
end
end
--------------------------------------------------------------------------------
-- BannerTemplate class
--------------------------------------------------------------------------------
local BannerTemplate = {}
BannerTemplate.__index = BannerTemplate
function BannerTemplate.new(protectionObj, cfg)
local obj = {}
obj._cfg = cfg
-- Set the image filename.
local imageFilename = protectionObj.bannerConfig.image
if imageFilename then
obj._imageFilename = imageFilename
else
-- If an image filename isn't specified explicitly in the banner config,
-- generate it from the protection status and the namespace.
local action = protectionObj.action
local level = protectionObj.level
local namespace = protectionObj.title.namespace
local reason = protectionObj.reason
-- Deal with special cases first.
if (
namespace == 10
or namespace == 828
or reason and obj._cfg.indefImageReasons[reason]
)
and action == 'edit'
and level == 'sysop'
and not protectionObj:isTemporary()
then
-- Fully protected modules and templates get the special red "indef"
-- padlock.
obj._imageFilename = obj._cfg.msg['image-filename-indef']
else
-- Deal with regular protection types.
local images = obj._cfg.images
if images[action] then
if images[action][level] then
obj._imageFilename = images[action][level]
elseif images[action].default then
obj._imageFilename = images[action].default
end
end
end
end
return setmetatable(obj, BannerTemplate)
end
function BannerTemplate:renderImage()
local filename = self._imageFilename
or self._cfg.msg['image-filename-default']
or 'Transparent.gif'
return makeFileLink{
file = filename,
size = (self.imageWidth or 20) .. 'px',
alt = self._imageAlt,
link = self._imageLink,
caption = self.imageCaption
}
end
--------------------------------------------------------------------------------
-- Banner class
--------------------------------------------------------------------------------
local Banner = setmetatable({}, BannerTemplate)
Banner.__index = Banner
function Banner.new(protectionObj, blurbObj, cfg)
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb.
obj.imageWidth = 40
obj.imageCaption = blurbObj:makeBannerText('alt') -- Large banners use the alt text for the tooltip.
obj._reasonText = blurbObj:makeBannerText('text')
obj._explanationText = blurbObj:makeBannerText('explanation')
obj._page = protectionObj.title.prefixedText -- Only makes a difference in testing.
return setmetatable(obj, Banner)
end
function Banner:__tostring()
-- Renders the banner.
makeMessageBox = makeMessageBox or require('Module:Message box').main
local reasonText = self._reasonText or error('no reason text set', 2)
local explanationText = self._explanationText
local mbargs = {
page = self._page,
type = 'protection',
image = self:renderImage(),
text = string.format(
"'''%s'''%s",
reasonText,
explanationText and '<br />' .. explanationText or ''
)
}
return makeMessageBox('mbox', mbargs)
end
--------------------------------------------------------------------------------
-- Padlock class
--------------------------------------------------------------------------------
local Padlock = setmetatable({}, BannerTemplate)
Padlock.__index = Padlock
function Padlock.new(protectionObj, blurbObj, cfg)
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb.
obj.imageWidth = 20
obj.imageCaption = blurbObj:makeBannerText('tooltip')
obj._imageAlt = blurbObj:makeBannerText('alt')
obj._imageLink = blurbObj:makeBannerText('link')
obj._indicatorName = cfg.padlockIndicatorNames[protectionObj.action]
or cfg.padlockIndicatorNames.default
or 'pp-default'
return setmetatable(obj, Padlock)
end
function Padlock:__tostring()
local frame = mw.getCurrentFrame()
-- The nowiki tag helps prevent whitespace at the top of articles.
return frame:extensionTag{name = 'nowiki'} .. frame:extensionTag{
name = 'indicator',
args = {name = self._indicatorName},
content = self:renderImage()
}
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p = {}
function p._exportClasses()
-- This is used for testing purposes.
return {
Protection = Protection,
Blurb = Blurb,
BannerTemplate = BannerTemplate,
Banner = Banner,
Padlock = Padlock,
}
end
function p._main(args, cfg, title)
args = args or {}
cfg = cfg or require(CONFIG_MODULE)
local protectionObj = Protection.new(args, cfg, title)
local ret = {}
-- If a page's edit protection is equally or more restrictive than its
-- protection from some other action, then don't bother displaying anything
-- for the other action (except categories).
if not yesno(args.catonly) and (protectionObj.action == 'edit' or
args.demolevel or
not getReachableNodes(
cfg.hierarchy,
protectionObj.level
)[effectiveProtectionLevel('edit', protectionObj.title)])
then
-- Initialise the blurb object
local blurbObj = Blurb.new(protectionObj, args, cfg)
-- Render the banner
if protectionObj:shouldShowLock() then
ret[#ret + 1] = tostring(
(yesno(args.small) and Padlock or Banner)
.new(protectionObj, blurbObj, cfg)
)
end
end
-- Render the categories
if yesno(args.category) ~= false then
ret[#ret + 1] = protectionObj:makeCategoryLinks()
end
return table.concat(ret)
end
function p.main(frame, cfg)
cfg = cfg or require(CONFIG_MODULE)
-- Find default args, if any.
local parent = frame.getParent and frame:getParent()
local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub('/sandbox$', '')]
-- Find user args, and use the parent frame if we are being called from a
-- wrapper template.
getArgs = getArgs or require('Module:Arguments').getArgs
local userArgs = getArgs(frame, {
parentOnly = defaultArgs,
frameOnly = not defaultArgs
})
-- Build the args table. User-specified args overwrite default args.
local args = {}
for k, v in pairs(defaultArgs or {}) do
args[k] = v
end
for k, v in pairs(userArgs) do
args[k] = v
end
return p._main(args, cfg)
end
return p
894f0884d4c2da1ce19d385b96f59af654b0946a
Module:Redirect template
828
248
488
2022-10-21T08:08:03Z
wikipedia>WOSlinker
0
use require('strict') instead of require('Module:No globals')
Scribunto
text/plain
require('strict')
local p = {}
-- key is beginning of arg name. value is table with namespace number and link
-- alternatively, a function taking the namespace number and returning a validity
-- can be used
local namespaceCategories = {
all = { function() return true end },
main = { 0, '[[wp:mainspace|main]]' },
help = { 12, '[[wp:help namespace|help]]' },
portal = { 100, '[[wp:portal|portal]]' },
talk = { function(n) return n > 0 and n%2 == 1 end, '[[Help:Talk pages|talk]]' },
template = { 10, '[[wp:template namespace|template]]' },
wikipedia = { 4, '[[wp:project namespace|Wikipedia project]]' },
category = { 14, '[[wp:categorization|category]]' },
user = { 2, '[[wp:user pages|user]]' },
}
-- remove whitespaces from beginning and end of args
local function valueFunc(key, val)
if type(val) == 'string' then
val = val:match('^%s*(.-)%s*$')
if val == '' then
return nil
end
end
return val
end
local function getPrettyName(args)
for k in pairs(namespaceCategories) do
if args[k .. ' category'] then
return string.format("'''[[:Category:%s|%s]]''': ", args[k .. ' category'], args.name)
end
end
return string.format("'''%s''': ", args.name)
end
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:Redirect template', valueFunc = valueFunc})
local namespace = mw.title.getCurrentTitle().namespace
--- XXX: this is a HORRIBLE HACK. kill it with fire as soon as https://bugzilla.wikimedia.org/show_bug.cgi?id=12974 is fixed
local beCompatibleWithBug12974 = args.info and (args.info:find('^[:;#*]', 1) == 1 or args.info:find('{|', 1, true) == 1) and '\n' or ' '
local content = string.format('\n<div class="rcat %s">\n*%sThis is a redirect%s%s.%s%s\n</div>',
args.id and ('rcat-' .. string.gsub(args.id, ' ', '_')) or '',
args.name and getPrettyName(args) or '',
args.from and (' from ' .. args.from) or '',
args.to and (' to ' .. args.to) or '',
args.info and beCompatibleWithBug12974 or '',
args.info or ''
)
for k,v in pairs(namespaceCategories) do
if args[k .. ' category'] then
if type(v[1]) == 'function' and v[1](namespace) or v[1] == namespace then
if args.sortkey then
content = content .. string.format('[[Category:%s|%s]]', args[k .. ' category'], args.sortkey)
else
content = content .. string.format('[[Category:%s]]', args[k .. ' category'])
end
elseif args['other category'] then
if args.sortkey then
content = content .. string.format('[[Category:%s|%s]]', args['other category'], args.sortkey)
else
content = content .. string.format('[[Category:%s]]', args['other category'])
end
else
content = content .. frame:expandTemplate{title = 'Incorrect redirect template', args = {v[2]}}
end
end
end
if namespace == 0 then
local yesno = require('Module:Yesno')
if yesno(args.printworthy) == true then
return content .. '[[Category:Printworthy redirects]]'
elseif yesno(args.printworthy) == false then
return content .. '[[Category:Unprintworthy redirects]]'
end
end
return content
end
return p
bcc2d5353cffbfcb00be2d9a7c2f9f276613e488
Module:Delink
828
45
83
2022-10-21T09:52:18Z
wikipedia>WOSlinker
0
use require("strict") instead of require("Module:No globals")
Scribunto
text/plain
-- This module de-links most wikitext.
require("strict")
local p = {}
local getArgs
local function delinkReversePipeTrick(s)
if s:match("^%[%[|.*[|\n]") then -- Check for newlines or multiple pipes.
return s
end
return s:match("%[%[|(.*)%]%]")
end
local function delinkPipeTrick(s)
-- We need to deal with colons, brackets, and commas, per [[Help:Pipe trick]].
-- First, remove the text before the first colon, if any.
if s:match(":") then
s = s:match("%[%[.-:(.*)|%]%]")
-- If there are no colons, grab all of the text apart from the square brackets and the pipe.
else
s = s:match("%[%[(.*)|%]%]")
end
-- Next up, brackets and commas.
if s:match("%(.-%)$") then -- Brackets trump commas.
s = s:match("(.-) ?%(.-%)$")
elseif s:match(",") then -- If there are no brackets, display only the text before the first comma.
s = s:match("(.-),.*$")
end
return s
end
-- Return wikilink target |wikilinks=target
local function getDelinkedTarget(s)
local result = s
-- Deal with the reverse pipe trick.
if result:match("%[%[|") then
return delinkReversePipeTrick(result)
end
result = mw.uri.decode(result, "PATH") -- decode percent-encoded entities. Leave underscores and plus signs.
result = mw.text.decode(result, true) -- decode HTML entities.
-- Check for bad titles. To do this we need to find the
-- title area of the link, i.e. the part before any pipes.
local target_area
if result:match("|") then -- Find if we're dealing with a piped link.
target_area = result:match("^%[%[(.-)|.*%]%]")
else
target_area = result:match("^%[%[(.-)%]%]")
end
-- Check for bad characters.
if mw.ustring.match(target_area, "[%[%]<>{}%%%c\n]") and mw.ustring.match(target_area, "[%[%]<>{}%%%c\n]") ~= "?" then
return s
end
return target_area
end
local function getDelinkedLabel(s)
local result = s
-- Deal with the reverse pipe trick.
if result:match("%[%[|") then
return delinkReversePipeTrick(result)
end
result = mw.uri.decode(result, "PATH") -- decode percent-encoded entities. Leave underscores and plus signs.
result = mw.text.decode(result, true) -- decode HTML entities.
-- Check for bad titles. To do this we need to find the
-- title area of the link, i.e. the part before any pipes.
local target_area
if result:match("|") then -- Find if we're dealing with a piped link.
target_area = result:match("^%[%[(.-)|.*%]%]")
else
target_area = result:match("^%[%[(.-)%]%]")
end
-- Check for bad characters.
if mw.ustring.match(target_area, "[%[%]<>{}%%%c\n]") and mw.ustring.match(target_area, "[%[%]<>{}%%%c\n]") ~= "?" then
return s
end
-- Check for categories, interwikis, and files.
local colon_prefix = result:match("%[%[(.-):.*%]%]") or "" -- Get the text before the first colon.
local ns = mw.site.namespaces[colon_prefix] -- see if this is a known namespace
if mw.language.isKnownLanguageTag(colon_prefix) or (ns and (ns.canonicalName == "File" or ns.canonicalName == "Category")) then
return ""
end
-- Remove the colon if the link is using the [[Help:Colon trick]].
if result:match("%[%[:") then
result = "[[" .. result:match("%[%[:(.*%]%])")
end
-- Deal with links using the [[Help:Pipe trick]].
if mw.ustring.match(result, "^%[%[[^|]*|%]%]") then
return delinkPipeTrick(result)
end
-- Find the display area of the wikilink
if result:match("|") then -- Find if we're dealing with a piped link.
result = result:match("^%[%[.-|(.+)%]%]")
-- Remove new lines from the display of multiline piped links,
-- where the pipe is before the first new line.
result = result:gsub("\n", "")
else
result = result:match("^%[%[(.-)%]%]")
end
return result
end
local function delinkURL(s)
-- Assume we have already delinked internal wikilinks, and that
-- we have been passed some text between two square brackets [foo].
-- If the text contains a line break it is not formatted as a URL, regardless of other content.
if s:match("\n") then
return s
end
-- Check if the text has a valid URL prefix and at least one valid URL character.
local valid_url_prefixes = {"//", "http://", "https://", "ftp://", "gopher://", "mailto:", "news:", "irc://"}
local url_prefix
for _ ,v in ipairs(valid_url_prefixes) do
if mw.ustring.match(s, '^%[' .. v ..'[^"%s].*%]' ) then
url_prefix = v
break
end
end
-- Get display text
if not url_prefix then
return s
end
s = s:match("^%[" .. url_prefix .. "(.*)%]") -- Grab all of the text after the URL prefix and before the final square bracket.
s = s:match('^.-(["<> ].*)') or "" -- Grab all of the text after the first URL separator character ("<> ).
s = mw.ustring.match(s, "^%s*(%S.*)$") or "" -- If the separating character was a space, trim it off.
local s_decoded = mw.text.decode(s, true)
if mw.ustring.match(s_decoded, "%c") then
return s
end
return s_decoded
end
local function delinkLinkClass(text, pattern, delinkFunction)
if type(text) ~= "string" then
error("Attempt to de-link non-string input.", 2)
end
if type(pattern) ~= "string" or mw.ustring.sub(pattern, 1, 1) ~= "^" then
error('Invalid pattern detected. Patterns must begin with "^".', 2)
end
-- Iterate over the text string, and replace any matched text. using the
-- delink function. We need to iterate character by character rather
-- than just use gsub, otherwise nested links aren't detected properly.
local result = ""
while text ~= "" do
-- Replace text using one iteration of gsub.
text = mw.ustring.gsub(text, pattern, delinkFunction, 1)
-- Append the left-most character to the result string.
result = result .. mw.ustring.sub(text, 1, 1)
text = mw.ustring.sub(text, 2, -1)
end
return result
end
function p._delink(args)
local text = args[1] or ""
if args.refs == "yes" then
-- Remove any [[Help:Strip markers]] representing ref tags. In most situations
-- this is not a good idea - only use it if you know what you are doing!
text = mw.ustring.gsub(text, "UNIQ%w*%-ref%-%d*%-QINU", "")
end
if args.comments ~= "no" then
text = text:gsub("<!%-%-.-%-%->", "") -- Remove html comments.
end
if args.wikilinks ~= "no" and args.wikilinks ~= "target" then
-- De-link wikilinks and return the label portion of the wikilink.
text = delinkLinkClass(text, "^%[%[.-%]%]", getDelinkedLabel)
elseif args.wikilinks == "target" then
-- De-link wikilinks and return the target portions of the wikilink.
text = delinkLinkClass(text, "^%[%[.-%]%]", getDelinkedTarget)
end
if args.urls ~= "no" then
text = delinkLinkClass(text, "^%[.-%]", delinkURL) -- De-link URLs.
end
if args.whitespace ~= "no" then
-- Replace single new lines with a single space, but leave double new lines
-- and new lines only containing spaces or tabs before a second new line.
text = mw.ustring.gsub(text, "([^\n \t][ \t]*)\n([ \t]*[^\n \t])", "%1 %2")
text = text:gsub("[ \t]+", " ") -- Remove extra tabs and spaces.
end
return text
end
function p.delink(frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
return p._delink(getArgs(frame, {wrappers = 'Template:Delink'}))
end
return p
5b8e75ac750b5d3ed76cc4158aefcd1568a6a6fd
Module:Ustring
828
231
454
2022-10-21T16:00:20Z
wikipedia>Legoktm
0
Replace [[Module:No globals]] with require( "strict" )
Scribunto
text/plain
require('strict')
return setmetatable({}, {
__index = function(t, k)
local what = mw.ustring[k]
if type(what) ~= "function" then
return what
end
return function(frame)
local fargs = frame.args
local fargsused = { tag = true }
local args = {}
local str_i = 1
while fargs['s' .. str_i] do
fargsused['s' .. str_i] = true
args[str_i] = fargs['s' .. str_i]
str_i = str_i + 1
end
for i, v in ipairs(fargs) do
fargsused[i] = true
args[i + str_i - 1] = tonumber(v) or v:gsub("^\\", "", 1)
end
if not fargs.tag then
return (what(unpack(args))) -- Outside parens truncate to first result avoiding tail call
end
local tagargs = {}
for x, y in pairs(fargs) do
if not fargsused[x] then tagargs[x] = y end
end
return frame:extensionTag{name = fargs.tag, content = what(unpack(args)), args = tagargs}
end
end
})
e0455dab4b66831f7596e77432ad865faeef506c
Module:Footnotes
828
57
107
2022-10-21T21:15:31Z
wikipedia>Legoktm
0
Replace [[Module:No globals]] with require( "strict" )
Scribunto
text/plain
require('strict');
local getArgs = require ('Module:Arguments').getArgs;
--[[--------------------------< A R G S _ D E F A U L T >------------------------------------------------------
a table to specify initial values.
]]
local args_default = {
bracket_left = '',
bracket_right = '',
bracket_year_left = '',
bracket_year_right = '',
postscript = '',
page = '',
pages = '',
location = '',
page_sep = ", p. ",
pages_sep = ", pp. ",
ref = '',
template = 'harv', -- if template name not provided in {{#invoke:}} use this
};
--[[--------------------------< T A R G E T _ C H E C K >------------------------------------------------------
look for anchor_id (CITEREF name-list and year or text from |ref=) in anchor_id_list
the 'no target' error may be suppressed with |ignore-err=yes when target cannot be found because target is inside
a template that wraps another template; 'multiple targets' error may not be suppressed
]]
local function target_check (anchor_id, args)
local namespace = mw.title.getCurrentTitle().namespace;
local anchor_id_list_module = mw.loadData ('Module:Footnotes/anchor_id_list');
local anchor_id_list = anchor_id_list_module.anchor_id_list;
local article_whitelist = anchor_id_list_module.article_whitelist;
local template_list = anchor_id_list_module.template_list;
local whitelist_module = mw.loadData ('Module:Footnotes/whitelist');
local whitelist = whitelist_module.whitelist;
local special_patterns = whitelist_module.special_patterns;
local DNB_special_patterns = whitelist_module.DNB_special_patterns;
local DNB_template_names = whitelist_module.DNB_template_names;
if 10 == namespace then
return ''; -- automatic form of |no-tracking=yes; TODO: is this too broad?
end
local tally = anchor_id_list[anchor_id]; -- nil when anchor_id not in list; else a tally
local msg;
local category;
if not tally then
if args.ignore then
return ''; -- if ignore is true then no message, no category
end
if article_whitelist and article_whitelist[anchor_id] then -- if an article-local whitelist and anchor ID is in it
return ''; -- done
end
local wl_anchor_id = anchor_id; -- copy to be modified to index into the whitelist
if args.year then -- for anchor IDs created by this template (not in |ref=) that have a date
if args.year:match ('%d%l$') or -- use the date value to determine if we should remove the disambiguator
args.year:match ('n%.d%.%l$') or
args.year:match ('nd%l$') then
wl_anchor_id = wl_anchor_id:gsub ('%l$', ''); -- remove the disambiguator
end
end
local t_tbl = whitelist[wl_anchor_id]; -- get list of templates associated with this anchor ID
if t_tbl then -- when anchor ID not whitelisted t_tbl is nil
for _, t in ipairs (t_tbl) do -- spin through the list of templates associated with this anchor ID
if template_list[t] then -- if associated template is found in the list of templates in the article
return ''; -- anchor ID is whitlisted and article has matching template so no error
end
end
end
for _, pattern in ipairs (special_patterns) do -- spin through the spcial patterns and try to match
if anchor_id:match (pattern) then
return '';
end
end
for _, dnb_t in ipairs (DNB_template_names or {}) do -- getting desparate now, are there any DNB templates? DNB_template_names may be nil; empty table prevents script error
if template_list[dnb_t] then -- if the article has this DNB template
for _, pattern in ipairs (DNB_special_patterns) do -- spin through the DNB-specifiec wildcard patterns
if anchor_id:match (pattern) then -- and attempt a match
return ''; -- found a match
end
end
end
end
msg = 'no target: ' .. anchor_id; -- anchor_id not found
category = '[[Category:Harv and Sfn no-target errors]]';
elseif 1 < tally then
msg = 'multiple targets (' .. tally .. '×): ' .. anchor_id; -- more than one anchor_id in this article
category = 0 == namespace and '[[Category:Harv and Sfn multiple-target errors]]' or ''; -- only categorize in article space
return '<span class="error harv-error" style="display: inline; font-size:100%"> ' .. args.template .. ' error: ' .. msg .. ' ([[:Category:Harv and Sfn template errors|help]])</span>' .. category;
end
-- category = 0 == namespace and '[[Category:Harv and Sfn template errors]]' or ''; -- only categorize in article space
category = 0 == namespace and category or ''; -- only categorize in article space
--use this version to show error messages
-- return msg and '<span class="error harv-error" style="display: inline; font-size:100%"> ' .. args.template .. ' error: ' .. msg .. ' ([[:Category:Harv and Sfn template errors|help]])</span>' .. category or '';
--use this version to hide error messages
return msg and '<span class="error harv-error" style="display: none; font-size:100%"> ' .. args.template .. ' error: ' .. msg .. ' ([[:Category:Harv and Sfn template errors|help]])</span>' .. category or '';
end
--[[--------------------------< I S _ Y E A R >----------------------------------------------------------------
evaluates param to see if it is one of these forms with or without lowercase letter disambiguator:
YYYY
n.d.
nd
c. YYYY
YYYY–YYYY (separator is endash)
YYYY–YY (separator is endash)
return true when param has a recognized form; false else
]]
local patterns_date= {
'^%d%d%d%d?%l?$',
'^n%.d%.%l?$',
'^nd%l?$',
'^c%. %d%d%d%d?%l?$',
'^%d%d%d%d–%d%d%d%d%l?$',
'^%d%d%d%d–%d%d%l?$',
}
local function is_year (param, args)
args.year = ''; -- used for harv error;
for _, pattern in ipairs (patterns_date) do
if mw.ustring.match (param, pattern) then
args.year = param; -- used for harv error;
return true;
end
end
end
--[[--------------------------< C O R E >----------------------------------------------------------------------
returns an anchor link (CITEREF) formed from one to four author names, year, and insource location (|p=, |pp=, loc=)
]]
local function core( args )
local result;
local err_msg = ''
if args.P5 ~= '' then
if is_year (args.P5, args) then
result = table.concat ({args.P1, ' et al. ', args.bracket_year_left, args.P5, args.bracket_year_right});
else
args.P5 = ''; -- when P5 not a year don't include in anchor
result = table.concat ({args.P1, ' et al.'}); -- and don't render it
end
elseif args.P4 ~= '' then
if is_year (args.P4, args) then
result = table.concat ({args.P1, ', ', args.P2, ' & ', args.P3, ' ', args.bracket_year_left, args.P4, args.bracket_year_right}); -- three names and a year
else
result = table.concat ({args.P1, ' et al.'}); -- four names
end
elseif args.P3 ~= '' then
if is_year (args.P3, args) then
result = table.concat ({args.P1, ' & ', args.P2, ' ', args.bracket_year_left, args.P3, args.bracket_year_right}); -- two names and a year
else
result = table.concat ({args.P1, ', ', args.P2, ' ', ' & ', args.P3}); -- three names
end
elseif args.P2 ~= '' then
if is_year (args.P2, args) then
result = table.concat ({args.P1, ' ', args.bracket_year_left, args.P2, args.bracket_year_right}); -- one name and year
else
result = table.concat ({args.P1, ' & ', args.P2}); -- two names
end
else
result = args.P1; -- one name
end
-- when author-date result ends with a dot (typically when the last positional parameter holds 'n.d.')
-- and when no in-source location (no |p=, |pp=, or |loc=)
-- and when the first or only character in args.postscript is a dot
-- remove the author-date result trailing dot
-- the author-date result trailing dot will be replaced later with the content of args.postscript (usually a dot)
if ('.' == result:sub(-1)) and ('.' == args.postscript:sub(1)) and ('' == args.page) and ('' == args.pages) and ('' == args.location) then
result = result:gsub ('%.$', '');
end
if args.ref ~= 'none' then
local anchor_id;
if args.ref ~= '' then
anchor_id = mw.uri.anchorEncode (args.ref);
err_msg = target_check (anchor_id, args);
result = table.concat ({'[[#', anchor_id, '|', result, ']]'});
else
anchor_id = mw.uri.anchorEncode (table.concat ({'CITEREF', args.P1, args.P2, args.P3, args.P4, args.P5}));
err_msg = target_check (anchor_id, args);
result = table.concat ({'[[#', anchor_id, '|', result, ']]'});
end
end
if args.page ~= '' then
result = table.concat ({result, args.page_sep, args.page});
elseif args.pages ~= ''then
result = table.concat ({result, args.pages_sep, args.pages});
end
if args.location ~= '' then
result = table.concat ({result, ', ', args.location});
end
result = table.concat ({args.bracket_left, result, args.bracket_right, args.postscript}):gsub ('%s+', ' '); -- strip redundant spaces
return result .. err_msg;
end
--[[--------------------------< H Y P H E N _ T O _ D A S H >--------------------------------------------------
Converts a hyphen to a dash under certain conditions. The hyphen must separate
like items; unlike items are returned unmodified. These forms are modified:
letter - letter (A - B)
digit - digit (4-5)
digit separator digit - digit separator digit (4.1-4.5 or 4-1-4-5)
letterdigit - letterdigit (A1-A5) (an optional separator between letter and
digit is supported – a.1-a.5 or a-1-a-5)
digitletter - digitletter (5a - 5d) (an optional separator between letter and
digit is supported – 5.a-5.d or 5-a-5-d)
any other forms are returned unmodified.
str may be a comma- or semicolon-separated list
This code copied from Module:Citation/CS1. The only modification is to require Module:Citation/CS1/Utilities
so that it has access to the functions is_set() and has_accept_as_written()
]]
local function hyphen_to_dash( str )
local utilities = require ('Module:Citation/CS1/Utilities'); -- only modification so that this function has access to is_set() and has_accept_as_written()
if not utilities.is_set (str) then
return str;
end
local accept; -- Boolean
str = str:gsub ('&[nm]dash;', {['–'] = '–', ['—'] = '—'}); -- replace — and – entities with their characters; semicolon mucks up the text.split
str = str:gsub ('-', '-'); -- replace HTML numeric entity with hyphen character
str = str:gsub (' ', ' '); -- replace entity with generic keyboard space character
local out = {};
local list = mw.text.split (str, '%s*[,;]%s*'); -- split str at comma or semicolon separators if there are any
for _, item in ipairs (list) do -- for each item in the list
item, accept = utilities.has_accept_as_written (item); -- remove accept-this-as-written markup when it wraps all of item
if not accept and mw.ustring.match (item, '^%w*[%.%-]?%w+%s*[%-–—]%s*%w*[%.%-]?%w+$') then -- if a hyphenated range or has endash or emdash separators
if item:match ('^%a+[%.%-]?%d+%s*%-%s*%a+[%.%-]?%d+$') or -- letterdigit hyphen letterdigit (optional separator between letter and digit)
item:match ('^%d+[%.%-]?%a+%s*%-%s*%d+[%.%-]?%a+$') or -- digitletter hyphen digitletter (optional separator between digit and letter)
item:match ('^%d+[%.%-]%d+%s*%-%s*%d+[%.%-]%d+$') or -- digit separator digit hyphen digit separator digit
item:match ('^%d+%s*%-%s*%d+$') or -- digit hyphen digit
item:match ('^%a+%s*%-%s*%a+$') then -- letter hyphen letter
item = item:gsub ('(%w*[%.%-]?%w+)%s*%-%s*(%w*[%.%-]?%w+)', '%1–%2'); -- replace hyphen, remove extraneous space characters
else
item = mw.ustring.gsub (item, '%s*[–—]%s*', '–'); -- for endash or emdash separated ranges, replace em with en, remove extraneous whitespace
end
end
table.insert (out, item); -- add the (possibly modified) item to the output table
end
local temp_str = ''; -- concatenate the output table into a comma separated string
temp_str, accept = utilities.has_accept_as_written (table.concat (out, ', ')); -- remove accept-this-as-written markup when it wraps all of concatenated out
if accept then
temp_str = utilities.has_accept_as_written (str); -- when global markup removed, return original str; do it this way to suppress boolean second return value
return temp_str;
else
return temp_str; -- else, return assembled temp_str
end
end
--[[--------------------------< A R G S _ F E T C H >---------------------------------------------------------
Because all of the templates share a common set of parameters, a single common function to fetch those parameters
from frame and parent frame.
]]
local function args_fetch (frame, ps)
local args = args_default; -- create a copy of the default table
local pframe = frame:getParent(); -- point to the template's parameter table
for k, v in pairs (frame.args) do -- override defaults with values provided in the #invoke: if any
args[k] = v;
end
args.postscript = pframe.args.postscript or pframe.args.ps or ps;
if 'none' == args.postscript then
args.postscript = '';
end
args.page = pframe.args.p or pframe.args.page or '';
args.pages = pframe.args.pp or pframe.args.pages or '';
args.pages = ('' ~= args.pages) and hyphen_to_dash (args.pages) or '';
args.location = pframe.args.loc or '';
args.ref = pframe.args.ref or pframe.args.Ref or '';
args.ignore = ('yes' == pframe.args['ignore-false-positive']) or ('yes' == pframe.args['ignore-err']);
for i, v in ipairs ({'P1', 'P2', 'P3', 'P4', 'P5'}) do -- loop through the five positional parameters and trim if set else empty string
args[v] = (pframe.args[i] and mw.text.trim (pframe.args[i])) or '';
end
if args.P5 and not is_year (args.P5, args) then
local i = 6; -- initialize the indexer to the sixth positional parameter
while pframe.args[i] do -- in case there are too many authors loop through the authors looking for a year
local v = mw.text.trim (pframe.args[i]); -- trim
if is_year (v, args) then -- if a year
args.P5 = v; -- overwrite whatever was in args.P5 with year
break; -- and abandon the search
end
i = i + 1; -- bump the indexer
end
end
return args;
end
--[[--------------------------< H A R V A R D _ C I T A T I O N >----------------------------------------------
common entry point for:
{{harvard citation}} aka {{harv}}
{{Harvard citation no brackets}} aka {{harvnb}}
{{harvcol}}
{{harvcolnb}}
{{harvcoltxt}}
{{Harvard citation text}} aka {{harvtxt}}
{{Harvp}}
Distinguishing features (brackets and page separators) are specified in this module's {{#invoke}} in the respective templates.
]]
local function harvard_citation (frame)
local args = args_fetch (frame, ''); -- get the template and invoke parameters; default postscript is empty string
return core (args);
end
--[[--------------------------< S T R I P _ U R L >------------------------------------------------------------
used by sfn() and sfnm(). This function fixes an issue with reference tooltip gadget where the tooltip is not displayed
when an insource locator (|p=, |pp=, |loc=) has an external wikilink that contains a # character
strip uri-reserved characters from urls in |p=, |pp-, and |loc= parameters The researved characters are:
!#$&'()*+,/:;=?@[]
]]
local function strip_url (pages)
local escaped_uri;
if not pages or ('' == pages) then
return pages;
end
for uri in pages:gmatch ('%[(%a[%w%+%.%-]*://%S+)') do -- for each external link get the uri
escaped_uri = uri:gsub ("([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" ); -- save a copy with lua pattern characters escaped
uri = uri:gsub ("[!#%$&'%(%)%*%+,/:;=%?@%[%]%.%%]", ''); -- remove reserved characters and '%' because '%20' (space character) is a lua 'invalid capture index'
pages = pages:gsub (escaped_uri, uri, 1); -- replace original uri with the stripped version
end
return pages;
end
--[[--------------------------< S F N >------------------------------------------------------------------------
entry point for {{sfn}} and {{sfnp}}
]]
local function sfn (frame)
local args = args_fetch (frame, '.'); -- get the template and invoke parameters; default postscript is a dot
local result = core (args); -- go make a CITEREF anchor
-- put it all together and then strip redundant spaces
local name = table.concat ({'FOOTNOTE', args.P1, args.P2, args.P3, args.P4, args.P5, strip_url (args.page), strip_url (args.pages), strip_url (args.location)}):gsub ('%s+', ' ');
return frame:extensionTag ({name='ref', args={name=name}, content=result});
end
--[[--------------------------< S F N M >----------------------------------------------------------------------
common entry point for {{sfnm}} and {{sfnmp}}
Distinguishing features (brackets) are specified in this module's {{#invoke}} in the respective templates.
]]
local function sfnm (frame)
local args = args_default; -- create a copy of the default table
local pframe = frame:getParent(); -- point to the template's parameter table
local n = 1; -- index of source; this is the 'n' in na1, ny, etc
local first_pnum = 1; -- first of a pair of positional parameters
local second_pnum = 2; -- second of a pair of positional parameters
local last_ps = 0; -- index of the last source with |nps= set
local last_index = 0; -- index of the last source; these used to determine which of |ps= or |nps= will terminate the whole rendering
local out = {}; -- table to hold rendered sources
local footnote = {'FOOTNOTE'}; -- all author, date, insource location stuff becomes part of the reference's footnote id; added as we go
for k, v in pairs (frame.args) do -- override defaults with values provided in the #invoke: if any
args[k] = v;
end
while true do
if not pframe.args[table.concat ({n, 'a1'})] and not pframe.args[first_pnum] then
break; -- no na1 or matching positional parameter so done
end
if pframe.args[table.concat ({n, 'a1'})] then -- does this source use named parameters?
for _, v in ipairs ({'P1', 'P2', 'P3', 'P4', 'P5'}) do -- initialize for this source
args[v] = '';
end
for i, v in ipairs ({'P1', 'P2', 'P3', 'P4', 'P5'}) do -- extract author and year parameters for this source
args[v] = pframe.args[table.concat ({n, 'a', i})] or ''; -- attempt to assign author name
if '' == args[v] then -- when there wasn't an author name
args[v] = pframe.args[table.concat ({n, 'y'})] or ''; -- attempt to assign year
break; -- done with author/date for this source
end
end
else -- this source uses positional parameters
args.P1 = mw.text.trim (pframe.args[first_pnum]); -- yes, only one author supported
args.P2 = (pframe.args[second_pnum] and mw.text.trim (pframe.args[second_pnum])) or ''; -- when positional author, year must also be positional
for _, v in ipairs ({'P3', 'P4', 'P5'}) do -- blank the rest of these for this source
args[v] = '';
end
first_pnum = first_pnum + 2; -- source must use positional author and positional year
second_pnum = first_pnum + 1; -- bump these for possible next positional source
end
args.postscript = pframe.args[table.concat ({n, 'ps'})] or '';
if 'none' == args.postscript then -- this for compatibility with other footnote templates; does nothing
args.postscript = '';
end
args.ref = pframe.args[table.concat ({n, 'ref'})] or ''; -- alternate reference for this source
args.page = pframe.args[table.concat ({n, 'p'})] or ''; -- insource locations for this source
args.pages = pframe.args[table.concat ({n, 'pp'})] or '';
args.pages = ('' ~= args.pages) and hyphen_to_dash (args.pages) or '';
args.location = pframe.args[table.concat ({n, 'loc'})] or '';
args.ignore = ('yes' == pframe.args[table.concat ({n, 'ignore-false-positive'})]) or ('yes' == pframe.args[table.concat ({n, 'ignore-err'})]);
table.insert (out, core (args)); -- save the rendering of this source
for k, v in ipairs ({'P1', 'P2', 'P3', 'P4', 'P5'}) do -- create the FOOTNOTE id
if '' ~= args[v] then
table.insert (footnote, args[v]);
end
end
for k, v in ipairs ({'page', 'pages', 'location'}) do -- these done separately so that we can strip uri-reserved characters from extlinked page numbers
if '' ~= args[v] then
table.insert (footnote, strip_url (args[v]))
end
end
last_index = n; -- flags used to select terminal postscript from nps or from end_ps
if '' ~= args.postscript then
last_ps = n;
end
n = n+1; -- bump for the next one
end
local name = table.concat (footnote):gsub ('%s+', ' '); -- put the footnote together and strip redundant space
args.end_ps = pframe.args.postscript or pframe.args.ps or '.'; -- this is the postscript for the whole not for the individual sources
if 'none' == args.end_ps then -- not an original sfnm parameter value; added for compatibility with other footnote templates
args.end_ps = '';
end
local result = table.concat ({table.concat (out, '; '), (last_index == last_ps) and '' or args.end_ps});
return frame:extensionTag ({name='ref', args={name=name}, content=result});
end
--[[--------------------------< S F N R E F >------------------------------------------------------------------
implements {{sfnref}}
]]
local function sfnref (frame)
local args = getArgs (frame);
local out = {};
for i=1, 5 do -- get the first five args if there are five args
if args[i] then
out[i] = args[i];
else
break; -- less than 5 args break out
end
end
if 5 == #out then -- when we have seen five args there may bemore
local i = 6; -- initialize the indexer to the sixth positional parameter
while args[i] do -- in case there are too many authors loop through the authors looking for a year
if is_year (args[i], args) then -- if a year
out[5] = args[i]; -- overwrite whatever was in args[5] with year
break; -- and abandon the search
end
i = i + 1; -- bump the indexer
end
end
return mw.uri.anchorEncode ('CITEREF' .. table.concat (out));
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {
harvard_citation = harvard_citation,
sfn = sfn,
sfnm = sfnm,
sfnref = sfnref,
};
6e6f14a1fb0053e5aed88c564fc13d570e2d5a03
Module:Footnotes/anchor id list/data
828
59
111
2022-10-22T09:20:53Z
wikipedia>WOSlinker
0
use require('strict') instead of require('Module:No globals')
Scribunto
text/plain
-- copied from Module:Ref info/data - maybe overkill here?
-- for this application make lists from the redirect lists and force all template names first character uppercase
require('strict');
--[[--------------------------< C S 1 _ T E M P L A T E _ P A T T E R N S >------------------------------------
These are patterns for cs1 templates and their redirects. These patterns exclude redirects that are vcite-like
which redirects should be deleted because vcite is not cs1.
]]
local cs1_template_patterns = { -- lua patterns of the cannonical names and redirects
'[Cc]ite ar[Xx]iv', -- arXiv is the canonical name
'[Cc]ite ArXiv',
'[Cc]ite AV media', -- canonical
'[Cc]ite audio', '[Cc]ite AV', '[Cc]ite AV ?Media', '[Cc]ite av media',
'[Cc]ite cd', '[Cc]ite DVD', '[Cc]ite dvd', '[Cc]ite film',
'[Cc]ite image', '[Cc]ite media', '[Cc]ite movie',
'[Cc]ite music video', '[Cc]ite radio', '[Cc]ite song',
'[Cc]ite ?video', '[Cc]ite visual', '[Cc]ite You[Tt]ube',
'[Cc]ita vídeo', -- non-English redirect; TODO: tally separately?
'[Cc]ite AV media notes', -- canonical
'[Cc]ite album[ %-]notes', '[Cc]ite av media notes',
'[Cc]ite DVD[ %-]notes', '[Cc]ite dvd%-notes', '[Cc]ite liner notes',
'[Cc]ite music release notes', '[Ll]iner notes',
'[Cc]ite bio[Rr]xiv', -- bioRxiv is the canonical form
'[Cc]ite [Bb]ook', -- book is the canonical form
'[Bb]ook cite', '[Bb]ook reference', '[Bb]ook reference url',
'[Cc] book', '[Cc]it book', '[Cc]ite books', '[Cc]ite chapter',
'[Cc]ite ebook', '[Cc]ite manual', '[Cc]ite page',
'[Cc]ite publication', '[Cc]ite score',
'[Cc]ite work', '[Cc]ite%-?book',
'[Bb]okref', '[Cc]itace monografie', '[Cc]itar livro', -- non-English redirects; TODO: tally separately?
'[Cc]iteer boek', '[Oo]uvrage', '[Rr]ef%-llibre', '서적 인용',
'[Cc]ite citeseerx', -- canonical
'[Cc]ite conference', -- canonical
'[Cc]ita conferenza', '[Cc]ite proceedings', '[Cc]onference reference', -- cita conferenza is non-English; TODO: tally separately?
'[Cc]ite ?encyclopedia', -- cite encyclopedia is the canonical name
'[Cc]ite contribution', '[Cc]ite dic', '[Cc]ite dictionary',
'[Cc]ite encyclopaedia', '[Cc]ite encyclopædia', '[Ee]ncyclopedia',
'[Cc]ite [Ee]pisode', -- episode is the canonical form
'[Cc]ite show',
'[Cc]ite interview', -- canonical
'[Cc]ite ?journal', -- cite journal is the canonical form
'[Cc] journal', '[Cc]itation journal', '[Cc]ite abstract',
'[Cc]ite document', '[Cc]ite Journal', '[Cc]ite journal zh',
'[Cc]ite ?paper', '[Vv]cite2 journal',
'[Cc]ita pubblicazione', '[Cc]itace periodika', '[Cc]itar jornal', -- non-English redirects; TODO: tally separately?
'[Cc]itar publicació', '[Cc]ytuj pismo', '[Tt]idskriftsref',
'Навод из стручног часописа', '저널 인용',
'[Cc]ite [Mm]agazine', -- magazine is the canonical form
'[Cc]ite mag', '[Cc]ite magazine article', '[Cc]ite newsletter',
'[Cc]ite periodical',
'[Cc]ite mailing ?list', -- mailing list is the canonical form
'[Cc]ite list',
'[Cc]ite maps?', -- map is the canonical form
'[Cc]ite[ %-]?news', -- cite news is the canonical form
'[Cc] news', '[Cc]it news', '[Cc]itation news', '[Cc]ite article',
'[Cc]ite n', '[Cc]ite new', '[Cc]ite newspaper', '[Cc]ite News',
'[Cc]ite news%-q', '[Cc]ite news2', '[Cc]itenewsauthor', '[Cc]ute news',
'[Cc]itar notícia', '[Hh]aber kaynağı', '[Tt]idningsref', 'استشهاد بخبر', -- non-English redirects; TODO: tally separately?
'뉴스 인용',
'[Cc]ite newsgroup', -- canonical
'[Cc]ite usenet',
'[Cc]ite podcast', -- canonical
'[Cc]ite [Pp]ress release', -- press release is the canonical form
'[Cc]ite media release', '[Cc]ite news release', '[Cc]ite pr',
'[Cc]ite press', '[Cc]ite press release\.', '[Cc]ite press[%-]?release',
'[Cc]ite report', -- canonical
'[Cc]ite serial', -- canonical
'[Cc]ite sign', -- canonical
'[Cc]ite plaque',
'[Cc]ite speech', -- canonical
'[Cc]ite ssrn', -- canonical
'[Cc]ite SSRN',
'[Cc]ite tech ?report', -- techreport is the canonical form
'[Cc]ite standard', '[Cc]ite technical report', '[Tt]echrep reference',
'[Cc]ite thesis', -- canonical
'[Cc]ite dissertation',
'[Cc]itar tese', -- non-English redirect; TODO: tally separately?
'[Cc]ite [Ww]eb', -- web is the canonical form
'[Cc] web', '[Cc]it web', '[Cc]ite blog', '[Cc]ite URL', '[Cc]ite url',
'[Cc]ite w', '[Cc]ite wb', '[Cc]ite we', '[Cc]ite web\.',
'[Cc]ite webpage', '[Cc]ite website', '[Cc]ite website article',
'[Cc]ite%-?web', '[Cc]itweb', '[Cc]w', '[Rr]ef web', '[Ww]eb citation',
'[Ww]eb cite', '[Ww]eb link', '[Ww]eb[ %-]reference', '[Ww]eblink',
'[Cc]hú thích web', '[Cc]ita web', '[Cc]itace elektronické monografie', -- non-English redirects; TODO: tally separately?
'[Cc]itat web', 'مرجع ويب', 'یادکرد وب', '웹 인용',
}
--[[--------------------------< C S 2 _ T E M P L A T E _ P A T T E R N S >------------------------------------
These are patterns for cs2 templates redirects.
]]
local cs2_template_patterns = { -- lua patterns of the cannonical names and redirects
'[Cc]itation',
'[Cc]ite', '[Cc]ite citation', '[Cc]ite study',
'[Cc]ite [Tt]echnical standard',
}
--[[--------------------------< V C I T E _ T E M P L A T E _ P A T T E R N S >--------------------------------
These are patterns for Vcite-family templates and their redirects.
]]
local vcite_template_patterns = {
'[Vv]cite book', -- canonical
'[Vv]ancite book', '[Vv]ancite report', '[Vv]cite encyclopedia',
'[Vv]cite report',
'[Vv]cite journal', -- canonical
'[Cc]it journal', '[Cc]it paper', '[Vv]ancite journal', '[Vv]cite paper',
'[Vv]cite news', -- canonical
'[Vv]ancite news',
'[Vv]cite web', -- canonical
'[Vv]ancite web',
}
--[[--------------------------< H A R V C _ T E M P L A T E _ P A T T E R N S >--------------------------------
These are patterns for the harvc template and its redirects.
]]
local harvc_template_patterns = {
'[Hh]arvc', -- canonical
'[Cc]itec',
}
--[[--------------------------< C S 1 _ L I K E _ T E M P L A T E _ P A T T E R N S >--------------------------
These are patterns for miscellaneous templates and their redirects that 'look like' cs1 templates (begin with cite ...)
Because they 'look like' cs1 templates they are handled as if they were cs1 templates. These templates are NOT
wrapper templates; names and dates are always to be extracted from the article instantiation of the template.
]]
local cs1_like_template_patterns = {
'[Cc]ite LSA', -- canonical
}
--[[--------------------------< W I K I C I T E _ T E M P L A T E _ P A T T E R N S >--------------------------
These are patterns for the wikicite template and its redirects.
]]
local wikicite_template_patterns = {
'[Ww]ikicite', -- canonical
}
--[[--------------------------< A N C H O R _ T E M P L A T E _ P A T T E R N S >------------------------------
These are patterns for the anchor template and its redirects.
]]
local anchor_template_patterns = {
'[Aa]nchors?', -- anchor is canonical form
'[Aa]nchor for redirect',
'[Aa]nchro',
'[Aa]ncor',
}
--[[--------------------------< S F N _ W H I T E L I S T _ P A T T E R N S >----------------------------------
These are patterns for the anchor template and its redirects.
]]
local sfn_whitelist_patterns = {
'[Ss]fn whitelist', -- canonical
'[Hh]arv whitelist',
}
--[[--------------------------< K N O W N _ T E M P L A T E S >------------------------------------------------
These tables are created from the *_template_patterns tables. To make these tables, entries in the source tables
are evaluated to replace lua patterns with the appropriate characters to create names for the output tables.
First charqacter is always uppercase
For example:
[Cc]ite ar[Xx]iv
becomes
Cite arXiv
Cite arxiv
]]
local known_templates_cs12 = {}; -- the exported tables
local known_templates_vcite = {};
local known_templates_harvc = {};
local known_templates_wikicite = {};
local known_templates_anchor = {};
local known_templates_sfn_whitelist = {};
local function add_stripped (list, name)
if not list[name] then
list[name] = true;
end
end
local function pattern_convert (pattern, list)
local lead, tail, c, l, name;
local first_char_patterns = {
'^%[(%a)%a%]', -- leading character (usually uppercase)
'^%[%a(%a)%]', -- leading character (usually lowercase)
}
c = tostring (pattern:match ('%u')); -- tostring() required because I don't know why; lua chokes complaining that c is not a string
name = pattern:gsub ('^%[%a%a%]', c); -- replace bracketed first character [Xx] with selected character from the match
if name:match ('(.-)%[(%a)(%a)%](.*)') then -- mixed case optional letters
lead, c, l, tail = name:match ('(.-)%[(%a)(%a)%](.*)');
add_stripped (list, lead .. c .. tail); -- uppercase
add_stripped (list, lead .. l .. tail); -- lowercase
elseif name:match ('^([^%[]+)(%[ %%%-%]%?)(.+)$') then -- [ %-]?
lead, c, tail = name:match ('^([^%[]+)(%[ %%%-%]%?)(.+)$');
add_stripped (list, lead .. tail); -- neither char
add_stripped (list, lead .. ' ' .. tail); -- space
add_stripped (list, lead .. '-' .. tail); -- hyphen
elseif name:match ('^([^%[]+)(%[%%%-%]%?)(.+)$') then -- [%-]?
lead, c, tail = name:match ('^([^%[]+)(%[%%%-%]%?)(.+)$');
add_stripped (list, lead .. tail); -- no hyphen
add_stripped (list, lead .. '-' .. tail); -- hyphen
elseif name:match ('^([^%[]+)(%[ %%%-%])(.+)$') then -- [ %-]
lead, c, tail = name:match ('^([^%[]+)(%[ %%%-%])(.+)$');
add_stripped (list, lead .. ' ' .. tail); -- space
add_stripped (list, lead .. '-' .. tail); -- hyphen
elseif name:match ('^([^%?]+)(%%%-%?)(.+)$') then -- %-?
lead, c, tail = name:match ('^([^%?]+)(%%%-%?)(.+)$');
add_stripped (list, lead .. tail); -- no hyphen
add_stripped (list, lead .. '-' .. tail); -- hyphen
elseif name:match ('^(.-)(%%%-)(.+)$') then -- %-
lead, c, tail = name:match ('^(.-)(%%%-)(.+)$');
add_stripped (list, lead .. '-' .. tail); -- hyphen
elseif name:match ('^(.-)(.)%?(.*)$') then -- .?
lead, c, tail = name:match ('^(.-)(.)%?(.*)$');
add_stripped (list, lead .. tail); -- no character
add_stripped (list, lead .. c .. tail); -- character
else
add_stripped (list, name); -- no patterns so save as is
end
end
for _, t in ipairs ({
{cs1_template_patterns, known_templates_cs12},
{cs2_template_patterns, known_templates_cs12},
{cs1_like_template_patterns, known_templates_cs12},
{vcite_template_patterns, known_templates_vcite},
{harvc_template_patterns, known_templates_harvc},
{wikicite_template_patterns, known_templates_wikicite},
{anchor_template_patterns, known_templates_anchor},
{sfn_whitelist_patterns, known_templates_sfn_whitelist},
}) do
for _, pattern in ipairs (t[1]) do -- for each patern in *_template_patterns
pattern_convert (pattern, t[2]) -- convert and store in known_templates_*
end
end
--[[--------------------------< E X P O R T S >----------------------------------------------------------------
]]
return
{
known_templates_anchor = known_templates_anchor,
known_templates_cs12 = known_templates_cs12,
known_templates_harvc = known_templates_harvc,
known_templates_vcite = known_templates_vcite,
known_templates_wikicite = known_templates_wikicite,
known_templates_sfn_whitelist = known_templates_sfn_whitelist,
}
29b949b2a7e0e2aedfb7399749d699512125a378
Module:MultiReplace
828
210
412
2022-11-15T20:58:00Z
wikipedia>Pppery
0
Per edit request
Scribunto
text/plain
local p = {}
local function MultiReplace(args)
local input = args[1] or "{{{1}}}"
local plain = args.plain == "yes"
local i = 1
local changeList = {}
while args[i * 2] do
local change = {pattern = args[i * 2], repl = args[i * 2 + 1]}
if not change.repl then
return require('Module:Error').error{
'MultiReplace: Unpaired argument: <code>' .. (i * 2) .. ' = ' .. mw.text.nowiki(change.pattern) .. '</code>'
}
end
changeList[i] = change
i = i + 1
end
local matchList = {}
local pos = 1
local len = mw.ustring.len(input)
local result = ""
while pos <= len do
local bestStart = len + 1
local bestStop = len
local bestChange
for _, change in ipairs(changeList) do
local start, stop = mw.ustring.find(input, change.pattern, pos, plain)
if start and (start < bestStart) then
bestStart = start
bestStop = stop
bestChange = change
end
end
result = result .. mw.ustring.sub(input, pos, bestStart - 1)
if bestChange then
local fragment = mw.ustring.sub(input, bestStart, bestStop)
result = result .. (plain and bestChange.repl or
mw.ustring.gsub(fragment, bestChange.pattern, bestChange.repl, 1))
end
pos = bestStop + 1
end
return result
end
function p.main(frame, ...)
local args =
type(frame) ~= 'table' and {frame, ...} or
type(frame.args) ~= 'table' and frame or
frame.args[1] and frame.args or
frame:getParent().args
return MultiReplace(args)
end
return p
3bd8e7e4debe76a2cd5ce5587b1629efc3e6d1f2
Template:Suppress categories
10
134
259
2022-11-26T18:00:01Z
wikipedia>MusikBot II
0
Changed protection settings for "[[Template:Suppress categories]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 2612 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))
wikitext
text/x-wiki
<includeonly>{{{{{|safesubst:}}}#invoke:Suppress categories|main}}</includeonly><noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
1f9c6065201d31d4c70f982129b5babbb809ae8c
Template:Dn
10
69
131
2022-11-29T13:15:03Z
wikipedia>MSGJ
0
+
wikitext
text/x-wiki
#REDIRECT [[Template:Disambiguation needed]]
{{Redirect category shell|
{{R from template shortcut}}
{{R from move}}
}}
30cdf9a806947028ecbc2413887cbd53f0cc4070
Template:Plainlist/styles.css
10
182
355
2022-12-11T06:59:53Z
wikipedia>Izno
0
add this reset from mobile.css
sanitized-css
text/css
/* {{pp-template|small=yes}} */
.plainlist ol,
.plainlist ul {
line-height: inherit;
list-style: none;
margin: 0;
padding: 0; /* Reset Minerva default */
}
.plainlist ol li,
.plainlist ul li {
margin-bottom: 0;
}
51706efa229ff8794c0d94f260a208e7c5e6ec30
Template:Plainlist
10
275
542
2022-12-12T22:45:26Z
wikipedia>Izno
0
add tstyles here
wikitext
text/x-wiki
<templatestyles src="Plainlist/styles.css"/><div class="plainlist {{{class|}}}" {{#if:{{{style|}}}{{{indent|}}}|style="{{#if:{{{indent|}}}|margin-left: {{#expr:{{{indent}}}*1.6}}em;}} {{{style|}}}"}}>{{#if:{{{1|}}}|
{{{1}}}
</div>}}<noinclude></div>
{{documentation}}
</noinclude>
582fe7098c25c1ecfc0ad32f62ecd674ebe2bdf0
Template:Mbox
10
143
277
2022-12-18T05:46:16Z
wikipedia>TadejM
0
wikitext
text/x-wiki
{{#invoke:Message box|mbox}}<noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage; interwikis go to Wikidata, thank you! -->
</noinclude>
5bfb2becf8bed35974b47e3ff8660dc14bee40c7
Template:Short description
10
30
53
2022-12-23T23:04:16Z
wikipedia>Fayenatic london
0
remove categories for several more namespaces, see [[Wikipedia:Categories for discussion/Log/2022 December 15#Pages with short description]]
wikitext
text/x-wiki
{{#ifeq:{{lc:{{{1|}}}}}|none|<nowiki /><!--Prevents whitespace issues when used with adjacent newlines-->|<div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">{{{1|}}}{{SHORTDESC:{{{1|}}}|{{{2|}}}}}</div>}}<includeonly>{{#ifeq:{{{pagetype}}}|Disambiguation pages||{{#ifeq:{{pagetype |defaultns = all |user=exclude}}|exclude||{{#ifeq:{{#switch: {{NAMESPACENUMBER}} | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 100 | 101 | 118 | 119 | 828 | 829 | = exclude|#default=}}|exclude||[[Category:{{{pagetype|{{pagetype |defaultns = extended |plural=y}}}}} with short description]]}}}}}}</includeonly><!-- Start tracking
-->{{#invoke:Check for unknown parameters|check|unknown={{Main other|[[Category:Pages using short description with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Short description]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | 2 | pagetype | bot |plural }}<!--
-->{{#ifexpr: {{#invoke:String|len|{{{1|}}}}}>100 | [[Category:{{{pagetype|{{pagetype |defaultns = extended |plural=y}}}}} with long short description]]}}<!--
--><includeonly>{{#if:{{{1|}}}||[[Category:Pages with empty short description]]}}</includeonly><!--
-->{{Short description/lowercasecheck|{{{1|}}}}}<!--
-->{{Main other |{{SDcat |sd={{{1|}}} }} }}<noinclude>
{{Documentation}}
</noinclude>
f175a6d61b40a87adb43e2dd4f73c7979759b34c
Template:Hlist/styles.css
10
140
271
2022-12-26T18:00:17Z
wikipedia>Izno
0
actually remove that block, someone can dig for authorship
sanitized-css
text/css
/* {{pp-protected|reason=match parent|small=yes}} */
/*
* hlist styles are defined in core and Minerva and differ in Minerva. The
* current definitions here (2023-01-01) are sufficient to override Minerva
* without use of the hlist-separated class. The most problematic styles were
* related to margin, padding, and the bullet. Check files listed at
* [[MediaWiki talk:Common.css/to do#hlist-separated]]
*/
/*
* TODO: When the majority of readership supports it (or some beautiful world
* in which grade C support is above the minimum threshold), use :is()
*/
.hlist dl,
.hlist ol,
.hlist ul {
margin: 0;
padding: 0;
}
/* Display list items inline */
.hlist dd,
.hlist dt,
.hlist li {
/*
* don't trust the note that says margin doesn't work with inline
* removing margin: 0 makes dds have margins again
* We also want to reset margin-right in Minerva
*/
margin: 0;
display: inline;
}
/* Display requested top-level lists inline */
.hlist.inline,
.hlist.inline dl,
.hlist.inline ol,
.hlist.inline ul,
/* Display nested lists inline */
.hlist dl dl,
.hlist dl ol,
.hlist dl ul,
.hlist ol dl,
.hlist ol ol,
.hlist ol ul,
.hlist ul dl,
.hlist ul ol,
.hlist ul ul {
display: inline;
}
/* Hide empty list items */
.hlist .mw-empty-li {
display: none;
}
/* TODO: :not() can maybe be used here to remove the later rule. naive test
* seems to work. more testing needed. like so:
*.hlist dt:not(:last-child)::after {
* content: ": ";
*}
*.hlist dd:not(:last-child)::after,
*.hlist li:not(:last-child)::after {
* content: " · ";
* font-weight: bold;
*}
*/
/* Generate interpuncts */
.hlist dt::after {
content: ": ";
}
.hlist dd::after,
.hlist li::after {
content: " · ";
font-weight: bold;
}
.hlist dd:last-child::after,
.hlist dt:last-child::after,
.hlist li:last-child::after {
content: none;
}
/* Add parentheses around nested lists */
.hlist dd dd:first-child::before,
.hlist dd dt:first-child::before,
.hlist dd li:first-child::before,
.hlist dt dd:first-child::before,
.hlist dt dt:first-child::before,
.hlist dt li:first-child::before,
.hlist li dd:first-child::before,
.hlist li dt:first-child::before,
.hlist li li:first-child::before {
content: " (";
font-weight: normal;
}
.hlist dd dd:last-child::after,
.hlist dd dt:last-child::after,
.hlist dd li:last-child::after,
.hlist dt dd:last-child::after,
.hlist dt dt:last-child::after,
.hlist dt li:last-child::after,
.hlist li dd:last-child::after,
.hlist li dt:last-child::after,
.hlist li li:last-child::after {
content: ")";
font-weight: normal;
}
/* Put ordinals in front of ordered list items */
.hlist ol {
counter-reset: listitem;
}
.hlist ol > li {
counter-increment: listitem;
}
.hlist ol > li::before {
content: " " counter(listitem) "\a0";
}
.hlist dd ol > li:first-child::before,
.hlist dt ol > li:first-child::before,
.hlist li ol > li:first-child::before {
content: " (" counter(listitem) "\a0";
}
8c9dd9c9c00f30eead17fe10f51d183333e81f33
Module:Infobox
828
88
167
2022-12-27T21:29:12Z
wikipedia>Izno
0
merge hlist here
Scribunto
text/plain
local p = {}
local args = {}
local origArgs = {}
local root
local empty_row_categories = {}
local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]'
local has_rows = false
local lists = {
plainlist_t = {
patterns = {
'^plainlist$',
'%splainlist$',
'^plainlist%s',
'%splainlist%s'
},
found = false,
styles = 'Plainlist/styles.css'
},
hlist_t = {
patterns = {
'^hlist$',
'%shlist$',
'^hlist%s',
'%shlist%s'
},
found = false,
styles = 'Hlist/styles.css'
}
}
local function has_list_class(args_to_check)
for _, list in pairs(lists) do
if not list.found then
for _, arg in pairs(args_to_check) do
for _, pattern in ipairs(list.patterns) do
if mw.ustring.find(arg or '', pattern) then
list.found = true
break
end
end
if list.found then break end
end
end
end
end
local function fixChildBoxes(sval, tt)
local function notempty( s ) return s and s:match( '%S' ) end
if notempty(sval) then
local marker = '<span class=special_infobox_marker>'
local s = sval
-- start moving templatestyles and categories inside of table rows
local slast = ''
while slast ~= s do
slast = s
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*%]%])', '%2%1')
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)', '%2%1')
end
-- end moving templatestyles and categories inside of table rows
s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1')
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>)', '%1' .. marker)
if s:match(marker) then
s = mw.ustring.gsub(s, marker .. '%s*' .. marker, '')
s = mw.ustring.gsub(s, '([\r\n]|-[^\r\n]*[\r\n])%s*' .. marker, '%1')
s = mw.ustring.gsub(s, marker .. '%s*([\r\n]|-)', '%1')
s = mw.ustring.gsub(s, '(</[Cc][Aa][Pp][Tt][Ii][Oo][Nn]%s*>%s*)' .. marker, '%1')
s = mw.ustring.gsub(s, '(<%s*[Tt][Aa][Bb][Ll][Ee][^<>]*>%s*)' .. marker, '%1')
s = mw.ustring.gsub(s, '^(%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1')
s = mw.ustring.gsub(s, '([\r\n]%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1')
s = mw.ustring.gsub(s, marker .. '(%s*</[Tt][Aa][Bb][Ll][Ee]%s*>)', '%1')
s = mw.ustring.gsub(s, marker .. '(%s*\n|%})', '%1')
end
if s:match(marker) then
local subcells = mw.text.split(s, marker)
s = ''
for k = 1, #subcells do
if k == 1 then
s = s .. subcells[k] .. '</' .. tt .. '></tr>'
elseif k == #subcells then
local rowstyle = ' style="display:none"'
if notempty(subcells[k]) then rowstyle = '' end
s = s .. '<tr' .. rowstyle ..'><' .. tt .. ' colspan=2>\n' ..
subcells[k]
elseif notempty(subcells[k]) then
if (k % 2) == 0 then
s = s .. subcells[k]
else
s = s .. '<tr><' .. tt .. ' colspan=2>\n' ..
subcells[k] .. '</' .. tt .. '></tr>'
end
end
end
end
-- the next two lines add a newline at the end of lists for the PHP parser
-- [[Special:Diff/849054481]]
-- remove when [[:phab:T191516]] is fixed or OBE
s = mw.ustring.gsub(s, '([\r\n][%*#;:][^\r\n]*)$', '%1\n')
s = mw.ustring.gsub(s, '^([%*#;:][^\r\n]*)$', '%1\n')
s = mw.ustring.gsub(s, '^([%*#;:])', '\n%1')
s = mw.ustring.gsub(s, '^(%{%|)', '\n%1')
return s
else
return sval
end
end
-- Cleans empty tables
local function cleanInfobox()
root = tostring(root)
if has_rows == false then
root = mw.ustring.gsub(root, '<table[^<>]*>%s*</table>', '')
end
end
-- Returns the union of the values of two tables, as a sequence.
local function union(t1, t2)
local vals = {}
for k, v in pairs(t1) do
vals[v] = true
end
for k, v in pairs(t2) do
vals[v] = true
end
local ret = {}
for k, v in pairs(vals) do
table.insert(ret, k)
end
return ret
end
-- Returns a table containing the numbers of the arguments that exist
-- for the specified prefix. For example, if the prefix was 'data', and
-- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}.
local function getArgNums(prefix)
local nums = {}
for k, v in pairs(args) do
local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$')
if num then table.insert(nums, tonumber(num)) end
end
table.sort(nums)
return nums
end
-- Adds a row to the infobox, with either a header cell
-- or a label/data cell combination.
local function addRow(rowArgs)
if rowArgs.header and rowArgs.header ~= '_BLANK_' then
has_rows = true
has_list_class({ rowArgs.rowclass, rowArgs.class, args.headerclass })
root
:tag('tr')
:addClass(rowArgs.rowclass)
:cssText(rowArgs.rowstyle)
:tag('th')
:attr('colspan', '2')
:addClass('infobox-header')
:addClass(rowArgs.class)
:addClass(args.headerclass)
-- @deprecated next; target .infobox-<name> .infobox-header
:cssText(args.headerstyle)
:cssText(rowArgs.rowcellstyle)
:wikitext(fixChildBoxes(rowArgs.header, 'th'))
if rowArgs.data then
root:wikitext(
'[[Category:Pages using infobox templates with ignored data cells]]'
)
end
elseif rowArgs.data and rowArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then
has_rows = true
has_list_class({ rowArgs.rowclass, rowArgs.class })
local row = root:tag('tr')
row:addClass(rowArgs.rowclass)
row:cssText(rowArgs.rowstyle)
if rowArgs.label then
row
:tag('th')
:attr('scope', 'row')
:addClass('infobox-label')
-- @deprecated next; target .infobox-<name> .infobox-label
:cssText(args.labelstyle)
:cssText(rowArgs.rowcellstyle)
:wikitext(rowArgs.label)
:done()
end
local dataCell = row:tag('td')
dataCell
:attr('colspan', not rowArgs.label and '2' or nil)
:addClass(not rowArgs.label and 'infobox-full-data' or 'infobox-data')
:addClass(rowArgs.class)
-- @deprecated next; target .infobox-<name> .infobox(-full)-data
:cssText(rowArgs.datastyle)
:cssText(rowArgs.rowcellstyle)
:wikitext(fixChildBoxes(rowArgs.data, 'td'))
else
table.insert(empty_row_categories, rowArgs.data or '')
end
end
local function renderTitle()
if not args.title then return end
has_rows = true
has_list_class({args.titleclass})
root
:tag('caption')
:addClass('infobox-title')
:addClass(args.titleclass)
-- @deprecated next; target .infobox-<name> .infobox-title
:cssText(args.titlestyle)
:wikitext(args.title)
end
local function renderAboveRow()
if not args.above then return end
has_rows = true
has_list_class({ args.aboveclass })
root
:tag('tr')
:tag('th')
:attr('colspan', '2')
:addClass('infobox-above')
:addClass(args.aboveclass)
-- @deprecated next; target .infobox-<name> .infobox-above
:cssText(args.abovestyle)
:wikitext(fixChildBoxes(args.above,'th'))
end
local function renderBelowRow()
if not args.below then return end
has_rows = true
has_list_class({ args.belowclass })
root
:tag('tr')
:tag('td')
:attr('colspan', '2')
:addClass('infobox-below')
:addClass(args.belowclass)
-- @deprecated next; target .infobox-<name> .infobox-below
:cssText(args.belowstyle)
:wikitext(fixChildBoxes(args.below,'td'))
end
local function addSubheaderRow(subheaderArgs)
if subheaderArgs.data and
subheaderArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then
has_rows = true
has_list_class({ subheaderArgs.rowclass, subheaderArgs.class })
local row = root:tag('tr')
row:addClass(subheaderArgs.rowclass)
local dataCell = row:tag('td')
dataCell
:attr('colspan', '2')
:addClass('infobox-subheader')
:addClass(subheaderArgs.class)
:cssText(subheaderArgs.datastyle)
:cssText(subheaderArgs.rowcellstyle)
:wikitext(fixChildBoxes(subheaderArgs.data, 'td'))
else
table.insert(empty_row_categories, subheaderArgs.data or '')
end
end
local function renderSubheaders()
if args.subheader then
args.subheader1 = args.subheader
end
if args.subheaderrowclass then
args.subheaderrowclass1 = args.subheaderrowclass
end
local subheadernums = getArgNums('subheader')
for k, num in ipairs(subheadernums) do
addSubheaderRow({
data = args['subheader' .. tostring(num)],
-- @deprecated next; target .infobox-<name> .infobox-subheader
datastyle = args.subheaderstyle,
rowcellstyle = args['subheaderstyle' .. tostring(num)],
class = args.subheaderclass,
rowclass = args['subheaderrowclass' .. tostring(num)]
})
end
end
local function addImageRow(imageArgs)
if imageArgs.data and
imageArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then
has_rows = true
has_list_class({ imageArgs.rowclass, imageArgs.class })
local row = root:tag('tr')
row:addClass(imageArgs.rowclass)
local dataCell = row:tag('td')
dataCell
:attr('colspan', '2')
:addClass('infobox-image')
:addClass(imageArgs.class)
:cssText(imageArgs.datastyle)
:wikitext(fixChildBoxes(imageArgs.data, 'td'))
else
table.insert(empty_row_categories, imageArgs.data or '')
end
end
local function renderImages()
if args.image then
args.image1 = args.image
end
if args.caption then
args.caption1 = args.caption
end
local imagenums = getArgNums('image')
for k, num in ipairs(imagenums) do
local caption = args['caption' .. tostring(num)]
local data = mw.html.create():wikitext(args['image' .. tostring(num)])
if caption then
data
:tag('div')
:addClass('infobox-caption')
-- @deprecated next; target .infobox-<name> .infobox-caption
:cssText(args.captionstyle)
:wikitext(caption)
end
addImageRow({
data = tostring(data),
-- @deprecated next; target .infobox-<name> .infobox-image
datastyle = args.imagestyle,
class = args.imageclass,
rowclass = args['imagerowclass' .. tostring(num)]
})
end
end
-- When autoheaders are turned on, preprocesses the rows
local function preprocessRows()
if not args.autoheaders then return end
local rownums = union(getArgNums('header'), getArgNums('data'))
table.sort(rownums)
local lastheader
for k, num in ipairs(rownums) do
if args['header' .. tostring(num)] then
if lastheader then
args['header' .. tostring(lastheader)] = nil
end
lastheader = num
elseif args['data' .. tostring(num)] and
args['data' .. tostring(num)]:gsub(
category_in_empty_row_pattern, ''
):match('^%S') then
local data = args['data' .. tostring(num)]
if data:gsub(category_in_empty_row_pattern, ''):match('%S') then
lastheader = nil
end
end
end
if lastheader then
args['header' .. tostring(lastheader)] = nil
end
end
-- Gets the union of the header and data argument numbers,
-- and renders them all in order
local function renderRows()
local rownums = union(getArgNums('header'), getArgNums('data'))
table.sort(rownums)
for k, num in ipairs(rownums) do
addRow({
header = args['header' .. tostring(num)],
label = args['label' .. tostring(num)],
data = args['data' .. tostring(num)],
datastyle = args.datastyle,
class = args['class' .. tostring(num)],
rowclass = args['rowclass' .. tostring(num)],
-- @deprecated next; target .infobox-<name> rowclass
rowstyle = args['rowstyle' .. tostring(num)],
rowcellstyle = args['rowcellstyle' .. tostring(num)]
})
end
end
local function renderNavBar()
if not args.name then return end
has_rows = true
root
:tag('tr')
:tag('td')
:attr('colspan', '2')
:addClass('infobox-navbar')
:wikitext(require('Module:Navbar')._navbar{
args.name,
mini = 1,
})
end
local function renderItalicTitle()
local italicTitle = args['italic title'] and mw.ustring.lower(args['italic title'])
if italicTitle == '' or italicTitle == 'force' or italicTitle == 'yes' then
root:wikitext(require('Module:Italic title')._main({}))
end
end
-- Categories in otherwise empty rows are collected in empty_row_categories.
-- This function adds them to the module output. It is not affected by
-- args.decat because this module should not prevent module-external categories
-- from rendering.
local function renderEmptyRowCategories()
for _, s in ipairs(empty_row_categories) do
root:wikitext(s)
end
end
-- Render tracking categories. args.decat == turns off tracking categories.
local function renderTrackingCategories()
if args.decat == 'yes' then return end
if args.child == 'yes' then
if args.title then
root:wikitext(
'[[Category:Pages using embedded infobox templates with the title parameter]]'
)
end
elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
root:wikitext('[[Category:Articles using infobox templates with no data rows]]')
end
end
--[=[
Loads the templatestyles for the infobox.
TODO: FINISH loading base templatestyles here rather than in
MediaWiki:Common.css. There are 4-5000 pages with 'raw' infobox tables.
See [[Mediawiki_talk:Common.css/to_do#Infobox]] and/or come help :).
When we do this we should clean up the inline CSS below too.
Will have to do some bizarre conversion category like with sidebar.
]=]
local function loadTemplateStyles()
local frame = mw.getCurrentFrame()
local hlist_templatestyles = ''
if lists.hlist_t.found then
hlist_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = lists.hlist_t.styles }
}
end
local plainlist_templatestyles = ''
if lists.plainlist_t.found then
plainlist_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = lists.plainlist_t.styles }
}
end
-- See function description
local base_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = 'Module:Infobox/styles.css' }
}
local templatestyles = ''
if args['templatestyles'] then
templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['templatestyles'] }
}
end
local child_templatestyles = ''
if args['child templatestyles'] then
child_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['child templatestyles'] }
}
end
local grandchild_templatestyles = ''
if args['grandchild templatestyles'] then
grandchild_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['grandchild templatestyles'] }
}
end
return table.concat({
-- hlist -> plainlist -> base is best-effort to preserve old Common.css ordering.
-- this ordering is not a guarantee because the rows of interest invoking
-- each class may not be on a specific page
hlist_templatestyles,
plainlist_templatestyles,
base_templatestyles,
templatestyles,
child_templatestyles,
grandchild_templatestyles
})
end
-- common functions between the child and non child cases
local function structure_infobox_common()
renderSubheaders()
renderImages()
preprocessRows()
renderRows()
renderBelowRow()
renderNavBar()
renderItalicTitle()
renderEmptyRowCategories()
renderTrackingCategories()
cleanInfobox()
end
-- Specify the overall layout of the infobox, with special settings if the
-- infobox is used as a 'child' inside another infobox.
local function _infobox()
if args.child ~= 'yes' then
root = mw.html.create('table')
root
:addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox')
:addClass(args.bodyclass)
-- @deprecated next; target .infobox-<name>
:cssText(args.bodystyle)
has_list_class({ args.bodyclass })
renderTitle()
renderAboveRow()
else
root = mw.html.create()
root
:wikitext(args.title)
end
structure_infobox_common()
return loadTemplateStyles() .. root
end
-- If the argument exists and isn't blank, add it to the argument table.
-- Blank arguments are treated as nil to match the behaviour of ParserFunctions.
local function preprocessSingleArg(argName)
if origArgs[argName] and origArgs[argName] ~= '' then
args[argName] = origArgs[argName]
end
end
-- Assign the parameters with the given prefixes to the args table, in order, in
-- batches of the step size specified. This is to prevent references etc. from
-- appearing in the wrong order. The prefixTable should be an array containing
-- tables, each of which has two possible fields, a "prefix" string and a
-- "depend" table. The function always parses parameters containing the "prefix"
-- string, but only parses parameters in the "depend" table if the prefix
-- parameter is present and non-blank.
local function preprocessArgs(prefixTable, step)
if type(prefixTable) ~= 'table' then
error("Non-table value detected for the prefix table", 2)
end
if type(step) ~= 'number' then
error("Invalid step value detected", 2)
end
-- Get arguments without a number suffix, and check for bad input.
for i,v in ipairs(prefixTable) do
if type(v) ~= 'table' or type(v.prefix) ~= "string" or
(v.depend and type(v.depend) ~= 'table') then
error('Invalid input detected to preprocessArgs prefix table', 2)
end
preprocessSingleArg(v.prefix)
-- Only parse the depend parameter if the prefix parameter is present
-- and not blank.
if args[v.prefix] and v.depend then
for j, dependValue in ipairs(v.depend) do
if type(dependValue) ~= 'string' then
error('Invalid "depend" parameter value detected in preprocessArgs')
end
preprocessSingleArg(dependValue)
end
end
end
-- Get arguments with number suffixes.
local a = 1 -- Counter variable.
local moreArgumentsExist = true
while moreArgumentsExist == true do
moreArgumentsExist = false
for i = a, a + step - 1 do
for j,v in ipairs(prefixTable) do
local prefixArgName = v.prefix .. tostring(i)
if origArgs[prefixArgName] then
-- Do another loop if any arguments are found, even blank ones.
moreArgumentsExist = true
preprocessSingleArg(prefixArgName)
end
-- Process the depend table if the prefix argument is present
-- and not blank, or we are processing "prefix1" and "prefix" is
-- present and not blank, and if the depend table is present.
if v.depend and (args[prefixArgName] or (i == 1 and args[v.prefix])) then
for j,dependValue in ipairs(v.depend) do
local dependArgName = dependValue .. tostring(i)
preprocessSingleArg(dependArgName)
end
end
end
end
a = a + step
end
end
-- Parse the data parameters in the same order that the old {{infobox}} did, so
-- that references etc. will display in the expected places. Parameters that
-- depend on another parameter are only processed if that parameter is present,
-- to avoid phantom references appearing in article reference lists.
local function parseDataParameters()
preprocessSingleArg('autoheaders')
preprocessSingleArg('child')
preprocessSingleArg('bodyclass')
preprocessSingleArg('subbox')
preprocessSingleArg('bodystyle')
preprocessSingleArg('title')
preprocessSingleArg('titleclass')
preprocessSingleArg('titlestyle')
preprocessSingleArg('above')
preprocessSingleArg('aboveclass')
preprocessSingleArg('abovestyle')
preprocessArgs({
{prefix = 'subheader', depend = {'subheaderstyle', 'subheaderrowclass'}}
}, 10)
preprocessSingleArg('subheaderstyle')
preprocessSingleArg('subheaderclass')
preprocessArgs({
{prefix = 'image', depend = {'caption', 'imagerowclass'}}
}, 10)
preprocessSingleArg('captionstyle')
preprocessSingleArg('imagestyle')
preprocessSingleArg('imageclass')
preprocessArgs({
{prefix = 'header'},
{prefix = 'data', depend = {'label'}},
{prefix = 'rowclass'},
{prefix = 'rowstyle'},
{prefix = 'rowcellstyle'},
{prefix = 'class'}
}, 50)
preprocessSingleArg('headerclass')
preprocessSingleArg('headerstyle')
preprocessSingleArg('labelstyle')
preprocessSingleArg('datastyle')
preprocessSingleArg('below')
preprocessSingleArg('belowclass')
preprocessSingleArg('belowstyle')
preprocessSingleArg('name')
-- different behaviour for italics if blank or absent
args['italic title'] = origArgs['italic title']
preprocessSingleArg('decat')
preprocessSingleArg('templatestyles')
preprocessSingleArg('child templatestyles')
preprocessSingleArg('grandchild templatestyles')
end
-- If called via #invoke, use the args passed into the invoking template.
-- Otherwise, for testing purposes, assume args are being passed directly in.
function p.infobox(frame)
if frame == mw.getCurrentFrame() then
origArgs = frame:getParent().args
else
origArgs = frame
end
parseDataParameters()
return _infobox()
end
-- For calling via #invoke within a template
function p.infoboxTemplate(frame)
origArgs = {}
for k,v in pairs(frame.args) do origArgs[k] = mw.text.trim(v) end
parseDataParameters()
return _infobox()
end
return p
0ddb7e5c8426d67cd589b710efb9912ddfb67fea
Template:Flatlist
10
144
279
2022-12-29T17:46:45Z
wikipedia>Izno
0
templatestyles obviates the need for hlist-separated
wikitext
text/x-wiki
<templatestyles src="Hlist/styles.css"/><div class="hlist {{{class|}}}" {{#if:{{{style|}}}{{{indent|}}}|style="{{#if:{{{indent|}}}|margin-left: {{#expr:{{{indent}}}*1.6}}em;}} {{{style|}}}"}}>{{#if:{{{1|}}}|
{{{1}}}
</div>}}<noinclude></div>
{{documentation}}
</noinclude>
cf60aa4aef920d48fa394e786f72fe5f6dcd3169
Module:List
828
90
171
2022-12-29T17:57:56Z
wikipedia>Izno
0
add templatestyles for hlist
Scribunto
text/plain
local libUtil = require('libraryUtil')
local checkType = libUtil.checkType
local mTableTools = require('Module:TableTools')
local p = {}
local listTypes = {
['bulleted'] = true,
['unbulleted'] = true,
['horizontal'] = true,
['ordered'] = true,
['horizontal_ordered'] = true
}
function p.makeListData(listType, args)
-- Constructs a data table to be passed to p.renderList.
local data = {}
-- Classes and TemplateStyles
data.classes = {}
data.templatestyles = ''
if listType == 'horizontal' or listType == 'horizontal_ordered' then
table.insert(data.classes, 'hlist')
data.templatestyles = mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Hlist/styles.css' }
}
elseif listType == 'unbulleted' then
table.insert(data.classes, 'plainlist')
data.templatestyles = mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Plainlist/styles.css' }
}
end
table.insert(data.classes, args.class)
-- Main div style
data.style = args.style
-- Indent for horizontal lists
if listType == 'horizontal' or listType == 'horizontal_ordered' then
local indent = tonumber(args.indent)
indent = indent and indent * 1.6 or 0
if indent > 0 then
data.marginLeft = indent .. 'em'
end
end
-- List style types for ordered lists
-- This could be "1, 2, 3", "a, b, c", or a number of others. The list style
-- type is either set by the "type" attribute or the "list-style-type" CSS
-- property.
if listType == 'ordered' or listType == 'horizontal_ordered' then
data.listStyleType = args.list_style_type or args['list-style-type']
data.type = args['type']
-- Detect invalid type attributes and attempt to convert them to
-- list-style-type CSS properties.
if data.type
and not data.listStyleType
and not tostring(data.type):find('^%s*[1AaIi]%s*$')
then
data.listStyleType = data.type
data.type = nil
end
end
-- List tag type
if listType == 'ordered' or listType == 'horizontal_ordered' then
data.listTag = 'ol'
else
data.listTag = 'ul'
end
-- Start number for ordered lists
data.start = args.start
if listType == 'horizontal_ordered' then
-- Apply fix to get start numbers working with horizontal ordered lists.
local startNum = tonumber(data.start)
if startNum then
data.counterReset = 'listitem ' .. tostring(startNum - 1)
end
end
-- List style
-- ul_style and ol_style are included for backwards compatibility. No
-- distinction is made for ordered or unordered lists.
data.listStyle = args.list_style
-- List items
-- li_style is included for backwards compatibility. item_style was included
-- to be easier to understand for non-coders.
data.itemStyle = args.item_style or args.li_style
data.items = {}
for _, num in ipairs(mTableTools.numKeys(args)) do
local item = {}
item.content = args[num]
item.style = args['item' .. tostring(num) .. '_style']
or args['item_style' .. tostring(num)]
item.value = args['item' .. tostring(num) .. '_value']
or args['item_value' .. tostring(num)]
table.insert(data.items, item)
end
return data
end
function p.renderList(data)
-- Renders the list HTML.
-- Return the blank string if there are no list items.
if type(data.items) ~= 'table' or #data.items < 1 then
return ''
end
-- Render the main div tag.
local root = mw.html.create('div')
for _, class in ipairs(data.classes or {}) do
root:addClass(class)
end
root:css{['margin-left'] = data.marginLeft}
if data.style then
root:cssText(data.style)
end
-- Render the list tag.
local list = root:tag(data.listTag or 'ul')
list
:attr{start = data.start, type = data.type}
:css{
['counter-reset'] = data.counterReset,
['list-style-type'] = data.listStyleType
}
if data.listStyle then
list:cssText(data.listStyle)
end
-- Render the list items
for _, t in ipairs(data.items or {}) do
local item = list:tag('li')
if data.itemStyle then
item:cssText(data.itemStyle)
end
if t.style then
item:cssText(t.style)
end
item
:attr{value = t.value}
:wikitext(t.content)
end
return data.templatestyles .. tostring(root)
end
function p.renderTrackingCategories(args)
local isDeprecated = false -- Tracks deprecated parameters.
for k, v in pairs(args) do
k = tostring(k)
if k:find('^item_style%d+$') or k:find('^item_value%d+$') then
isDeprecated = true
break
end
end
local ret = ''
if isDeprecated then
ret = ret .. '[[Category:List templates with deprecated parameters]]'
end
return ret
end
function p.makeList(listType, args)
if not listType or not listTypes[listType] then
error(string.format(
"bad argument #1 to 'makeList' ('%s' is not a valid list type)",
tostring(listType)
), 2)
end
checkType('makeList', 2, args, 'table')
local data = p.makeListData(listType, args)
local list = p.renderList(data)
local trackingCategories = p.renderTrackingCategories(args)
return list .. trackingCategories
end
for listType in pairs(listTypes) do
p[listType] = function (frame)
local mArguments = require('Module:Arguments')
local origArgs = mArguments.getArgs(frame, {
valueFunc = function (key, value)
if not value or not mw.ustring.find(value, '%S') then return nil end
if mw.ustring.find(value, '^%s*[%*#;:]') then
return value
else
return value:match('^%s*(.-)%s*$')
end
return nil
end
})
-- Copy all the arguments to a new table, for faster indexing.
local args = {}
for k, v in pairs(origArgs) do
args[k] = v
end
return p.makeList(listType, args)
end
end
return p
7a4f36a6e9cd56370bdd8207d23694124821dc1a
Module:Navbox/configuration
828
194
380
2022-12-29T18:14:27Z
wikipedia>Izno
0
get these in
Scribunto
text/plain
return {
aria_label = 'Navbox',
nowrap_item = '%s<span class="nowrap">%s</span>',
templatestyles = mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Module:Navbox/styles.css' }
},
hlist_templatestyles = 'Hlist/styles.css',
plainlist_templatestyles = 'Plainlist/styles.css',
-- do not localize marker table
marker = {
oddeven = '\127_ODDEVEN_\127',
restart = '\127_ODDEVEN0_\127',
regex = '\127_ODDEVEN(%d?)_\127'
},
category = {
orphan = '[[Category:Navbox orphans]]',
horizontal_lists = 'Navigational boxes without horizontal lists',
background_colors = 'Navboxes using background colours',
illegible = 'Potentially illegible navboxes',
borders = 'Navboxes using borders',
},
keyword = {
border_subgroup = 'subgroup',
border_child = 'child',
border_none = 'none',
evenodd_swap = 'swap',
navbar_off = 'off',
navbar_plain = 'plain',
nocat_false = 'false',
nowrapitems_yes = 'yes',
orphan_yes = 'yes',
state_collapsed = 'collapsed',
state_off = 'off',
state_plain = 'plain',
subpage_doc = 'doc',
subpage_sandbox = 'sandbox',
subpage_testcases = 'testcases',
tracking_no = 'no'
},
class = {
autocollapse = 'autocollapse',
collapsible = 'mw-collapsible',
collapsed = 'mw-collapsed',
-- Warning
navbox = 'navbox', -- WMF currently hides 'navbox' from mobile,
-- so you probably shouldn't change the navbox class.
navbox_abovebelow = 'navbox-abovebelow',
navbox_group = 'navbox-group',
navbox_image = 'navbox-image',
navbox_inner = 'navbox-inner',
navbox_list = 'navbox-list',
navbox_list_with_group = 'navbox-list-with-group',
navbox_part = 'navbox-', -- do not l10n
navbox_styles = 'navbox-styles',
navbox_subgroup = 'navbox-subgroup',
navbox_title = 'navbox-title', -- l10n only if you change pattern.navbox_title below
navbox_odd_part = 'odd', -- do not l10n
navbox_even_part = 'even', -- do not l10n
nomobile = 'nomobile',
nowraplinks = 'nowraplinks',
noviewer = 'noviewer' -- used to remove images from MediaViewer
},
pattern = {
listnum = '^list(%d+)$',
class = 'class',
sandbox = '/sandbox$',
navbox = 'Template:Navbox',
nowrap = '^<span class="nowrap">',
style = 'style$',
navbox_title = '<th[^>]*"navbox%-title"',
hlist = 'hlist',
plainlist = 'plainlist',
},
arg = {
above = 'above',
aboveclass = 'aboveclass',
abovestyle = 'abovestyle',
basestyle = 'basestyle',
bodyclass = 'bodyclass',
bodystyle = 'bodystyle',
border = 'border',
below = 'below',
belowclass = 'belowclass',
belowstyle = 'belowstyle',
evenodd = 'evenodd',
evenstyle = 'evenstyle',
group1 = 'group1',
group2 = 'group2',
group_and_num = 'group%d',
groupstyle_and_num = 'group%dstyle',
groupclass = 'groupclass',
groupstyle = 'groupstyle',
groupwidth = 'groupwidth',
innerstyle = 'innerstyle',
image = 'image',
imageclass = 'imageclass',
imageleft = 'imageleft',
imageleftstyle = 'imageleftstyle',
imagesetyle = 'imagestyle',
list_and_num = 'list%d',
listclass_and_num = 'list%dclass',
liststyle_and_num = 'list%dstyle',
list1padding = 'list1padding',
listclass = 'listclass',
listpadding = 'listpadding',
liststyle = 'liststyle',
name = 'name',
navbar = 'navbar',
navboxclass = 'navboxclass',
nocat = 'nocat',
nowrapitems = 'nowrapitems',
oddstyle = 'oddstyle',
orphan = 'orphan',
state = 'state',
style = 'style',
templatestyles = 'templatestyles',
child_templatestyles = 'child templatestyles',
title = 'title',
titleclass = 'titleclass',
titlestyle = 'titlestyle',
tracking = 'tracking'
},
-- names of navbar arguments
navbar = {
name = 1,
fontstyle = 'fontstyle',
mini = 'mini'
}
}
4148736fd32a93636c0413e73ed38afaef065ec9
Module:Navbar/configuration
828
104
199
2022-12-29T18:18:21Z
wikipedia>Izno
0
add hlist/styles.css
Scribunto
text/plain
return {
['templatestyles'] = 'Module:Navbar/styles.css',
['hlist_templatestyles'] = 'Hlist/styles.css',
['box_text'] = 'This box: ', -- default text box when not plain or mini
['title_namespace'] = 'Template', -- namespace to default to for title
['invalid_title'] = 'Invalid title ',
['classes'] = { -- set a line to nil if you don't want it
['navbar'] = 'navbar',
['plainlinks'] = 'plainlinks', -- plainlinks
['horizontal_list'] = 'hlist', -- horizontal list class
['mini'] = 'navbar-mini', -- class indicating small links in the navbar
['this_box'] = 'navbar-boxtext',
['brackets'] = 'navbar-brackets',
-- 'collapsible' is the key for a class to indicate the navbar is
-- setting up the collapsible element in addition to the normal
-- navbar.
['collapsible'] = 'navbar-collapse',
['collapsible_title_mini'] = 'navbar-ct-mini',
['collapsible_title_full'] = 'navbar-ct-full'
}
}
b007c336b17ec4bcd4d5a9dca9f8cba301662b55
Module:Detect singular
828
155
301
2023-01-02T22:05:13Z
wikipedia>Hike395
0
decode HTML entities
Scribunto
text/plain
local p = {}
local getArgs = require('Module:Arguments').getArgs
local yesNo = require('Module:Yesno')
local getPlain = require('Module:Text').Text().getPlain
-- function to determine whether "sub" occurs in "s"
local function plainFind(s, sub)
return mw.ustring.find(s, sub, 1, true)
end
-- function to count the number of times "pattern" (a regex) occurs in "s"
local function countMatches(s, pattern)
local _, count = mw.ustring.gsub(s, pattern, '')
return count
end
local singular = 1
local likelyPlural = 2
local plural = 3
-- Determine whether a string is singular or plural (i.e., it represents one
-- item or many)
-- Arguments:
-- origArgs[1]: string to process
-- origArgs.no_comma: if false, use commas to detect plural (default false)
-- origArgs.parse_links: if false, treat wikilinks as opaque singular objects (default false)
-- Returns:
-- singular, likelyPlural, or plural (see constants above), or nil for completely unknown
function p._main(origArgs)
origArgs = type(origArgs) == 'table' and origArgs or {}
local args = {}
-- canonicalize boolean arguments
for key, default in pairs({no_comma=false,parse_links=false,any_comma=false,no_and=false}) do
if origArgs[key] == nil then
args[key] = default
else
args[key] = yesNo(origArgs[key],default)
end
end
local checkComma = not args.no_comma
local checkAnd = not args.no_and
local rewriteLinks = not args.parse_links
local anyComma = args.any_comma
local s = origArgs[1] -- the input string
if not s then
return nil -- empty input returns nil
end
s = tostring(s)
s = mw.text.decode(s,true) --- replace HTML entities (to avoid spurious semicolons)
if plainFind(s,'data-plural="0"') then -- magic data string to return true
return singular
end
if plainFind(s,'data-plural="1"') then -- magic data string to return false
return plural
end
-- count number of list items
local numListItems = countMatches(s,'<%s*li')
-- if exactly one, then singular, if more than one, then plural
if numListItems == 1 then
return singular
end
if numListItems > 1 then
return plural
end
-- if "list of" occurs inside of wlink, then it's plural
if mw.ustring.find(s:lower(), '%[%[[^%]]*list of[^%]]+%]%]') then
return plural
end
-- fix for trailing br tags passed through [[template:marriage]]
s = mw.ustring.gsub(s, '<%s*br[^>]*>%s*(</div>)', '%1')
-- replace all wikilinks with fixed string
if rewriteLinks then
s = mw.ustring.gsub(s,'%b[]','WIKILINK')
end
-- Five conditions: any one of them can make the string a likely plural or plural
local hasBreak = mw.ustring.find(s,'<%s*br')
-- For the last 4, evaluate on string stripped of wikimarkup
s = getPlain(s)
local hasBullets = countMatches(s,'%*+') > 1
local multipleQids = mw.ustring.find(s,'Q%d+[%p%s]+Q%d+') -- has multiple QIDs in a row
if hasBullets or multipleQids then
return plural
end
local commaPattern = anyComma and '[,;]' or '%D[,;]%D' -- semi-colon similar to comma
local hasComma = checkComma and mw.ustring.find(s, commaPattern)
local hasAnd = checkAnd and mw.ustring.find(s,'[,%s]and%s')
if hasBreak or hasComma or hasAnd then
return likelyPlural
end
return singular
end
function p._pluralize(args)
args = type(args) == 'table' and args or {}
local singularForm = args[3] or args.singular or ""
local pluralForm = args[4] or args.plural or ""
local likelyForm = args.likely or pluralForm
local link = args[5] or args.link
if link then
link = tostring(link)
singularForm = '[['..link..'|'..singularForm..']]'
pluralForm = '[['..link..'|'..pluralForm..']]'
likelyForm = '[['..link..'|'..likelyForm..']]'
end
if args[2] then
return pluralForm
end
local detect = p._main(args)
if detect == nil then
return "" -- return blank on complete failure
end
if detect == singular then
return singularForm
elseif detect == likelyPlural then
return likelyForm
else
return pluralForm
end
end
function p.main(frame)
local args = getArgs(frame)
-- For template, return 1 if singular, blank if plural or empty
local result = p._main(args)
if result == nil then
return 1
end
return result == singular and 1 or ""
end
function p.pluralize(frame)
local args = getArgs(frame)
return p._pluralize(args)
end
return p
6afb2e8c0bd8ddff094e2861b836521ee4a5a779
Module:Citation/CS1/styles.css
828
24
41
2023-01-14T14:43:34Z
wikipedia>Trappist the monk
0
sync from sandbox;
sanitized-css
text/css
/* Protection icon
the following line controls the page-protection icon in the upper right corner
it must remain within this comment
{{sandbox other||{{pp-template}}}}
*/
/* Overrides
Some wikis do not override user agent default styles for HTML <cite> and <q>,
unlike en.wp. On en.wp, keep these the same as [[MediaWiki:Common.css]].
The word-wrap and :target styles were moved here from Common.css.
On en.wp, keep these the same as [[Template:Citation/styles.css]].
*/
cite.citation {
font-style: inherit; /* Remove italics for <cite> */
/* Break long urls, etc., rather than overflowing box */
word-wrap: break-word;
}
.citation q {
quotes: '"' '"' "'" "'"; /* Straight quote marks for <q> */
}
/* Highlight linked elements (such as clicked references) in blue */
.citation:target {
/* ignore the linter - all browsers of interest implement this */
background-color: rgba(0, 127, 255, 0.133);
}
/* ID and URL access
Both core and Common.css have selector .mw-parser-output a[href$=".pdf"].external
for PDF pages. All TemplateStyles pages are hoisted to .mw-parser-output. We need
to have specificity equal to a[href$=".pdf"].external for locks to override PDF icon.
That's essentially 2 classes and 1 element.
the .id-lock-... selectors are for use by non-citation templates like
{{Catalog lookup link}} which do not have to handle PDF links
*/
.id-lock-free a,
.citation .cs1-lock-free a {
background: url(//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg)
right 0.1em center/9px no-repeat;
}
.id-lock-limited a,
.id-lock-registration a,
.citation .cs1-lock-limited a,
.citation .cs1-lock-registration a {
background: url(//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg)
right 0.1em center/9px no-repeat;
}
.id-lock-subscription a,
.citation .cs1-lock-subscription a {
background: url(//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg)
right 0.1em center/9px no-repeat;
}
/* Wikisource
Wikisource icon when |chapter= or |title= is wikilinked to Wikisource
as in cite wikisource
*/
.cs1-ws-icon a {
background: url(//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg)
right 0.1em center/12px no-repeat;
}
/* Errors and maintenance */
.cs1-code {
/* <code>...</code> style override: mediawiki's css definition is specified here:
https://git.wikimedia.org/blob/mediawiki%2Fcore.git/
69cd73811f7aadd093050dbf20ed70ef0b42a713/skins%2Fcommon%2FcommonElements.css#L199
*/
color: inherit;
background: inherit;
border: none;
padding: inherit;
}
.cs1-hidden-error {
display: none;
color: #d33;
}
.cs1-visible-error {
color: #d33;
}
.cs1-maint {
display: none;
color: #3a3;
margin-left: 0.3em;
}
/* Small text size
Set small text size in one place. 0.95 (here) * 0.9 (from references list) is
~0.85, which is the lower bound for size for accessibility. Old styling for this
was just 0.85. We could write the rule so that when this template is inside
references/reflist, only then does it multiply by 0.95; else multiply by 0.85 */
.cs1-format {
font-size: 95%;
}
/* kerning */
.cs1-kern-left {
padding-left: 0.2em;
}
.cs1-kern-right {
padding-right: 0.2em;
}
/* selflinks – avoid bold font style when cs1|2 template links to the current page */
.citation .mw-selflink {
font-weight: inherit;
}
7c96feb084b1883e7b6522660da6a14bdcc94752
Template:Large
10
201
394
2023-01-16T01:12:34Z
wikipedia>Jonesey95
0
use this template's own documentation
wikitext
text/x-wiki
<span style="font-size:120%">{{{1}}}</span><noinclude>
{{Documentation}}
</noinclude>
8ba6ec8c3178e22dc1f05aa239df8a2b052be668
Template:Notice
10
167
325
2023-01-25T22:32:14Z
wikipedia>Izno
0
per tper
wikitext
text/x-wiki
{{Mbox
| name = Notice
| demospace = {{{demospace|}}}
| style = {{#if:{{{style|}}} |{{{style}}} }}
| subst = <includeonly>{{subst:substcheck}}</includeonly>
| type = notice
| image = {{#if:{{{image|}}} |[[File:{{{image}}}|40px|Notice|alt={{{imagealt|}}}]]}}
| small = {{{small|}}}
| smallimage = {{#if:{{{image|}}} |[[File:{{{image}}}|30px|Notice|alt={{{imagealt|}}}]]}}
| imageright = {{#if:{{{imageright|}}} |{{{imageright}}} |{{#if:{{{shortcut|{{{shortcut1|}}}}}} |{{Ombox/shortcut|{{{shortcut|{{{shortcut1|}}}}}}|{{{shortcut2|}}}|{{{shortcut3|}}}|{{{shortcut4|}}}|{{{shortcut5|}}}}}}} }}
| textstyle = {{{textstyle|text-align: {{#if:{{{center|}}}|center|{{{align|left}}}}};}}}
| text = {{#if:{{{header|{{{heading|{{{title|}}}}}}}}} |<div style="{{{headstyle|text-align: {{#if:{{{center|}}}|center|left}};}}}">'''{{{header|{{{heading|{{{title|}}}}}}}}}'''</div>}}<!--
-->{{{text|{{{content|{{{reason|{{{1}}}}}}}}}}}}
}}<noinclude>
{{Documentation}}
</noinclude>
2cbdbb721ca517005f6827650eef5b0f17537a43
Module:If empty
828
187
366
2023-01-26T18:33:28Z
wikipedia>MSGJ
0
lastk is not needed
Scribunto
text/plain
local p = {}
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:If empty', removeBlanks = false})
for k,v in ipairs(args) do
if v ~= '' then
return v
end
end
end
return p
4790391408957dea3ff9f453834c05f6b379a45c
Template:Distinguish
10
97
185
2023-02-04T21:16:13Z
wikipedia>Hog Farm
0
[[Wikipedia:Templates for discussion/Log/2023 February 4#Template:Distinguish]] closed as keep ([[WP:XFDC#4.0.13|XFDcloser]])
wikitext
text/x-wiki
{{#invoke:Distinguish|distinguish}}<noinclude><!-- splitting these lines causes {{Documentation}} template to terminate green shading when Distinguish is used in /doc pages. -->
{{Documentation}}
<!-- Add categories to the /doc subpage and interwikis to Wikidata, not here! -->
</noinclude>
f949a4cbfd6eb0ab77b832e69059a40a964b1fd8
Module:Lua banner
828
129
249
2023-02-16T14:39:53Z
wikipedia>Uzume
0
[[Module:Citation]] has been blanked since [[Wikipedia:Templates for discussion/Log/2018 May 13#Module:Citation]]; remove special handling
Scribunto
text/plain
-- This module implements the {{lua}} template.
local yesno = require('Module:Yesno')
local mList = require('Module:List')
local mTableTools = require('Module:TableTools')
local mMessageBox = require('Module:Message box')
local p = {}
function p.main(frame)
local origArgs = frame:getParent().args
local args = {}
for k, v in pairs(origArgs) do
v = v:match('^%s*(.-)%s*$')
if v ~= '' then
args[k] = v
end
end
return p._main(args)
end
function p._main(args)
local modules = mTableTools.compressSparseArray(args)
local box = p.renderBox(modules)
local trackingCategories = p.renderTrackingCategories(args, modules)
return box .. trackingCategories
end
function p.renderBox(modules)
local boxArgs = {}
if #modules < 1 then
boxArgs.text = '<strong class="error">Error: no modules specified</strong>'
else
local moduleLinks = {}
for i, module in ipairs(modules) do
moduleLinks[i] = string.format('[[:%s]]', module)
local maybeSandbox = mw.title.new(module .. '/sandbox')
if maybeSandbox.exists then
moduleLinks[i] = moduleLinks[i] .. string.format(' ([[:%s|sandbox]])', maybeSandbox.fullText)
end
end
local moduleList = mList.makeList('bulleted', moduleLinks)
local title = mw.title.getCurrentTitle()
if title.subpageText == "doc" then
title = title.basePageTitle
end
if title.contentModel == "Scribunto" then
boxArgs.text = 'This module depends on the following other modules:' .. moduleList
else
boxArgs.text = 'This template uses [[Wikipedia:Lua|Lua]]:\n' .. moduleList
end
end
boxArgs.type = 'notice'
boxArgs.small = true
boxArgs.image = '[[File:Lua-Logo.svg|30px|alt=|link=]]'
return mMessageBox.main('mbox', boxArgs)
end
function p.renderTrackingCategories(args, modules, titleObj)
if yesno(args.nocat) then
return ''
end
local cats = {}
-- Error category
if #modules < 1 then
cats[#cats + 1] = 'Lua templates with errors'
end
-- Lua templates category
titleObj = titleObj or mw.title.getCurrentTitle()
local subpageBlacklist = {
doc = true,
sandbox = true,
sandbox2 = true,
testcases = true
}
if not subpageBlacklist[titleObj.subpageText] then
local protCatName
if titleObj.namespace == 10 then
local category = args.category
if not category then
local categories = {
['Module:String'] = 'Templates based on the String Lua module',
['Module:Math'] = 'Templates based on the Math Lua module',
['Module:BaseConvert'] = 'Templates based on the BaseConvert Lua module',
['Module:Citation/CS1'] = 'Templates based on the Citation/CS1 Lua module'
}
category = modules[1] and categories[modules[1]]
category = category or 'Lua-based templates'
end
cats[#cats + 1] = category
protCatName = "Templates using under-protected Lua modules"
elseif titleObj.namespace == 828 then
protCatName = "Modules depending on under-protected modules"
end
if not args.noprotcat and protCatName then
local protLevels = {
autoconfirmed = 1,
extendedconfirmed = 2,
templateeditor = 3,
sysop = 4
}
local currentProt
if titleObj.id ~= 0 then
-- id is 0 (page does not exist) if am previewing before creating a template.
currentProt = titleObj.protectionLevels["edit"][1]
end
if currentProt == nil then currentProt = 0 else currentProt = protLevels[currentProt] end
for i, module in ipairs(modules) do
if module ~= "WP:libraryUtil" then
local moduleProt = mw.title.new(module).protectionLevels["edit"][1]
if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end
if moduleProt < currentProt then
cats[#cats + 1] = protCatName
break
end
end
end
end
end
for i, cat in ipairs(cats) do
cats[i] = string.format('[[Category:%s]]', cat)
end
return table.concat(cats)
end
return p
03ec1b34a40121efc562c0c64a67ebbf57d56dff
Template:Infobox political party
10
183
358
2023-02-23T04:32:29Z
wikipedia>ಮಲ್ನಾಡಾಚ್ ಕೊಂಕ್ಣೊ
0
add support for chairwoman per tper
wikitext
text/x-wiki
<includeonly>{{#if:{{Has short description}} |<!--Do nothing--> |{{main other|{{Short description|Political party{{#if:{{{country|}}}| in {{Plain text|{{{country}}}}}}}|noreplace}}}} }}</includeonly>
{{Infobox
| bodyclass = vcard
| abovestyle = font-size: 125%;
| above = <div style="padding-top:0.3em; padding-bottom:0.3em; {{#if:{{{colorcode|}}}|border-top:2px solid {{{colorcode}}}; border-bottom:2px solid {{{colorcode}}};}} line-height: 1;"><div class="fn org">{{if empty|{{{name|}}}|{{PAGENAMEBASE}}}}</div> {{#if:{{{native_name|}}} |<div style="font-size: 0.8em; padding-top:0.3em;" class="nickname" {{#if:{{{native_name_lang|}}}|lang="{{{native_name_lang}}}"}}>{{{native_name}}}</div>}}</div>
| subheader = {{{_subheader|}}}
| imageclass = logo
| imagestyle = padding-top:.4em;padding-bottom:.3em;
| image = {{#invoke:InfoboxImage|InfoboxImage|image={{{logo|}}}|upright={{{logo_upright|0.8}}}|alt={{{logo_alt|}}}|size={{{logo_size|}}}}}
| caption = {{{caption|}}}
| headerstyle = line-height: 0.8em;
| labelstyle = line-height:1.3em;
| datastyle = line-height:1.3em;
| label1 = {{{lang1}}} name
| class1 = nickname
| data1 = {{{name_lang1|}}}
| label2 = {{{lang2}}} name
| class2 = nickname
| data2 = {{{name_lang2|}}}
| label3 = {{{lang3}}} name
| class3 = nickname
| data3 = {{{name_lang3|}}}
| label4 = {{{lang4}}} name
| class4 = nickname
| data4 = {{{name_lang4|}}}
| label5 = Abbreviation
| class5 = nickname
| data5 = {{if empty|{{{abbreviation|}}}|{{{abbr|}}}}}
| label6 = [[Party leader|Leader]]
| class6 = agent
| data6 = {{{leader|}}}
| label7 = President
| class7 = agent
| data7 = {{{president|}}}
| label8 = [[Party chair|Chair{{#if:{{{chairperson|}}}|person|{{#if:{{{chairman|}}}|man|woman}}}}]]
| class8 = agent
| data8 = {{if empty|{{{chairperson|}}}|{{{chairman|}}}|{{{chairwoman|}}}}}
| label9 = [[Party secretary|Secretary]]
| class9 = agent
| data9 = {{{secretary|}}}
| label10 = General Secretary
| class10 = agent
| data10 = {{{general_secretary|}}}
| label11 = First Secretary
| class11 = agent
| data11 = {{{first_secretary|}}}
| label12 = {{nowrap|Secretary-General}}
| class12 = agent
| data12 = {{{secretary_general|}}}
| label13 = [[Presidium]]
| class13 = agent
| data13 = {{{presidium|}}}
| label14 = Governing body
| class14 = agent
| data14 = {{{governing_body|}}}
| label15 = Standing Committee
| class15 = agent
| data15 = {{{standing_committee|}}}
| label16 = [[Party spokesperson|Spokes{{#if:{{{spokesperson|}}}|person|man}}]]
| class16 = agent
| data16 = {{if empty|{{{spokesperson|}}}|{{{spokesman|}}}}}
| label17 = {{{leader1_title|}}}
| class17 = agent
| data17 = {{{leader1_name|}}}
| label18 = {{{leader2_title|}}}
| class18 = agent
| data18 = {{{leader2_name|}}}
| label19 = {{{leader3_title|}}}
| class19 = agent
| data19 = {{{leader3_name|}}}
| label20 = {{{leader4_title|}}}
| class20 = agent
| data20 = {{{leader4_name|}}}
| label21 = {{{leader5_title|}}}
| class21 = agent
| data21 = {{{leader5_name|}}}
| label22 = {{#if:{{{founders|}}} |Founders |Founder}}
| class22 = agent
| data22 = {{if empty|{{{founders|}}}|{{{founder|}}}}}
| label23 = Founded
| data23 = {{if empty|{{{founded|}}}|{{{foundation|}}}}}
| label24 = Registered
| data24 = {{{registered|}}}
| label25 = Legali{{#if:{{{legalised|}}}|s|z}}ed
| data25 = {{if empty|{{{legalised|}}}|{{{legalized|}}}}}
| label26 = {{#if:{{{banned|}}} |Banned |Dissolved}}
| data26 = {{if empty|{{{banned|}}}|{{{dissolved|}}}|{{{dissolution|}}}}}
| label27 = Merger of
| data27 = {{{merger|}}}
| label28 = Split from
| data28 = {{{split|}}}
| label29 = Preceded by
| data29 = {{{predecessor|}}}
| label30 = Merged into
| data30 = {{{merged|}}}
| label31 = Succeeded by
| data31 = {{{successor|}}}
| label32 = Headquarters
| class32 = label
| data32 = {{{headquarters|}}}
| label33 = Newspaper
| data33 = {{{newspaper|}}}
| label34 = [[Think tank]]
| data34 = {{if empty|{{{think tank|}}}|{{{think_tank|}}}}}
| label35 = [[Student wing]]
| data35 = {{{student_wing|}}}
| label36 = [[Youth wing]]
| data36 = {{{youth_wing|}}}
| label37 = [[Women's wing]]
| data37 = {{{womens_wing|}}}
| label38 = {{{wing1_title}}}
| data38 = {{{wing1|}}}
| label39 = {{{wing2_title}}}
| data39 = {{{wing2|}}}
| label40 = {{{wing3_title}}}
| data40 = {{{wing3|}}}
| label41 = {{{wing4_title}}}
| data41 = {{{wing4|}}}
| label42 = Membership {{#if:{{{membership_year|}}} |{{nobold|({{{membership_year}}})}}}}
| data42 = {{{membership|}}}
| label43 = [[List of political ideologies|Ideology]]
| class43 = category
| data43 = {{{ideology|}}}
| label44 = [[Political spectrum|Political position]]
| class44 = category
| data44 = {{{position|}}}
| label45 = Religion
| class45 = category
| data45 = {{{religion|}}}
| label46 = National affiliation
| class46 = category
| data46 = {{{national|}}}
| label47 = Regional affiliation
| class47 = category
| data47 = {{if empty|{{{regional|}}}|{{{regional affiliation|}}}}}
| label48 = [[European political party|European affiliation]]
| class48 = category
| data48 = {{{european|}}}
| label49 = Continental affiliation
| class49 = category
| data49 = {{if empty|{{{continental|}}}|{{{continental affiliation|}}}}}
| label50 = International affiliation
| class50 = category
| data50 = {{{international|}}}
| label51 = [[Political groups of the European Parliament|European Parliament group]]
| class51 = category
| data51 = {{{europarl|}}}
| label52 = {{{affiliation1_title}}}
| class52 = category
| data52 = {{#if:{{{affiliation1_title|}}}|{{{affiliation1|}}}}}
| label53 = {{{affiliation2_title}}}
| class53 = category
| data53 = {{#if:{{{affiliation2_title|}}}|{{{affiliation2|}}}}}
| label54 = Colo{{#if:{{{colours|}}}|u|}}rs
| data54 = {{{colo{{#if:{{{colours|}}}|u|}}rs|}}}
| label55 = Slogan
| data55 = {{{slogan|}}}
| label56 = Anthem
| data56 = {{{anthem|}}}
| label57 = {{{blank1_title|}}}
| data57 = {{{blank1|}}}
| label58 = {{{blank2_title|}}}
| data58 = {{{blank2|}}}
| label59 = {{{blank3_title|}}}
| data59 = {{{blank3|}}}
| label60 = {{{blank4_title|}}}
| data60 = {{{blank4|}}}
| label61 = {{{seats1_title|}}}
| data61 = {{{seats1|}}}
| label62 = {{{seats2_title|}}}
| data62 = {{{seats2|}}}
| label63 = {{{seats3_title|}}}
| data63 = {{{seats3|}}}
| label64 = {{{seats4_title|}}}
| data64 = {{{seats4|}}}
| label65 = {{{seats5_title|}}}
| data65 = {{{seats5|}}}
| label66 = {{{seats6_title|}}}
| data66 = {{{seats6|}}}
| label67 = {{{seats7_title|}}}
| data67 = {{{seats7|}}}
| label68 = {{{seats8_title|}}}
| data68 = {{{seats8|}}}
| label69 = {{{seats9_title|}}}
| data69 = {{{seats9|}}}
| label70 = {{{seats10_title|}}}
| data70 = {{{seats10|}}}
| label71 = {{{seats11_title|}}}
| data71 = {{{seats11|}}}
| header72 = {{#if:{{{symbol|}}} |Election symbol}}
| data73 = {{{symbol|}}}
| header74 = {{#if:{{{flag|}}} |{{{flag_title|Party flag}}}}}
| data75 = {{#invoke:InfoboxImage|InfoboxImage|image={{{flag|}}}|upright=0.8|alt={{if empty|{{{flag_alt|}}}|{{{flag_title|}}}}}}}
| header76 = {{#if:{{{website|}}} |Website}}
| data77 = {{{website|}}}
| belowstyle = padding-top:0;
| below = {{#if:{{{state|}}}{{{country|}}}
| {{Hlist |style=line-height:1.3em; padding-top:0.3em; border-top:{{#if:{{{colorcode|}}}|2|1}}px solid {{{colorcode|#aaa}}};
| {{#if:{{{country_dab1|}}}
| {{#ifexist: {{{country_dab1|}}} | [[{{{country_dab1}}}|Politics of {{if empty|{{{state|}}}|{{{country}}}}}]] }}
| {{#ifexist: Politics of {{if empty|{{{state|}}}|{{{country}}}}} | [[Politics of {{if empty|{{{state|}}}|{{{country}}}}}]] }}
}}
| {{#if:{{{parties_dab1|}}}
| {{#ifexist: {{{parties_dab1|}}} | [[{{{parties_dab1}}}|Political parties]] }}
| {{#ifexist: List of political parties in {{if empty|{{{state|}}}|{{{country}}}}} | [[List of political parties in {{if empty|{{{state|}}}|{{{country}}}}}|Political parties]] }}
}}
| {{#if:{{{elections_dab1|}}}
| {{#ifexist: {{{elections_dab1}}} | [[{{{elections_dab1}}}|Elections]] }}
| {{#ifexist: Elections in {{if empty|{{{state|}}}|{{{country}}}}} | [[Elections in {{if empty|{{{state|}}}|{{{country}}}}}|Elections]]}}
}}
}}<!--
-->{{#if:{{{country2|}}}
| {{Hlist |style=line-height:1.3em; margin-top:0.2em; padding-top:0.2em; border-top: 1px solid #aaa;
| {{#if:{{{country_dab2|}}}
| {{#ifexist: {{{country_dab2|}}} | [[{{{country_dab2}}}|Politics of {{{country2}}}]] }}
| {{#ifexist: Politics of {{{country2}}} | [[Politics of {{{country2}}}]] }}
}}
| {{#if:{{{parties_dab1|}}}
| {{#ifexist: {{{parties_dab2|}}} | [[{{{parties_dab2}}}|Political parties]] }}
| {{#ifexist: List of political parties in {{{country2}}} | [[List of political parties in {{{country2}}}|Political parties]] }}
}}
| {{#if:{{{elections_dab1|}}}
| {{#ifexist: {{{elections_dab2}}} | [[{{{elections_dab2}}}|Elections]] }}
| {{#ifexist: Elections in {{{country2}}} | [[Elections in {{{country2}}}|Elections]]}}
}}
}} }} }}<!--
-->{{#if:{{{footnotes|}}} |<hr/>{{{footnotes}}} }}
}}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox political party with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox political party]] with unknown parameter "_VALUE_"|ignoreblank=y| _subheader | abbr | abbreviation | affiliation1 | affiliation1_title | affiliation2 | affiliation2_title | anthem | banned | blank1 | blank1_title | blank2 | blank2_title | blank3 | blank3_title | blank4 | blank4_title | caption | categories | chairman | chairperson | chairwoman | colorcode | colors | colours | continental | continental affiliation | country | country_dab1 | country_dab2 | country2 | demo | dissolution | dissolved | elections_dab1 | elections_dab2 | europarl | european | first_secretary | flag | flag_alt | flag_title | footnotes | foundation | founded | founder | founders | general_secretary | governing_body | headquarters | ideology | international | lang1 | lang2 | lang3 | lang4 | leader | leader1_name | leader1_title | leader2_name | leader2_title | leader3_name | leader3_title | leader4_name | leader4_title | leader5_name | leader5_title | legalised | legalized | logo | logo_alt | logo_size | logo_upright | membership | membership_year | merged | merger | name | name_lang1 | name_lang2 | name_lang3 | name_lang4 | national | native_name | native_name_lang | newspaper | nocat | parties_dab1 | parties_dab2 | position | predecessor | president | presidium | regional | regional affiliation | registered | religion | seats1 | seats1_title | seats10 | seats10_title | seats11 | seats11_title | seats2 | seats2_title | seats3 | seats3_title | seats4 | seats4_title | seats5 | seats5_title | seats6 | seats6_title | seats7 | seats7_title | seats8 | seats8_title | seats9 | seats9_title | secretary | secretary_general | slogan | split | spokesman | spokesperson | standing_committee | state | student_wing | successor | symbol | think tank | think_tank | website | wing1 | wing1_title | wing2 | wing2_title | wing3 | wing3_title | wing4 | wing4_title | womens_wing | youth_wing
}}<noinclude>
{{Documentation}}
</noinclude>
8b587d5ac78b0131b82ed669ff04f80ed06765f8
Template:Infobox election
10
209
410
2023-03-02T13:58:13Z
wikipedia>Number 57
0
Per RfC outcome
wikitext
text/x-wiki
<includeonly>{{#invoke:infobox|infoboxTemplate
| child = {{{child|{{{embed|}}}}}}
| bodyclass = {{#if:{{{election_date|}}}|vevent|}}
| bodystyle = line-height: 1.5em; {{#if:<!--
-->{{{map_image|}}}{{{map|}}}{{{map2_image|}}}{{{map2|}}}{{{map3_image|}}}{{{map3|}}}{{{map4_image|}}}{{{map4|}}}<!--
-->|width:{{max
| 1 = {{#if:{{{map_image|}}}{{{map|}}}|{{#invoke:string|replace|{{if empty|{{{map_size|}}}|300px}}|px%s*$||plain=false}}}}
| 2 = {{#if:{{{map2_image|}}}{{{map2|}}}|{{#invoke:string|replace|{{if empty|{{{map2_size|}}}|300px}}|px%s*$||plain=false}}}}
| 3 = {{#if:{{{map3_image|}}}{{{map3|}}}|{{#invoke:string|replace|{{if empty|{{{map3_size|}}}|300px}}|px%s*$||plain=false}}}}
| 4 = {{#if:{{{map4_image|}}}{{{map4|}}}|{{#invoke:string|replace|{{if empty|{{{map4_size|}}}|300px}}|px%s*$||plain=false}}}}
}}px}}
| titleclass = summary
| titlestyle = font-size: 125%;
| title = {{#ifeq:{{{child|{{{embed|}}}}}}|yes|{{#if:{{{election_name|}}}|<div style="background-color:#ddd; font-size:120%; font-weight:bold">{{{election_name}}}</div>}}|{{{election_name|{{PAGENAME}}}}}}}
| datastyle = text-align:center;
| labelstyle = width:5em;white-space:nowrap;
| subheaderstyle = line-height:130%;
| subheader1 = {{#if:{{{flag_image|}}}
|{{#invoke:InfoboxImage|InfoboxImage|image={{{flag_image|}}}|size=50px|alt=|link=}}<hr />
|{{#if:{{{country|}}}
|{{#ifexist:Template:Country data {{{country}}}|{{flagdeco|{{{country}}}|variant={{{flag_year|}}}|size=50px|noredlink={{main other||yes}}}}<hr />}}
}}
}}
| subheader2 = {{#if:{{{previous_year|}}}{{{election_date|}}}{{{next_year|}}}|
{{succession links|leftstyle=width:20%;|centerstyle = width:60%;|rightstyle=width:20%;
| left ={{#if:{{{previous_year|}}}|{{#ifexist:{{{previous_election|}}}|[[{{{previous_election}}}|{{{previous_year}}}]]|{{{previous_year}}}}}}}
| center = {{#if:{{{election_date|}}}|'''{{{election_date}}}'''}}
| right = {{#if:{{{next_year|}}}|{{#ifexist:{{{next_election|}}}|[[{{{next_election}}}|{{{next_year}}}]]|{{{next_year}}}}}}}
}}
}}
| subheader3 =
{{#if:{{{outgoing_members|{{{previous_mps|}}}}}}{{{elected_members|{{{elected_mps|}}}}}}|
{{succession links|leftstyle=width:40%; text-align:center;|rightstyle=width:40%; text-align:center;
| left = {{#if:{{{outgoing_members|{{{previous_mps|}}}}}}|{{#ifexist:{{{outgoing_members|{{{previous_mps|}}}}}}|[[{{{outgoing_members|{{{previous_mps|}}}}}}|outgoing members]]|{{{outgoing_members|{{{previous_mps|}}}}}}}}}}
| right = {{#if:{{{elected_members|{{{elected_mps|}}}}}}|{{#ifexist:{{{elected_members|{{{elected_mps|}}}}}}|[[{{{elected_members|{{{elected_mps|}}}}}}|elected members]]|{{{elected_members|{{{elected_mps|}}}}}}}}|}}
}}
}}
| headerstyle = font-weight:normal;
| header1 =
{{#switch:{{{type|}}}
| primary
| Primary
| presidential
| Presidential = {{#if:{{{votes_for_election|}}}|<hr />{{{votes_for_election}}}{{#if:{{{needed_votes|}}}|<br />{{{needed_votes}}} votes needed to win}}
}}
| parliamentary
| Parliamentary
| legislative
| Legislative
| by-election
| By-election = {{#if:{{{seats_for_election|}}}|<hr />{{{seats_for_election}}}{{#if:{{{majority_seats|}}}|<br />{{{majority_seats}}} seats needed for a majority}}
}}
| #default =
}}
| data2 = {{#if:{{{opinion_polls|}}}| [[{{{opinion_polls}}}|Opinion polls]] }}
| label3 = Registered
| data3 = {{{registered|}}}
| label4 = Turnout
| data4 = {{{turnout|}}}
| label5 = Votes counted
| data5 = {{#if:{{{votes_counted|}}}|{{center|{{Percentage bar|{{{votes_counted}}}|{{{votes_counted}}}%|1BCE0E}}}}as of '''{{{last_update}}} {{{time_zone}}}''' }}
| label6 = Reporting
| data6 = {{#if:{{{reporting|}}}|{{center|{{Percentage bar|{{{reporting}}}|{{{reporting}}}%|1BCE0E}}}}as of '''{{{last_update}}} {{{time_zone}}}''' }}
| label7 = Declared
| data7 = {{#if:{{{declared|}}}|{{center|{{Percentage bar|{{{declared}}}|{{{declared}}}%|1BCE0E}}}}as of '''{{{last_update}}} {{{time_zone}}}''' }}
| data10 = <nowiki />
{{(!}} style="background:transparent; width:100%;"
{{!}}-
{{Infobox election/row
| type = {{{type|}}}
| divider = <!-- none -->
| filler = {{{filler|}}}
| col3 = {{#if:{{{color3|}}}{{{colour3|}}}{{{image3|}}}{{{nominee3|}}}{{{candidate3|}}}{{{leader3|}}}{{{party3|}}}{{{alliance3|}}}{{{home_state3|}}}{{{running_mate3|}}}{{{electoral_vote3|}}}{{{delegate_count3|}}}{{{states_carried3|}}}{{{leader_since3|}}}{{{leaders_seat3|}}}{{{last_election3|}}}{{{seats_before3|}}}{{{seats_needed3|}}}{{{seats3|}}}{{{seats_after3|}}}{{{seat_change3|}}}{{{popular_vote3|}}}{{{percentage3|}}}{{{swing3|}}}{{{poll1_nominee3|}}}{{{poll1_candidate3|}}}{{{poll2_nominee3|}}}{{{poll2_candidate3|}}}{{{poll3_nominee3|}}}{{{poll3_candidate3|}}}{{{poll4_nominee3|}}}{{{poll4_candidate3|}}}{{{poll5_nominee3|}}}{{{poll5_candidate3|}}}{{{poll1_party3|}}}{{{poll2_party3|}}}{{{poll3_party3|}}}{{{poll4_party3|}}}{{{poll5_party3|}}}{{{1data3|}}}{{{2data3|}}}{{{3data3|}}}{{{4data3|}}}{{{5data3|}}}{{{6data3|}}}|yes}}
| ongoing = {{{ongoing|no}}}
| header1 = {{#switch:{{{type|}}}|parliamentary|Parliamentary=First party|#default=Majority party}}
| header2 = {{#switch:{{{type|}}}|parliamentary|Parliamentary=Second party|#default=Minority party}}
| header3 = {{#switch:{{{type|}}}|parliamentary|Parliamentary=Third party|#default=Third party}}
| party_color = {{if empty| {{{party_colour|}}} | {{{party_color|}}} | yes }}
| color1 = {{if empty| {{{color1|}}} | {{{colour1|}}} }}
| color2 = {{if empty| {{{color2|}}} | {{{colour2|}}} }}
| color3 = {{if empty| {{{color3|}}} | {{{colour3|}}} }}
| image_size = {{{image_size|150x150px}}}
| image_upright = {{{image_upright|}}}
| image1 = {{{image1|}}}
| image1_size = {{{image1_size|}}}
| image1_upright = {{{image1_upright|}}}
| image2 = {{{image2|}}}
| image2_size = {{{image2_size|}}}
| image2_upright = {{{image2_upright|}}}
| image3 = {{{image3|}}}
| image3_size = {{{image3_size|}}}
| image3_upright = {{{image3_upright|}}}
| pageimage1 = {{{pageimage1|}}}
| pageimage2 = {{{pageimage2|}}}
| pageimage3 = {{{pageimage3|}}}
| nominee1 = {{{nominee1|}}}
| nominee2 = {{{nominee2|}}}
| nominee3 = {{{nominee3|}}}
| candidate1 = {{{candidate1|}}}
| candidate2 = {{{candidate2|}}}
| candidate3 = {{{candidate3|}}}
| leader1 = {{{leader1|}}}
| leader2 = {{{leader2|}}}
| leader3 = {{{leader3|}}}
| party1_name = {{{party1_name|{{{party_name|}}}}}}
| party2_name = {{{party2_name|{{{party_name|}}}}}}
| party3_name = {{{party3_name|{{{party_name|}}}}}}
| party1 = {{{party1|}}}
| party2 = {{{party2|}}}
| party3 = {{{party3|}}}
| alliance1_name = {{{alliance1_name|{{{alliance_name|}}}}}}
| alliance2_name = {{{alliance2_name|{{{alliance_name|}}}}}}
| alliance3_name = {{{alliance3_name|{{{alliance_name|}}}}}}
| alliance1 = {{{alliance1|}}}
| alliance2 = {{{alliance2|}}}
| alliance3 = {{{alliance3|}}}
| home_state1 = {{{home_state1|}}}
| home_state2 = {{{home_state2|}}}
| home_state3 = {{{home_state3|}}}
| running_mate1 = {{{running_mate1|}}}
| running_mate2 = {{{running_mate2|}}}
| running_mate3 = {{{running_mate3|}}}
| college_voted = {{{college_voted|}}}
| electoral_vote1 = {{{electoral_vote1|}}}
| electoral_vote2 = {{{electoral_vote2|}}}
| electoral_vote3 = {{{electoral_vote3|}}}
| delegate_count1 = {{{delegate_count1|}}}
| delegate_count2 = {{{delegate_count2|}}}
| delegate_count3 = {{{delegate_count3|}}}
| states_carried1 = {{{states_carried1|}}}
| states_carried2 = {{{states_carried2|}}}
| states_carried3 = {{{states_carried3|}}}
| leader_since1 = {{{leader_since1|}}}
| leader_since2 = {{{leader_since2|}}}
| leader_since3 = {{{leader_since3|}}}
| leaders_seat1 = {{{leaders_seat1|}}}
| leaders_seat2 = {{{leaders_seat2|}}}
| leaders_seat3 = {{{leaders_seat3|}}}
| last_election1 = {{{last_election1|}}}
| last_election2 = {{{last_election2|}}}
| last_election3 = {{{last_election3|}}}
| seats_before1 = {{{seats_before1|}}}
| seats_before2 = {{{seats_before2|}}}
| seats_before3 = {{{seats_before3|}}}
| seats_needed1 = {{{seats_needed1|}}}
| seats_needed2 = {{{seats_needed2|}}}
| seats_needed3 = {{{seats_needed3|}}}
| seats1 = {{{seats1|}}}
| seats2 = {{{seats2|}}}
| seats3 = {{{seats3|}}}
| seats_after1 = {{{seats_after1|}}}
| seats_after2 = {{{seats_after2|}}}
| seats_after3 = {{{seats_after3|}}}
| seat_change1 = {{{seat_change1|}}}
| seat_change2 = {{{seat_change2|}}}
| seat_change3 = {{{seat_change3|}}}
| vote_type = {{{vote_type|Popular}}}
| popular_vote1 = {{{popular_vote1|}}}
| popular_vote2 = {{{popular_vote2|}}}
| popular_vote3 = {{{popular_vote3|}}}
| percentage1 = {{{percentage1|}}}
| percentage2 = {{{percentage2|}}}
| percentage3 = {{{percentage3|}}}
| counties_won1 = {{{counties_won1|}}}
| counties_won2 = {{{counties_won2|}}}
| counties_won3 = {{{counties_won3|}}}
| counties_threshold1 = {{{counties_threshold1|}}}
| counties_threshold2 = {{{counties_threshold2|}}}
| counties_threshold3 = {{{counties_threshold3|}}}
| swing1 = {{{swing1|}}}
| swing2 = {{{swing2|}}}
| swing3 = {{{swing3|}}}
| opinion_polls = {{{opinion_polls|}}}
| poll1_date = {{if empty|{{{poll1_date1|}}}|{{{poll1_date|}}}}}
| poll1_source = {{if empty|{{{poll1_source1|}}}|{{{poll1_source|}}}}}
| poll1_person1 = {{if empty|{{{poll1_nominee1|}}}|{{{poll1_candidate1|}}}}}
| poll1_person2 = {{if empty|{{{poll1_nominee2|}}}|{{{poll1_candidate2|}}}}}
| poll1_person3 = {{if empty|{{{poll1_nominee3|}}}|{{{poll1_candidate3|}}}}}
| poll2_date = {{if empty|{{{poll2_date1|}}}|{{{poll2_date|}}}}}
| poll2_source = {{if empty|{{{poll2_source1|}}}|{{{poll2_source|}}}}}
| poll2_person1 = {{if empty|{{{poll2_nominee1|}}}|{{{poll2_candidate1|}}}}}
| poll2_person2 = {{if empty|{{{poll2_nominee2|}}}|{{{poll2_candidate2|}}}}}
| poll2_person3 = {{if empty|{{{poll2_nominee3|}}}|{{{poll2_candidate3|}}}}}
| poll3_date = {{if empty|{{{poll3_date1|}}}|{{{poll3_date|}}}}}
| poll3_source = {{if empty|{{{poll3_source1|}}}|{{{poll3_source|}}}}}
| poll3_person1 = {{if empty|{{{poll3_nominee1|}}}|{{{poll3_candidate1|}}}}}
| poll3_person2 = {{if empty|{{{poll3_nominee2|}}}|{{{poll3_candidate2|}}}}}
| poll3_person3 = {{if empty|{{{poll3_nominee3|}}}|{{{poll3_candidate3|}}}}}
| poll4_date = {{if empty|{{{poll4_date1|}}}|{{{poll4_date|}}}}}
| poll4_source = {{if empty|{{{poll4_source1|}}}|{{{poll4_source|}}}}}
| poll4_person1 = {{if empty|{{{poll4_nominee1|}}}|{{{poll4_candidate1|}}}}}
| poll4_person2 = {{if empty|{{{poll4_nominee2|}}}|{{{poll4_candidate2|}}}}}
| poll4_person3 = {{if empty|{{{poll4_nominee3|}}}|{{{poll4_candidate3|}}}}}
| poll5_date = {{if empty|{{{poll5_date1|}}}|{{{poll5_date|}}}}}
| poll5_source = {{if empty|{{{poll5_source1|}}}|{{{poll5_source|}}}}}
| poll5_person1 = {{if empty|{{{poll5_nominee1|}}}|{{{poll5_candidate1|}}}}}
| poll5_person2 = {{if empty|{{{poll5_nominee2|}}}|{{{poll5_candidate2|}}}}}
| poll5_person3 = {{if empty|{{{poll5_nominee3|}}}|{{{poll5_candidate3|}}}}}
| poll1_party1 = {{{poll1_party1|}}}| poll1_party2 = {{{poll1_party2|}}}| poll1_party3 = {{{poll1_party3|}}}
| poll2_party1 = {{{poll2_party1|}}}| poll2_party2 = {{{poll2_party2|}}}| poll2_party3 = {{{poll2_party3|}}}
| poll3_party1 = {{{poll3_party1|}}}| poll3_party2 = {{{poll3_party2|}}}| poll3_party3 = {{{poll3_party3|}}}
| poll4_party1 = {{{poll4_party1|}}}| poll4_party2 = {{{poll4_party2|}}}| poll4_party3 = {{{poll4_party3|}}}
| poll5_party1 = {{{poll5_party1|}}}| poll5_party2 = {{{poll5_party2|}}}| poll5_party3 = {{{poll5_party3|}}}
| 1blank = {{{1blank|}}}| 1data1 = {{{1data1|}}}| 1data2 = {{{1data2|}}}| 1data3 = {{{1data3|}}}
| 2blank = {{{2blank|}}}| 2data1 = {{{2data1|}}}| 2data2 = {{{2data2|}}}| 2data3 = {{{2data3|}}}
| 3blank = {{{3blank|}}}| 3data1 = {{{3data1|}}}| 3data2 = {{{3data2|}}}| 3data3 = {{{3data3|}}}
| 4blank = {{{4blank|}}}| 4data1 = {{{4data1|}}}| 4data2 = {{{4data2|}}}| 4data3 = {{{4data3|}}}
| 5blank = {{{5blank|}}}| 5data1 = {{{5data1|}}}| 5data2 = {{{5data2|}}}| 5data3 = {{{5data3|}}}
| 6blank = {{{6blank|}}}| 6data1 = {{{6data1|}}}| 6data2 = {{{6data2|}}}| 6data3 = {{{6data3|}}}
}}
{{!}}-
{{Infobox election/row
| type = {{{type|}}}
| divider = <hr />
| col3 = {{#if:{{{color6|}}}{{{colour6|}}}{{{image6|}}}{{{nominee6|}}}{{{candidate6|}}}{{{leader6|}}}{{{party6|}}}{{{alliance6|}}}{{{home_state6|}}}{{{running_mate6|}}}{{{electoral_vote6|}}}{{{delegate_count6|}}}{{{states_carried6|}}}{{{leader_since6|}}}{{{leaders_seat6|}}}{{{last_election6|}}}{{{seats_before6|}}}{{{seats_needed6|}}}{{{seats6|}}}{{{seats_after6|}}}{{{seat_change6|}}}{{{popular_vote6|}}}{{{percentage6|}}}{{{swing6|}}}{{{poll1_nominee6|}}}{{{poll1_candidate6|}}}{{{poll2_nominee6|}}}{{{poll2_candidate6|}}}{{{poll3_nominee6|}}}{{{poll3_candidate6|}}}{{{poll4_nominee6|}}}{{{poll4_candidate6|}}}{{{poll5_nominee6|}}}{{{poll5_candidate6|}}}{{{poll1_party6|}}}{{{poll2_party6|}}}{{{poll3_party6|}}}{{{poll4_party6|}}}{{{poll5_party6|}}}{{{1data6|}}}{{{2data6|}}}{{{3data6|}}}{{{4data6|}}}{{{5data6|}}}{{{6data6|}}}|yes}}
| ongoing = {{{ongoing|no}}}
| header1 = {{#if:{{{party3|}}}|Fourth party|Third party}}
| header2 = {{#if:{{{party3|}}}|Fifth party|Fourth party}}
| header3 = {{#if:{{{party3|}}}|Sixth party|Fifth party}}
| party_color = {{if empty| {{{party_colour|}}} | {{{party_color|}}} | yes }}
| color1 = {{if empty| {{{color4|}}} | {{{colour4|}}} }}
| color2 = {{if empty| {{{color5|}}} | {{{colour5|}}} }}
| color3 = {{if empty| {{{color6|}}} | {{{colour6|}}} }}
| image_size = {{{image_size|150x150px}}}
| image_upright = {{{image_upright|}}}
| image1 = {{{image4|}}}
| image1_size = {{{image4_size|}}}
| image1_upright = {{{image4_upright|}}}
| image2 = {{{image5|}}}
| image2_size = {{{image5_size|}}}
| image2_upright = {{{image5_upright|}}}
| image3 = {{{image6|}}}
| image3_size = {{{image6_size|}}}
| image3_upright = {{{image6_upright|}}}
| pageimage1 = {{{pageimage4|}}}
| pageimage2 = {{{pageimage5|}}}
| pageimage3 = {{{pageimage6|}}}
| nominee1 = {{{nominee4|}}}
| nominee2 = {{{nominee5|}}}
| nominee3 = {{{nominee6|}}}
| candidate1 = {{{candidate4|}}}
| candidate2 = {{{candidate5|}}}
| candidate3 = {{{candidate6|}}}
| leader1 = {{{leader4|}}}
| leader2 = {{{leader5|}}}
| leader3 = {{{leader6|}}}
| party1_name = {{{party4_name|{{{party_name|}}}}}}
| party2_name = {{{party5_name|{{{party_name|}}}}}}
| party3_name = {{{party6_name|{{{party_name|}}}}}}
| party1 = {{{party4|}}}
| party2 = {{{party5|}}}
| party3 = {{{party6|}}}
| alliance1_name = {{{alliance4_name|{{{alliance_name|}}}}}}
| alliance2_name = {{{alliance5_name|{{{alliance_name|}}}}}}
| alliance3_name = {{{alliance6_name|{{{alliance_name|}}}}}}
| alliance1 = {{{alliance4|}}}
| alliance2 = {{{alliance5|}}}
| alliance3 = {{{alliance6|}}}
| home_state1 = {{{home_state4|}}}
| home_state2 = {{{home_state5|}}}
| home_state3 = {{{home_state6|}}}
| running_mate1 = {{{running_mate4|}}}
| running_mate2 = {{{running_mate5|}}}
| running_mate3 = {{{running_mate6|}}}
| college_voted = {{{college_voted|}}}
| electoral_vote1 = {{{electoral_vote4|}}}
| electoral_vote2 = {{{electoral_vote5|}}}
| electoral_vote3 = {{{electoral_vote6|}}}
| delegate_count1 = {{{delegate_count4|}}}
| delegate_count2 = {{{delegate_count5|}}}
| delegate_count3 = {{{delegate_count6|}}}
| states_carried1 = {{{states_carried4|}}}
| states_carried2 = {{{states_carried5|}}}
| states_carried3 = {{{states_carried6|}}}
| leader_since1 = {{{leader_since4|}}}
| leader_since2 = {{{leader_since5|}}}
| leader_since3 = {{{leader_since6|}}}
| leaders_seat1 = {{{leaders_seat4|}}}
| leaders_seat2 = {{{leaders_seat5|}}}
| leaders_seat3 = {{{leaders_seat6|}}}
| last_election1 = {{{last_election4|}}}
| last_election2 = {{{last_election5|}}}
| last_election3 = {{{last_election6|}}}
| seats_before1 = {{{seats_before4|}}}
| seats_before2 = {{{seats_before5|}}}
| seats_before3 = {{{seats_before6|}}}
| seats_needed1 = {{{seats_needed4|}}}
| seats_needed2 = {{{seats_needed5|}}}
| seats_needed3 = {{{seats_needed6|}}}
| seats1 = {{{seats4|}}}
| seats2 = {{{seats5|}}}
| seats3 = {{{seats6|}}}
| seats_after1 = {{{seats_after4|}}}
| seats_after2 = {{{seats_after5|}}}
| seats_after3 = {{{seats_after6|}}}
| seat_change1 = {{{seat_change4|}}}
| seat_change2 = {{{seat_change5|}}}
| seat_change3 = {{{seat_change6|}}}
| vote_type = {{{vote_type|Popular}}}
| popular_vote1 = {{{popular_vote4|}}}
| popular_vote2 = {{{popular_vote5|}}}
| popular_vote3 = {{{popular_vote6|}}}
| percentage1 = {{{percentage4|}}}
| percentage2 = {{{percentage5|}}}
| percentage3 = {{{percentage6|}}}
| swing1 = {{{swing4|}}}
| swing2 = {{{swing5|}}}
| swing3 = {{{swing6|}}}
| opinion_polls = {{{opinion_polls|}}}
| poll1_date = {{if empty|{{{poll1_date2|}}}|{{{poll1_date|}}}}}
| poll1_source = {{if empty|{{{poll1_source2|}}}|{{{poll1_source|}}}}}
| poll1_person1 = {{if empty|{{{poll1_nominee4|}}}|{{{poll1_candidate4|}}}}}
| poll1_person2 = {{if empty|{{{poll1_nominee5|}}}|{{{poll1_candidate5|}}}}}
| poll1_person3 = {{if empty|{{{poll1_nominee6|}}}|{{{poll1_candidate6|}}}}}
| poll2_date = {{if empty|{{{poll2_date2|}}}|{{{poll2_date|}}}}}
| poll2_source = {{if empty|{{{poll2_source2|}}}|{{{poll2_source|}}}}}
| poll2_person1 = {{if empty|{{{poll2_nominee4|}}}|{{{poll2_candidate4|}}}}}
| poll2_person2 = {{if empty|{{{poll2_nominee5|}}}|{{{poll2_candidate5|}}}}}
| poll2_person3 = {{if empty|{{{poll2_nominee6|}}}|{{{poll2_candidate6|}}}}}
| poll3_date = {{if empty|{{{poll3_date2|}}}|{{{poll3_date|}}}}}
| poll3_source = {{if empty|{{{poll3_source2|}}}|{{{poll3_source|}}}}}
| poll3_person1 = {{if empty|{{{poll3_nominee4|}}}|{{{poll3_candidate4|}}}}}
| poll3_person2 = {{if empty|{{{poll3_nominee5|}}}|{{{poll3_candidate5|}}}}}
| poll3_person3 = {{if empty|{{{poll3_nominee6|}}}|{{{poll3_candidate6|}}}}}
| poll4_date = {{if empty|{{{poll4_date2|}}}|{{{poll4_date|}}}}}
| poll4_source = {{if empty|{{{poll4_source2|}}}|{{{poll4_source|}}}}}
| poll4_person1 = {{if empty|{{{poll4_nominee4|}}}|{{{poll4_candidate4|}}}}}
| poll4_person2 = {{if empty|{{{poll4_nominee5|}}}|{{{poll4_candidate5|}}}}}
| poll4_person3 = {{if empty|{{{poll4_nominee6|}}}|{{{poll4_candidate6|}}}}}
| poll5_date = {{if empty|{{{poll5_date2|}}}|{{{poll5_date|}}}}}
| poll5_source = {{if empty|{{{poll5_source2|}}}|{{{poll5_source|}}}}}
| poll5_person1 = {{if empty|{{{poll5_nominee4|}}}|{{{poll5_candidate4|}}}}}
| poll5_person2 = {{if empty|{{{poll5_nominee5|}}}|{{{poll5_candidate5|}}}}}
| poll5_person3 = {{if empty|{{{poll5_nominee6|}}}|{{{poll5_candidate6|}}}}}
| poll1_party1 = {{{poll1_party4|}}}| poll1_party2 = {{{poll1_party5|}}}| poll1_party3 = {{{poll1_party6|}}}
| poll2_party1 = {{{poll2_party4|}}}| poll2_party2 = {{{poll2_party5|}}}| poll2_party3 = {{{poll2_party6|}}}
| poll3_party1 = {{{poll3_party4|}}}| poll3_party2 = {{{poll3_party5|}}}| poll3_party3 = {{{poll3_party6|}}}
| poll4_party1 = {{{poll4_party4|}}}| poll4_party2 = {{{poll4_party5|}}}| poll4_party3 = {{{poll4_party6|}}}
| poll5_party1 = {{{poll5_party4|}}}| poll5_party2 = {{{poll5_party5|}}}| poll5_party3 = {{{poll5_party6|}}}
| 1blank = {{{1blank|}}}| 1data1 = {{{1data4|}}}| 1data2 = {{{1data5|}}}| 1data3 = {{{1data6|}}}
| 2blank = {{{2blank|}}}| 2data1 = {{{2data4|}}}| 2data2 = {{{2data5|}}}| 2data3 = {{{2data6|}}}
| 3blank = {{{3blank|}}}| 3data1 = {{{3data4|}}}| 3data2 = {{{3data5|}}}| 3data3 = {{{3data6|}}}
| 4blank = {{{4blank|}}}| 4data1 = {{{4data4|}}}| 4data2 = {{{4data5|}}}| 4data3 = {{{4data6|}}}
| 5blank = {{{5blank|}}}| 5data1 = {{{5data4|}}}| 5data2 = {{{5data5|}}}| 5data3 = {{{5data6|}}}
| 6blank = {{{6blank|}}}| 6data1 = {{{6data4|}}}| 6data2 = {{{6data5|}}}| 6data3 = {{{6data6|}}}
}}
{{!}}-
{{Infobox election/row
| type = {{{type|}}}
| divider = <hr />
| ongoing = {{{ongoing|no}}}
| col3 = {{#if:{{{color9|}}}{{{colour9|}}}{{{image9|}}}{{{nominee9|}}}{{{candidate9|}}}{{{leader9|}}}{{{party9|}}}{{{alliance9|}}}{{{home_state9|}}}{{{running_mate9|}}}{{{electoral_vote9|}}}{{{delegate_count9|}}}{{{states_carried9|}}}{{{leader_since9|}}}{{{leaders_seat9|}}}{{{last_election9|}}}{{{seats_before9|}}}{{{seats_needed9|}}}{{{seats9|}}}{{{seats_after9|}}}{{{seat_change9|}}}{{{popular_vote9|}}}{{{percentage9|}}}{{{counties_won9|}}}{{{counties_threshold9|}}}{{{swing9|}}}{{{poll1_nominee9|}}}{{{poll1_candidate9|}}}{{{poll2_nominee9|}}}{{{poll2_candidate9|}}}{{{poll3_nominee9|}}}{{{poll3_candidate9|}}}{{{poll4_nominee9|}}}{{{poll4_candidate9|}}}{{{poll5_nominee9|}}}{{{poll5_candidate9|}}}{{{poll1_party9|}}}{{{poll2_party9|}}}{{{poll3_party9|}}}{{{poll4_party9|}}}{{{poll5_party9|}}}{{{1data9|}}}{{{2data9|}}}{{{3data9|}}}{{{4data9|}}}{{{5data9|}}}{{{6data9|}}}|yes}}
| header1 = {{#switch:{{#expr:{{#if:{{{party3|}}}|1|0}}+{{#if:{{{party6|}}}|1|0}}}}|0=Fifth party|1=Sixth party|2=Seventh party}}
| header2 = {{#switch:{{#expr:{{#if:{{{party3|}}}|1|0}}+{{#if:{{{party6|}}}|1|0}}}}|0=Sixth party|1=Seventh party|2=Eighth party}}
| header3 = {{#switch:{{#expr:{{#if:{{{party3|}}}|1|0}}+{{#if:{{{party6|}}}|1|0}}}}|0=Seventh party|1=Eighth party|2=Ninth party}}
| party_color = {{if empty| {{{party_colour|}}} | {{{party_color|}}} | yes }}
| color1 = {{if empty| {{{color7|}}} | {{{colour7|}}} }}
| color2 = {{if empty| {{{color8|}}} | {{{colour8|}}} }}
| color3 = {{if empty| {{{color9|}}} | {{{colour9|}}} }}
| image_size = {{{image_size|150x150px}}}
| image_upright = {{{image_upright|}}}
| image1 = {{{image7|}}}
| image1_size = {{{image7_size|}}}
| image1_upright = {{{image7_upright|}}}
| image2 = {{{image8|}}}
| image2_size = {{{image8_size|}}}
| image2_upright = {{{image8_upright|}}}
| image3 = {{{image9|}}}
| image3_size = {{{image9_size|}}}
| image3_upright = {{{image9_upright|}}}
| pageimage1 = {{{pageimage7|}}}
| pageimage2 = {{{pageimage8|}}}
| pageimage3 = {{{pageimage9|}}}
| nominee1 = {{{nominee7|}}}
| nominee2 = {{{nominee8|}}}
| nominee3 = {{{nominee9|}}}
| candidate1 = {{{candidate7|}}}
| candidate2 = {{{candidate8|}}}
| candidate3 = {{{candidate9|}}}
| leader1 = {{{leader7|}}}
| leader2 = {{{leader8|}}}
| leader3 = {{{leader9|}}}
| party1_name = {{{party7_name|{{{party_name|}}}}}}
| party2_name = {{{party8_name|{{{party_name|}}}}}}
| party3_name = {{{party9_name|{{{party_name|}}}}}}
| party1 = {{{party7|}}}
| party2 = {{{party8|}}}
| party3 = {{{party9|}}}
| alliance1_name = {{{alliance7_name|{{{alliance_name|}}}}}}
| alliance2_name = {{{alliance8_name|{{{alliance_name|}}}}}}
| alliance3_name = {{{alliance9_name|{{{alliance_name|}}}}}}
| alliance1 = {{{alliance7|}}}
| alliance2 = {{{alliance8|}}}
| alliance3 = {{{alliance9|}}}
| home_state1 = {{{home_state7|}}}
| home_state2 = {{{home_state8|}}}
| home_state3 = {{{home_state9|}}}
| running_mate1 = {{{running_mate7|}}}
| running_mate2 = {{{running_mate8|}}}
| running_mate3 = {{{running_mate9|}}}
| college_voted = {{{college_voted|}}}
| electoral_vote1 = {{{electoral_vote7|}}}
| electoral_vote2 = {{{electoral_vote8|}}}
| electoral_vote3 = {{{electoral_vote9|}}}
| delegate_count1 = {{{delegate_count7|}}}
| delegate_count2 = {{{delegate_count8|}}}
| delegate_count3 = {{{delegate_count9|}}}
| states_carried1 = {{{states_carried7|}}}
| states_carried2 = {{{states_carried8|}}}
| states_carried3 = {{{states_carried9|}}}
| leader_since1 = {{{leader_since7|}}}
| leader_since2 = {{{leader_since8|}}}
| leader_since3 = {{{leader_since9|}}}
| leaders_seat1 = {{{leaders_seat7|}}}
| leaders_seat2 = {{{leaders_seat8|}}}
| leaders_seat3 = {{{leaders_seat9|}}}
| last_election1 = {{{last_election7|}}}
| last_election2 = {{{last_election8|}}}
| last_election3 = {{{last_election9|}}}
| seats_before1 = {{{seats_before7|}}}
| seats_before2 = {{{seats_before8|}}}
| seats_before3 = {{{seats_before9|}}}
| seats_needed1 = {{{seats_needed7|}}}
| seats_needed2 = {{{seats_needed8|}}}
| seats_needed3 = {{{seats_needed9|}}}
| seats1 = {{{seats7|}}}
| seats2 = {{{seats8|}}}
| seats3 = {{{seats9|}}}
| seats_after1 = {{{seats_after7|}}}
| seats_after2 = {{{seats_after8|}}}
| seats_after3 = {{{seats_after9|}}}
| seat_change1 = {{{seat_change7|}}}
| seat_change2 = {{{seat_change8|}}}
| seat_change3 = {{{seat_change9|}}}
| vote_type = {{{vote_type|Popular}}}
| popular_vote1 = {{{popular_vote7|}}}
| popular_vote2 = {{{popular_vote8|}}}
| popular_vote3 = {{{popular_vote9|}}}
| percentage1 = {{{percentage7|}}}
| percentage2 = {{{percentage8|}}}
| percentage3 = {{{percentage9|}}}
| swing1 = {{{swing7|}}}
| swing2 = {{{swing8|}}}
| swing3 = {{{swing9|}}}
| opinion_polls = {{{opinion_polls|}}}
| poll1_date = {{if empty|{{{poll1_date3|}}}|{{{poll1_date|}}}}}
| poll1_source = {{if empty|{{{poll1_source3|}}}|{{{poll1_source|}}}}}
| poll1_person1 = {{if empty|{{{poll1_nominee7|}}}|{{{poll1_candidate7|}}}}}
| poll1_person2 = {{if empty|{{{poll1_nominee8|}}}|{{{poll1_candidate8|}}}}}
| poll1_person3 = {{if empty|{{{poll1_nominee9|}}}|{{{poll1_candidate9|}}}}}
| poll2_date = {{if empty|{{{poll2_date3|}}}|{{{poll2_date|}}}}}
| poll2_source = {{if empty|{{{poll2_source3|}}}|{{{poll2_source|}}}}}
| poll2_person1 = {{if empty|{{{poll2_nominee7|}}}|{{{poll2_candidate7|}}}}}
| poll2_person2 = {{if empty|{{{poll2_nominee8|}}}|{{{poll2_candidate8|}}}}}
| poll2_person3 = {{if empty|{{{poll2_nominee9|}}}|{{{poll2_candidate9|}}}}}
| poll3_date = {{if empty|{{{poll3_date3|}}}|{{{poll3_date|}}}}}
| poll3_source = {{if empty|{{{poll3_source3|}}}|{{{poll3_source|}}}}}
| poll3_person1 = {{if empty|{{{poll3_nominee7|}}}|{{{poll3_candidate7|}}}}}
| poll3_person2 = {{if empty|{{{poll3_nominee8|}}}|{{{poll3_candidate8|}}}}}
| poll3_person3 = {{if empty|{{{poll3_nominee9|}}}|{{{poll3_candidate9|}}}}}
| poll4_date = {{if empty|{{{poll4_date3|}}}|{{{poll4_date|}}}}}
| poll4_source = {{if empty|{{{poll4_source3|}}}|{{{poll4_source|}}}}}
| poll4_person1 = {{if empty|{{{poll4_nominee7|}}}|{{{poll4_candidate7|}}}}}
| poll4_person2 = {{if empty|{{{poll4_nominee8|}}}|{{{poll4_candidate8|}}}}}
| poll4_person3 = {{if empty|{{{poll4_nominee9|}}}|{{{poll4_candidate9|}}}}}
| poll5_date = {{if empty|{{{poll5_date3|}}}|{{{poll5_date|}}}}}
| poll5_source = {{if empty|{{{poll5_source3|}}}|{{{poll5_source|}}}}}
| poll5_person1 = {{if empty|{{{poll5_nominee7|}}}|{{{poll5_candidate7|}}}}}
| poll5_person2 = {{if empty|{{{poll5_nominee8|}}}|{{{poll5_candidate8|}}}}}
| poll5_person3 = {{if empty|{{{poll5_nominee9|}}}|{{{poll5_candidate9|}}}}}
| poll1_party1 = {{{poll1_party7|}}}| poll1_party2 = {{{poll1_party8|}}}| poll1_party3 = {{{poll1_party9|}}}
| poll2_party1 = {{{poll2_party7|}}}| poll2_party2 = {{{poll2_party8|}}}| poll2_party3 = {{{poll2_party9|}}}
| poll3_party1 = {{{poll3_party7|}}}| poll3_party2 = {{{poll3_party8|}}}| poll3_party3 = {{{poll3_party9|}}}
| poll4_party1 = {{{poll4_party7|}}}| poll4_party2 = {{{poll4_party8|}}}| poll4_party3 = {{{poll4_party9|}}}
| poll5_party1 = {{{poll5_party7|}}}| poll5_party2 = {{{poll5_party8|}}}| poll5_party3 = {{{poll5_party9|}}}
| 1blank = {{{1blank|}}}| 1data1 = {{{1data7|}}}| 1data2 = {{{1data8|}}}| 1data3 = {{{1data9|}}}
| 2blank = {{{2blank|}}}| 2data1 = {{{2data7|}}}| 2data2 = {{{2data8|}}}| 2data3 = {{{2data9|}}}
| 3blank = {{{3blank|}}}| 3data1 = {{{3data7|}}}| 3data2 = {{{3data8|}}}| 3data3 = {{{3data9|}}}
| 4blank = {{{4blank|}}}| 4data1 = {{{4data7|}}}| 4data2 = {{{4data8|}}}| 4data3 = {{{4data9|}}}
| 5blank = {{{5blank|}}}| 5data1 = {{{5data7|}}}| 5data2 = {{{5data8|}}}| 5data3 = {{{5data9|}}}
| 6blank = {{{6blank|}}}| 6data1 = {{{6data7|}}}| 6data2 = {{{6data8|}}}| 6data3 = {{{6data9|}}}
}}
{{!)}}
| data11 =
{{#if:{{{map_image|}}}{{{map|}}}|<hr />{{#if:{{{map_image|}}}
|{{#invoke:InfoboxImage|InfoboxImage|image={{{map_image}}}|size={{{map_size|}}}|sizedefault=300px|alt={{{map_alt|}}}}}
|{{{map}}}
}}{{#if:{{{map_caption|}}}|<div>{{{map_caption|}}}</div>}}
}}
| data12 =
{{#if:{{{map2_image|}}}{{{map2|}}}|<hr />{{#if:{{{map2_image|}}}
|{{#invoke:InfoboxImage|InfoboxImage|image={{{map2_image}}}|size={{{map2_size|}}}|sizedefault=300px|alt={{{map2_alt|}}}}}
|{{{map2}}}
}}{{#if:{{{map2_caption|}}}|<div>{{{map2_caption|}}}</div>}}
}}
|data13 =
{{#if:{{{map3_image|}}}{{{map3|}}}|<hr />{{#if:{{{map3_image|}}}
|{{#invoke:InfoboxImage|InfoboxImage|image={{{map3_image}}}|size={{{map3_size|}}}|sizedefault=300px|alt={{{map3_alt|}}}}}
|{{{map3}}}
}}{{#if:{{{map3_caption|}}}|<div>{{{map3_caption|}}}</div>}}
}}
|data14 =
{{#if:{{{map4_image|}}}{{{map4|}}}|<hr />{{#if:{{{map4_image|}}}
|{{#invoke:InfoboxImage|InfoboxImage|image={{{map4_image}}}|size={{{map4_size|}}}|sizedefault=300px|alt={{{map4_alt|}}}}}
|{{{map4}}}
}}{{#if:{{{map4_caption|}}}|<div>{{{map4_caption|}}}</div>}}
}}
| data15 = {{#if:{{{title|}}}|<hr />
{{{!}} cellspacing="0" cellpadding="0" style="background:transparent; width:100%;"
{{!}} style="width:50%; text-align:left;" {{!}}{{#if:{{{before_election|}}}{{{before_party|}}}|'''{{#ifeq:{{{type}}}|primary|Previous {{{title}}}|{{#ifeq:{{{ongoing|no}}}|yes|Incumbent {{#ifeq:{{lc:{{{title}}}}}|u.s. senator|[[List of United States senators from {{#ifeq:{{{country}}}|Georgia (U.S. state)|Georgia|{{{country}}}}}|U.S. senator]]|{{{title}}}}}|{{#ifeq:{{lc:{{{title}}}}}|u.s. senator|[[List of United States senators from {{#ifeq:{{{country}}}|Georgia (U.S. state)|Georgia|{{{country}}}}}|U.S. senator]]|{{{title}}}}} before election}}}}'''<br />
{{{before_election}}}<br />
{{#if:{{{before_party|}}}|{{Infobox election/shortname|link={{{before_party_link|{{{party_name}}}}}}|name={{{before_party}}}}} }} }}
{{!}} style="width:50%; text-align:right;" {{!}} {{#ifeq:{{{ongoing|no}}}|yes|{{#ifeq:{{{type}}}|primary|{{#if:{{{after_election|}}}|'''Presumptive {{#if:{{{posttitle|}}}|{{{posttitle}}}|{{{title}}}}}'''|}}|}} |'''{{#if:{{{posttitle|}}}|{{{posttitle}}}|{{#ifeq:{{{type}}}|primary||Elected}} {{{title}}}}}'''}} <br />
{{#ifeq:{{{ongoing|no}}}|yes|{{#ifeq:{{{type}}}|primary|{{#if:{{{after_election|}}}|{{{after_election}}}|}}}}}}
{{#ifeq:{{{ongoing|no}}}|yes||{{#if:{{{after_election|}}}|{{{after_election}}}|}}{{#if:{{{after_election|}}}{{{after_party|}}}||TBD}}<br />
{{#if:{{{after_party|}}}|{{Infobox election/shortname|link={{{after_party_link|{{{party_name|}}}}}}|name={{{after_party}}}}}}} }}
{{!}}} }}
{{#if:{{{template_name|}}}|{{align|right|{{navbar|{{{template_name}}}|mini=2}}}} }}
| data16 = {{{module|}}}
}}</includeonly><noinclude>{{documentation}}<!-- Add categories to the /doc subpage, not here! --></noinclude>{{#if:{{{electoral_vote1|}}}|{{Main other|[[Category:Elections using electoral votes]]}}}}<!-- temporary tracking of elections using an electoral college -->{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox election with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox election]] with unknown parameter "_VALUE_"|ignoreblank=y| regexp1 = [%d]blank | regexp2 = [%d]data[%d] | after_election | after_party | after_party_link | regexp3 = alliance[%d]_name | alliance_name | regexp4 = alliance[%d] | before_election | before_party | before_party_link | regexp5 = candidate[%d] | child | college_voted | regexp6 = colou?r[%d] | counties_threshold1 | counties_threshold2 | counties_threshold3 | counties_threshold9 | counties_won1 | counties_won2 | counties_won3 | counties_won9 | country | declared | regexp7 = delegate_count[%d] | elected_members | elected_mps | election_date | election_name | regexp8 = electoral_vote[%d] | embed | filler | flag_image | flag_year | regexp9 = home_state[%d] | image_size | image_upright | regexp10 = image[%d] | regexp11 = image[%d]_size | regexp12 = image[%d]_upright | regexp13 = last_election[%d] | last_update | regexp14 = leader_since[%d] | regexp15 = leader[%d] | regexp16 = leaders_seat[%d] | majority_seats | map | map_alt | map_caption | map_image | map_size | map2 | map2_alt | map2_caption | map2_image | map2_size | map3 | map3_alt | map3_caption | map3_image | map3_size | map4 | map4_alt | map4_caption | map4_image | map4_size | module | needed_votes | next_election | next_year | regexp17 = nominee[%d] | ongoing | opinion_polls | outgoing_members | party_color | party_colour | regexp18 = party[%d]_name | party_name | regexp19 = party[%d] | regexp20 = percentage[%d] | regexp21 = poll[%d]_candidate[%d] | regexp22 = poll[%d]_date[%d]? | regexp23 = poll[%d]_nominee[%d] | regexp24 = poll[%d]_party[%d] | regexp25 = poll[%d]_source[%d]? | regexp26 = popular_vote[%d] | posttitle | previous_election | previous_mps | previous_year | registered | reporting | regexp27 = running_mate[%d] | regexp28 = seat_change[%d] | regexp29 = seats_after[%d] | regexp30 = seats_before[%d] | seats_for_election | regexp31 = seats_needed[%d] | regexp32 = seats[%d] | regexp33 = states_carried[%d] | regexp34 = swing[%d] | template_name | time_zone | title | turnout | type | vote_type | votes_counted | votes_for_election }}
df420508fd5c0716ddbc0c7e9b78e637a11151d3
Module:Sidebar/configuration
828
109
209
2023-03-14T22:32:24Z
wikipedia>Izno
0
add hlist and plainlist_templatestyles keys
Scribunto
text/plain
return {
i18n = {
child_yes = 'yes',
float_none = 'none',
float_left = 'left',
wrap_true = 'true',
navbar_none = 'none',
navbar_off = 'off',
default_list_title = 'List',
title_not_to_add_navbar = 'Template:Sidebar',
collapse_title_not_to_add_navbar = 'Template:Sidebar with collapsible lists',
templatestyles = 'Module:Sidebar/styles.css',
hlist_templatestyles = 'Hlist/styles.css',
plainlist_templatestyles = 'Plainlist/styles.css',
category = {
child = '[[Category:Pages using sidebar with the child parameter]]',
conversion = '[[Category:Sidebars with styles needing conversion]]'
},
pattern = {
collapse_sandbox = '/sandbox$',
sandbox = '/sandbox$',
subgroup = 'sidebar%-subgroup',
style_conversion = 'style$',
uncategorized_conversion_titles = {
'/[Ss]andbox',
'/[Tt]estcases',
'/[Dd]oc$'
}
},
class = {
sidebar = 'sidebar',
subgroup = 'sidebar-subgroup',
collapse = 'sidebar-collapse',
float_none = 'sidebar-none',
float_left = 'sidebar-left',
wraplinks = 'nowraplinks',
outer_title = 'sidebar-outer-title',
top_image = 'sidebar-top-image',
top_caption = 'sidebar-top-caption',
pretitle = 'sidebar-pretitle',
pretitle_with_top_image = 'sidebar-pretitle-with-top-image',
title = 'sidebar-title',
title_with_pretitle = 'sidebar-title-with-pretitle',
image = 'sidebar-image',
caption = 'sidebar-caption',
above = 'sidebar-above',
heading = 'sidebar-heading',
content = 'sidebar-content',
content_with_subgroup = 'sidebar-content-with-subgroup',
below = 'sidebar-below',
navbar = 'sidebar-navbar',
list = 'sidebar-list',
list_title = 'sidebar-list-title',
list_title_centered = 'sidebar-list-title-c',
list_content = 'sidebar-list-content'
}
}
}
dc2a980ac2162a898f7c21e6d6ba7e994dfeb315
Module:Sidebar
828
108
207
2023-03-14T22:35:53Z
wikipedia>Izno
0
move these items to config, discovered during work at meta
Scribunto
text/plain
require('strict')
local cfg = mw.loadData('Module:Sidebar/configuration')
local p = {}
local getArgs = require('Module:Arguments').getArgs
--[[
Categorizes calling templates and modules with a 'style' parameter of any sort
for tracking to convert to TemplateStyles.
TODO after a long cleanup: Catch sidebars in other namespaces than Template and Module.
TODO would probably want to remove /log and /archive as CS1 does
]]
local function categorizeTemplatesWithInlineStyles(args)
local title = mw.title.getCurrentTitle()
if title.namespace ~= 10 and title.namespace ~= 828 then return '' end
for _, pattern in ipairs (cfg.i18n.pattern.uncategorized_conversion_titles) do
if title.text:match(pattern) then return '' end
end
for key, _ in pairs(args) do
if mw.ustring.find(key, cfg.i18n.pattern.style_conversion) or key == 'width' then
return cfg.i18n.category.conversion
end
end
end
--[[
For compatibility with the original {{sidebar with collapsible lists}}
implementation, which passed some parameters through {{#if}} to trim their
whitespace. This also triggered the automatic newline behavior.
]]
-- See ([[meta:Help:Newlines and spaces#Automatic newline]])
local function trimAndAddAutomaticNewline(s)
s = mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1")
if mw.ustring.find(s, '^[#*:;]') or mw.ustring.find(s, '^{|') then
return '\n' .. s
else
return s
end
end
--[[
Finds whether a sidebar has a subgroup sidebar.
]]
local function hasSubgroup(s)
if mw.ustring.find(s, cfg.i18n.pattern.subgroup) then
return true
else
return false
end
end
local function has_navbar(navbar_mode, sidebar_name)
return navbar_mode ~= cfg.i18n.navbar_none and
navbar_mode ~= cfg.i18n.navbar_off and
(
sidebar_name or
mw.getCurrentFrame():getParent():getTitle():gsub(cfg.i18n.pattern.sandbox, '') ~=
cfg.i18n.title_not_to_add_navbar
)
end
local function has_list_class(args, htmlclass)
local patterns = {
'^' .. htmlclass .. '$',
'%s' .. htmlclass .. '$',
'^' .. htmlclass .. '%s',
'%s' .. htmlclass .. '%s'
}
for arg, value in pairs(args) do
if type(arg) == 'string' and mw.ustring.find(arg, 'class') then
for _, pattern in ipairs(patterns) do
if mw.ustring.find(args[arg] or '', pattern) then
return true
end
end
end
end
return false
end
-- there are a lot of list classes in the wild, so we add their TemplateStyles
local function add_list_styles(args)
local frame = mw.getCurrentFrame()
local function add_list_templatestyles(htmlclass, templatestyles)
if has_list_class(args, htmlclass) then
return frame:extensionTag{
name = 'templatestyles', args = { src = templatestyles }
}
else
return ''
end
end
local plainlist_styles = add_list_templatestyles('plainlist', cfg.i18n.plainlist_templatestyles)
local hlist_styles = add_list_templatestyles('hlist', cfg.i18n.hlist_templatestyles)
-- a second workaround for [[phab:T303378]]
-- when that issue is fixed, we can actually use has_navbar not to emit the
-- tag here if we want
if has_navbar(args.navbar, args.name) and hlist_styles == '' then
hlist_styles = frame:extensionTag{
name = 'templatestyles', args = { src = cfg.i18n.hlist_templatestyles}
}
end
-- hlist -> plainlist is best-effort to preserve old Common.css ordering. [hlist_note]
return hlist_styles .. plainlist_styles
end
-- work around [[phab:T303378]]
-- for each arg: find all the templatestyles strip markers, insert them into a
-- table. then remove all templatestyles markers from the arg
local function move_hiding_templatestyles(args)
local gfind = string.gfind
local gsub = string.gsub
local templatestyles_markers = {}
local strip_marker_pattern = '(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)'
for k, arg in pairs(args) do
for marker in gfind(arg, strip_marker_pattern) do
table.insert(templatestyles_markers, marker)
end
args[k] = gsub(arg, strip_marker_pattern, '')
end
return templatestyles_markers
end
--[[
Main sidebar function. Takes the frame, args, and an optional collapsibleClass.
The collapsibleClass is and should be used only for sidebars with collapsible
lists, as in p.collapsible.
]]
function p.sidebar(frame, args, collapsibleClass)
if not args then
args = getArgs(frame)
end
local hiding_templatestyles = table.concat(move_hiding_templatestyles(args))
local root = mw.html.create()
local child = args.child and mw.text.trim(args.child) == cfg.i18n.child_yes
root = root:tag('table')
if not child then
root
:addClass(cfg.i18n.class.sidebar)
-- force collapsibleclass to be sidebar-collapse otherwise output nothing
:addClass(collapsibleClass == cfg.i18n.class.collapse and cfg.i18n.class.collapse or nil)
:addClass('nomobile')
:addClass(args.float == cfg.i18n.float_none and cfg.i18n.class.float_none or nil)
:addClass(args.float == cfg.i18n.float_left and cfg.i18n.class.float_left or nil)
:addClass(args.wraplinks ~= cfg.i18n.wrap_true and cfg.i18n.class.wraplinks or nil)
:addClass(args.bodyclass or args.class)
:css('width', args.width or nil)
:cssText(args.bodystyle or args.style)
if args.outertitle then
root
:tag('caption')
:addClass(cfg.i18n.class.outer_title)
:addClass(args.outertitleclass)
:cssText(args.outertitlestyle)
:wikitext(args.outertitle)
end
if args.topimage then
local imageCell = root:tag('tr'):tag('td')
imageCell
:addClass(cfg.i18n.class.top_image)
:addClass(args.topimageclass)
:cssText(args.topimagestyle)
:wikitext(args.topimage)
if args.topcaption then
imageCell
:tag('div')
:addClass(cfg.i18n.class.top_caption)
:cssText(args.topcaptionstyle)
:wikitext(args.topcaption)
end
end
if args.pretitle then
root
:tag('tr')
:tag('td')
:addClass(args.topimage and cfg.i18n.class.pretitle_with_top_image
or cfg.i18n.class.pretitle)
:addClass(args.pretitleclass)
:cssText(args.basestyle)
:cssText(args.pretitlestyle)
:wikitext(args.pretitle)
end
else
root
:addClass(cfg.i18n.class.subgroup)
:addClass(args.bodyclass or args.class)
:cssText(args.bodystyle or args.style)
end
if args.title then
if child then
root
:wikitext(args.title)
else
root
:tag('tr')
:tag('th')
:addClass(args.pretitle and cfg.i18n.class.title_with_pretitle
or cfg.i18n.class.title)
:addClass(args.titleclass)
:cssText(args.basestyle)
:cssText(args.titlestyle)
:wikitext(args.title)
end
end
if args.image then
local imageCell = root:tag('tr'):tag('td')
imageCell
:addClass(cfg.i18n.class.image)
:addClass(args.imageclass)
:cssText(args.imagestyle)
:wikitext(args.image)
if args.caption then
imageCell
:tag('div')
:addClass(cfg.i18n.class.caption)
:cssText(args.captionstyle)
:wikitext(args.caption)
end
end
if args.above then
root
:tag('tr')
:tag('td')
:addClass(cfg.i18n.class.above)
:addClass(args.aboveclass)
:cssText(args.abovestyle)
:newline() -- newline required for bullet-points to work
:wikitext(args.above)
end
local rowNums = {}
for k, v in pairs(args) do
k = '' .. k
local num = k:match('^heading(%d+)$') or k:match('^content(%d+)$')
if num then table.insert(rowNums, tonumber(num)) end
end
table.sort(rowNums)
-- remove duplicates from the list (e.g. 3 will be duplicated if both heading3
-- and content3 are specified)
for i = #rowNums, 1, -1 do
if rowNums[i] == rowNums[i - 1] then
table.remove(rowNums, i)
end
end
for i, num in ipairs(rowNums) do
local heading = args['heading' .. num]
if heading then
root
:tag('tr')
:tag('th')
:addClass(cfg.i18n.class.heading)
:addClass(args.headingclass)
:addClass(args['heading' .. num .. 'class'])
:cssText(args.basestyle)
:cssText(args.headingstyle)
:cssText(args['heading' .. num .. 'style'])
:newline()
:wikitext(heading)
end
local content = args['content' .. num]
if content then
root
:tag('tr')
:tag('td')
:addClass(hasSubgroup(content) and cfg.i18n.class.content_with_subgroup
or cfg.i18n.class.content)
:addClass(args.contentclass)
:addClass(args['content' .. num .. 'class'])
:cssText(args.contentstyle)
:cssText(args['content' .. num .. 'style'])
:newline()
:wikitext(content)
:done()
-- Without a linebreak after the </td>, a nested list like
-- "* {{hlist| ...}}" doesn't parse correctly.
:newline()
end
end
if args.below then
root
:tag('tr')
:tag('td')
:addClass(cfg.i18n.class.below)
:addClass(args.belowclass)
:cssText(args.belowstyle)
:newline()
:wikitext(args.below)
end
if not child and has_navbar(args.navbar, args.name) then
root
:tag('tr')
:tag('td')
:addClass(cfg.i18n.class.navbar)
:cssText(args.navbarstyle)
:wikitext(require('Module:Navbar')._navbar{
args.name,
mini = 1,
fontstyle = args.navbarfontstyle
})
end
local base_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = cfg.i18n.templatestyles }
}
local templatestyles = ''
if args['templatestyles'] and args['templatestyles'] ~= '' then
templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['templatestyles'] }
}
end
local child_templatestyles = ''
if args['child templatestyles'] and args['child templatestyles'] ~= '' then
child_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['child templatestyles'] }
}
end
local grandchild_templatestyles = ''
if args['grandchild templatestyles'] and args['grandchild templatestyles'] ~= '' then
grandchild_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['grandchild templatestyles'] }
}
end
return table.concat({
add_list_styles(args), -- see [hlist_note] above about ordering
base_templatestyles,
templatestyles,
child_templatestyles,
grandchild_templatestyles,
hiding_templatestyles,
tostring(root),
(child and cfg.i18n.category.child or ''),
categorizeTemplatesWithInlineStyles(args)
})
end
local function list_title(args, is_centered_list_titles, num)
local title_text = trimAndAddAutomaticNewline(args['list' .. num .. 'title']
or cfg.i18n.default_list_title)
local title
if is_centered_list_titles then
-- collapsible can be finicky, so provide some CSS/HTML to support
title = mw.html.create('div')
:addClass(cfg.i18n.class.list_title_centered)
:wikitext(title_text)
else
title = mw.html.create()
:wikitext(title_text)
end
local title_container = mw.html.create('div')
:addClass(cfg.i18n.class.list_title)
-- don't /need/ a listnumtitleclass because you can do
-- .templateclass .listnumclass .sidebar-list-title
:addClass(args.listtitleclass)
:cssText(args.basestyle)
:cssText(args.listtitlestyle)
:cssText(args['list' .. num .. 'titlestyle'])
:node(title)
:done()
return title_container
end
--[[
Main entry point for sidebar with collapsible lists.
Does the work of creating the collapsible lists themselves and including them
into the args.
]]
function p.collapsible(frame)
local args = getArgs(frame)
if not args.name and
frame:getParent():getTitle():gsub(cfg.i18n.pattern.collapse_sandbox, '') ==
cfg.i18n.collapse_title_not_to_add_navbar then
args.navbar = cfg.i18n.navbar_none
end
local contentArgs = {}
local is_centered_list_titles = false
if args['centered list titles'] and args['centered list titles'] ~= '' then
is_centered_list_titles = true
end
for k, v in pairs(args) do
local num = string.match(k, '^list(%d+)$')
if num then
local expand = args.expanded and
(args.expanded == 'all' or args.expanded == args['list' .. num .. 'name'])
local row = mw.html.create('div')
row
:addClass(cfg.i18n.class.list)
:addClass('mw-collapsible')
:addClass((not expand) and 'mw-collapsed' or nil)
:addClass(args['list' .. num .. 'class'])
:cssText(args.listframestyle)
:cssText(args['list' .. num .. 'framestyle'])
:node(list_title(args, is_centered_list_titles, num))
:tag('div')
:addClass(cfg.i18n.class.list_content)
:addClass('mw-collapsible-content')
-- don't /need/ a listnumstyleclass because you can do
-- .templatename .listnumclass .sidebar-list
:addClass(args.listclass)
:cssText(args.liststyle)
:cssText(args['list' .. num .. 'style'])
:wikitext(trimAndAddAutomaticNewline(args['list' .. num]))
contentArgs['content' .. num] = tostring(row)
end
end
for k, v in pairs(contentArgs) do
args[k] = v
end
return p.sidebar(frame, args, cfg.i18n.class.collapse)
end
return p
71fe765846593e025ca2f94371315e9dbb5bb4d2
Module:Mapframe
828
253
498
2023-03-21T11:20:30Z
wikipedia>Uzume
0
strict
Scribunto
text/plain
-- Note: Originally written on English Wikipedia at https://en.wikipedia.org/wiki/Module:Mapframe
--[[----------------------------------------------------------------------------
##### Localisation (L10n) settings #####
Replace values in quotes ("") with localised values
----------------------------------------------------------------------------]]--
local L10n = {}
-- Modue dependencies
local transcluder -- local copy of https://www.mediawiki.org/wiki/Module:Transcluder loaded lazily
-- "strict" should not be used, at least until all other modules which require this module are not using globals.
-- Template parameter names (unnumbered versions only)
-- Specify each as either a single string, or a table of strings (aliases)
-- Aliases are checked left-to-right, i.e. `{ "one", "two" }` is equivalent to using `{{{one| {{{two|}}} }}}` in a template
L10n.para = {
display = "display",
type = "type",
id = { "id", "ids" },
from = "from",
raw = "raw",
title = "title",
description = "description",
strokeColor = { "stroke-color", "stroke-colour" },
strokeWidth = "stroke-width",
strokeOpacity = "stroke-opacity",
fill = "fill",
fillOpacity = "fill-opacity",
coord = "coord",
marker = "marker",
markerColor = { "marker-color", "marker-colour" },
markerSize = "marker-size",
radius = { "radius", "radius_m" },
radiusKm = "radius_km",
radiusFt = "radius_ft",
radiusMi = "radius_mi",
edges = "edges",
text = "text",
icon = "icon",
zoom = "zoom",
frame = "frame",
plain = "plain",
frameWidth = "frame-width",
frameHeight = "frame-height",
frameCoordinates = { "frame-coordinates", "frame-coord" },
frameLatitude = { "frame-lat", "frame-latitude" },
frameLongitude = { "frame-long", "frame-longitude" },
frameAlign = "frame-align",
switch = "switch",
overlay = "overlay",
overlayBorder = "overlay-border",
overlayHorizontalAlignment = "overlay-horizontal-alignment",
overlayVerticalAlignment = "overlay-vertical-alignment",
overlayHorizontalOffset = "overlay-horizontal-offset",
overlayVerticalOffset = "overlay-vertical-offset"
}
-- Names of other templates this module can extract coordinates from
L10n.template = {
coord = { -- The coord template, as well as templates with output that contains {{coord}}
"Coord", "Coord/sandbox",
"NRHP row", "NRHP row/sandbox",
"WikidataCoord", "WikidataCoord/sandbox", "Wikidatacoord", "Wikidata coord"
}
}
-- Error messages
L10n.error = {
badDisplayPara = "Invalid display parameter",
noCoords = "Coordinates must be specified on Wikidata or in |" .. ( type(L10n.para.coord)== 'table' and L10n.para.coord[1] or L10n.para.coord ) .. "=",
wikidataCoords = "Coordinates not found on Wikidata",
noCircleCoords = "Circle centre coordinates must be specified, or available via Wikidata",
negativeRadius = "Circle radius must be a positive number",
noRadius = "Circle radius must be specified",
negativeEdges = "Circle edges must be a positive number",
noSwitchPara = "Found only one switch value in |" .. ( type(L10n.para.switch)== 'table' and L10n.para.switch[1] or L10n.para.switch ) .. "=",
oneSwitchLabel = "Found only one label in |" .. ( type(L10n.para.switch)== 'table' and L10n.para.switch[1] or L10n.para.switch ) .. "=",
noSwitchLists = "At least one parameter must have a SWITCH: list",
switchMismatches = "All SWITCH: lists must have the same number of values",
-- "%s" and "%d" tokens will be replaced with strings and numbers when used
oneSwitchValue = "Found only one switch value in |%s=",
fewerSwitchLabels = "Found %d switch values but only %d labels in |" .. ( type(L10n.para.switch)== 'table' and L10n.para.switch[1] or L10n.para.switch ) .. "=",
noNamedCoords = "No named coordinates found in %s"
}
-- Other strings
L10n.str = {
-- valid values for display parameter, e.g. (|display=inline) or (|display=title) or (|display=inline,title) or (|display=title,inline)
inline = "inline",
title = "title",
dsep = ",", -- separator between inline and title (comma in the example above)
-- valid values for type paramter
line = "line", -- geoline feature (e.g. a road)
shape = "shape", -- geoshape feature (e.g. a state or province)
shapeInverse = "shape-inverse", -- geomask feature (the inverse of a geoshape)
data = "data", -- geoJSON data page on Commons
point = "point", -- single point feature (coordinates)
circle = "circle", -- circular area around a point
named = "named", -- all named coordinates in an article or section
-- Keyword to indicate a switch list. Must NOT use the special characters ^$()%.[]*+-?
switch = "SWITCH",
-- valid values for icon, frame, and plain parameters
affirmedWords = ' '..table.concat({
"add",
"added",
"affirm",
"affirmed",
"include",
"included",
"on",
"true",
"yes",
"y"
}, ' ')..' ',
declinedWords = ' '..table.concat({
"decline",
"declined",
"exclude",
"excluded",
"false",
"none",
"not",
"no",
"n",
"off",
"omit",
"omitted",
"remove",
"removed"
}, ' ')..' '
}
-- Default values for parameters
L10n.defaults = {
display = L10n.str.inline,
text = "Map",
frameWidth = "300",
frameHeight = "200",
frameAlign = "right",
markerColor = "5E74F3",
markerSize = nil,
strokeColor = "#ff0000",
strokeWidth = 6,
edges = 32, -- number of edges used to approximate a circle
overlayBorder = "1px solid white",
overlayHorizontalAlignment = "right",
overlayHorizontalOffset = "0",
overlayVerticalAlignment = "bottom",
overlayVerticalOffset = "0"
}
-- #### End of L10n settings ####
--[[----------------------------------------------------------------------------
Utility methods
----------------------------------------------------------------------------]]--
local util = {}
--[[
Looks up a parameter value based on the id (a key from the L10n.para table) and
optionally a suffix, for parameters that can be suffixed (e.g. type2 is type
with suffix 2).
@param {table} args key-value pairs of parameter names and their values
@param {string} param_id id for parameter name (key from the L10n.para table)
@param {string} [suffix] suffix for parameter name
@returns {string|nil} parameter value if found, or nil if not found
]]--
function util.getParameterValue(args, param_id, suffix)
suffix = suffix or ''
if type( L10n.para[param_id] ) ~= 'table' then
return args[L10n.para[param_id]..suffix]
end
for _i, paramAlias in ipairs(L10n.para[param_id]) do
if args[paramAlias..suffix] then
return args[paramAlias..suffix]
end
end
return nil
end
--[[
Trim whitespace from args, and remove empty args. Also fix control characters.
@param {table} argsTable
@returns {table} trimmed args table
]]--
function util.trimArgs(argsTable)
local cleanArgs = {}
for key, val in pairs(argsTable) do
if type(key) == 'string' and type(val) == 'string' then
val = val:match('^%s*(.-)%s*$')
if val ~= '' then
-- control characters inside json need to be escaped, but stripping them is simpler
-- See also T214984
-- However, *don't* strip control characters from wikitext (text or description parameters) or you'll break strip markers
-- Alternatively it might be better to only strip control char from raw parameter content
if util.matchesParam('text', key) or util.matchesParam('description', key, key:gsub('^%D+(%d+)$', '%1') ) then
cleanArgs[key] = val
else
cleanArgs[key] = val:gsub('%c',' ')
end
end
else
cleanArgs[key] = val
end
end
return cleanArgs
end
--[[
Check if a parameter name matches an unlocalized parameter key
@param {string} key - the unlocalized parameter name to search through
@param {string} name - the localized parameter name to check
@param {string|nil} - an optional suffix to apply to the value(s) from the localization key
@returns {boolean} true if the name matches the parameter, false otherwise
]]--
function util.matchesParam(key, name, suffix)
local param = L10n.para[key]
suffix = suffix or ''
if type(param) == 'table' then
for _, v in pairs(param) do
if (v .. suffix) == name then return true end
end
return false
end
return ((param .. suffix) == name)
end
--[[
Check if a value is affirmed (one of the values in L10n.str.affirmedWords)
@param {string} val Value to be checked
@returns {boolean} true if affirmed, false otherwise
]]--
function util.isAffirmed(val)
if not(val) then return false end
return string.find(L10n.str.affirmedWords, ' '..val..' ', 1, true ) and true or false
end
--[[
Check if a value is declined (one of the values in L10n.str.declinedWords)
@param {string} val Value to be checked
@returns {boolean} true if declined, false otherwise
]]--
function util.isDeclined(val)
if not(val) then return false end
return string.find(L10n.str.declinedWords , ' '..val..' ', 1, true ) and true or false
end
--[[
Check if the name of a template matches the known coord templates or wrappers
(in L10n.template.coord). The name is normalised when checked, so e.g. the names
"Coord", "coord", and " Coord" all return true.
@param {string} name
@returns {boolean} true if it is a coord template or wrapper, false otherwise
]]--
function util.isCoordTemplateOrWrapper(name)
name = mw.text.trim(name)
local inputTitle = mw.title.new(name, 'Template')
if not inputTitle then
return false
end
-- Create (or reuse) mw.title objects for each known coord template/wrapper.
-- Stored in L10n.template.title so that they don't need to be recreated
-- each time this function is called
if not L10n.template.titles then
L10n.template.titles = {}
for _, v in pairs(L10n.template.coord) do
table.insert(L10n.template.titles, mw.title.new(v, 'Template'))
end
end
for _, templateTitle in pairs(L10n.template.titles) do
if mw.title.equals(inputTitle, templateTitle) then
return true
end
end
return false
end
--[[
Recursively extract coord templates which have a name parameter.
@param {string} wikitext
@returns {table} table sequence of coord templates
]]--
function util.extractCoordTemplates(wikitext)
local output = {}
local templates = mw.ustring.gmatch(wikitext, '{%b{}}')
local subtemplates = {}
for template in templates do
local templateName = mw.ustring.match(template, '{{([^}|]+)')
local nameParam = mw.ustring.match(template, "|%s*name%s*=%s*[^}|]+")
if util.isCoordTemplateOrWrapper(templateName) then
if nameParam then table.insert(output, template) end
elseif mw.ustring.find(mw.ustring.sub(template, 2), "{{") then
local subOutput = util.extractCoordTemplates(mw.ustring.sub(template, 2))
for _, t in pairs(subOutput) do
table.insert(output, t)
end
end
end
-- ensure coords are not using title display
for k, v in pairs(output) do
output[k] = mw.ustring.gsub(v, "|%s*display%s*=[^|}]+", "|display=inline")
end
return output
end
--[[
Gets all named coordiates from a page or a section of a page.
@param {string|nil} page Page name, or name#section, to get named coordinates
from. If the name is omitted, i.e. #section or nil or empty string, then
the current page will be used.
@returns {table} sequence of {coord, name, description} tables where coord is
the coordinates in a format suitable for #util.parseCoords, name is a string,
and description is a string (coordinates in a format suitable for displaying
to the reader). If for some reason the name can't be found, the description
is nil and the name contains display-format coordinates.
@throws {L10n.error.noNamedCoords} if no named coordinates are found.
]]--
function util.getNamedCoords(page)
if transcluder == nil then
-- load [[Module:Transcluder]] lazily so it is only transcluded on pages that
-- actually use named coordinates
transcluder = require("Module:Transcluder")
end
local parts = mw.text.split(page or "", "#", true)
local name = parts[1] == "" and mw.title.getCurrentTitle().prefixedText or parts[1]
local section = parts[2]
local pageWikitext = transcluder.get(section and name.."#"..section or name)
local coordTemplates = util.extractCoordTemplates(pageWikitext)
if #coordTemplates == 0 then error(string.format(L10n.error.noNamedCoords, page or name), 0) end
local frame = mw.getCurrentFrame()
local sep = "________"
local expandedContent = frame:preprocess(table.concat(coordTemplates, sep))
local expandedTemplates = mw.text.split(expandedContent, sep)
local namedCoords = {}
for _, expandedTemplate in pairs(expandedTemplates) do
local coord = mw.ustring.match(expandedTemplate, "<span class=\"geo%-dec\".->(.-)</span>")
if coord then
local name = (
-- name specified by a wrapper template, e.g [[Article|Name]]
mw.ustring.match(expandedTemplate, "<span class=\"mapframe%-coord%-name\">(.-)</span>") or
-- name passed into coord template
mw.ustring.match(expandedTemplate, "<span class=\"fn org\">(.-)</span>") or
-- default to the coordinates if the name can't be retrieved
coord
)
local description = name ~= coord and coord
local coord = mw.ustring.gsub(coord, "[° ]", "_")
table.insert(namedCoords, {coord=coord, name=name, description=description})
end
end
if #namedCoords == 0 then error(string.format(L10n.error.noNamedCoords, page or name), 0) end
return namedCoords
end
--[[
Parse coordinate values from the params passed in a GeoHack url (such as
//tools.wmflabs.org/geohack/geohack.php?pagename=Example¶ms=1_2_N_3_4_W_ or
//tools.wmflabs.org/geohack/geohack.php?pagename=Example¶ms=1.23_S_4.56_E_ )
or non-url string in the same format (such as `1_2_N_3_4_W_` or `1.23_S_4.56_E_`)
@param {string} coords string containing coordinates
@returns {number, number} latitude, longitude
]]--
function util.parseCoords(coords)
local coordsPatt
if mw.ustring.find(coords, "params=", 1, true) then
-- prevent false matches from page name, e.g. ?pagename=Lorem_S._Ipsum
coordsPatt = 'params=([_%.%d]+[NS][_%.%d]+[EW])'
else
-- not actually a geohack url, just the same format
coordsPatt = '[_%.%d]+[NS][_%.%d]+[EW]'
end
local parts = mw.text.split((mw.ustring.match(coords, coordsPatt) or ''), '_')
local lat_d = tonumber(parts[1])
local lat_m = tonumber(parts[2]) -- nil if coords are in decimal format
local lat_s = lat_m and tonumber(parts[3]) -- nil if coords are either in decimal format or degrees and minutes only
local lat = lat_d + (lat_m or 0)/60 + (lat_s or 0)/3600
if parts[#parts/2] == 'S' then
lat = lat * -1
end
local long_d = tonumber(parts[1+#parts/2])
local long_m = tonumber(parts[2+#parts/2]) -- nil if coords are in decimal format
local long_s = long_m and tonumber(parts[3+#parts/2]) -- nil if coords are either in decimal format or degrees and minutes only
local long = long_d + (long_m or 0)/60 + (long_s or 0)/3600
if parts[#parts] == 'W' then
long = long * -1
end
return lat, long
end
--[[
Get coordinates from a Wikidata item
@param {string} item_id Wikidata item id (Q number)
@returns {number, number} latitude, longitude
@throws {L10n.error.noCoords} if item_id is invalid or the item does not exist
@throws {L10n.error.wikidataCoords} if the the item does not have a P625
statement (coordinates), or it is set to "no value"
]]--
function util.wikidataCoords(item_id)
if not (item_id and mw.wikibase.isValidEntityId(item_id) and mw.wikibase.entityExists(item_id)) then
error(L10n.error.noCoords, 0)
end
local coordStatements = mw.wikibase.getBestStatements(item_id, 'P625')
if not coordStatements or #coordStatements == 0 then
error(L10n.error.wikidataCoords, 0)
end
local hasNoValue = ( coordStatements[1].mainsnak and (coordStatements[1].mainsnak.snaktype == 'novalue' or coordStatements[1].mainsnak.snaktype == 'somevalue') )
if hasNoValue then
error(L10n.error.wikidataCoords, 0)
end
local wdCoords = coordStatements[1]['mainsnak']['datavalue']['value']
return tonumber(wdCoords['latitude']), tonumber(wdCoords['longitude'])
end
--[[
Creates a polygon that approximates a circle
@param {number} lat Latitude
@param {number} long Longitude
@param {number} radius Radius in metres
@param {number} n Number of edges for the polygon
@returns {table} sequence of {latitude, longitude} table sequences, where
latitude and longitude are both numbers
]]--
function util.circleToPolygon(lat, long, radius, n) -- n is number of edges
-- Based on https://github.com/gabzim/circle-to-polygon, ISC licence
local function offset(cLat, cLon, distance, bearing)
local lat1 = math.rad(cLat)
local lon1 = math.rad(cLon)
local dByR = distance / 6378137 -- distance divided by 6378137 (radius of the earth) wgs84
local lat = math.asin(
math.sin(lat1) * math.cos(dByR) +
math.cos(lat1) * math.sin(dByR) * math.cos(bearing)
)
local lon = lon1 + math.atan2(
math.sin(bearing) * math.sin(dByR) * math.cos(lat1),
math.cos(dByR) - math.sin(lat1) * math.sin(lat)
)
return {math.deg(lon), math.deg(lat)}
end
local coordinates = {};
local i = 0;
while i < n do
table.insert(coordinates,
offset(lat, long, radius, (2*math.pi*i*-1)/n)
)
i = i + 1
end
table.insert(coordinates, offset(lat, long, radius, 0))
return coordinates
end
--[[
Get the number of key-value pairs in a table, which might not be a sequence.
@param {table} t
@returns {number} count of key-value pairs
]]--
function util.tableCount(t)
local count = 0
for k, v in pairs(t) do
count = count + 1
end
return count
end
--[[
For a table where the values are all tables, returns either the util.tableCount
of the subtables if they are all the same, or nil if they are not all the same.
@param {table} t
@returns {number|nil} count of key-value pairs of subtable, or nil if subtables
have different counts
]]--
function util.subTablesCount(t)
local count = nil
for k, v in pairs(t) do
if count == nil then
count = util.tableCount(v)
elseif count ~= util.tableCount(v) then
return nil
end
end
return count
end
--[[
Splits a list into a table sequence. The items in the list may be separated by
commas, or by semicolons (if items may contain commas), or by "###" (if items
may contain semicolons).
@param {string} listString
@returns {table} sequence of list items
]]--
function util.tableFromList(listString)
if type(listString) ~= "string" or listString == "" then return nil end
local separator = (mw.ustring.find(listString, "###", 0, true ) and "###") or
(mw.ustring.find(listString, ";", 0, true ) and ";") or ","
local pattern = "%s*"..separator.."%s*"
return mw.text.split(listString, pattern)
end
-- Boolean in outer scope indicating if Kartographer should be able to
-- automatically calculate coordinates (see phab:T227402)
local coordsDerivedFromFeatures = false;
--[[----------------------------------------------------------------------------
Make methods: These take in a table of arguments, and return either a string
or a table to be used in the eventual output.
----------------------------------------------------------------------------]]--
local make = {}
--[[
Makes content to go inside the maplink or mapframe tag.
@param {table} args
@returns {string} tag content
]]--
function make.content(args)
if util.getParameterValue(args, 'raw') then
coordsDerivedFromFeatures = true -- Kartographer should be able to automatically calculate coords from raw geoJSON
return util.getParameterValue(args, 'raw')
end
local content = {}
local argsExpanded = {}
for k, v in pairs(args) do
local index = string.match( k, '^[^0-9]+([0-9]*)$' )
if index ~= nil then
local indexNumber = ''
if index ~= '' then
indexNumber = tonumber(index)
else
indexNumber = 1
end
if argsExpanded[indexNumber] == nil then
argsExpanded[indexNumber] = {}
end
argsExpanded[indexNumber][ string.gsub(k, index, '') ] = v
end
end
for contentIndex, contentArgs in pairs(argsExpanded) do
local argType = util.getParameterValue(contentArgs, "type")
-- Kartographer automatically calculates coords if geolines/shapes are used (T227402)
if not coordsDerivedFromFeatures then
coordsDerivedFromFeatures = ( argType == L10n.str.line or argType == L10n.str.shape ) and true or false
end
if argType == L10n.str.named then
local namedCoords = util.getNamedCoords(util.getParameterValue(contentArgs, "from"))
local typeKey = type(L10n.para.type) == "table" and L10n.para.type[1] or L10n.para.type
local coordKey = type(L10n.para.coord) == "table" and L10n.para.coord[1] or L10n.para.coord
local titleKey = type(L10n.para.title) == "table" and L10n.para.title[1] or L10n.para.title
local descKey = type(L10n.para.description) == "table" and L10n.para.description[1] or L10n.para.description
for _, namedCoord in pairs(namedCoords) do
contentArgs[typeKey] = "point"
contentArgs[coordKey] = namedCoord.coord
contentArgs[titleKey] = namedCoord.name
contentArgs[descKey] = namedCoord.description
content[#content+1] = make.contentJson(contentArgs)
end
else
content[#content + 1] = make.contentJson(contentArgs)
end
end
--Single item, no array needed
if #content==1 then return content[1] end
--Multiple items get placed in a FeatureCollection
local contentArray = '[\n' .. table.concat( content, ',\n') .. '\n]'
return contentArray
end
--[[
Make coordinates from the coord arg, or the id arg, or the current page's
Wikidata item.
@param {table} args
@param {boolean} [plainOutput]
@returns {Mixed} Either:
{number, number} latitude, longitude if plainOutput is true; or
{table} table sequence of longitude, then latitude (gives the required format
for GeoJSON when encoded)
]]--
function make.coords(args, plainOutput)
local coords, lat, long
local frame = mw.getCurrentFrame()
if util.getParameterValue(args, 'coord') then
coords = frame:preprocess( util.getParameterValue(args, 'coord') )
lat, long = util.parseCoords(coords)
else
lat, long = util.wikidataCoords(util.getParameterValue(args, 'id') or mw.wikibase.getEntityIdForCurrentPage())
end
if plainOutput then
return lat, long
end
return {[0] = long, [1] = lat}
end
--[[
Makes a table of coordinates that approximate a circle.
@param {table} args
@returns {table} sequence of {latitude, longitude} table sequences, where
latitude and longitude are both numbers
@throws {L10n.error.noCircleCoords} if centre coordinates are not specified
@throws {L10n.error.noRadius} if radius is not specified
@throws {L10n.error.negativeRadius} if radius is negative or zero
@throws {L10n.error.negativeEdges} if edges is negative or zero
]]--
function make.circleCoords(args)
local lat, long = make.coords(args, true)
local radius = util.getParameterValue(args, 'radius')
if not radius then
radius = util.getParameterValue(args, 'radiusKm') and tonumber(util.getParameterValue(args, 'radiusKm'))*1000
if not radius then
radius = util.getParameterValue(args, 'radiusMi') and tonumber(util.getParameterValue(args, 'radiusMi'))*1609.344
if not radius then
radius = util.getParameterValue(args, 'radiusFt') and tonumber(util.getParameterValue(args, 'radiusFt'))*0.3048
end
end
end
local edges = util.getParameterValue(args, 'edges') or L10n.defaults.edges
if not lat or not long then
error(L10n.error.noCircleCoords, 0)
elseif not radius then
error(L10n.error.noRadius, 0)
elseif tonumber(radius) <= 0 then
error(L10n.error.negativeRadius, 0)
elseif tonumber(edges) <= 0 then
error(L10n.error.negativeEdges, 0)
end
return util.circleToPolygon(lat, long, radius, tonumber(edges))
end
--[[
Makes JSON data for a feature
@param contentArgs args for this feature. Keys must be the non-suffixed version
of the parameter names, i.e. use type, stroke, fill,... rather than type3,
stroke3, fill3,...
@returns {string} JSON encoded data
]]--
function make.contentJson(contentArgs)
local data = {}
if util.getParameterValue(contentArgs, 'type') == L10n.str.point or util.getParameterValue(contentArgs, 'type') == L10n.str.circle then
local isCircle = util.getParameterValue(contentArgs, 'type') == L10n.str.circle
data.type = "Feature"
data.geometry = {
type = isCircle and "LineString" or "Point",
coordinates = isCircle and make.circleCoords(contentArgs) or make.coords(contentArgs)
}
data.properties = {
title = util.getParameterValue(contentArgs, 'title') or mw.getCurrentFrame():getParent():getTitle()
}
if isCircle then
-- TODO: This is very similar to below, should be extracted into a function
data.properties.stroke = util.getParameterValue(contentArgs, 'strokeColor') or L10n.defaults.strokeColor
data.properties["stroke-width"] = tonumber(util.getParameterValue(contentArgs, 'strokeWidth')) or L10n.defaults.strokeWidth
local strokeOpacity = util.getParameterValue(contentArgs, 'strokeOpacity')
if strokeOpacity then
data.properties['stroke-opacity'] = tonumber(strokeOpacity)
end
local fill = util.getParameterValue(contentArgs, 'fill')
if fill then
data.properties.fill = fill
local fillOpacity = util.getParameterValue(contentArgs, 'fillOpacity')
data.properties['fill-opacity'] = fillOpacity and tonumber(fillOpacity) or 0.6
end
else -- is a point
local markerSymbol = util.getParameterValue(contentArgs, 'marker') or L10n.defaults.marker
-- allow blank to be explicitly specified, for overriding infoboxes or other templates with a default value
if markerSymbol ~= "blank" then
data.properties["marker-symbol"] = markerSymbol
end
data.properties["marker-color"] = util.getParameterValue(contentArgs, 'markerColor') or L10n.defaults.markerColor
data.properties["marker-size"] = util.getParameterValue(contentArgs, 'markerSize') or L10n.defaults.markerSize
end
else
data.type = "ExternalData"
if util.getParameterValue(contentArgs, 'type') == L10n.str.data or util.getParameterValue(contentArgs, 'from') then
data.service = "page"
elseif util.getParameterValue(contentArgs, 'type') == L10n.str.line then
data.service = "geoline"
elseif util.getParameterValue(contentArgs, 'type') == L10n.str.shape then
data.service = "geoshape"
elseif util.getParameterValue(contentArgs, 'type') == L10n.str.shapeInverse then
data.service = "geomask"
end
if util.getParameterValue(contentArgs, 'id') or (not (util.getParameterValue(contentArgs, 'from')) and mw.wikibase.getEntityIdForCurrentPage()) then
data.ids = util.getParameterValue(contentArgs, 'id') or mw.wikibase.getEntityIdForCurrentPage()
else
data.title = util.getParameterValue(contentArgs, 'from')
end
data.properties = {
stroke = util.getParameterValue(contentArgs, 'strokeColor') or L10n.defaults.strokeColor,
["stroke-width"] = tonumber(util.getParameterValue(contentArgs, 'strokeWidth')) or L10n.defaults.strokeWidth
}
local strokeOpacity = util.getParameterValue(contentArgs, 'strokeOpacity')
if strokeOpacity then
data.properties['stroke-opacity'] = tonumber(strokeOpacity)
end
local fill = util.getParameterValue(contentArgs, 'fill')
if fill and (data.service == "geoshape" or data.service == "geomask") then
data.properties.fill = fill
local fillOpacity = util.getParameterValue(contentArgs, 'fillOpacity')
if fillOpacity then
data.properties['fill-opacity'] = tonumber(fillOpacity)
end
end
end
data.properties.title = util.getParameterValue(contentArgs, 'title') or mw.title.getCurrentTitle().text
if util.getParameterValue(contentArgs, 'description') then
data.properties.description = util.getParameterValue(contentArgs, 'description')
end
return mw.text.jsonEncode(data)
end
--[[
Makes attributes for the maplink or mapframe tag.
@param {table} args
@param {boolean} [isTitle] Tag is to be displayed in the title of page rather
than inline
@returns {table<string,string>} key-value pairs of attribute names and values
]]--
function make.tagAttribs(args, isTitle)
local attribs = {}
if util.getParameterValue(args, 'zoom') then
attribs.zoom = util.getParameterValue(args, 'zoom')
end
if util.isDeclined(util.getParameterValue(args, 'icon')) then
attribs.class = "no-icon"
end
if util.getParameterValue(args, 'type') == L10n.str.point and not coordsDerivedFromFeatures then
local lat, long = make.coords(args, 'plainOutput')
attribs.latitude = tostring(lat)
attribs.longitude = tostring(long)
end
if util.isAffirmed(util.getParameterValue(args, 'frame')) and not(isTitle) then
attribs.width = util.getParameterValue(args, 'frameWidth') or L10n.defaults.frameWidth
attribs.height = util.getParameterValue(args, 'frameHeight') or L10n.defaults.frameHeight
if util.getParameterValue(args, 'frameCoordinates') then
local frameLat, frameLong = util.parseCoords(util.getParameterValue(args, 'frameCoordinates'))
attribs.latitude = frameLat
attribs.longitude = frameLong
else
if util.getParameterValue(args, 'frameLatitude') then
attribs.latitude = util.getParameterValue(args, 'frameLatitude')
end
if util.getParameterValue(args, 'frameLongitude') then
attribs.longitude = util.getParameterValue(args, 'frameLongitude')
end
end
if not attribs.latitude and not attribs.longitude and not coordsDerivedFromFeatures then
local success, lat, long = pcall(util.wikidataCoords, util.getParameterValue(args, 'id') or mw.wikibase.getEntityIdForCurrentPage())
if success then
attribs.latitude = tostring(lat)
attribs.longitude = tostring(long)
end
end
if util.getParameterValue(args, 'frameAlign') then
attribs.align = util.getParameterValue(args, 'frameAlign')
end
if util.isAffirmed(util.getParameterValue(args, 'plain')) then
attribs.frameless = "1"
else
attribs.text = util.getParameterValue(args, 'text') or L10n.defaults.text
end
else
attribs.text = util.getParameterValue(args, 'text') or L10n.defaults.text
end
return attribs
end
--[[
Makes maplink wikitext that will be located in the top-right of the title of the
page (the same place where coords with |display=title are positioned).
@param {table} args
@param {string} tagContent Content for the maplink tag
@returns {string}
]]--
function make.titleOutput(args, tagContent)
local titleTag = mw.text.tag('maplink', make.tagAttribs(args, true), tagContent)
local spanAttribs = {
style = "font-size: small;",
id = "coordinates"
}
return mw.text.tag('span', spanAttribs, titleTag)
end
--[[
Makes maplink or mapframe wikitext that will be located inline.
@param {table} args
@param {string} tagContent Content for the maplink tag
@returns {string}
]]--
function make.inlineOutput(args, tagContent)
local tagName = 'maplink'
if util.getParameterValue(args, 'frame') then
tagName = 'mapframe'
end
return mw.text.tag(tagName, make.tagAttribs(args), tagContent)
end
--[[
Makes the HTML required for the swicther to work, including the templatestyles
tag.
@param {table} params table sequence of {map, label} tables
@param {string} params{}.map Wikitext for mapframe map
@param {string} params{}.label Label text for swicther option
@param {table} options
@param {string} options.alignment "left" or "center" or "right"
@param {boolean} options.isThumbnail Display in a thumbnail
@param {string} options.width Width of frame, e.g. "200"
@param {string} [options.caption] Caption wikitext for thumnail
@retruns {string} swicther HTML
]]--
function make.switcherHtml(params, options)
options = options or {}
local frame = mw.getCurrentFrame()
local styles = frame:extensionTag{
name = "templatestyles",
args = {src = "Template:Maplink/styles-multi.css"}
}
local container = mw.html.create("div")
:addClass("switcher-container")
:addClass("mapframe-multi-container")
if options.alignment == "left" or options.alignment == "right" then
container:addClass("float"..options.alignment)
else -- alignment is "center"
container:addClass("center")
end
for i = 1, #params do
container
:tag("div")
:wikitext(params[i].map)
:tag("span")
:addClass("switcher-label")
:css("display", "none")
:wikitext(mw.text.trim(params[i].label))
end
if not options.isThumbnail then
return styles .. tostring(container)
end
local classlist = container:getAttr("class")
classlist = mw.ustring.gsub(classlist, "%a*"..options.alignment, "")
container:attr("class", classlist)
local outerCountainer = mw.html.create("div")
:addClass("mapframe-multi-outer-container")
:addClass("mw-kartographer-container")
:addClass("thumb")
if options.alignment == "left" or options.alignment == "right" then
outerCountainer:addClass("t"..options.alignment)
else -- alignment is "center"
outerCountainer
:addClass("tnone")
:addClass("center")
end
outerCountainer
:tag("div")
:addClass("thumbinner")
:css("width", options.width.."px")
:node(container)
:node(options.caption and mw.html.create("div")
:addClass("thumbcaption")
:wikitext(options.caption)
)
return styles .. tostring(outerCountainer)
end
--[[
Makes the HTML required for an overlay map to work
tag.
@param {string} overlayMap wikitext for the overlay map
@param {string} baseMap wikitext for the base map
@param {table} options various styling/display options
@param {string} options.align "left" or "center" or "right"
@param {string|number} options.width Width of the base map, e.g. "300"
@param {string|number} options.width Height of the base map, e.g. "200"
@param {string} options.border Border style for the overlayed map, e.g. "1px solid white"
@param {string} options.horizontalAlignment Horizontal alignment for overlay map, "left" or "right"
@param {string|number} options.horizontalOffset Horizontal offset in pixels from the alignment edge, e.g "10"
@param {string} options.verticalAlignment Vertical alignment for overlay map, "top" or "bottom"
@param {string|number} options.verticalOffset Vertical offset in pixels from the alignment edge, e.g. is "10"
@param {boolean} options.isThumbnail Display in a thumbnail
@param {string} [options.caption] Caption wikitext for thumnail
@retruns {string} HTML for basemap with overlay
]]--
function make.overlayHtml(overlayMap, baseMap, options)
options = options or {}
local containerFloatClass = "float"..(options.align or "none")
if options.align == "center" then
containerFloatClass = "center"
end
local containerStyle = {
position = "relative",
width = options.width .. "px",
height = options.height .. "px",
overflow = "hidden" -- mobile/minerva tends to add scrollbars for a couple of pixels
}
if options.align == "center" then
containerStyle["margin-left"] = "auto"
containerStyle["margin-right"] = "auto"
end
local container = mw.html.create("div")
:addClass("mapframe-withOverlay-container")
:addClass(containerFloatClass)
:addClass("noresize")
:css(containerStyle)
local overlayStyle = {
position = "absolute",
["z-index"] = "1",
border = options.border or "1px solid white"
}
if options.horizontalAlignment == "right" then
overlayStyle.right = options.horizontalOffset .. "px"
else
overlayStyle.left = options.horizontalOffset .. "px"
end
if options.verticalAlignment == "bottom" then
overlayStyle.bottom = options.verticalOffset .. "px"
else
overlayStyle.top = options.verticalOffset .. "px"
end
local overlayDiv = mw.html.create("div")
:css(overlayStyle)
:wikitext(overlayMap)
container
:node(overlayDiv)
:wikitext(baseMap)
if not options.isThumbnail then
return tostring(container)
end
local classlist = container:getAttr("class")
classlist = mw.ustring.gsub(classlist, "%a*"..options.align, "")
container:attr("class", classlist)
local outerCountainer = mw.html.create("div")
:addClass("mapframe-withOverlay-outerContainer")
:addClass("mw-kartographer-container")
:addClass("thumb")
if options.align == "left" or options.align == "right" then
outerCountainer:addClass("t"..options.align)
else -- alignment is "center"
outerCountainer
:addClass("tnone")
:addClass("center")
end
outerCountainer
:tag("div")
:addClass("thumbinner")
:css("width", options.width.."px")
:node(container)
:node(options.caption and mw.html.create("div")
:addClass("thumbcaption")
:wikitext(options.caption)
)
return tostring(outerCountainer)
end
--[[----------------------------------------------------------------------------
Package to be exported, i.e. methods which will available to templates and
other modules.
----------------------------------------------------------------------------]]--
local p = {}
-- Entry point for templates
function p.main(frame)
local parent = frame.getParent(frame)
-- Check for overlay option
local overlay = util.getParameterValue(parent.args, 'overlay')
local hasOverlay = overlay and mw.text.trim(overlay) ~= ""
-- Check for switch option
local switch = util.getParameterValue(parent.args, 'switch')
local isMulti = switch and mw.text.trim(switch) ~= ""
-- Create output by choosing method to suit options
local output
if hasOverlay then
output = p.withOverlay(parent.args)
elseif isMulti then
output = p.multi(parent.args)
else
output = p._main(parent.args)
end
-- Preprocess output before returning it
return frame:preprocess(output)
end
-- Entry points for modules
function p._main(_args)
local args = util.trimArgs(_args)
local tagContent = make.content(args)
local display = mw.text.split(util.getParameterValue(args, 'display') or L10n.defaults.display, '%s*' .. L10n.str.dsep .. '%s*')
local displayInTitle = display[1] == L10n.str.title or display[2] == L10n.str.title
local displayInline = display[1] == L10n.str.inline or display[2] == L10n.str.inline
local output
if displayInTitle and displayInline then
output = make.titleOutput(args, tagContent) .. make.inlineOutput(args, tagContent)
elseif displayInTitle then
output = make.titleOutput(args, tagContent)
elseif displayInline then
output = make.inlineOutput(args, tagContent)
else
error(L10n.error.badDisplayPara)
end
return output
end
function p.multi(_args)
local args = util.trimArgs(_args)
if not args[L10n.para.switch] then error(L10n.error.noSwitchPara, 0) end
local switchParamValue = util.getParameterValue(args, 'switch')
local switchLabels = util.tableFromList(switchParamValue)
if #switchLabels == 1 then error(L10n.error.oneSwitchLabel, 0) end
local mapframeArgs = {}
local switchParams = {}
for name, val in pairs(args) do
-- Copy to mapframeArgs, if not the switch labels or a switch parameter
if val ~= switchParamValue and not string.match(val, "^"..L10n.str.switch..":") then
mapframeArgs[name] = val
end
-- Check if this is a param to switch. If so, store the name and switch
-- values in switchParams table.
local switchList = string.match(val, "^"..L10n.str.switch..":(.+)")
if switchList ~= nil then
local values = util.tableFromList(switchList)
if #values == 1 then
error(string.format(L10n.error.oneSwitchValue, name), 0)
end
switchParams[name] = values
end
end
if util.tableCount(switchParams) == 0 then
error(L10n.error.noSwitchLists, 0)
end
local switchCount = util.subTablesCount(switchParams)
if not switchCount then
error(L10n.error.switchMismatches, 0)
elseif switchCount > #switchLabels then
error(string.format(L10n.error.fewerSwitchLabels, switchCount, #switchLabels), 0)
end
-- Ensure a plain frame will be used (thumbnail will be built by the
-- make.switcherHtml function if required, so that switcher options are
-- inside the thumnail)
mapframeArgs.plain = "yes"
local switcher = {}
for i = 1, switchCount do
local label = switchLabels[i]
for name, values in pairs(switchParams) do
mapframeArgs[name] = values[i]
end
table.insert(switcher, {
map = p._main(mapframeArgs),
label = "Show "..label
})
end
return make.switcherHtml(switcher, {
alignment = args["frame-align"] or "right",
isThumbnail = (args.frame and not args.plain) and true or false,
width = args["frame-width"] or L10n.defaults.frameWidth,
caption = args.text
})
end
function p.withOverlay(_args)
-- Get and trim wikitext for overlay map
local overlayMap = _args.overlay
if type(overlayMap) == 'string' then
overlayMap = overlayMap:match('^%s*(.-)%s*$')
end
local isThumbnail = (util.getParameterValue(_args, "frame") and not util.getParameterValue(_args, "plain")) and true or false
-- Get base map using the _main function, as a plain map
local args = util.trimArgs(_args)
args.plain = "yes"
local basemap = p._main(args)
-- Extract overlay options from args
local overlayOptions = {
width = util.getParameterValue(args, "frameWidth") or L10n.defaults.frameWidth,
height = util.getParameterValue(args, "frameHeight") or L10n.defaults.frameHeight,
align = util.getParameterValue(args, "frameAlign") or L10n.defaults.frameAlign,
border = util.getParameterValue(args, "overlayBorder") or L10n.defaults.overlayBorder,
horizontalAlignment = util.getParameterValue(args, "overlayHorizontalAlignment") or L10n.defaults.overlayHorizontalAlignment,
horizontalOffset = util.getParameterValue(args, "overlayHorizontalOffset") or L10n.defaults.overlayHorizontalOffset,
verticalAlignment = util.getParameterValue(args, "overlayVerticalAlignment") or L10n.defaults.overlayVerticalAlignment,
verticalOffset = util.getParameterValue(args, "overlayVerticalOffset") or L10n.defaults.overlayVerticalOffset,
isThumbnail = isThumbnail,
caption = util.getParameterValue(args, "text") or L10n.defaults.text
}
-- Make the HTML for the overlaying maps
return make.overlayHtml(overlayMap, basemap, overlayOptions)
end
return p
f05a265dfd758f11fbf3c621b1711e277c8df1f0
Template:Self-reference
10
70
133
2023-03-30T11:42:06Z
wikipedia>Mclay1
0
Mclay1 moved page [[Template:Self reference]] to [[Template:Self-reference]]: grammatically correct hyphen
wikitext
text/x-wiki
{{#switch:{{{2|NONE}}}
|NONE|hatnote|hat={{Hatnote|extraclasses=plainlinks selfreference noprint|1={{{1}}}}}
|inline=<div class="plainlinks selfreference" style="display:inline; font-style: italic;"><!--Same style as class hatnote.-->{{{1}}}</div>
|<!--Matching the empty string here for unprintworthy content is for backwards compatibility with the 2006-2008 version. Do not depend on it!-->=<div style="display:inline;" class="plainlinks selfreference noprint">{{{1}}}</div>
|#default={{error|Second parameter must be <code>hatnote</code>, <code>hat</code>, or <code>inline</code>}}
}}<noinclude>
{{Documentation}}
<!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES THE /doc SUBPAGE, AND INTERWIKIS TO WIKIDATA, THANKS -->
</noinclude>
0c4a08f880070e918c3edcaa50cc493f99841e98
Template:Infobox election/row
10
222
436
2023-04-02T12:01:03Z
wikipedia>Number 57
0
Creates issues
wikitext
text/x-wiki
<includeonly>|-
{{#if:{{{divider|}}}|{{#if:{{{party1|}}}{{{color1|}}}{{{leader1|}}}{{{party2|}}}{{{color2|}}}{{{leader2|}}}{{{party3|}}}{{{color3|}}}{{{leader3|}}}|{{!}} colspan=4 {{!}} {{{divider}}} }} }}
|- style="display:none"
{{#ifeq:{{{ongoing|}}}|yes||{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative = {{#if:{{{party1|}}}{{{party2|}}}{{{party3|}}}|
! style="text-align:left;" {{!}}
! style="text-align:center" {{!}} {{#if:{{{party1|}}}| {{{header1|}}} }}
! style="text-align:center" {{!}} {{#if:{{{party2|}}}| {{{header2|}}} }}
{{#if:{{{col3|}}}|! style="text-align:center" {{!}} {{#if:{{{party3|}}}| {{{header3|}}} }}}}
}}
| #default =
}}}}
|-
{{#if:{{{party1|}}}{{{color1|}}}{{{image1|}}}{{{party2|}}}{{{color2|}}}{{{image2|}}}{{{party3|}}}{{{color3|}}}{{{image3|}}}|<!-- Images -->
{{#if:{{{filler|}}}|
! <br />{{{filler}}}
|
{{!}}
}}
{{!}} style="text-align:center;{{#if:{{{party1|}}}{{{color1|}}}||width:0;}}{{#if:{{{color1|}}}|border-bottom: 6px solid #{{#invoke:Ustring|gsub|s1={{{color1}}}|#|}}|{{#ifeq: {{{party_color}}}|no||{{#if:{{{party1|}}}|{{#ifeq: {{#invoke:Political party|fetch|{{#invoke:delink|delink|wikilinks=target|1={{#invoke:string|replace|source={{{party1}}}|pattern=^(%[%[%s*[^%]%[]*%]%]).*$|replace=%1|plain=false}}}}|color|error=NOTHERE}} | NOTHERE || border-bottom: 6px solid {{#invoke:Political party|fetch|{{#invoke:delink|delink|wikilinks=target|1={{#invoke:string|replace|source={{{party1}}}|pattern=^(%[%[%s*[^%]%[]*%]%]).*$|replace=%1|plain=false}}}}|color}};}}}}}}}}" {{!}} {{#invoke:InfoboxImage|InfoboxImage|image={{{image1|}}}|size={{if empty|{{{image1_size|}}}|{{{image_size|}}}}}|alt={{{alt1|}}}|upright={{if empty|{{{image1_upright|}}}|{{{image_upright|}}}|{{#if:{{both|{{{col3|}}}|{{{image3|}}}}}|0.5|0.75}}}}|suppressplaceholder=yes|class={{#if:{{{pageimage1|}}}||notpageimage}}}}
{{!}} style="text-align:center;{{#if:{{{party2|}}}{{{color2|}}}||width:0;}}{{#if:{{{color2|}}}|border-bottom: 6px solid #{{#invoke:Ustring|gsub|s1={{{color2}}}|#|}}|{{#ifeq: {{{party_color}}}|no||{{#if:{{{party2|}}}|{{#ifeq: {{#invoke:Political party|fetch|{{#invoke:delink|delink|wikilinks=target|1={{#invoke:string|replace|source={{{party2}}}|pattern=^(%[%[%s*[^%]%[]*%]%]).*$|replace=%1|plain=false}}}}|color|error=NOTHERE}} | NOTHERE || border-bottom: 6px solid {{#invoke:Political party|fetch|{{#invoke:delink|delink|wikilinks=target|1={{#invoke:string|replace|source={{{party2}}}|pattern=^(%[%[%s*[^%]%[]*%]%]).*$|replace=%1|plain=false}}}}|color}};}}}}}}}}"{{!}} {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{if empty|{{{image2_size|}}}|alt={{{alt2|}}}|{{{image_size|}}}}}|upright={{if empty|{{{image2_upright|}}}|{{{image_upright|}}}|{{#if:{{both|{{{col3|}}}|{{{image3|}}}}}|0.5|0.75}}}}|suppressplaceholder=yes|class={{#if:{{{pageimage2|}}}||notpageimage}}}}
{{#if:{{{col3|}}}|{{!}} style="text-align:center;{{#if:{{{party3|}}}{{{color3|}}}||width:0;}}{{#if:{{{color3|}}}|border-bottom: 6px solid #{{#invoke:Ustring|gsub|s1={{{color3}}}|#|}}|{{#ifeq: {{{party_color}}}|no||{{#if:{{{party3|}}}|{{#ifeq: {{#invoke:Political party|fetch|{{#invoke:delink|delink|wikilinks=target|1={{#invoke:string|replace|source={{{party3}}}|pattern=^(%[%[%s*[^%]%[]*%]%]).*$|replace=%1|plain=false}}}}|color|error=NOTHERE}} | NOTHERE || border-bottom: 6px solid {{#invoke:Political party|fetch|{{#invoke:delink|delink|wikilinks=target|1={{#invoke:string|replace|source={{{party3}}}|pattern=^(%[%[%s*[^%]%[]*%]%]).*$|replace=%1|plain=false}}}}|color}};}}}}}}}}"{{!}} {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|alt={{{alt3|}}}|size={{if empty|{{{image3_size|}}}|{{{image_size|}}}}}|upright={{if empty|{{{image3_upright|}}}|{{{image_upright|}}}|0.5}}|suppressplaceholder=yes|class={{#if:{{{pageimage3|}}}||notpageimage}}}}}}
}}
|-
{{#if:{{{nominee1|}}}{{{nominee2|}}}{{{nominee3|}}}|<!-- Presidential & by-election nominee -->
{{#switch:{{{type|}}}
| primary
| Primary
| presidential
| Presidential
| by-election
| By-election =
! style="width:75px;text-align:left" {{!}}Nominee
{{!}} style="{{#if:{{{nominee1|}}}|width:75px;}}text-align:center" {{!}} {{{nominee1|}}}
{{!}} style="{{#if:{{{nominee2|}}}|width:75px;}}text-align:center" {{!}} {{{nominee2|}}}
{{!}} style="{{#if:{{{nominee3|}}}|width:75px;}}text-align:center" {{!}} {{{nominee3|}}}
| #default =
}}|{{#if:{{{candidate1|}}}{{{candidate2|}}}{{{candidate3|}}}|<!-- Candidate -->
! style="width:75px;text-align:left" {{!}}Candidate
{{!}} style="{{#if:{{{candidate1|}}}|width:75px;}}text-align:center" {{!}} {{{candidate1|}}}
{{!}} style="{{#if:{{{candidate2|}}}|width:75px;}}text-align:center" {{!}} {{{candidate2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{candidate3|}}}|width:75px;}}text-align:center" {{!}} {{{candidate3|}}}}}
}}
}}
|-<!-- Party leader -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#if:{{{leader1|}}}{{{leader2|}}}{{{leader3|}}}|
! style="text-align:left" {{!}} Leader
{{!}} style="{{#if:{{{leader1|}}}|width:75px;}}text-align:center" {{!}} {{{leader1|}}}
{{!}} style="{{#if:{{{leader2|}}}|width:75px;}}text-align:center" {{!}} {{{leader2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{leader3|}}}|width:75px;}}text-align:center" {{!}} {{{leader3|}}}}}
}}
| #default =
}}
|-
{{#if:{{{party1|}}}{{{party2|}}}{{{party3|}}}|<!-- Party name -->
! style="width:75px;text-align:left" {{!}} Party
{{!}} style="{{#if:{{{party1|}}}|width:75px;}}text-align:center" {{!}} {{Infobox election/shortname|link={{{party1_name}}}|name={{{party1|}}}}}
{{!}} style="{{#if:{{{party2|}}}|width:75px;}}text-align:center" {{!}} {{Infobox election/shortname|link={{{party2_name}}}|name={{{party2|}}}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{party3|}}}|width:75px;}}text-align:center" {{!}} {{Infobox election/shortname|link={{{party3_name}}}|name={{{party3|}}}}}}}
}}
|-
{{#if:{{{alliance1|}}}{{{alliance2|}}}{{{alliance3|}}}|<!-- Alliance name -->
! style="text-align:left" {{!}} Alliance
{{!}} style="{{#if:{{{alliance1|}}}|width:75px;}}text-align:center" {{!}} {{Infobox election/shortname|link={{{alliance1_name}}}|name={{{alliance1|}}}}}
{{!}} style="{{#if:{{{alliance2|}}}|width:75px;}}text-align:center" {{!}} {{Infobox election/shortname|link={{{alliance2_name}}}|name={{{alliance2|}}}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{alliance3|}}}|width:75px;}}text-align:center" {{!}} {{Infobox election/shortname|link={{{alliance3_name}}}|name={{{alliance3|}}}}}}}
}}
|-<!-- Home state -->
{{#if:{{{home_state1|}}}{{{home_state2|}}}{{{home_state3|}}}|
{{#switch:{{{type|}}}
| primary
| Primary
| presidential
| Presidential =
! style="text-align:left" {{!}} Home state
{{!}} style="{{#if:{{{home_state1|}}}|width:75px;}}text-align:center" {{!}} {{{home_state1|}}}
{{!}} style="{{#if:{{{home_state2|}}}|width:75px;}}text-align:center" {{!}} {{{home_state2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{home_state3|}}}|width:75px;}}text-align:center" {{!}} {{{home_state3|}}}}}
| #default =
}}
}}
|-<!-- Running mate -->
{{#switch:{{{type|}}}
| presidential
| Presidential =
{{#if:{{{running_mate1|}}}{{{running_mate2|}}}{{{running_mate3|}}}|
! style="text-align:left" {{!}} Running mate
{{!}} style="{{#if:{{{running_mate1|}}}|width:75px;}}text-align:center" {{!}} {{{running_mate1|}}}
{{!}} style="{{#if:{{{running_mate2|}}}|width:75px;}}text-align:center" {{!}} {{{running_mate2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{running_mate3|}}}|width:75px;}}text-align:center" {{!}} {{{running_mate3|}}}}}
}}
| #default =
}}
|-<!-- Electoral vote -->
{{#switch:{{{type|}}}
| presidential
| Presidential =
{{#ifeq:{{{ongoing|}}}|yes||
{{#if:{{{electoral_vote1|}}}{{{electoral_vote2|}}}{{{electoral_vote3|}}}|
! style="text-align:left" {{!}} {{#ifeq:{{{college_voted|}}}|no|Projected e|E}}lectoral vote
{{!}} style="{{#if:{{{electoral_vote1|}}}|width:75px;}}text-align:center" {{!}} {{{electoral_vote1|}}}
{{!}} style="{{#if:{{{electoral_vote2|}}}|width:75px;}}text-align:center" {{!}} {{{electoral_vote2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{electoral_vote3|}}}|width:75px;}}text-align:center" {{!}} {{{electoral_vote3|}}}}}
}}
}}
| #default =
}}
|-<!-- Delegate count -->
{{#switch:{{{type|}}}
| primary
| Primary
| presidential
| Presidential =
{{#if:{{{delegate_count1|}}}{{{delegate_count2|}}}{{{delegate_count3|}}}|
! style="text-align:left" {{!}} {{#ifeq:{{{ongoing|}}}|yes|Estimated delegate|Delegate}} count
{{!}} style="{{#if:{{{delegate_count2|}}}|width:75px;}}text-align:center" {{!}} {{{delegate_count1|}}}
{{!}} style="{{#if:{{{delegate_count2|}}}|width:75px;}}text-align:center" {{!}} {{{delegate_count2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{delegate_count3|}}}|width:75px;}}text-align:center" {{!}} {{{delegate_count3|}}}}}
}}
| #default =
}}
|-<!-- States carried -->
{{#switch:{{{type|}}}
| primary
| Primary =
{{#if:{{{states_carried1|}}}{{{states_carried2|}}}{{{states_carried3|}}}|
! style="text-align:left" {{!}} Contests won
{{!}} style="{{#if:{{{states_carried2|}}}|width:75px;}}text-align:center" {{!}} {{{states_carried1|}}}
{{!}} style="{{#if:{{{states_carried2|}}}|width:75px;}}text-align:center" {{!}} {{{states_carried2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{states_carried2|}}}|width:75px;}}text-align:center" {{!}} {{{states_carried3|}}}}}
}}
| presidential
| Presidential =
{{#ifeq:{{{ongoing|}}}|yes||
{{#if:{{{states_carried1|}}}{{{states_carried2|}}}{{{states_carried3|}}}|
! style="text-align:left" {{!}} States carried
{{!}} style="{{#if:{{{states_carried2|}}}|width:75px;}}text-align:center" {{!}} {{{states_carried1|}}}
{{!}} style="{{#if:{{{states_carried2|}}}|width:75px;}}text-align:center" {{!}} {{{states_carried2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{states_carried3|}}}|width:75px;}}text-align:center" {{!}} {{{states_carried3|}}}}}
}}
}}
| #default =
}}
|-<!-- Leader since -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#if:{{{leader_since1|}}}{{{leader_since2|}}}{{{leader_since3|}}}|
! style="text-align:left" {{!}} Leader since
{{!}} style="{{#if:{{{leader_since1|}}}|width:75px;}}text-align:center" {{!}} {{{leader_since1|}}}
{{!}} style="{{#if:{{{leader_since2|}}}|width:75px;}}text-align:center" {{!}} {{{leader_since2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{leader_since3|}}}|width:75px;}}text-align:center" {{!}} {{{leader_since3|}}}}}
}}
| #default =
}}
|-<!-- Leader seat -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#if:{{{leaders_seat1|}}}{{{leaders_seat2|}}}{{{leaders_seat3|}}}|
! style="text-align:left" {{!}} Leader's seat
{{!}} style="{{#if:{{{leaders_seat2|}}}|width:75px;}}text-align:center" {{!}} {{{leaders_seat1|}}}
{{!}} style="{{#if:{{{leaders_seat2|}}}|width:75px;}}text-align:center" {{!}} {{{leaders_seat2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{leaders_seat3|}}}|width:75px;}}text-align:center" {{!}} {{{leaders_seat3|}}}}}
}}
| #default =
}}
|-<!-- last election -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#if:{{{last_election1|}}}{{{last_election2|}}}{{{last_election3|}}}|
! style="text-align:left" {{!}} Last election
{{!}} style="{{#if:{{{last_election1|}}}|width:75px;}}text-align:center" {{!}} {{{last_election1|}}}
{{!}} style="{{#if:{{{last_election2|}}}|width:75px;}}text-align:center" {{!}} {{{last_election2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{last_election3|}}}|width:75px;}}text-align:center" {{!}} {{{last_election3|}}}}}
}}
| #default =
}}
|-<!-- seats before -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#if:{{{seats_before1|}}}{{{seats_before2|}}}{{{seats_before3|}}}|
! style="text-align:left" {{!}} {{#ifeq:{{{ongoing|}}}|yes|Current seats|Seats before}}
{{!}} style="{{#if:{{{seats_before1|}}}|width:75px;}}text-align:center" {{!}} {{{seats_before1|}}}
{{!}} style="{{#if:{{{seats_before2|}}}|width:75px;}}text-align:center" {{!}} {{{seats_before2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{seats_before3|}}}|width:75px;}}text-align:center" {{!}} {{{seats_before3|}}}}}
}}
| #default =
}}
|-<!-- seats needed -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{seats_needed1|}}}{{{seats_needed2|}}}{{{seats_needed3|}}}|
! style="text-align:left" {{!}} Seats needed
{{!}} style="{{#if:{{{seats_needed1|}}}|width:75px;}}text-align:center" {{!}} {{{seats_needed1|}}}
{{!}} style="{{#if:{{{seats_needed2|}}}|width:75px;}}text-align:center" {{!}} {{{seats_needed2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{seats_needed3|}}}|width:75px;}}text-align:center" {{!}} {{{seats_needed3|}}}}}
}}
}}
| #default =
}}
|-<!-- seats -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes||
{{#if:{{{seats1|}}}{{{seats2|}}}{{{seats3|}}}|
! style="text-align:left" {{!}} Seats won
{{!}} style="{{#if:{{{seats1|}}}|width:75px;}}text-align:center" {{!}} {{{seats1|}}}
{{!}} style="{{#if:{{{seats2|}}}|width:75px;}}text-align:center" {{!}} {{{seats2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{seats3|}}}|width:75px;}}text-align:center" {{!}} {{{seats3|}}}}}
}}
}}
| #default =
}}
|-<!-- seats after -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes||
{{#if:{{{seats_after1|}}}{{{seats_after2|}}}{{{seats_after3|}}}|
! style="text-align:left" {{!}} Seats after
{{!}} style="{{#if:{{{seats_after1|}}}|width:75px;}}text-align:center" {{!}} {{{seats_after1|}}}
{{!}} style="{{#if:{{{seats_after2|}}}|width:75px;}}text-align:center" {{!}} {{{seats_after2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{seats_after3|}}}|width:75px;}}text-align:center" {{!}} {{{seats_after3|}}}}}
}}
}}
| #default =
}}
|-<!-- seat change -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes||
{{#if:{{{seat_change1|}}}{{{seat_change2|}}}{{{seat_change3|}}}|
! style="text-align:left" {{!}} Seat change
{{!}} style="{{#if:{{{seat_change1|}}}|width:75px;}}text-align:center" {{!}} {{{seat_change1|}}}
{{!}} style="{{#if:{{{seat_change2|}}}|width:75px;}}text-align:center" {{!}} {{{seat_change2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{seat_change3|}}}|width:75px;}}text-align:center" {{!}} {{{seat_change3|}}}}}
}}
}}
| #default =
}}
|-<!-- popular vote -->
{{#ifexpr:not {{#ifeq:{{{ongoing|}}}|yes|1|0}} or {{#ifeq:{{{type|}}}|primary|1|0}}|
{{#if:{{{popular_vote1|}}}{{{popular_vote2|}}}{{{popular_vote3|}}}|
! style="text-align:left" {{!}} {{{vote_type|Popular}}} vote
{{!}} style="{{#if:{{{popular_vote1|}}}|width:75px;}}text-align:center" {{!}} {{{popular_vote1|}}}
{{!}} style="{{#if:{{{popular_vote2|}}}|width:75px;}}text-align:center" {{!}} {{{popular_vote2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{popular_vote3|}}}|width:75px;}}text-align:center" {{!}} {{{popular_vote3|}}}}}
}}
}}
|-<!-- percentage -->
{{#ifexpr:not {{#ifeq:{{{ongoing|}}}|yes|1|0}} or {{#ifeq:{{{type|}}}|primary|1|0}}|
{{#if:{{{percentage1|}}}{{{percentage2|}}}{{{percentage3|}}}|
! style="text-align:left" {{!}} Percentage
{{!}} style="{{#if:{{{percentage1|}}}|width:75px;}}text-align:center" {{!}} {{{percentage1|}}}
{{!}} style="{{#if:{{{percentage2|}}}|width:75px;}}text-align:center" {{!}} {{{percentage2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{percentage3|}}}|width:75px;}}text-align:center" {{!}} {{{percentage3|}}}}}
}}
}}
|-<!-- Counties won -->
{{#switch:{{{type|}}}
| primary
| Primary
| presidential
| Presidential =
{{#ifexpr:not {{#ifeq:{{{ongoing|}}}|yes|1|0}} or {{#ifeq:{{{type|}}}|primary|1|0}}|
{{#if:{{{counties_won1|}}}{{{counties_won2|}}}{{{counties_won3|}}}|
! style="text-align:left" {{!}} Counties won
{{!}} style="{{#if:{{{counties_won1|}}}|width:75px;}}text-align:center" {{!}} {{{counties_won1|}}}
{{!}} style="{{#if:{{{counties_won2|}}}|width:75px;}}text-align:center" {{!}} {{{counties_won2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{counties_won3|}}}|width:75px;}}text-align:center" {{!}} {{{counties_won3|}}}}}
}}
}}
| #default =
}}
|-<!-- Counties 25% threshold -->
{{#switch:{{{type|}}}
| primary
| Primary
| presidential
| Presidential =
{{#ifexpr:not {{#ifeq:{{{ongoing|}}}|yes|1|0}} or {{#ifeq:{{{type|}}}|primary|1|0}}|
{{#if:{{{counties_threshold1|}}}{{{counties_threshold2|}}}{{{counties_threshold3|}}}|
! style="text-align:left" {{!}} Counties with 25% vote
{{!}} style="{{#if:{{{counties_threshold1|}}}|width:75px;}}text-align:center" {{!}} {{{counties_threshold1|}}}
{{!}} style="{{#if:{{{counties_threshold2|}}}|width:75px;}}text-align:center" {{!}} {{{counties_threshold2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{counties_threshold3|}}}|width:75px;}}text-align:center" {{!}} {{{counties_threshold3|}}}}}
}}
}}
| #default =
}}
|-<!-- swing -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes||
{{#if:{{{swing1|}}}|
! style="text-align:left" {{!}} Swing
{{!}} style="width:75px;text-align:center" {{!}} {{{swing1}}}
{{!}} style="{{#if:{{{swing2|}}}|width:75px;}}text-align:center" {{!}} {{{swing2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{swing3|}}}|width:75px;}}text-align:center" {{!}} {{{swing3|}}}}}
}}
}}
| #default =
}}
{{#if:{{{opinion_polls|}}}||
{{!-}}<!-- Presidential poll nominee -->
{{#switch:{{{type|}}}
| presidential
| Presidential =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll1_person1|}}}{{{poll1_person2|}}}{{{poll1_person3|}}}|
! colspan=4 {{!}} Opinion polls
}}
}}
| #default =
}}
{{!-}}
{{#switch:{{{type|}}}
| presidential
| Presidential =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll1_person1|}}}{{{poll1_person2|}}}{{{poll1_person3|}}}|
! style="text-align:left; white-space: nowrap" {{!}} {{{poll1_date|}}}{{#if:{{{poll1_source|}}}| [{{{poll1_source|}}}]}}
{{!}} style="{{#if:{{{poll1_person1|}}}|width:75px;}}text-align:center" {{!}} {{{poll1_person1|}}}
{{!}} style="{{#if:{{{poll1_person2|}}}|width:75px;}}text-align:center" {{!}} {{{poll1_person2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{poll1_person3|}}}|width:75px;}}text-align:center" {{!}} {{{poll1_person3|}}}}}
}}}}
| #default =
}}
{{!-}}
{{#switch:{{{type|}}}
| presidential
| Presidential =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll2_person1|}}}{{{poll2_person2|}}}{{{poll2_person3|}}}|
! style="text-align:left; white-space: nowrap" {{!}} {{{poll2_date|}}}{{#if:{{{poll2_source|}}}| [{{{poll2_source|}}}]}}
{{!}} style="{{#if:{{{poll2_person1|}}}|width:75px;}}text-align:center" {{!}} {{{poll2_person1|}}}
{{!}} style="{{#if:{{{poll2_person2|}}}|width:75px;}}text-align:center" {{!}} {{{poll2_person2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{poll2_person3|}}}|width:75px;}}text-align:center" {{!}} {{{poll2_person3|}}}}}
}}}}
| #default =
}}
{{!-}}
{{#switch:{{{type|}}}
| presidential
| Presidential =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll3_person1|}}}{{{poll3_person2|}}}{{{poll3_person3|}}}|
! style="text-align:left; white-space: nowrap" {{!}} {{{poll3_date|}}}{{#if:{{{poll3_source|}}}| [{{{poll3_source|}}}]}}
{{!}} style="{{#if:{{{poll3_person1|}}}|width:75px;}}text-align:center" {{!}} {{{poll3_person1|}}}
{{!}} style="{{#if:{{{poll3_person2|}}}|width:75px;}}text-align:center" {{!}} {{{poll3_person2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{poll3_person3|}}}|width:75px;}}text-align:center" {{!}} {{{poll3_person3|}}}}}
}}}}
| #default =
}}
{{!-}}
{{#switch:{{{type|}}}
| presidential
| Presidential =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll4_person1|}}}{{{poll4_person2|}}}{{{poll4_person3|}}}|
! style="text-align:left; white-space: nowrap" {{!}} {{{poll4_date|}}}{{#if:{{{poll4_source|}}}| [{{{poll4_source|}}}]}}
{{!}} style="{{#if:{{{poll4_person1|}}}|width:75px;}}text-align:center" {{!}} {{{poll4_person1|}}}
{{!}} style="{{#if:{{{poll4_person2|}}}|width:75px;}}text-align:center" {{!}} {{{poll4_person2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{poll4_person3|}}}|width:75px;}}text-align:center" {{!}} {{{poll4_person3|}}}}}
}}}}
| #default =
}}
{{!-}}
{{#switch:{{{type|}}}
| presidential
| Presidential =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll5_person1|}}}{{{poll5_person2|}}}{{{poll5_person3|}}}|
! style="text-align:left; white-space: nowrap" {{!}} {{{poll5_date|}}}{{#if:{{{poll5_source|}}}| [{{{poll5_source|}}}]}}
{{!}} style="{{#if:{{{poll5_person1|}}}|width:75px;}}text-align:center" {{!}} {{{poll5_person1|}}}
{{!}} style="{{#if:{{{poll5_person2|}}}|width:75px;}}text-align:center" {{!}} {{{poll5_person2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{poll5_person3|}}}|width:75px;}}text-align:center" {{!}} {{{poll5_person3|}}}}}
}}}}
| #default =
}}
{{!-}}<!-- Legislative poll nominee -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll1_party1|}}}{{{poll1_party2|}}}{{{poll1_party3|}}}|
! colspan=4 {{!}} Opinion polls
}}
}}
| #default =
}}
{{!-}}
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll1_party1|}}}{{{poll1_party2|}}}{{{poll1_party3|}}}|
! style="text-align:left; white-space: nowrap" {{!}} {{{poll1_date|}}}{{#if:{{{poll1_source|}}}| [{{{poll1_source|}}}]}}
{{!}} style="{{#if:{{{poll1_party1|}}}|width:75px;}}text-align:center" {{!}} {{{poll1_party1|}}}
{{!}} style="{{#if:{{{poll1_party2|}}}|width:75px;}}text-align:center" {{!}} {{{poll1_party2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{poll1_party3|}}}|width:75px;}}text-align:center" {{!}} {{{poll1_party3|}}}}}
}}
}}
| #default =
}}
{{!-}}
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll2_party1|}}}{{{poll2_party2|}}}{{{poll2_party3|}}}|
! style="text-align:left; white-space: nowrap" {{!}} {{{poll2_date|}}}{{#if:{{{poll2_source|}}}| [{{{poll2_source|}}}]}}
{{!}} style="{{#if:{{{poll2_party1|}}}|width:75px;}}text-align:center" {{!}} {{{poll2_party1|}}}
{{!}} style="{{#if:{{{poll2_party2|}}}|width:75px;}}text-align:center" {{!}} {{{poll2_party2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{poll2_party3|}}}|width:75px;}}text-align:center" {{!}} {{{poll2_party3|}}}}}
}}
}}
| #default =
}}
{{!-}}
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll3_party1|}}}{{{poll3_party2|}}}{{{poll3_party3|}}}|
! style="text-align:left; white-space: nowrap" {{!}} {{{poll3_date|}}}{{#if:{{{poll3_source|}}}| [{{{poll3_source|}}}]}}
{{!}} style="{{#if:{{{poll3_party1|}}}|width:75px;}}text-align:center" {{!}} {{{poll3_party1|}}}
{{!}} style="{{#if:{{{poll3_party2|}}}|width:75px;}}text-align:center" {{!}} {{{poll3_party2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{poll3_party3|}}}|width:75px;}}text-align:center" {{!}} {{{poll3_party3|}}}}}
}}
}}
| #default =
}}
{{!-}}
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll4_party1|}}}{{{poll4_party2|}}}{{{poll4_party3|}}}|
! style="text-align:left; white-space: nowrap" {{!}} {{{poll4_date|}}}{{#if:{{{poll4_source|}}}| [{{{poll4_source|}}}]}}
{{!}} style="{{#if:{{{poll4_party1|}}}|width:75px;}}text-align:center" {{!}} {{{poll4_party1|}}}
{{!}} style="{{#if:{{{poll4_party2|}}}|width:75px;}}text-align:center" {{!}} {{{poll4_party2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{poll4_party3|}}}|width:75px;}}text-align:center" {{!}} {{{poll4_party3|}}}}}
}}
}}
| #default =
}}
{{!-}}
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll5_party1|}}}{{{poll5_party2|}}}{{{poll5_party3|}}}|
! style="text-align:left; white-space: nowrap" {{!}} {{{poll5_date|}}}{{#if:{{{poll5_source|}}}| [{{{poll5_source|}}}]}}
{{!}} style="{{#if:{{{poll5_party1|}}}|width:75px;}}text-align:center" {{!}} {{{poll5_party1|}}}
{{!}} style="{{#if:{{{poll5_party2|}}}|width:75px;}}text-align:center" {{!}} {{{poll5_party2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{poll5_party3|}}}|width:75px;}}text-align:center" {{!}} {{{poll5_party3|}}}}}
}}
}}
| #default =
}}}}
|-<!-- Blank field -->
{{#if:{{#if:{{{1blank|}}}|{{{1data1|}}}{{{1data2|}}}{{{1data3|}}}}}|
! style="text-align:left" {{!}} {{{1blank}}}
{{!}} style="{{#if:{{{1data1|}}}|width:75px;}}text-align:center" {{!}} {{{1data1|}}}
{{!}} style="{{#if:{{{1data2|}}}|width:75px;}}text-align:center" {{!}} {{{1data2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{1data3|}}}|width:75px;}}text-align:center" {{!}} {{{1data3|}}}}}
}}
|-
{{#if:{{#if:{{{2blank|}}}|{{{2data1|}}}{{{2data2|}}}{{{2data3|}}}}}|
! style="text-align:left" {{!}} {{{2blank}}}
{{!}} style="{{#if:{{{2data1|}}}|width:75px;}}text-align:center" {{!}} {{{2data1|}}}
{{!}} style="{{#if:{{{2data2|}}}|width:75px;}}text-align:center" {{!}} {{{2data2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{2data3|}}}|width:75px;}}text-align:center" {{!}} {{{2data3|}}}}}
}}
|-
{{#if:{{#if:{{{3blank|}}}|{{{3data1|}}}{{{3data2|}}}{{{3data3|}}}}}|
! style="text-align:left" {{!}} {{{3blank}}}
{{!}} style="{{#if:{{{3data1|}}}|width:75px;}}text-align:center" {{!}} {{{3data1|}}}
{{!}} style="{{#if:{{{3data2|}}}|width:75px;}}text-align:center" {{!}} {{{3data2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{3data3|}}}|width:75px;}}text-align:center" {{!}} {{{3data3|}}}}}
}}
|-
{{#if:{{#if:{{{4blank|}}}|{{{4data1|}}}{{{4data2|}}}{{{4data3|}}}}}|
! style="text-align:left" {{!}} {{{4blank}}}
{{!}} style="{{#if:{{{4data1|}}}|width:75px;}}text-align:center" {{!}} {{{4data1|}}}
{{!}} style="{{#if:{{{4data2|}}}|width:75px;}}text-align:center" {{!}} {{{4data2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{4data3|}}}|width:75px;}}text-align:center" {{!}} {{{4data3|}}}}}
}}
|-
{{#if:{{#if:{{{5blank|}}}|{{{5data1|}}}{{{5data2|}}}{{{5data3|}}}}}|
! style="text-align:left" {{!}} {{{5blank}}}
{{!}} style="{{#if:{{{5data1|}}}|width:75px;}}text-align:center" {{!}} {{{5data1|}}}
{{!}} style="{{#if:{{{5data2|}}}|width:75px;}}text-align:center" {{!}} {{{5data2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{5data3|}}}|width:75px;}}text-align:center" {{!}} {{{5data3|}}}}}
}}
|-
{{#if:{{#if:{{{6blank|}}}|{{{6data1|}}}{{{6data2|}}}{{{6data3|}}}}}|
! style="text-align:left" {{!}} {{{6blank}}}
{{!}} style="{{#if:{{{6data1|}}}|width:75px;}}text-align:center" {{!}} {{{6data1|}}}
{{!}} style="{{#if:{{{6data2|}}}|width:75px;}}text-align:center" {{!}} {{{6data2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{6data3|}}}|width:75px;}}text-align:center" {{!}} {{{6data3|}}}}}
}}</includeonly><noinclude>
{{Documentation}}</noinclude>
378d817ebb08432f35bc744f7606f7bddcc99d6a
Help:Infobox/user style
12
138
267
2023-04-03T14:00:08Z
wikipedia>Maddy from Celeste
0
blatant self-promotion
wikitext
text/x-wiki
{{{heading|
==Infoboxes and user style ==
}}}
Users can have [[WP:User style|user CSS]] that hides<!--, moves, or makes collapsible--> any infoboxes in their own browsers.
To hide all infoboxes, add the following to [[Special:MyPage/common.css]] (for all [[WP:Skin|skins]], or [[Special:MyPage/skin.css]] for just the current skin), on a line by itself:
<syntaxhighlight lang="css">div.mw-parser-output .infobox { display: none; }</syntaxhighlight>
Alternatively, you can add the following code to [[Special:MyPage/common.js|your common.js]] or into a browser user script that is executed by an extension like [[Greasemonkey]]:
<syntaxhighlight lang="js">$('.infobox').hide();</syntaxhighlight>
Be aware that although{{#if:{{{guideline|}}}||, per [[WP:Manual of Style/Infoboxes]],}} all information in an infobox ideally should also be found in the main body of an article, there isn't perfect compliance with this guideline. For example, the full taxonomic hierarchy in {{tlx|Taxobox}}, and the OMIM and other medical database codes of {{tlx|Infobox disease}} are often not found in the main article content. The infobox is also often the location of the most significant, even only, image in an article. There is a userscript which removes infoboxes but moves the images contained to separate thumbnails: [[User:Maddy from Celeste/disinfobox.js]].<!--
Needs Special:Mypage/common.js options for:
* Making infoboxes collapsible
** Making them auto-collapsed
* Moving infoboxes to bottom of page
--><noinclude>
{{Documentation|content=
This documentation snippet is transcluded at [[Help:Infobox]], [[Template:Infobox/doc]], [[WP:Customisation#Hiding specific messages]], [[Help:User style]], [[WP:Manual of Style/Infoboxes]], and other places where this information is relevant.
As a template, this snippet takes a {{para|heading}} parameter to replace the level-2 <code>==Infoboxes and user style==</code> section heading code, as needed. E.g., for a <code>=== ... ===</code> level-3 heading: <code><nowiki>heading={{=}}{{=}}{{=}}Infoboxes and user style{{=}}{{=}}{{=}}</nowiki></code>
}}
</noinclude>
ba4dac68eb2bdc49a32f2a11b9afd52381bf06b5
Module:Infobox mapframe/doc
828
289
570
2023-04-05T14:38:29Z
wikipedia>Paine Ellsworth
0
High-use template and update /doc
wikitext
text/x-wiki
{{Module rating|beta}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{High-use}}
{{Lua sidebar}}
== Usage ==
Module that automatically makes a mapframe suitable for an infobox automatically, with minimal user input.
===Generic usage===
Just use the template {{tl|Infobox mapframe}}, following the documentation there. This module may also be imported to another Lua module.
===Automatic maps in infoboxes===
:''Example edits: [https://en.wikipedia.org/w/index.php?title=Template%3AInfobox_prison&type=revision&diff=962824818&oldid=782742135 Template:Infobox prison], [https://en.wikipedia.org/w/index.php?title=Template%3AInfobox_prison%2Fdoc&type=revision&diff=962825435&oldid=768262729 Template:Infobox prison/doc]''
Edit the infobox template (or its sandbox).
Add lines like the following examples to the infobox. Replace numbers ({{kbd|4}}, or {{kbd|97}} to {{kbd|99}}), with the appropriate number based on how many other image or data parameters are already present.
{|style=width:100%
|-
! If placing near the top of infobox !! If placing at/near the bottom of the infobox
|-
|<pre>
| image4 = {{#invoke:Infobox mapframe|auto}}
| caption4 = {{#invoke:Infobox mapframe|autocaption}}
</pre>
|<pre>
| header97 = {{#if:{{{mapframe|}}}|Location}}
| data98 = {{#invoke:Infobox mapframe|auto}}
| data99 = {{#invoke:Infobox mapframe|autocaption}}
</pre>
|}
If the template has a <code><nowiki>{{#invoke:</nowiki>[[Module:Check for unknown parameters|Check for unknown parameters]]<nowiki>}}</nowiki></code>, add the following parameters:
<pre>
| mapframe | mapframe-area_km2 | mapframe-area_mi2 | mapframe-caption | mapframe-coord | mapframe-coordinates | mapframe-custom | mapframe-frame-coord | mapframe-frame-coordinates | mapframe-frame-height | mapframe-frame-width | mapframe-geomask | mapframe-geomask-fill | mapframe-geomask-fill-opacity | mapframe-geomask-stroke-color | mapframe-geomask-stroke-colour | mapframe-geomask-stroke-width | mapframe-height | mapframe-id | mapframe-length_km | mapframe-length_mi | mapframe-marker | mapframe-marker-color | mapframe-marker-colour | mapframe-point | mapframe-shape | mapframe-shape-fill | mapframe-shape-fill-opacity | mapframe-stroke-color | mapframe-stroke-colour | mapframe-stroke-width | mapframe-switcher | mapframe-width | mapframe-wikidata | mapframe-zoom
</pre>
Once this is done, the above parameters will be available to users of the template.
* Defaults values for these parameters can also be specified in the {{kbd|#invoke}} calls above, e.g. <code><nowiki>{{#invoke:Infobox mapframe|auto|mapframe-marker=library}}</nowiki></code> means that the library marker will be used, unless a different value is passed in to the template.
* The maps are off by default, which means maps will not be displayed unless {{para|mapframe|yes}} is present in the template call. To turn maps on by default, in the {{kbd|#invoke}} calls above add {{para|onByDefault|yes}} – which means maps will be displayed unless {{para|mapframe|no}} is present in the template call. {{kbd|onByDefault}} can also be set to a conditional, such as if another parameters is present, e.g. {{para|onByDefault|2=<nowiki>{{#if:{{{pushpin_map|}}}|no|yes}}</nowiki>}}
* Add the new parameters to the document. You can use {{tlx|Infobox mapframe/doc/parameters}}. Specify default values (if any are used in the {{kbd|#invoke}} calls) using by adding parameters in the form {{tt|{{!}}}}''parameter-name''{{tt|{{=}}}}''value''. The default output is shown here collapsed:
{{cot}}
{{Infobox mapframe/doc/parameters}}
{{cob}}
*Parameters can also be added to the TemplateData can also be added by copy-pasting from {{edit|Template:Infobox mapframe/doc/templatedata|Template:Infobox mapframe/doc/templatedata}}
== See also ==
* [[Wikipedia:Mapframe maps in infoboxes]]
* [[Module:Mapframe]] & [[Template:Maplink]]
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<!-- Categories below this line, please; interwikis at Wikidata -->
}}</includeonly>
51cd0f5b193959f102c4be64250d13289a60a5fa
Template:Collapse top
10
164
319
2023-04-07T02:02:13Z
wikipedia>Izno
0
per tech news
wikitext
text/x-wiki
<div style="margin-left:{{{indent|0}}}"><!-- NOTE: width renders incorrectly if added to main STYLE section -->
{| <!-- Template:Collapse top --> class="mw-collapsible mw-archivedtalk {{<includeonly>safesubst:</includeonly>#if:{{{expand|{{{collapse|}}}}}}||mw-collapsed}} {{{class|}}}" style="background: {{{bg1|transparent}}}; text-align: left; border: {{{border|1px}}} solid {{{b-color|Silver}}}; margin: 0.2em auto auto; width:{{<includeonly>safesubst:</includeonly>#if:{{{width|}}}|{{{width}}}|100%}}; clear: {{{clear|both}}}; padding: 1px;"
|-
! style="background: {{{bg|#{{main other|F0F2F5|CCFFCC}}}}}; font-size:87%; padding:0.2em 0.3em; text-align:{{<includeonly>safesubst:</includeonly>#if:{{{left|}}}|left|{{<includeonly>safesubst:</includeonly>#if:{{{align|}}}|left|center}}}}; {{<includeonly>safesubst:</includeonly>#if:{{{fc|}}}|color: {{{fc}}};|}}" | <div style="font-size:115%;{{<includeonly>safesubst:</includeonly>#if:{{{left|}}}||margin:0 4em}}">{{{1|{{{title|{{{reason|{{{header|{{{heading|{{{result|Extended content}}}}}}}}}}}}}}}}}}</div>
{{<includeonly>safesubst:</includeonly>#if:{{{warning|{{{2|}}}}}}
|{{<includeonly>safesubst:</includeonly>!}}-
{{<includeonly>safesubst:</includeonly>!}} style="text-align:center; font-style:italic;" {{<includeonly>safesubst:</includeonly>!}} {{{2|The following is a closed discussion. {{strongbad|Please do not modify it.}} }}} }}
|-
| style="border: solid {{{border2|1px Silver}}}; padding: {{{padding|0.6em}}}; background: {{{bg2|White}}};" {{<includeonly>safesubst:</includeonly>!}}<noinclude>
{{lorem ipsum|3}}
{{Collapse bottom}}
{{Documentation}}
</noinclude>
247cc43d5198baf8804d0926529cbbdd7be91113
Template:Uses TemplateStyles
10
267
526
2023-04-18T22:22:16Z
wikipedia>Grufo
0
Move the preview inside the documentation
wikitext
text/x-wiki
<includeonly>{{#invoke:Uses TemplateStyles|main}}</includeonly><noinclude>{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
60f2fc73c4d69b292455879f9fcb3c68f6c63c2a
Template:Microformat message
10
206
404
2023-04-24T21:58:07Z
wikipedia>GoldRingChip
0
large
wikitext
text/x-wiki
The [[Help:HTML in wikitext|HTML mark-up]] produced by this template includes {{#if:{{{type|}}} |{{{type}}} |an [[{{{format}}} microformat]]}} that makes {{{data}}} readily [[Parsing|parsable]] by computer programs. This aids tasks such as the cataloguing of articles and maintenance of databases. For more information about the use of microformats on Wikipedia, please visit [[Wikipedia:WikiProject Microformats|the Microformat WikiProject]].<!--
-->{{#if:{{{subtemplates<includeonly>|</includeonly>}}}
| <div style="margin-top:0.5em;margin-bottom:0.65em;">
; {{large|Subtemplates}}
{{{subtemplates}}}
'''''Please do not remove instances of these subtemplates.'''''
</div>}}<!--
-->{{#if:{{{subsection1|}}}
| <div style="margin-top:0.5em;margin-bottom:0.65em;"><!--(newline in case subsection begins with heading:)-->
{{{subsection1}}}
</div>}}<!--
-->{{#if:{{{1<includeonly>|</includeonly>}}} <!--(i.e. if at least one unnamed parameter supplied:)-->
| <div style="margin-top:0.5em;margin-bottom:0.65em;">
; {{large|Classes used}}
The [[HTML attribute|HTML class]]es of this microformat include:
: {{hlist
|item_style=font-size:110%;{{{itemstyle|}}}
|{{{1}}} |{{{2<includeonly>|</includeonly>}}} |{{{3|<noinclude>{{nobold|……}}</noinclude>}}}
|{{{4|}}} |{{{5|}}} |{{{6|}}} |{{{7|}}} |{{{8|}}} |{{{9|}}} |{{{10|}}} |{{{11|}}} |{{{12|}}} |{{{13|}}} |{{{14|}}} |{{{15|}}} |{{{16|}}} |{{{17|}}} |{{{18|}}} |{{{19|}}} |{{{20|}}}
}} </div>
{{longitem|style=line-height:1.3em|'''''Please do not rename or remove these classes{{#if:{{{nocollapse<includeonly>|</includeonly>}}} |<br/>nor collapse nested elements which use them}}.'''''}}<!--
-->}}<!--(end #if:[1])--><noinclude>
{{Documentation}}
</noinclude>
25d8c54d56c1c64f1b98e6c8b2a50054e6a9deb5
Template:Documentation subpage
10
121
233
2023-04-29T17:27:17Z
wikipedia>Paine Ellsworth
0
m
wikitext
text/x-wiki
<includeonly><!--
-->{{#ifeq:{{lc:{{SUBPAGENAME}}}} |{{{override|doc}}}
| <!--(this template has been transcluded on a /doc or /{{{override}}} page)-->
</includeonly><!--
-->{{#ifeq:{{{doc-notice|show}}} |show
| {{Mbox
| type = notice
| style = margin-bottom:1.0em;
| image = [[File:Edit-copy green.svg|40px|alt=|link=]]
| text =
{{strong|This is a [[Wikipedia:Template documentation|documentation]] [[Wikipedia:Subpages|subpage]]}} for {{terminate sentence|{{{1|[[:{{SUBJECTSPACE}}:{{BASEPAGENAME}}]]}}}}}<br />It may contain usage information, [[Wikipedia:Categorization|categories]] and other content that is not part of the original {{#if:{{{text2|}}} |{{{text2}}} |{{#if:{{{text1|}}} |{{{text1}}} |{{#ifeq:{{SUBJECTSPACE}} |{{ns:User}} |{{lc:{{SUBJECTSPACE}}}} template page |{{#if:{{SUBJECTSPACE}} |{{lc:{{SUBJECTSPACE}}}} page|article}}}}}}}}.
}}
}}<!--
-->{{DEFAULTSORT:{{{defaultsort|{{PAGENAME}}}}}}}<!--
-->{{#if:{{{inhibit|}}} |<!--(don't categorize)-->
| <includeonly><!--
-->{{#ifexist:{{NAMESPACE}}:{{BASEPAGENAME}}
| [[Category:{{#switch:{{SUBJECTSPACE}} |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
| [[Category:Documentation subpages without corresponding pages]]
}}<!--
--></includeonly>
}}<!--
(completing initial #ifeq: at start of template:)
--><includeonly>
| <!--(this template has not been transcluded on a /doc or /{{{override}}} page)-->
}}<!--
--></includeonly><noinclude>{{Documentation}}</noinclude>
41ca90af0945442788a2dbd08c8c54a61a23c057
Module:Political party
828
226
444
2023-05-07T14:19:00Z
wikipedia>Primefac
0
Undid revision 1153505214 by [[Special:Contributions/R'n'B|R'n'B]] ([[User talk:R'n'B|talk]]) this is already in the /I module as an alternate name?
Scribunto
text/plain
local p = {}
local default_color = '#F8F9FA'
local categories = {
party_not_in_list = '[[Category:Pages using Political party with unknown party]]',
shortname_not_in_list = '[[Category:Pages using Political party with missing shortname]]',
color_not_in_list = '[[Category:Pages using Political party with missing color]]',
}
local function create_error(error_message)
return string.format('<strong class="error">%s</strong>', error_message)
end
local function getFirstLetter(party)
local index = mw.ustring.sub(party, 1, 1)
-- Set index for non-A-Z starts
if string.match(index, '%A') then
return '1'
end
return string.upper(index)
end
local function stripToNil(text)
-- If text is a string, return its trimmed content, or nil if empty.
-- Otherwise return text (which may, for example, be nil).
if type(text) == 'string' then
text = text:match('(%S.-)%s*$')
local delink = require('Module:Delink')._delink
text = delink({text, wikilinks = "target"})
end
return text
end
-- Example of having all the data - color and names - in one table. Requires one page to be edited instead of two when adding a new party.
function p._fetch(args)
if not args[1] then
return create_error("parameter 1 should be a party name.")
end
if not args[2] then
return create_error("parameter 2 should be the output type.")
end
local party = stripToNil(args[1])
local out_type = stripToNil(args[2])
if out_type == 'colour' then
out_type = 'color'
end
local index = getFirstLetter(party)
-- Load data from submodule
local data = mw.loadData('Module:Political party/' .. index)
local data_all = data.full
local party_alt = data.alternate[party]
local party_info
if party_alt then
if data_all[party_alt] then
party_info = data_all[party_alt]
else
index = getFirstLetter(party_alt)
data = mw.loadData('Module:Political party/' .. index)
party_info = data.full[party_alt]
end
else
party_info = data_all[party]
end
-- Check if database value exists
-- * Not even in database - return given error or input
-- * No color - return error
-- * No shortname/abbrev - return first non-blank of abbrev->shortname->input
if not party_info then
if out_type == 'color' then
return args.error or default_color
else
return args.error or party
end
end
local return_value = party_info[out_type]
if return_value == "" then
if out_type == 'color' then
return args.error or create_error("Value not in template. Please request that it be added.")
elseif out_type == 'abbrev' then
if party_info.shortname ~= "" then
return party_info.shortname
else
return party
end
elseif out_type == 'shortname' then
if party_info.abbrev ~= "" then
return party_info.abbrev
else
return party
end
else
return party
end
end
if out_type == 'color' and string.find(return_value, '#') then
return_value = string.gsub(return_value, '#', '#')
end
return return_value
end
function p.fetch(frame)
-- Initialise and populate variables
local getArgs = require("Module:Arguments").getArgs
local args = getArgs(frame)
return p._fetch(args)
end
return p
5619f7c33e00168878164325d0fcb8600faa2446
Module:Protection banner/config
828
107
205
2023-05-08T11:41:01Z
wikipedia>Fayenatic london
0
Update categories from "fully-protected" to "fully protected", removing hyphen, per valid request at [[WP:CFDS]]
Scribunto
text/plain
-- This module provides configuration data for [[Module:Protection banner]].
return {
--------------------------------------------------------------------------------
--
-- BANNER DATA
--
--------------------------------------------------------------------------------
--[[
-- Banner data consists of six fields:
-- * text - the main protection text that appears at the top of protection
-- banners.
-- * explanation - the text that appears below the main protection text, used
-- to explain the details of the protection.
-- * tooltip - the tooltip text you see when you move the mouse over a small
-- padlock icon.
-- * link - the page that the small padlock icon links to.
-- * alt - the alt text for the small padlock icon. This is also used as tooltip
-- text for the large protection banners.
-- * image - the padlock image used in both protection banners and small padlock
-- icons.
--
-- The module checks in three separate tables to find a value for each field.
-- First it checks the banners table, which has values specific to the reason
-- for the page being protected. Then the module checks the defaultBanners
-- table, which has values specific to each protection level. Finally, the
-- module checks the masterBanner table, which holds data for protection
-- templates to use if no data has been found in the previous two tables.
--
-- The values in the banner data can take parameters. These are specified
-- using ${TEXTLIKETHIS} (a dollar sign preceding a parameter name
-- enclosed in curly braces).
--
-- Available parameters:
--
-- ${CURRENTVERSION} - a link to the page history or the move log, with the
-- display message "current-version-edit-display" or
-- "current-version-move-display".
--
-- ${EDITREQUEST} - a link to create an edit request for the current page.
--
-- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes
-- on the talk page; you may submit a request to ask an administrator to make
-- an edit if it is minor or supported by consensus."
--
-- ${IMAGELINK} - a link to set the image to, depending on the protection
-- action and protection level.
--
-- ${INTROBLURB} - the PROTECTIONBLURB parameter, plus the expiry if an expiry
-- is set. E.g. "Editing of this page by new or unregistered users is currently
-- disabled until dd Month YYYY."
--
-- ${INTROFRAGMENT} - the same as ${INTROBLURB}, but without final punctuation
-- so that it can be used in run-on sentences.
--
-- ${PAGETYPE} - the type of the page, e.g. "article" or "template".
-- Defined in the cfg.pagetypes table.
--
-- ${PROTECTIONBLURB} - a blurb explaining the protection level of the page, e.g.
-- "Editing of this page by new or unregistered users is currently disabled"
--
-- ${PROTECTIONDATE} - the protection date, if it has been supplied to the
-- template.
--
-- ${PROTECTIONLEVEL} - the protection level, e.g. "fully protected" or
-- "semi-protected".
--
-- ${PROTECTIONLOG} - a link to the protection log or the pending changes log,
-- depending on the protection action.
--
-- ${TALKPAGE} - a link to the talk page. If a section is specified, links
-- straight to that talk page section.
--
-- ${TOOLTIPBLURB} - uses the PAGETYPE, PROTECTIONTYPE and EXPIRY parameters to
-- create a blurb like "This template is semi-protected", or "This article is
-- move-protected until DD Month YYYY".
--
-- ${VANDAL} - links for the specified username (or the root page name)
-- using Module:Vandal-m.
--
-- Functions
--
-- For advanced users, it is possible to use Lua functions instead of strings
-- in the banner config tables. Using functions gives flexibility that is not
-- possible just by using parameters. Functions take two arguments, the
-- protection object and the template arguments, and they must output a string.
--
-- For example:
--
-- text = function (protectionObj, args)
-- if protectionObj.level == 'autoconfirmed' then
-- return 'foo'
-- else
-- return 'bar'
-- end
-- end
--
-- Some protection object properties and methods that may be useful:
-- protectionObj.action - the protection action
-- protectionObj.level - the protection level
-- protectionObj.reason - the protection reason
-- protectionObj.expiry - the expiry. Nil if unset, the string "indef" if set
-- to indefinite, and the protection time in unix time if temporary.
-- protectionObj.protectionDate - the protection date in unix time, or nil if
-- unspecified.
-- protectionObj.bannerConfig - the banner config found by the module. Beware
-- of editing the config field used by the function, as it could create an
-- infinite loop.
-- protectionObj:isProtected - returns a boolean showing whether the page is
-- protected.
-- protectionObj:isTemporary - returns a boolean showing whether the expiry is
-- temporary.
-- protectionObj:isIncorrect - returns a boolean showing whether the protection
-- template is incorrect.
--]]
-- The master banner data, used if no values have been found in banners or
-- defaultBanners.
masterBanner = {
text = '${INTROBLURB}',
explanation = '${EXPLANATIONBLURB}',
tooltip = '${TOOLTIPBLURB}',
link = '${IMAGELINK}',
alt = 'Page ${PROTECTIONLEVEL}'
},
-- The default banner data. This holds banner data for different protection
-- levels.
-- *required* - this table needs edit, move, autoreview and upload subtables.
defaultBanners = {
edit = {},
move = {},
autoreview = {
default = {
alt = 'Page protected with pending changes',
tooltip = 'All edits by unregistered and new users are subject to review prior to becoming visible to unregistered users',
image = 'Pending-protection-shackle.svg'
}
},
upload = {}
},
-- The banner data. This holds banner data for different protection reasons.
-- In fact, the reasons specified in this table control which reasons are
-- valid inputs to the first positional parameter.
--
-- There is also a non-standard "description" field that can be used for items
-- in this table. This is a description of the protection reason for use in the
-- module documentation.
--
-- *required* - this table needs edit, move, autoreview and upload subtables.
banners = {
edit = {
blp = {
description = 'For pages protected to promote compliance with the'
.. ' [[Wikipedia:Biographies of living persons'
.. '|biographies of living persons]] policy',
text = '${INTROFRAGMENT} to promote compliance with'
.. ' [[Wikipedia:Biographies of living persons'
.. "|Wikipedia's policy on the biographies"
.. ' of living people]].',
tooltip = '${TOOLTIPFRAGMENT} to promote compliance with the policy on'
.. ' biographies of living persons',
},
dmca = {
description = 'For pages protected by the Wikimedia Foundation'
.. ' due to [[Digital Millennium Copyright Act]] takedown requests',
explanation = function (protectionObj, args)
local ret = 'Pursuant to a rights owner notice under the Digital'
.. ' Millennium Copyright Act (DMCA) regarding some content'
.. ' in this article, the Wikimedia Foundation acted under'
.. ' applicable law and took down and restricted the content'
.. ' in question.'
if args.notice then
ret = ret .. ' A copy of the received notice can be found here: '
.. args.notice .. '.'
end
ret = ret .. ' For more information, including websites discussing'
.. ' how to file a counter-notice, please see'
.. " [[Wikipedia:Office actions]] and the article's ${TALKPAGE}."
.. "'''Do not remove this template from the article until the"
.. " restrictions are withdrawn'''."
return ret
end,
image = 'Office-protection-shackle.svg',
},
dispute = {
description = 'For pages protected due to editing disputes',
text = function (protectionObj, args)
-- Find the value of "disputes".
local display = 'disputes'
local disputes
if args.section then
disputes = string.format(
'[[%s:%s#%s|%s]]',
mw.site.namespaces[protectionObj.title.namespace].talk.name,
protectionObj.title.text,
args.section,
display
)
else
disputes = display
end
-- Make the blurb, depending on the expiry.
local msg
if type(protectionObj.expiry) == 'number' then
msg = '${INTROFRAGMENT} or until editing %s have been resolved.'
else
msg = '${INTROFRAGMENT} until editing %s have been resolved.'
end
return string.format(msg, disputes)
end,
explanation = "This protection is '''not''' an endorsement of the"
.. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}',
tooltip = '${TOOLTIPFRAGMENT} due to editing disputes',
},
ecp = {
description = 'For articles in topic areas authorized by'
.. ' [[Wikipedia:Arbitration Committee|ArbCom]] or'
.. ' meets the criteria for community use',
tooltip = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}',
alt = 'Extended-protected ${PAGETYPE}',
},
mainpage = {
description = 'For pages protected for being displayed on the [[Main Page]]',
text = 'This file is currently'
.. ' [[Wikipedia:This page is protected|protected]] from'
.. ' editing because it is currently or will soon be displayed'
.. ' on the [[Main Page]].',
explanation = 'Images on the Main Page are protected due to their high'
.. ' visibility. Please discuss any necessary changes on the ${TALKPAGE}.'
.. '<br /><span style="font-size:90%;">'
.. "'''Administrators:''' Once this image is definitely off the Main Page,"
.. ' please unprotect this file, or reduce to semi-protection,'
.. ' as appropriate.</span>',
},
office = {
description = 'For pages protected by the Wikimedia Foundation',
text = function (protectionObj, args)
local ret = 'This ${PAGETYPE} is currently under the'
.. ' scrutiny of the'
.. ' [[Wikipedia:Office actions|Wikimedia Foundation Office]]'
.. ' and is protected.'
if protectionObj.protectionDate then
ret = ret .. ' It has been protected since ${PROTECTIONDATE}.'
end
return ret
end,
explanation = "If you can edit this page, please discuss all changes and"
.. " additions on the ${TALKPAGE} first. '''Do not remove protection from this"
.. " page unless you are authorized by the Wikimedia Foundation to do"
.. " so.'''",
image = 'Office-protection-shackle.svg',
},
reset = {
description = 'For pages protected by the Wikimedia Foundation and'
.. ' "reset" to a bare-bones version',
text = 'This ${PAGETYPE} is currently under the'
.. ' scrutiny of the'
.. ' [[Wikipedia:Office actions|Wikimedia Foundation Office]]'
.. ' and is protected.',
explanation = function (protectionObj, args)
local ret = ''
if protectionObj.protectionDate then
ret = ret .. 'On ${PROTECTIONDATE} this ${PAGETYPE} was'
else
ret = ret .. 'This ${PAGETYPE} has been'
end
ret = ret .. ' reduced to a'
.. ' simplified, "bare bones" version so that it may be completely'
.. ' rewritten to ensure it meets the policies of'
.. ' [[WP:NPOV|Neutral Point of View]] and [[WP:V|Verifiability]].'
.. ' Standard Wikipedia policies will apply to its rewriting—which'
.. ' will eventually be open to all editors—and will be strictly'
.. ' enforced. The ${PAGETYPE} has been ${PROTECTIONLEVEL} while'
.. ' it is being rebuilt.\n\n'
.. 'Any insertion of material directly from'
.. ' pre-protection revisions of the ${PAGETYPE} will be removed, as'
.. ' will any material added to the ${PAGETYPE} that is not properly'
.. ' sourced. The associated talk page(s) were also cleared on the'
.. " same date.\n\n"
.. "If you can edit this page, please discuss all changes and"
.. " additions on the ${TALKPAGE} first. '''Do not override"
.. " this action, and do not remove protection from this page,"
.. " unless you are authorized by the Wikimedia Foundation"
.. " to do so. No editor may remove this notice.'''"
return ret
end,
image = 'Office-protection-shackle.svg',
},
sock = {
description = 'For pages protected due to'
.. ' [[Wikipedia:Sock puppetry|sock puppetry]]',
text = '${INTROFRAGMENT} to prevent [[Wikipedia:Sock puppetry|sock puppets]] of'
.. ' [[Wikipedia:Blocking policy|blocked]] or'
.. ' [[Wikipedia:Banning policy|banned users]]'
.. ' from editing it.',
tooltip = '${TOOLTIPFRAGMENT} to prevent sock puppets of blocked or banned users from'
.. ' editing it',
},
template = {
description = 'For [[Wikipedia:High-risk templates|high-risk]]'
.. ' templates and Lua modules',
text = 'This is a permanently [[Help:Protection|protected]] ${PAGETYPE},'
.. ' as it is [[Wikipedia:High-risk templates|high-risk]].',
explanation = 'Please discuss any changes on the ${TALKPAGE}; you may'
.. ' ${EDITREQUEST} to ask an'
.. ' [[Wikipedia:Administrators|administrator]] or'
.. ' [[Wikipedia:Template editor|template editor]] to make an edit if'
.. ' it is [[Help:Minor edit#When to mark an edit as a minor edit'
.. '|uncontroversial]] or supported by'
.. ' [[Wikipedia:Consensus|consensus]]. You can also'
.. ' [[Wikipedia:Requests for page protection|request]] that the page be'
.. ' unprotected.',
tooltip = 'This high-risk ${PAGETYPE} is permanently ${PROTECTIONLEVEL}'
.. ' to prevent vandalism',
alt = 'Permanently protected ${PAGETYPE}',
},
usertalk = {
description = 'For pages protected against disruptive edits by a'
.. ' particular user',
text = '${INTROFRAGMENT} to prevent ${VANDAL} from using it to make disruptive edits,'
.. ' such as abusing the'
.. ' {{[[Template:unblock|unblock]]}} template.',
explanation = 'If you cannot edit this user talk page and you need to'
.. ' make a change or leave a message, you can'
.. ' [[Wikipedia:Requests for page protection'
.. '#Current requests for edits to a protected page'
.. '|request an edit]],'
.. ' [[Wikipedia:Requests for page protection'
.. '#Current requests for reduction in protection level'
.. '|request unprotection]],'
.. ' [[Special:Userlogin|log in]],'
.. ' or [[Special:UserLogin/signup|create an account]].',
},
vandalism = {
description = 'For pages protected against'
.. ' [[Wikipedia:Vandalism|vandalism]]',
text = '${INTROFRAGMENT} due to [[Wikipedia:Vandalism|vandalism]].',
explanation = function (protectionObj, args)
local ret = ''
if protectionObj.level == 'sysop' then
ret = ret .. "This protection is '''not''' an endorsement of the"
.. ' ${CURRENTVERSION}. '
end
return ret .. '${EXPLANATIONBLURB}'
end,
tooltip = '${TOOLTIPFRAGMENT} due to vandalism',
}
},
move = {
dispute = {
description = 'For pages protected against page moves due to'
.. ' disputes over the page title',
explanation = "This protection is '''not''' an endorsement of the"
.. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}',
image = 'Move-protection-shackle.svg'
},
vandalism = {
description = 'For pages protected against'
.. ' [[Wikipedia:Vandalism#Page-move vandalism'
.. ' |page-move vandalism]]'
}
},
autoreview = {},
upload = {}
},
--------------------------------------------------------------------------------
--
-- GENERAL DATA TABLES
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Protection blurbs
--------------------------------------------------------------------------------
-- This table produces the protection blurbs available with the
-- ${PROTECTIONBLURB} parameter. It is sorted by protection action and
-- protection level, and is checked by the module in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
protectionBlurbs = {
edit = {
default = 'This ${PAGETYPE} is currently [[Help:Protection|'
.. 'protected]] from editing',
autoconfirmed = 'Editing of this ${PAGETYPE} by [[Wikipedia:User access'
.. ' levels#New users|new]] or [[Wikipedia:User access levels#Unregistered'
.. ' users|unregistered]] users is currently [[Help:Protection|disabled]]',
extendedconfirmed = 'This ${PAGETYPE} is currently under extended confirmed protection',
},
move = {
default = 'This ${PAGETYPE} is currently [[Help:Protection|protected]]'
.. ' from [[Help:Moving a page|page moves]]'
},
autoreview = {
default = 'All edits made to this ${PAGETYPE} by'
.. ' [[Wikipedia:User access levels#New users|new]] or'
.. ' [[Wikipedia:User access levels#Unregistered users|unregistered]]'
.. ' users are currently'
.. ' [[Wikipedia:Pending changes|subject to review]]'
},
upload = {
default = 'Uploading new versions of this ${PAGETYPE} is currently disabled'
}
},
--------------------------------------------------------------------------------
-- Explanation blurbs
--------------------------------------------------------------------------------
-- This table produces the explanation blurbs available with the
-- ${EXPLANATIONBLURB} parameter. It is sorted by protection action,
-- protection level, and whether the page is a talk page or not. If the page is
-- a talk page it will have a talk key of "talk"; otherwise it will have a talk
-- key of "subject". The table is checked in the following order:
-- 1. page's protection action, page's protection level, page's talk key
-- 2. page's protection action, page's protection level, default talk key
-- 3. page's protection action, default protection level, page's talk key
-- 4. page's protection action, default protection level, default talk key
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
explanationBlurbs = {
edit = {
autoconfirmed = {
subject = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details. If you'
.. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can'
.. ' ${EDITREQUEST}, discuss changes on the ${TALKPAGE},'
.. ' [[Wikipedia:Requests for page protection'
.. '#Current requests for reduction in protection level'
.. '|request unprotection]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].',
default = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details. If you'
.. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can'
.. ' [[Wikipedia:Requests for page protection'
.. '#Current requests for reduction in protection level'
.. '|request unprotection]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].',
},
extendedconfirmed = {
default = 'Extended confirmed protection prevents edits from all unregistered editors'
.. ' and registered users with fewer than 30 days tenure and 500 edits.'
.. ' The [[Wikipedia:Protection policy#extended|policy on community use]]'
.. ' specifies that extended confirmed protection can be applied to combat'
.. ' disruption, if semi-protection has proven to be ineffective.'
.. ' Extended confirmed protection may also be applied to enforce'
.. ' [[Wikipedia:Arbitration Committee|arbitration sanctions]].'
.. ' Please discuss any changes on the ${TALKPAGE}; you may'
.. ' ${EDITREQUEST} to ask for uncontroversial changes supported by'
.. ' [[Wikipedia:Consensus|consensus]].'
},
default = {
subject = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Please discuss any changes on the ${TALKPAGE}; you'
.. ' may ${EDITREQUEST} to ask an'
.. ' [[Wikipedia:Administrators|administrator]] to make an edit if it'
.. ' is [[Help:Minor edit#When to mark an edit as a minor edit'
.. '|uncontroversial]] or supported by [[Wikipedia:Consensus'
.. '|consensus]]. You may also [[Wikipedia:Requests for'
.. ' page protection#Current requests for reduction in protection level'
.. '|request]] that this page be unprotected.',
default = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' You may [[Wikipedia:Requests for page'
.. ' protection#Current requests for edits to a protected page|request an'
.. ' edit]] to this page, or [[Wikipedia:Requests for'
.. ' page protection#Current requests for reduction in protection level'
.. '|ask]] for it to be unprotected.'
}
},
move = {
default = {
subject = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' The page may still be edited but cannot be moved'
.. ' until unprotected. Please discuss any suggested moves on the'
.. ' ${TALKPAGE} or at [[Wikipedia:Requested moves]]. You can also'
.. ' [[Wikipedia:Requests for page protection|request]] that the page be'
.. ' unprotected.',
default = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' The page may still be edited but cannot be moved'
.. ' until unprotected. Please discuss any suggested moves at'
.. ' [[Wikipedia:Requested moves]]. You can also'
.. ' [[Wikipedia:Requests for page protection|request]] that the page be'
.. ' unprotected.'
}
},
autoreview = {
default = {
default = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Edits to this ${PAGETYPE} by new and unregistered users'
.. ' will not be visible to readers until they are accepted by'
.. ' a reviewer. To avoid the need for your edits to be'
.. ' reviewed, you may'
.. ' [[Wikipedia:Requests for page protection'
.. '#Current requests for reduction in protection level'
.. '|request unprotection]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].'
},
},
upload = {
default = {
default = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' The page may still be edited but new versions of the file'
.. ' cannot be uploaded until it is unprotected. You can'
.. ' request that a new version be uploaded by using a'
.. ' [[Wikipedia:Edit requests|protected edit request]], or you'
.. ' can [[Wikipedia:Requests for page protection|request]]'
.. ' that the file be unprotected.'
}
}
},
--------------------------------------------------------------------------------
-- Protection levels
--------------------------------------------------------------------------------
-- This table provides the data for the ${PROTECTIONLEVEL} parameter, which
-- produces a short label for different protection levels. It is sorted by
-- protection action and protection level, and is checked in the following
-- order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
protectionLevels = {
edit = {
default = 'protected',
templateeditor = 'template-protected',
extendedconfirmed = 'extended-protected',
autoconfirmed = 'semi-protected',
},
move = {
default = 'move-protected'
},
autoreview = {
},
upload = {
default = 'upload-protected'
}
},
--------------------------------------------------------------------------------
-- Images
--------------------------------------------------------------------------------
-- This table lists different padlock images for each protection action and
-- protection level. It is used if an image is not specified in any of the
-- banner data tables, and if the page does not satisfy the conditions for using
-- the ['image-filename-indef'] image. It is checked in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
images = {
edit = {
default = 'Full-protection-shackle.svg',
templateeditor = 'Template-protection-shackle.svg',
extendedconfirmed = 'Extended-protection-shackle.svg',
autoconfirmed = 'Semi-protection-shackle.svg'
},
move = {
default = 'Move-protection-shackle.svg',
},
autoreview = {
default = 'Pending-protection-shackle.svg'
},
upload = {
default = 'Upload-protection-shackle.svg'
}
},
-- Pages with a reason specified in this table will show the special "indef"
-- padlock, defined in the 'image-filename-indef' message, if no expiry is set.
indefImageReasons = {
template = true
},
--------------------------------------------------------------------------------
-- Image links
--------------------------------------------------------------------------------
-- This table provides the data for the ${IMAGELINK} parameter, which gets
-- the image link for small padlock icons based on the page's protection action
-- and protection level. It is checked in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
imageLinks = {
edit = {
default = 'Wikipedia:Protection policy#full',
templateeditor = 'Wikipedia:Protection policy#template',
extendedconfirmed = 'Wikipedia:Protection policy#extended',
autoconfirmed = 'Wikipedia:Protection policy#semi'
},
move = {
default = 'Wikipedia:Protection policy#move'
},
autoreview = {
default = 'Wikipedia:Protection policy#pending'
},
upload = {
default = 'Wikipedia:Protection policy#upload'
}
},
--------------------------------------------------------------------------------
-- Padlock indicator names
--------------------------------------------------------------------------------
-- This table provides the "name" attribute for the <indicator> extension tag
-- with which small padlock icons are generated. All indicator tags on a page
-- are displayed in alphabetical order based on this attribute, and with
-- indicator tags with duplicate names, the last tag on the page wins.
-- The attribute is chosen based on the protection action; table keys must be a
-- protection action name or the string "default".
padlockIndicatorNames = {
autoreview = 'pp-autoreview',
default = 'pp-default'
},
--------------------------------------------------------------------------------
-- Protection categories
--------------------------------------------------------------------------------
--[[
-- The protection categories are stored in the protectionCategories table.
-- Keys to this table are made up of the following strings:
--
-- 1. the expiry date
-- 2. the namespace
-- 3. the protection reason (e.g. "dispute" or "vandalism")
-- 4. the protection level (e.g. "sysop" or "autoconfirmed")
-- 5. the action (e.g. "edit" or "move")
--
-- When the module looks up a category in the table, first it will will check to
-- see a key exists that corresponds to all five parameters. For example, a
-- user page semi-protected from vandalism for two weeks would have the key
-- "temp-user-vandalism-autoconfirmed-edit". If no match is found, the module
-- changes the first part of the key to "all" and checks the table again. It
-- keeps checking increasingly generic key combinations until it finds the
-- field, or until it reaches the key "all-all-all-all-all".
--
-- The module uses a binary matrix to determine the order in which to search.
-- This is best demonstrated by a table. In this table, the "0" values
-- represent "all", and the "1" values represent the original data (e.g.
-- "indef" or "file" or "vandalism").
--
-- expiry namespace reason level action
-- order
-- 1 1 1 1 1 1
-- 2 0 1 1 1 1
-- 3 1 0 1 1 1
-- 4 0 0 1 1 1
-- 5 1 1 0 1 1
-- 6 0 1 0 1 1
-- 7 1 0 0 1 1
-- 8 0 0 0 1 1
-- 9 1 1 1 0 1
-- 10 0 1 1 0 1
-- 11 1 0 1 0 1
-- 12 0 0 1 0 1
-- 13 1 1 0 0 1
-- 14 0 1 0 0 1
-- 15 1 0 0 0 1
-- 16 0 0 0 0 1
-- 17 1 1 1 1 0
-- 18 0 1 1 1 0
-- 19 1 0 1 1 0
-- 20 0 0 1 1 0
-- 21 1 1 0 1 0
-- 22 0 1 0 1 0
-- 23 1 0 0 1 0
-- 24 0 0 0 1 0
-- 25 1 1 1 0 0
-- 26 0 1 1 0 0
-- 27 1 0 1 0 0
-- 28 0 0 1 0 0
-- 29 1 1 0 0 0
-- 30 0 1 0 0 0
-- 31 1 0 0 0 0
-- 32 0 0 0 0 0
--
-- In this scheme the action has the highest priority, as it is the last
-- to change, and the expiry has the least priority, as it changes the most.
-- The priorities of the expiry, the protection level and the action are
-- fixed, but the priorities of the reason and the namespace can be swapped
-- through the use of the cfg.bannerDataNamespaceHasPriority table.
--]]
-- If the reason specified to the template is listed in this table,
-- namespace data will take priority over reason data in the protectionCategories
-- table.
reasonsWithNamespacePriority = {
vandalism = true,
},
-- The string to use as a namespace key for the protectionCategories table for each
-- namespace number.
categoryNamespaceKeys = {
[ 2] = 'user',
[ 3] = 'user',
[ 4] = 'project',
[ 6] = 'file',
[ 8] = 'mediawiki',
[ 10] = 'template',
[ 12] = 'project',
[ 14] = 'category',
[100] = 'portal',
[828] = 'module',
},
protectionCategories = {
['all|all|all|all|all'] = 'Wikipedia fully protected pages',
['all|all|office|all|all'] = 'Wikipedia Office-protected pages',
['all|all|reset|all|all'] = 'Wikipedia Office-protected pages',
['all|all|dmca|all|all'] = 'Wikipedia Office-protected pages',
['all|all|mainpage|all|all'] = 'Wikipedia fully protected main page files',
['all|all|all|extendedconfirmed|all'] = 'Wikipedia extended-confirmed-protected pages',
['all|all|ecp|extendedconfirmed|all'] = 'Wikipedia extended-confirmed-protected pages',
['all|template|all|all|edit'] = 'Wikipedia fully protected templates',
['all|all|all|autoconfirmed|edit'] = 'Wikipedia semi-protected pages',
['indef|all|all|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected pages',
['all|all|blp|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected biographies of living people',
['temp|all|blp|autoconfirmed|edit'] = 'Wikipedia temporarily semi-protected biographies of living people',
['all|all|dispute|autoconfirmed|edit'] = 'Wikipedia pages semi-protected due to dispute',
['all|all|sock|autoconfirmed|edit'] = 'Wikipedia pages semi-protected from banned users',
['all|all|vandalism|autoconfirmed|edit'] = 'Wikipedia pages semi-protected against vandalism',
['all|category|all|autoconfirmed|edit'] = 'Wikipedia semi-protected categories',
['all|file|all|autoconfirmed|edit'] = 'Wikipedia semi-protected files',
['all|portal|all|autoconfirmed|edit'] = 'Wikipedia semi-protected portals',
['all|project|all|autoconfirmed|edit'] = 'Wikipedia semi-protected project pages',
['all|talk|all|autoconfirmed|edit'] = 'Wikipedia semi-protected talk pages',
['all|template|all|autoconfirmed|edit'] = 'Wikipedia semi-protected templates',
['all|user|all|autoconfirmed|edit'] = 'Wikipedia semi-protected user and user talk pages',
['all|all|all|templateeditor|edit'] = 'Wikipedia template-protected pages other than templates and modules',
['all|template|all|templateeditor|edit'] = 'Wikipedia template-protected templates',
['all|template|all|templateeditor|move'] = 'Wikipedia template-protected templates', -- move-protected templates
['all|all|blp|sysop|edit'] = 'Wikipedia indefinitely protected biographies of living people',
['temp|all|blp|sysop|edit'] = 'Wikipedia temporarily protected biographies of living people',
['all|all|dispute|sysop|edit'] = 'Wikipedia pages protected due to dispute',
['all|all|sock|sysop|edit'] = 'Wikipedia pages protected from banned users',
['all|all|vandalism|sysop|edit'] = 'Wikipedia pages protected against vandalism',
['all|category|all|sysop|edit'] = 'Wikipedia fully protected categories',
['all|file|all|sysop|edit'] = 'Wikipedia fully protected files',
['all|project|all|sysop|edit'] = 'Wikipedia fully protected project pages',
['all|talk|all|sysop|edit'] = 'Wikipedia fully protected talk pages',
['all|template|all|extendedconfirmed|edit'] = 'Wikipedia extended-confirmed-protected templates',
['all|template|all|sysop|edit'] = 'Wikipedia fully protected templates',
['all|user|all|sysop|edit'] = 'Wikipedia fully protected user and user talk pages',
['all|module|all|all|edit'] = 'Wikipedia fully protected modules',
['all|module|all|templateeditor|edit'] = 'Wikipedia template-protected modules',
['all|module|all|extendedconfirmed|edit'] = 'Wikipedia extended-confirmed-protected modules',
['all|module|all|autoconfirmed|edit'] = 'Wikipedia semi-protected modules',
['all|all|all|sysop|move'] = 'Wikipedia move-protected pages',
['indef|all|all|sysop|move'] = 'Wikipedia indefinitely move-protected pages',
['all|all|dispute|sysop|move'] = 'Wikipedia pages move-protected due to dispute',
['all|all|vandalism|sysop|move'] = 'Wikipedia pages move-protected due to vandalism',
['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals',
['all|project|all|sysop|move'] = 'Wikipedia move-protected project pages',
['all|talk|all|sysop|move'] = 'Wikipedia move-protected talk pages',
['all|template|all|sysop|move'] = 'Wikipedia move-protected templates',
['all|user|all|sysop|move'] = 'Wikipedia move-protected user and user talk pages',
['all|all|all|autoconfirmed|autoreview'] = 'Wikipedia pending changes protected pages',
['all|file|all|all|upload'] = 'Wikipedia upload-protected files',
},
--------------------------------------------------------------------------------
-- Expiry category config
--------------------------------------------------------------------------------
-- This table configures the expiry category behaviour for each protection
-- action.
-- * If set to true, setting that action will always categorise the page if
-- an expiry parameter is not set.
-- * If set to false, setting that action will never categorise the page.
-- * If set to nil, the module will categorise the page if:
-- 1) an expiry parameter is not set, and
-- 2) a reason is provided, and
-- 3) the specified reason is not blacklisted in the reasonsWithoutExpiryCheck
-- table.
expiryCheckActions = {
edit = nil,
move = false,
autoreview = true,
upload = false
},
reasonsWithoutExpiryCheck = {
blp = true,
template = true,
},
--------------------------------------------------------------------------------
-- Pagetypes
--------------------------------------------------------------------------------
-- This table produces the page types available with the ${PAGETYPE} parameter.
-- Keys are namespace numbers, or the string "default" for the default value.
pagetypes = {
[0] = 'article',
[6] = 'file',
[10] = 'template',
[14] = 'category',
[828] = 'module',
default = 'page'
},
--------------------------------------------------------------------------------
-- Strings marking indefinite protection
--------------------------------------------------------------------------------
-- This table contains values passed to the expiry parameter that mean the page
-- is protected indefinitely.
indefStrings = {
['indef'] = true,
['indefinite'] = true,
['indefinitely'] = true,
['infinite'] = true,
},
--------------------------------------------------------------------------------
-- Group hierarchy
--------------------------------------------------------------------------------
-- This table maps each group to all groups that have a superset of the original
-- group's page editing permissions.
hierarchy = {
sysop = {},
reviewer = {'sysop'},
filemover = {'sysop'},
templateeditor = {'sysop'},
extendedconfirmed = {'sysop'},
autoconfirmed = {'reviewer', 'filemover', 'templateeditor', 'extendedconfirmed'},
user = {'autoconfirmed'},
['*'] = {'user'}
},
--------------------------------------------------------------------------------
-- Wrapper templates and their default arguments
--------------------------------------------------------------------------------
-- This table contains wrapper templates used with the module, and their
-- default arguments. Templates specified in this table should contain the
-- following invocation, and no other template content:
--
-- {{#invoke:Protection banner|main}}
--
-- If other content is desired, it can be added between
-- <noinclude>...</noinclude> tags.
--
-- When a user calls one of these wrapper templates, they will use the
-- default arguments automatically. However, users can override any of the
-- arguments.
wrappers = {
['Template:Pp'] = {},
['Template:Pp-extended'] = {'ecp'},
['Template:Pp-blp'] = {'blp'},
-- we don't need Template:Pp-create
['Template:Pp-dispute'] = {'dispute'},
['Template:Pp-main-page'] = {'mainpage'},
['Template:Pp-move'] = {action = 'move', catonly = 'yes'},
['Template:Pp-move-dispute'] = {'dispute', action = 'move', catonly = 'yes'},
-- we don't need Template:Pp-move-indef
['Template:Pp-move-vandalism'] = {'vandalism', action = 'move', catonly = 'yes'},
['Template:Pp-office'] = {'office'},
['Template:Pp-office-dmca'] = {'dmca'},
['Template:Pp-pc'] = {action = 'autoreview', small = true},
['Template:Pp-pc1'] = {action = 'autoreview', small = true},
['Template:Pp-reset'] = {'reset'},
['Template:Pp-semi-indef'] = {small = true},
['Template:Pp-sock'] = {'sock'},
['Template:Pp-template'] = {'template', small = true},
['Template:Pp-upload'] = {action = 'upload'},
['Template:Pp-usertalk'] = {'usertalk'},
['Template:Pp-vandalism'] = {'vandalism'},
},
--------------------------------------------------------------------------------
--
-- MESSAGES
--
--------------------------------------------------------------------------------
msg = {
--------------------------------------------------------------------------------
-- Intro blurb and intro fragment
--------------------------------------------------------------------------------
-- These messages specify what is produced by the ${INTROBLURB} and
-- ${INTROFRAGMENT} parameters. If the protection is temporary they use the
-- intro-blurb-expiry or intro-fragment-expiry, and if not they use
-- intro-blurb-noexpiry or intro-fragment-noexpiry.
-- It is possible to use banner parameters in these messages.
['intro-blurb-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY}.',
['intro-blurb-noexpiry'] = '${PROTECTIONBLURB}.',
['intro-fragment-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY},',
['intro-fragment-noexpiry'] = '${PROTECTIONBLURB}',
--------------------------------------------------------------------------------
-- Tooltip blurb
--------------------------------------------------------------------------------
-- These messages specify what is produced by the ${TOOLTIPBLURB} parameter.
-- If the protection is temporary the tooltip-blurb-expiry message is used, and
-- if not the tooltip-blurb-noexpiry message is used.
-- It is possible to use banner parameters in these messages.
['tooltip-blurb-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY}.',
['tooltip-blurb-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}.',
['tooltip-fragment-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY},',
['tooltip-fragment-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}',
--------------------------------------------------------------------------------
-- Special explanation blurb
--------------------------------------------------------------------------------
-- An explanation blurb for pages that cannot be unprotected, e.g. for pages
-- in the MediaWiki namespace.
-- It is possible to use banner parameters in this message.
['explanation-blurb-nounprotect'] = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Please discuss any changes on the ${TALKPAGE}; you'
.. ' may ${EDITREQUEST} to ask an'
.. ' [[Wikipedia:Administrators|administrator]] to make an edit if it'
.. ' is [[Help:Minor edit#When to mark an edit as a minor edit'
.. '|uncontroversial]] or supported by [[Wikipedia:Consensus'
.. '|consensus]].',
--------------------------------------------------------------------------------
-- Protection log display values
--------------------------------------------------------------------------------
-- These messages determine the display values for the protection log link
-- or the pending changes log link produced by the ${PROTECTIONLOG} parameter.
-- It is possible to use banner parameters in these messages.
['protection-log-display'] = 'protection log',
['pc-log-display'] = 'pending changes log',
--------------------------------------------------------------------------------
-- Current version display values
--------------------------------------------------------------------------------
-- These messages determine the display values for the page history link
-- or the move log link produced by the ${CURRENTVERSION} parameter.
-- It is possible to use banner parameters in these messages.
['current-version-move-display'] = 'current title',
['current-version-edit-display'] = 'current version',
--------------------------------------------------------------------------------
-- Talk page
--------------------------------------------------------------------------------
-- This message determines the display value of the talk page link produced
-- with the ${TALKPAGE} parameter.
-- It is possible to use banner parameters in this message.
['talk-page-link-display'] = 'talk page',
--------------------------------------------------------------------------------
-- Edit requests
--------------------------------------------------------------------------------
-- This message determines the display value of the edit request link produced
-- with the ${EDITREQUEST} parameter.
-- It is possible to use banner parameters in this message.
['edit-request-display'] = 'submit an edit request',
--------------------------------------------------------------------------------
-- Expiry date format
--------------------------------------------------------------------------------
-- This is the format for the blurb expiry date. It should be valid input for
-- the first parameter of the #time parser function.
['expiry-date-format'] = 'F j, Y "at" H:i e',
--------------------------------------------------------------------------------
-- Tracking categories
--------------------------------------------------------------------------------
-- These messages determine which tracking categories the module outputs.
['tracking-category-incorrect'] = 'Wikipedia pages with incorrect protection templates',
['tracking-category-template'] = 'Wikipedia template-protected pages other than templates and modules',
--------------------------------------------------------------------------------
-- Images
--------------------------------------------------------------------------------
-- These are images that are not defined by their protection action and protection level.
['image-filename-indef'] = 'Full-protection-shackle.svg',
['image-filename-default'] = 'Transparent.gif',
--------------------------------------------------------------------------------
-- End messages
--------------------------------------------------------------------------------
}
--------------------------------------------------------------------------------
-- End configuration
--------------------------------------------------------------------------------
}
a20552ae38cb5253a4fa29aa126abc74215a589f
Template:Longitem
10
191
374
2023-05-09T01:38:28Z
wikipedia>Neveselbert
0
Undid revision 1153902556 by [[Special:Contributions/Neveselbert|Neveselbert]] ([[User talk:Neveselbert|talk]]) - backlinked
wikitext
text/x-wiki
<noinclude>{{#tag: code|
</noinclude>{{#ifeq: {{{1|+}}} | {{{1|-}}} | <div style="}}display: inline-block; line-height: 1.2em; padding: .1em 0; {{#ifeq: {{{1|+}}} | {{{1|-}}} | {{{style|}}}">{{{1|}}}</div> | <includeonly>width: 100%;</includeonly> }}<includeonly>{{#if:{{{2|}}}|[[Category:Pages using Template:Longitem with unnamed style parameter]]}}</includeonly><noinclude>
|lang=wikitext}}
{{documentation}}
</noinclude>
2919b818deb36b243e9f9517917cbcfaa2c8d4ec
Template:Post-nominals/AUS
10
258
508
2023-05-09T07:25:59Z
wikipedia>Paine Ellsworth
0
this should do it
wikitext
text/x-wiki
{{#switch: {{{1}}}
| AAM = [[Australian Antarctic Medal|AAM]]
| AC = [[Companion of the Order of Australia|AC]]
| ACm = [[Companion of the Order of Australia|AC (Mil)]]
| ACh = [[Honorary Companion of the Order of Australia|AC]]
| AD = [[Dame of the Order of Australia|AD]]
| ADh = [[Honorary Dame of the Order of Australia|AD]]
| AFSM = [[Australian Fire Service Medal|AFSM]]
| AIM = [[Australian Intelligence Medal|AIM]]
| AK = [[Knight of the Order of Australia|AK]]
| AKh = [[Honorary Knight of the Order of Australia|AK]]
| AM = [[Member of the Order of Australia|AM]]
| AMg = [[Member of the Order of Australia|AM (Gen)]]
| AMm = [[Member of the Order of Australia|AM (Mil)]]
| AMh = [[Honorary Member of the Order of Australia|AM]]
| AO = [[Officer of the Order of Australia|AO]]
| AOg = [[Officer of the Order of Australia|AO (Gen)]]
| AOm = [[Officer of the Order of Australia|AO (Mil)]]
| AOh = [[Honorary Officer of the Order of Australia|AO]]
| APM = [[Australian Police Medal|APM]]
| ASM = [[Ambulance Service Medal (Australia)|ASM]]
| BM = [[Bravery Medal (Australia)|BM]]
| CD = [[Canadian Forces Decoration|CD]]
| C.D. = [[Canadian Forces Decoration|C.D.]]
| CF = [[Churchill Fellow|CF]]
| CSC = [[Conspicuous Service Cross (Australia)|CSC]]
| CSC1 = [[Conspicuous Service Cross (Australia)|CSC]] & [[Medal bar|Bar]]
| CSM = [[Conspicuous Service Medal|CSM]]
| CV = [[Cross of Valour (Australia)|CV]]
| DSC = [[Distinguished Service Cross (Australia)|DSC]]
| DSCa = [[Distinguished Service Cross (Australia)|DSC]]
| DSCuk = [[Distinguished Service Cross (United Kingdom)|DSC]]
| DSC1 = [[Distinguished Service Cross (United Kingdom)|DSC]] & [[Medal bar|Bar]]
| DSC2 = [[Distinguished Service Cross (United Kingdom)|DSC]] & [[Medal bar|Two Bars]]
| DSM = [[Distinguished Service Medal (Australia)|DSM]]
| DSMuk = [[Distinguished Service Medal (United Kingdom)|DSM]]
| ESM = [[Emergency Services Medal (Australia)|ESM]]
| MG = [[Medal for Gallantry|MG]]
| MP = [[Member of parliament#Australia|MP]]
| NSC = [[Nursing Service Cross (Australia)|NSC]]
| OAM = [[Medal of the Order of Australia|OAM]]
| OAMg = [[Medal of the Order of Australia|OAM (Gen)]]
| OAMm = [[Medal of the Order of Australia|OAM (Mil)]]
| PSM = [[Public Service Medal (Australia)|PSM]]
| SC = [[Star of Courage (Australia)|SC]]
| SG = [[Star of Gallantry|SG]]
| VC = [[Victoria Cross for Australia|VC]]
| ADC = [[Aide de Camp|ADC]]
| ADC(P) = [[Personal Aide-de-Camp|ADC(P)]]
| AE = [[Air Efficiency Award|AE]]
| AFC = [[Air Force Cross (United Kingdom)|AFC]]
| AFC1 = [[Air Force Cross (United Kingdom)|AFC]] & [[Medal bar|Bar]]
| AFM = [[Air Force Medal|AFM]]
| ARRC = [[Royal Red Cross|ARRC]]
| AsstChStJ = [[Assistant Chaplin of The Most Venerable Order of the Hospital of Saint John of Jerusalem|AsstChStJ]]
| BEM = [[British Empire Medal|BEM]]
| Bart = [[Baronet|Bart]]
| Bt = [[Baronet|Bt]]
| Btss = [[Baronet|Btss]]
| CB = [[Companion of the Order of the Bath|CB]]
| CBE = [[Commander of the Order of the British Empire|CBE]]
| CBEh = [[Commander of the Order of the British Empire|CBE]]
| CChem = [[Chartered Chemist|CChem]]
| CGM = [[Conspicuous Gallantry Medal|CGM]]
| CH = [[Companion of the Order of the Companions of Honour|CH]]
| CIE = [[Companion of the Order of the Indian Empire|CIE]]
| CMG = [[Companion of the Order of St Michael and St George|CMG]]
| CNZM = [[Companion of the New Zealand Order of Merit|CNZM]]
| CPM = [[Colonial Police Medal|CPM]]
| CSI = [[Companion of the Order of the Star of India|CSI]]
| CStJ = [[Commander of the Most Venerable Order of the Hospital of Saint John of Jerusalem|CStJ]]
| ChStJ = [[Chaplain of the Most Venerable Order of the Hospital of Saint John of Jerusalem|ChStJ]]
| CVO = [[Commander of the Royal Victorian Order|CVO]]
| DBE = [[Dame Commander of the Order of the British Empire|DBE]]
| DCB = [[Dame Commander of the Order of the Bath|DCB]]
| DCIE = [[Dame Commander of the Order of the Indian Empire|DCIE]]
| DCM = [[Distinguished Conduct Medal|DCM]]
| DCM1 = [[Distinguished Conduct Medal|DCM]] & [[Medal bar|Bar]]
| DCMG = [[Dame Commander of the Order of St Michael and St George|DCMG]]
| DCVO = [[Dame Commander of the Royal Victorian Order|DCVO]]
| DFC = [[Distinguished Flying Cross (United Kingdom)|DFC]]
| DFC1 = [[Distinguished Flying Cross (United Kingdom)|DFC]] & [[Medal bar|Bar]]
| DFC2 = [[Distinguished Flying Cross (United Kingdom)|DFC]] & [[Medal bar|Two Bars]]
| DFM = [[Distinguished Flying Medal|DFM]]
| DFM1 = [[Distinguished Flying Medal|DFM]] & [[Medal bar|Bar]]
| DFM2 = [[Distinguished Flying Medal|DFM]] & [[Medal bar|Two Bars]]
| DL = [[Deputy Lieutenant|DL]]
| DSO = [[Companion of the Distinguished Service Order|DSO]]
| DSO1 = [[Companion of the Distinguished Service Order|DSO]] & [[Medal Bar|Bar]]
| DSO2 = [[Companion of the Distinguished Service Order|DSO]] & [[Medal bar|Two Bars]]
| DStJ = [[Dame of Justice of the Most Venerable Order of the Hospital of Saint John of Jerusalem|DStJ]]
| DStJg = [[Dame of Grace of the Most Venerable Order of the Hospital of Saint John of Jerusalem|DStJ]]
| ED = [[Efficiency Decoration|ED]]
| ERD = [[Emergency Reserve Decoration|ERD]]
| EsqStJ = [[Esquire of the Most Venerable Order of the Hospital of Saint John of Jerusalem|EsqStJ]]
| FAA = [[Fellow of the Australian Academy of Science|FAA]]
| FAAL = [[Australian Academy of Law#Fellows|FAAL]]
| FACE = [[Fellow of the Australian College of Educators|FACE]]
| FAHA = [[Fellow of the Australian Academy of the Humanities|FAHA]]
| FAHMS = [[Fellow of the Australian Academy of Health and Medical Sciences|FAHMS]]
| FAICD = [[Fellow of the Australian Institute of Company Directors|FAICD]]
| FASSA = [[Fellow of the Academy of the Social Sciences in Australia|FASSA]]
| FMedSci= [[Fellow of the Academy of Medical Sciences|FMedSci]]
| FRACI = [[Fellow of the Royal Australian Chemical Institute|FRACI]]
| FRACP = [[Fellow of the Royal Australasian College of Physicians|FRACP]]
| FRACS = [[Fellow of the Royal Australasian College of Surgeons|FRACS]]
| FRAeS = [[Fellow of the Royal Aeronautical Society|FRAeS]]
| FRCP = [[Fellow of the Royal College of Physicians|FRCP]]
| FRCPE = [[Fellow of the Royal College of Physicians of Edinburgh|FRCPE]]
| FRCS = [[Fellow of the Royal College of Surgeons|FRCS]]
| FRMS = [[Royal Microscopical Society|FRMS]]
| FRS = [[Fellow of the Royal Society|FRS]]
| FRSA = [[Fellow of the Royal Society of Arts|FRSA]]
| FRSN = [[Fellow of the Royal Society of New South Wales|FRSN]]
| FRSNZ = [[Fellow of the Royal Society of New Zealand|FRSNZ]]
| FRZS = [[Royal Zoological Society of New South Wales|FRZS]]
| FTSE = [[Fellow of the Australian Academy of Technological Sciences and Engineering|FTSE]]
| GBE = [[Knight Grand Cross of the Order of the British Empire|GBE]]
| GBEf = [[Dame Grand Cross of the Order of the British Empire|GBE]]
| GC = [[George Cross|GC]]
| GCB = [[Knight Grand Cross of the Order of the Bath|GCB]]
| GCBf = [[Dame Grand Cross of the Order of the Bath|GCB]]
| GCIE = [[Knight Grand Cross of the Order of the Indian Empire|GCIE]]
| GCIEf = [[Dame Grand Cross of the Order of the Indian Empire|GCIE]]
| GCMG = [[Knight Grand Cross of the Order of St Michael and St George|GCMG]]
| GCMGf = [[Dame Grand Cross of the Order of St Michael and St George|GCMG]]
| GCSI = [[Knight Grand Cross of the Order of the Star of India|GCSI]]
| GCSIf = [[Dame Grand Cross of the Order of the Star of India|GCSI]]
| GCStJ = [[Bailiff Grand Cross of the Most Venerable Order of the Hospital of Saint John of Jerusalem|GCStJ]]
| GCStJf = [[Dame Grand Cross of the Most Venerable Order of the Hospital of Saint John of Jerusalem|GCStJ]]
| GCVO = [[Knight Grand Cross of the Royal Victorian Order|GCVO]]
| GCVOf = [[Dame Grand Cross of the Royal Victorian Order|GCVO]]
| GM = [[George Medal|GM]]
| GM1 = [[George Medal|GM]] & [[Medal bar|Bar]]
| ISO = [[Imperial Service Order|ISO]]
| JP = [[Justice of the peace#Australia|JP]]
| KBE = [[Knight Commander of the Order of the British Empire|KBE]]
| KC = [[King's Counsel|KC]]
| KCB = [[Knight Commander of the Order of the Bath|KCB]]
| KCIE = [[Knight Commander of the Order of the Indian Empire|KCIE]]
| KCMG = [[Knight Commander of the Order of St Michael and St George|KCMG]]
| KCVO = [[Knight Commander of the Royal Victorian Order|KCVO]]
| KG = [[Knight of the Order of the Garter|KG]]
| KP = [[Knight of the Order of Saint Patrick|KP]]
| KCSI = [[Knight Commander of the Order of the Star of India|KCSI]]
| DCSI = [[Dame Commander of the Order of the Star of India|DCSI]]
| KStJ = [[Knight of Justice of the Most Venerable Order of the Hospital of Saint John of Jerusalem|KStJ]]
| KStJg = [[Knight of Grace of the Most Venerable Order of the Hospital of Saint John of Jerusalem|KStJ]]
| KT = [[Knight of the Order of the Thistle|KT]]
| LG = [[Lady Companion of the Order of the Garter|LG]]
| LT = [[Lady Companion of the Order of the Thistle|LT]]
| LVO = [[Lieutenant of the Royal Victorian Order|LVO]]
| MBE = [[Member of the Order of the British Empire|MBE]]
| MC = [[Military Cross|MC]]
| MC1 = [[Military Cross|MC]] & [[Medal bar|Bar]]
| MC2 = [[Military Cross|MC]] & [[Medal bar|Two Bars]]
| MM = [[Military Medal|MM]]
| MM1 = [[Military Medal|MM]] & [[Medal bar|Bar]]
| MM2 = [[Military Medal|MM]] & [[Medal bar|Two Bars]]
| MM3 = [[Military Medal|MM]] & [[Medal bar|Three Bars]]
| MVO = [[Member of the Royal Victorian Order|MVO]]
| OBE = [[Officer of the Order of the British Empire|OBE]]
| OM = [[Member of the Order of Merit|OM]]
| OStJ = [[Officer of the Most Venerable Order of the Hospital of Saint John of Jerusalem|OStJ]]
| PC = [[Her Majesty's Most Honourable Privy Council|PC]]
| QC = [[Queen's Counsel|QC]]
| QGM = [[Queen's Gallantry Medal|QGM]]
| QFSM = [[Queen's Fire Service Medal for Gallantry|QFSM]]
| QPM = [[Queen's Police Medal for Gallantry|QPM]]
| QFSMd = [[Queen's Fire Service Medal for Distinguished Service|QFSM]]
| QPMd = [[Queen's Police Medal for Distinguished Service|QPM]]
| RAN = [[Royal Australian Navy|RAN]]
| RAAF = [[Royal Australian Air Force|RAAF]]
| RANR = [[Royal Australian Naval Reserve|RANR]]
| RFD = [[Reserve Force Decoration|RFD]]
| RRC = [[Royal Red Cross|RRC]]
| RVM = [[Royal Victorian Medal|RVM]]
| SBStJ = [[Serving Brother of the Most Venerable Order of the Hospital of Saint John of Jerusalem|SBStJ]]
| SrC = [[Senior Counsel|SC]]
| SSStJ = [[Serving Sister of the Most Venerable Order of the Hospital of Saint John of Jerusalem|SSStJ]]
| Sub-ChStJ = [[Sub-Chaplain of the Most Venerable Order of the Hospital of Saint John of Jerusalem|Sub-ChStJ]]
| TD = [[Territorial Decoration|TD]]
| VCi = [[Victoria Cross|VC]]
| VD = [[Colonial Auxiliary Forces Officers' Decoration|VD]]
| * = [[Medal bar|*]]
| SSI = [[Star of the Solomon Islands|SSI]]
| GCL = [[Grand Companion of the Order of Logohu|GCL]]
| QSO = [[Companion of the Queen's Service Order|QSO]]
| CFA = [[Chartered Financial Analyst|CFA]]
| C.F.A. = [[Chartered Financial Analyst|C.F.A.]]
| AAM, = [[Australian Antarctic Medal|AAM]],
| AC, = [[Companion of the Order of Australia|AC]],
| ACh, = [[Honorary Companion of the Order of Australia|AC]],
| AD, = [[Dame of the Order of Australia|AD]],
| ADh, = [[Honorary Dame of the Order of Australia|AD]],
| AFSM, = [[Australian Fire Service Medal|AFSM]],
| AK, = [[Knight of the Order of Australia|AK]],
| AKh, = [[Honorary Knight of the Order of Australia|AK]],
| AM, = [[Member of the Order of Australia|AM]],
| AMh, = [[Honorary Member of the Order of Australia|AM]],
| AO, = [[Officer of the Order of Australia|AO]],
| AOh, = [[Honorary Officer of the Order of Australia|AO]],
| APM, = [[Australian Police Medal|APM]],
| ASM, = [[Ambulance Service Medal (Australia)|ASM]],
| BM, = [[Bravery Medal (Australia)|BM]],
| CSC, = [[Conspicuous Service Cross (Australia)|CSC]],
| CSM, = [[Conspicuous Service Medal|CSM]],
| CV, = [[Cross of Valour (Australia)|CV]],
| DSC, = [[Distinguished Service Cross (Australia)|DSC]],
| DSCa, = [[Distinguished Service Cross (Australia)|DSC]],
| DSCuk, = [[Distinguished Service Cross (United Kingdom)|DSC]],
| DSC1, = [[Distinguished Service Cross and Bar (United Kingdom)|DSC]] & [[Medal bar|Bar]],
| DSC2, = [[Distinguished Service Cross and two Bars (United Kingdom)|DSC]] & [[Medal bar|Two Bars]],
| DSM, = [[Distinguished Service Medal (Australia)|DSM]],
| DSMuk, = [[Distinguished Service Medal (United Kingdom)|DSM]],
| ESM, = [[Emergency Services Medal (Australia)|ESM]],
| MG, = [[Medal for Gallantry|MG]],
| MP, = [[Member of Parliament|MP]],
| NSC, = [[Nursing Service Cross (Australia)|NSC]],
| OAM, = [[Medal of the Order of Australia|OAM]],
| PSM, = [[Public Service Medal (Australia)|PSM]],
| SC, = [[Star of Courage (Australia)|SC]],
| SG, = [[Star of Gallantry|SG]],
| VC, = [[Victoria Cross for Australia|VC]],
| ADC, = [[Aide de Camp|ADC]],
| ADC(P),= [[Personal Aide-de-Camp|ADC(P)]],
| AE, = [[Air Efficiency Award|AE]],
| AFC, = [[Air Force Cross (United Kingdom)|AFC]],
| AFC1, = [[Air Force Cross (United Kingdom)|AFC]] & [[Medal bar|Bar]],
| AFM, = [[Air Force Medal|AFM]],
| ARRC, = [[Royal Red Cross|ARRC]],
| AsstChStJ, = [[Assistant Chaplin of The Most Venerable Order of the Hospital of Saint John of Jerusalem|AsstChStJ]],
| BEM, = [[British Empire Medal|BEM]],
| Bart, = [[Baronet|Bart]],
| Bt, = [[Baronet|Bt]],
| Btss, = [[Baronet|Btss]],
| CB, = [[Companion of the Order of the Bath|CB]],
| CBE, = [[Commander of the Order of the British Empire|CBE]],
| CBEh, = [[Commander of the Order of the British Empire|CBE]],
| CGM, = [[Conspicuous Gallantry Medal|CGM]],
| CH, = [[Companion of the Order of the Companions of Honour|CH]],
| CIE, = [[Companion of the Order of the Indian Empire|CIE]],
| CMG, = [[Companion of the Order of St Michael and St George|CMG]],
| CPM, = [[Colonial Police Medal|CPM]],
| CStJ, = [[Commander of the Most Venerable Order of the Hospital of Saint John of Jerusalem|CStJ]],
| ChStJ, = [[Chaplain of the Most Venerable Order of the Hospital of Saint John of Jerusalem|ChStJ]],
| CVO, = [[Commander of the Royal Victorian Order|CVO]],
| DBE, = [[Dame Commander of the Order of the British Empire|DBE]],
| DCB, = [[Dame Commander of the Order of the Bath|DCB]],
| DCIE, = [[Dame Commander of the Order of the Indian Empire|DCIE]],
| DCM, = [[Distinguished Conduct Medal|DCM]],
| DCMG, = [[Dame Commander of the Order of St Michael and St George|DCMG]],
| DCVO, = [[Dame Commander of the Royal Victorian Order|DCVO]],
| DFC, = [[Distinguished Flying Cross (United Kingdom)|DFC]],
| DFC1, = [[Distinguished Flying Cross (United Kingdom)|DFC]] & [[Medal bar|Bar]],
| DFC2, = [[Distinguished Flying Cross (United Kingdom)|DFC]] & [[Medal bar|Two Bars]],
| DFM, = [[Distinguished Flying Medal|DFM]],
| DFM1, = [[Distinguished Flying Medal|DFM]] & [[Medal bar|Bar]],
| DFM2, = [[Distinguished Flying Medal|DFM]] & [[Medal bar|Two Bars]],
| DL, = [[Deputy Lieutenant|DL]],
| DSO, = [[Companion of the Distinguished Service Order|DSO]],
| DSO1, = [[Companion of the Distinguished Service Order|DSO]] & [[Medal bar|Bar]],
| DSO2, = [[Companion of the Distinguished Service Order|DSO]] & [[Medal bar|Two Bars]],
| DStJ, = [[Dame of Justice of the Most Venerable Order of the Hospital of Saint John of Jerusalem|DStJ]],
| DStJg, = [[Dame of Grace of the Most Venerable Order of the Hospital of Saint John of Jerusalem|DStJ]],
| ED, = [[Efficiency Decoration|ED]],
| ERD, = [[Emergency Reserve Decoration|ERD]],
| EsqStJ,= [[Esquire of the Most Venerable Order of the Hospital of Saint John of Jerusalem|EsqStJ]],
| FAA, = [[Fellow of the Australian Academy of Science|FAA]],
| FAHMS, = [[Fellow of the Australian Academy of Health and Medical Sciences|FAHMS]],
| FAICD, = [[Fellow of the Australian Institute of Company Directors|FAICD]],
| FRACP, = [[Fellow of the Royal Australasian College of Physicians|FRACP]],
| FRCP, = [[Fellow of the Royal College of Physicians|FRCP]],
| FRCPE, = [[Fellow of the Royal College of Physicians of Edinburgh|FRCPE]],
| FRS, = [[Fellow of the Royal Society|FRS]],
| FRSN, = [[Fellow of the Royal Society of New South Wales|FRSN]],
| FRSNZ, = [[Fellow of the Royal Society of New Zealand|FRSNZ]],
| FTSE, = [[Fellow of the Australian Academy of Technological Sciences and Engineering|FTSE]],
| GBE, = [[Knight Grand Cross of the Order of the British Empire|GBE]],
| GBEf, = [[Dame Grand Cross of the Order of the British Empire|GBE]],
| GC, = [[George Cross|GC]],
| GCB, = [[Knight Grand Cross of the Order of the Bath|GCB]],
| GCBf, = [[Dame Grand Cross of the Order of the Bath|GCB]],
| GCIE, = [[Knight Grand Cross of the Order of the Indian Empire|GCIE]],
| GCIEf, = [[Dame Grand Cross of the Order of the Indian Empire|GCIE]],
| GCMG, = [[Knight Grand Cross of the Order of St Michael and St George|GCMG]],
| GCMGf, = [[Dame Grand Cross of the Order of St Michael and St George|GCMG]],
| GCStJ, = [[Bailiff Grand Cross of the Most Venerable Order of the Hospital of Saint John of Jerusalem|GCStJ]],
| GCStJf,= [[Dame Grand Cross of the Most Venerable Order of the Hospital of Saint John of Jerusalem|GCStJ]],
| GCVO, = [[Knight Grand Cross of the Royal Victorian Order|GCVO]],
| GCVOf, = [[Dame Grand Cross of the Royal Victorian Order|GCVO]],
| GM, = [[George Medal|GM]],
| JP, = [[Justice of the Peace|JP]],
| KBE, = [[Knight Commander of the Order of the British Empire|KBE]],
| KC, = [[King's Counsel|KC]],
| KCB, = [[Knight Commander of the Order of the Bath|KCB]],
| KCIE, = [[Knight Commander of the Order of the Indian Empire|KCIE]],
| KCMG, = [[Knight Commander of the Order of St Michael and St George|KCMG]],
| KCVO, = [[Knight Commander of the Royal Victorian Order|KCVO]],
| KG, = [[Knight of the Order of the Garter|KG]],
| KP, = [[Knight of the Order of Saint Patrick|KP]],
| KStJ, = [[Knight of Justice of the Most Venerable Order of the Hospital of Saint John of Jerusalem|KStJ]],
| KStJg, = [[Knight of Grace of the Most Venerable Order of the Hospital of Saint John of Jerusalem|KStJ]],
| KT, = [[Knight of the Order of the Thistle|KT]],
| LG, = [[Lady Companion of the Order of the Garter|LG]],
| LT, = [[Lady Companion of the Order of the Thistle|LT]],
| LVO, = [[Lieutenant of the Royal Victorian Order|LVO]],
| MBE, = [[Member of the Order of the British Empire|MBE]],
| MC, = [[Military Cross|MC]],
| MM, = [[Military Medal|MM]],
| MVO, = [[Member of the Royal Victorian Order|MVO]],
| OBE, = [[Officer of the Order of the British Empire|OBE]],
| OM, = [[Member of the Order of Merit|OM]],
| OStJ, = [[Officer of the Most Venerable Order of the Hospital of Saint John of Jerusalem|OStJ]],
| PC, = [[Her Majesty's Most Honourable Privy Council|PC]],
| QC, = [[Queen's Counsel|QC]],
| QGM, = [[Queen's Gallantry Medal|QGM]],
| QFSM, = [[Queen's Fire Service Medal for Gallantry|QFSM]],
| QPM, = [[Queen's Police Medal for Gallantry|QPM]],
| QFSMd, = [[Queen's Fire Service Medal for Distinguished Service|QFSM]],
| QPMd, = [[Queen's Police Medal for Distinguished Service|QPM]],
| RAN = [[Royal Australian Navy|RAN]]
| RANR = [[Royal Australian Naval Reserve|RANR]]
| RD, = [[Decoration for Officers of the Royal Naval Reserve|RD]],
| RFD, = [[Reserve Force Decoration|RFD]],
| RRC, = [[Royal Red Cross|RRC]],
| RVM, = [[Royal Victorian Medal|RVM]],
| SBStJ, = [[Serving Brother of the Most Venerable Order of the Hospital of Saint John of Jerusalem|SBStJ]],
| SSStJ, = [[Serving Sister of the Most Venerable Order of the Hospital of Saint John of Jerusalem|SSStJ]],
| Sub-ChStJ, = [[Sub-Chaplain of the Most Venerable Order of the Hospital of Saint John of Jerusalem|Sub-ChStJ]],
| TD, = [[Territorial Decoration|TD]],
| VCi, = [[Victoria Cross|VC]],
| VD, = [[Volunteer Officers' Decoration|VD]],
| *, = [[Medal bar|*]],
| SSI, = [[Star of the Solomon Islands|SSI]],
| GCL, = [[Grand Companion of the Order of Logohu|GCL]],
| QSO, = [[Companion of the Queen's Service Order|QSO]],
| OLY, = [[Competitor at the Olympic Games|OLY]]
}}<noinclude>
{{documentation}}
</noinclude>
19cc27a6404b36a86c2168793efca07cc03427a7
Template:Infobox political party/doc
10
204
400
2023-05-10T17:03:29Z
wikipedia>WOSlinker
0
syntaxhighlight lang="wikitext"
wikitext
text/x-wiki
{{Documentation subpage}}
<!--Categories where indicated at the bottom of this page, please; interwikis at Wikidata (see [[Wikipedia:Wikidata]])-->
{{#ifeq:{{SUBPAGENAME}}|sandbox||{{High-use}}}}
{{Auto short description}}
{{lua|Module:Infobox|Module:InfoboxImage|Module:Check for unknown parameters}}
==Usage==
===Basic===
{{Parameter names example
|name
|logo
|logo_alt
|colorcode=red
|leader
|president
|chairperson
|secretary
|general_secretary
|first_secretary
|secretary_general
|presidium
|governing_body
|standing_committee
|spokesperson
|founder
|founded
|headquarters
|ideology
|international
|website
|country
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox political party
| name =
| logo =
| logo_alt =
| colorcode = <!-- HTML color code (e.g. "red", "#FF0000" or Party metadata color template) otherwise "transparent" -->
| leader =
| president =
| chairperson =
| secretary =
| general_secretary =
| first_secretary =
| secretary_general =
| presidium =
| governing_body =
| standing_committee =
| spokesperson =
| founder =
| founded = <!-- {{start date|YYYY|MM|DD}} -->
| headquarters =
| ideology =
| international =
| website =
| country =
}}
</syntaxhighlight>
{{clear right}}
===Full===
{{Parameter names example
|name |native_name
|native_name_lang |lang1 |name_lang1 |lang2 |name_lang2 |lang3 |name_lang3 |lang4 |name_lang4 |logo |logo_size |logo_upright |logo_alt |caption |colorcode=red |abbreviation={{{abbreviation}}} or {{{abbr}}} |leader |president |chairperson={{{chairperson}}} or {{{chairman}}} |general_secretary |first_secretary |secretary_general |presidium |governing_body |standing_committee |secretary |spokesperson={{{spokesperson}}} or {{{spokesman}}}
|leader1_title |leader1_name |leader2_title |leader2_name |leader3_title |leader3_name |leader4_title |leader4_name |leader5_title |leader5_name
|founder={{{founder}}} or {{{founders}}} |founded={{{founded}}} or {{{foundation}}} |registered |legalised={{{legalised}}} or {{{legalized}}} |dissolved={{{dissolved}}} or {{{banned}}} or {{{dissolution}}} |merger |split |predecessor |merged |successor |headquarters |newspaper |think_tank |student_wing |youth_wing |womens_wing |lgbt_wing |wing1_title |wing1 |wing2_title |wing2 |wing3_title |wing3 |wing4_title |wing4
|membership_year=[''year''] |membership |ideology |position |religion |national |regional |european |continental |international |europarl |affiliation1_title |affiliation1 |affiliation2_title |affiliation2 |colors={{{colors}}} or {{{colours}}} |slogan |anthem
|blank1_title |blank1 |blank2_title |blank2 |blank3_title |blank3 |blank4_title |blank4
|seats1_title |seats1 |seats2_title |seats2 |seats3_title |seats3 |seats4_title |seats4
|symbol |flag |flag_title |flag_alt |website |country |country2 |footnotes
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox political party
| name =
| native_name =
| native_name_lang =
| lang1 =
| name_lang1 =
| lang2 =
| name_lang2 =
| lang3 =
| name_lang3 =
| lang4 =
| name_lang4 =
| logo =
| logo_size =
| logo_upright =
| logo_alt =
| caption =
| colorcode = <!-- HTML color code (e.g. "red", "#FF0000" or Party metadata color template) otherwise "transparent" -->
| abbreviation = <!-- official abbreviation or | abbr = -->
| leader =
| president =
| chairperson = <!-- or | chairman = -->
| secretary =
| general_secretary =
| first_secretary =
| secretary_general =
| presidium =
| governing_body =
| standing_committee =
| spokesperson = <!-- or | spokesman = -->
| leader1_title =
| leader1_name =
| leader2_title =
| leader2_name =
| leader3_title =
| leader3_name =
| leader4_title =
| leader4_name =
| leader5_title =
| leader5_name =
| founder = <!-- or | founders = -->
| founded = <!-- or | foundation = use {{start date|YYYY|MM|DD}} -->
| registered =
| legalised = <!-- or | legalized = -->
| dissolved = <!-- or | banned = or | dissolution = use {{end date|YYYY|MM|DD}} -->
| merger =
| split =
| predecessor =
| merged =
| successor =
| headquarters =
| newspaper =
| think_tank =
| student_wing =
| youth_wing =
| womens_wing =
| wing1_title =
| wing1 =
| wing2_title =
| wing2 =
| wing3_title =
| wing3 =
| wing4_title =
| wing4 =
| membership_year =
| membership =
| ideology =
| position =
| religion =
| national =
| regional = <!-- or | regional affiliation = -->
| european =
| continental = <!-- or | continental affiliation = -->
| international =
| europarl =
| affiliation1_title =
| affiliation1 =
| affiliation2_title =
| affiliation2 =
| colors = <!-- or | colours = ; use based on [[WP:ENGVAR]]-->
| slogan =
| anthem =
| blank1_title =
| blank1 =
| blank2_title =
| blank2 =
| blank3_title =
| blank3 =
| blank4_title =
| blank4 =
| seats1_title =
| seats1 = <!-- {{Infobox political party/seats|50|100|hex=#ff0000}} -->
| seats2_title =
| seats2 =
| seats3_title =
| seats3 =
| seats4_title = <!-- up to | seats11_title = -->
| seats4 = <!-- up to | seats11 = -->
| symbol =
| flag =
| flag_title =
| flag_alt =
| website =
| state = <!-- or | country = -->
| country = <!-- or | state = -->
| country_dab1 =
| parties_dab1 =
| elections_dab1 =
| country2 =
| country_dab2 =
| parties_dab2 =
| elections_dab2 =
| footnotes =
}}
</syntaxhighlight>
{{clear right}}
==Microformat==
{{UF-hcard-org}}
== TemplateData ==
{{TemplateData header}}
<templatedata>
{
"description": "An infobox for a political party. Used to briefly summarize information about a party at the top of the article. ",
"format": "{{_\n| ________________ = _\n}}\n",
"params": {
"name": {
"label": "Name",
"description": "The name of the party",
"type": "string"
},
"logo": {
"label": "Logo",
"description": "The logo of the party",
"type": "string"
},
"logo_size": {
"label": "Logo size",
"description": "Size of logo image",
"type": "string"
},
"colorcode": {
"label": "Color code",
"description": "The color to be used for infobox accents. HTML color code (e.g. red, #FF0000 or Party metadata color template) or transparent for no coloring.",
"type": "string"
},
"leader": {
"label": "Leader",
"description": "The leader of the party",
"type": "string"
},
"president": {
"label": "President",
"description": "The president of the party",
"type": "string"
},
"chairperson": {
"label": "Chairperson",
"description": "The chairperson of the party",
"type": "string",
"aliases": [
"chairman"
]
},
"secretary": {
"label": "Secretary",
"description": "The secretary of the party",
"type": "string"
},
"general_secretary": {
"label": "General secretary",
"description": "The general secretary of the party",
"type": "string"
},
"first_secretary": {
"label": "First secretary",
"description": "The first secretary of the party",
"type": "string"
},
"secretary_general": {
"label": "Secretary-general",
"description": "The secretary-general of the party",
"type": "string"
},
"presidium": {
"label": "Presidium",
"description": "The presidium of the party",
"type": "string"
},
"spokesperson": {
"label": "Spokesperson",
"description": "The spokesperson of the party",
"type": "string",
"aliases": [
"spokesman"
]
},
"foundation": {
"label": "Foundation",
"description": "The foundation date of the party. Insert as {{Start date|YYYY|MM|DD}}.",
"type": "string",
"aliases": [
"founded"
]
},
"ideology": {
"label": "Ideology",
"description": "The ideology of the party",
"type": "string"
},
"headquarters": {
"label": "Headquarters",
"description": "The headquarters of the party",
"type": "string"
},
"international": {
"label": "International",
"description": "The party’s international affiliation(s)",
"type": "string"
},
"website": {
"label": "Website",
"description": "The website of the party",
"type": "string"
},
"registered": {
"label": "Registered",
"description": "The registration number of party; if unregistered, then write NO.",
"type": "string"
},
"country": {
"label": "Country",
"description": "The country of the party",
"type": "string",
"aliases": [
"state"
]
},
"abbreviation": {
"aliases": [
"abbr"
]
},
"founder": {
"aliases": [
"founders"
]
},
"legalised": {
"aliases": [
"legalized"
]
},
"dissolved": {
"aliases": [
"banned",
"dissolution"
]
},
"colors": {
"description": "The official colors of the party, independent of infobox usage",
"aliases": [
"colours"
]
},
"native_name": {
"label": "Native name",
"description": "The native name of the party",
"type": "string"
},
"native_name_lang": {
"label": "Native name language code",
"description": "The ISO-639 language code of the native name of the party",
"example": "fr",
"type": "string"
},
"governing_body": {},
"standing_committee": {},
"merger": {},
"split": {
"label": "Split from",
"description": "Party or organisation the party was split from",
"type": "string"
},
"predecessor": {},
"merged": {},
"successor": {},
"newspaper": {},
"think_tank": {
"aliases": [
"think tank"
]
},
"student_wing": {},
"youth_wing": {},
"womens_wing": {},
"membership": {},
"membership_year": {},
"position": {},
"religion": {},
"national": {},
"regional": {
"aliases": [
"regional affiliation"
]
},
"european": {},
"continental": {
"aliases": [
"continental affiliation"
]
},
"europarl": {},
"slogan": {},
"anthem": {},
"symbol": {},
"flag": {
"aliases": [
"flag_title"
]
},
"flag_alt": {},
"country2": {},
"footnotes": {},
"logo_upright": {},
"logo_alt": {}
},
"paramOrder": [
"name",
"native_name",
"logo",
"logo_size",
"colorcode",
"leader",
"president",
"chairperson",
"secretary",
"general_secretary",
"first_secretary",
"secretary_general",
"presidium",
"spokesperson",
"foundation",
"ideology",
"headquarters",
"international",
"website",
"registered",
"country",
"abbreviation",
"founder",
"legalised",
"dissolved",
"colors",
"native_name_lang",
"governing_body",
"standing_committee",
"merger",
"split",
"predecessor",
"merged",
"successor",
"newspaper",
"think_tank",
"student_wing",
"youth_wing",
"womens_wing",
"membership",
"membership_year",
"position",
"religion",
"national",
"regional",
"european",
"continental",
"europarl",
"slogan",
"anthem",
"symbol",
"flag",
"flag_alt",
"country2",
"footnotes",
"logo_upright",
"logo_alt"
]
}
</templatedata>
== Tracking categories ==
* {{clc|Pages using infobox political party with unknown parameters}}
== See also ==
* {{tl|Composition bar}}, used to display a statistic, such as the number of seats held by a political party.
{{Organization infoboxes}}
<includeonly>{{sandbox other||
<!-- Categories below this line; interwikis at Wikidata -->
[[Category:Organization infobox templates|Political Party]]
[[Category:Political party infobox templates| ]]
[[Category:Templates that add a tracking category]]
}}</includeonly>
b246a618822a8e4debea143592790494f2f156b3
Module:Navbox
828
193
378
2023-05-28T13:26:56Z
wikipedia>Uzume
0
strict
Scribunto
text/plain
require('strict')
local p = {}
local navbar = require('Module:Navbar')._navbar
local cfg = mw.loadData('Module:Navbox/configuration')
local getArgs -- lazily initialized
local args
local format = string.format
local function striped(wikitext, border)
-- Return wikitext with markers replaced for odd/even striping.
-- Child (subgroup) navboxes are flagged with a category that is removed
-- by parent navboxes. The result is that the category shows all pages
-- where a child navbox is not contained in a parent navbox.
local orphanCat = cfg.category.orphan
if border == cfg.keyword.border_subgroup and args[cfg.arg.orphan] ~= cfg.keyword.orphan_yes then
-- No change; striping occurs in outermost navbox.
return wikitext .. orphanCat
end
local first, second = cfg.class.navbox_odd_part, cfg.class.navbox_even_part
if args[cfg.arg.evenodd] then
if args[cfg.arg.evenodd] == cfg.keyword.evenodd_swap then
first, second = second, first
else
first = args[cfg.arg.evenodd]
second = first
end
end
local changer
if first == second then
changer = first
else
local index = 0
changer = function (code)
if code == '0' then
-- Current occurrence is for a group before a nested table.
-- Set it to first as a valid although pointless class.
-- The next occurrence will be the first row after a title
-- in a subgroup and will also be first.
index = 0
return first
end
index = index + 1
return index % 2 == 1 and first or second
end
end
local regex = orphanCat:gsub('([%[%]])', '%%%1')
return (wikitext:gsub(regex, ''):gsub(cfg.marker.regex, changer)) -- () omits gsub count
end
local function processItem(item, nowrapitems)
if item:sub(1, 2) == '{|' then
-- Applying nowrap to lines in a table does not make sense.
-- Add newlines to compensate for trim of x in |parm=x in a template.
return '\n' .. item ..'\n'
end
if nowrapitems == cfg.keyword.nowrapitems_yes then
local lines = {}
for line in (item .. '\n'):gmatch('([^\n]*)\n') do
local prefix, content = line:match('^([*:;#]+)%s*(.*)')
if prefix and not content:match(cfg.pattern.nowrap) then
line = format(cfg.nowrap_item, prefix, content)
end
table.insert(lines, line)
end
item = table.concat(lines, '\n')
end
if item:match('^[*:;#]') then
return '\n' .. item ..'\n'
end
return item
end
local function has_navbar()
return args[cfg.arg.navbar] ~= cfg.keyword.navbar_off
and args[cfg.arg.navbar] ~= cfg.keyword.navbar_plain
and (
args[cfg.arg.name]
or mw.getCurrentFrame():getParent():getTitle():gsub(cfg.pattern.sandbox, '')
~= cfg.pattern.navbox
)
end
local function renderNavBar(titleCell)
if has_navbar() then
titleCell:wikitext(navbar{
[cfg.navbar.name] = args[cfg.arg.name],
[cfg.navbar.mini] = 1,
[cfg.navbar.fontstyle] = (args[cfg.arg.basestyle] or '') .. ';' ..
(args[cfg.arg.titlestyle] or '') ..
';background:none transparent;border:none;box-shadow:none;padding:0;'
})
end
end
local function renderTitleRow(tbl)
if not args[cfg.arg.title] then return end
local titleRow = tbl:tag('tr')
local titleCell = titleRow:tag('th'):attr('scope', 'col')
local titleColspan = 2
if args[cfg.arg.imageleft] then titleColspan = titleColspan + 1 end
if args[cfg.arg.image] then titleColspan = titleColspan + 1 end
titleCell
:cssText(args[cfg.arg.basestyle])
:cssText(args[cfg.arg.titlestyle])
:addClass(cfg.class.navbox_title)
:attr('colspan', titleColspan)
renderNavBar(titleCell)
titleCell
:tag('div')
-- id for aria-labelledby attribute
:attr('id', mw.uri.anchorEncode(args[cfg.arg.title]))
:addClass(args[cfg.arg.titleclass])
:css('font-size', '114%')
:css('margin', '0 4em')
:wikitext(processItem(args[cfg.arg.title]))
end
local function getAboveBelowColspan()
local ret = 2
if args[cfg.arg.imageleft] then ret = ret + 1 end
if args[cfg.arg.image] then ret = ret + 1 end
return ret
end
local function renderAboveRow(tbl)
if not args[cfg.arg.above] then return end
tbl:tag('tr')
:tag('td')
:addClass(cfg.class.navbox_abovebelow)
:addClass(args[cfg.arg.aboveclass])
:cssText(args[cfg.arg.basestyle])
:cssText(args[cfg.arg.abovestyle])
:attr('colspan', getAboveBelowColspan())
:tag('div')
-- id for aria-labelledby attribute, if no title
:attr('id', (not args[cfg.arg.title]) and mw.uri.anchorEncode(args[cfg.arg.above]) or nil)
:wikitext(processItem(args[cfg.arg.above], args[cfg.arg.nowrapitems]))
end
local function renderBelowRow(tbl)
if not args[cfg.arg.below] then return end
tbl:tag('tr')
:tag('td')
:addClass(cfg.class.navbox_abovebelow)
:addClass(args[cfg.arg.belowclass])
:cssText(args[cfg.arg.basestyle])
:cssText(args[cfg.arg.belowstyle])
:attr('colspan', getAboveBelowColspan())
:tag('div')
:wikitext(processItem(args[cfg.arg.below], args[cfg.arg.nowrapitems]))
end
local function renderListRow(tbl, index, listnum, listnums_size)
local row = tbl:tag('tr')
if index == 1 and args[cfg.arg.imageleft] then
row
:tag('td')
:addClass(cfg.class.noviewer)
:addClass(cfg.class.navbox_image)
:addClass(args[cfg.arg.imageclass])
:css('width', '1px') -- Minimize width
:css('padding', '0 2px 0 0')
:cssText(args[cfg.arg.imageleftstyle])
:attr('rowspan', listnums_size)
:tag('div')
:wikitext(processItem(args[cfg.arg.imageleft]))
end
local group_and_num = format(cfg.arg.group_and_num, listnum)
local groupstyle_and_num = format(cfg.arg.groupstyle_and_num, listnum)
if args[group_and_num] then
local groupCell = row:tag('th')
-- id for aria-labelledby attribute, if lone group with no title or above
if listnum == 1 and not (args[cfg.arg.title] or args[cfg.arg.above] or args[cfg.arg.group2]) then
groupCell
:attr('id', mw.uri.anchorEncode(args[cfg.arg.group1]))
end
groupCell
:attr('scope', 'row')
:addClass(cfg.class.navbox_group)
:addClass(args[cfg.arg.groupclass])
:cssText(args[cfg.arg.basestyle])
-- If groupwidth not specified, minimize width
:css('width', args[cfg.arg.groupwidth] or '1%')
groupCell
:cssText(args[cfg.arg.groupstyle])
:cssText(args[groupstyle_and_num])
:wikitext(args[group_and_num])
end
local listCell = row:tag('td')
if args[group_and_num] then
listCell
:addClass(cfg.class.navbox_list_with_group)
else
listCell:attr('colspan', 2)
end
if not args[cfg.arg.groupwidth] then
listCell:css('width', '100%')
end
local rowstyle -- usually nil so cssText(rowstyle) usually adds nothing
if index % 2 == 1 then
rowstyle = args[cfg.arg.oddstyle]
else
rowstyle = args[cfg.arg.evenstyle]
end
local list_and_num = format(cfg.arg.list_and_num, listnum)
local listText = args[list_and_num]
local oddEven = cfg.marker.oddeven
if listText:sub(1, 12) == '</div><table' then
-- Assume list text is for a subgroup navbox so no automatic striping for this row.
oddEven = listText:find(cfg.pattern.navbox_title) and cfg.marker.restart or cfg.class.navbox_odd_part
end
local liststyle_and_num = format(cfg.arg.liststyle_and_num, listnum)
local listclass_and_num = format(cfg.arg.listclass_and_num, listnum)
listCell
:css('padding', '0')
:cssText(args[cfg.arg.liststyle])
:cssText(rowstyle)
:cssText(args[liststyle_and_num])
:addClass(cfg.class.navbox_list)
:addClass(cfg.class.navbox_part .. oddEven)
:addClass(args[cfg.arg.listclass])
:addClass(args[listclass_and_num])
:tag('div')
:css('padding',
(index == 1 and args[cfg.arg.list1padding]) or args[cfg.arg.listpadding] or '0 0.25em'
)
:wikitext(processItem(listText, args[cfg.arg.nowrapitems]))
if index == 1 and args[cfg.arg.image] then
row
:tag('td')
:addClass(cfg.class.noviewer)
:addClass(cfg.class.navbox_image)
:addClass(args[cfg.arg.imageclass])
:css('width', '1px') -- Minimize width
:css('padding', '0 0 0 2px')
:cssText(args[cfg.arg.imagestyle])
:attr('rowspan', listnums_size)
:tag('div')
:wikitext(processItem(args[cfg.arg.image]))
end
end
local function has_list_class(htmlclass)
local patterns = {
'^' .. htmlclass .. '$',
'%s' .. htmlclass .. '$',
'^' .. htmlclass .. '%s',
'%s' .. htmlclass .. '%s'
}
for arg, _ in pairs(args) do
if type(arg) == 'string' and mw.ustring.find(arg, cfg.pattern.class) then
for _, pattern in ipairs(patterns) do
if mw.ustring.find(args[arg] or '', pattern) then
return true
end
end
end
end
return false
end
-- there are a lot of list classes in the wild, so we add their TemplateStyles
local function add_list_styles()
local frame = mw.getCurrentFrame()
local function add_list_templatestyles(htmlclass, templatestyles)
if has_list_class(htmlclass) then
return frame:extensionTag{
name = 'templatestyles', args = { src = templatestyles }
}
else
return ''
end
end
local hlist_styles = add_list_templatestyles('hlist', cfg.hlist_templatestyles)
local plainlist_styles = add_list_templatestyles('plainlist', cfg.plainlist_templatestyles)
-- a second workaround for [[phab:T303378]]
-- when that issue is fixed, we can actually use has_navbar not to emit the
-- tag here if we want
if has_navbar() and hlist_styles == '' then
hlist_styles = frame:extensionTag{
name = 'templatestyles', args = { src = cfg.hlist_templatestyles }
}
end
-- hlist -> plainlist is best-effort to preserve old Common.css ordering.
-- this ordering is not a guarantee because most navboxes will emit only
-- one of these classes [hlist_note]
return hlist_styles .. plainlist_styles
end
local function needsHorizontalLists(border)
if border == cfg.keyword.border_subgroup or args[cfg.arg.tracking] == cfg.keyword.tracking_no then
return false
end
return not has_list_class(cfg.pattern.hlist) and not has_list_class(cfg.pattern.plainlist)
end
local function hasBackgroundColors()
for _, key in ipairs({cfg.arg.titlestyle, cfg.arg.groupstyle,
cfg.arg.basestyle, cfg.arg.abovestyle, cfg.arg.belowstyle}) do
if tostring(args[key]):find('background', 1, true) then
return true
end
end
return false
end
local function hasBorders()
for _, key in ipairs({cfg.arg.groupstyle, cfg.arg.basestyle,
cfg.arg.abovestyle, cfg.arg.belowstyle}) do
if tostring(args[key]):find('border', 1, true) then
return true
end
end
return false
end
local function isIllegible()
local styleratio = require('Module:Color contrast')._styleratio
for key, style in pairs(args) do
if tostring(key):match(cfg.pattern.style) then
if styleratio{mw.text.unstripNoWiki(style)} < 4.5 then
return true
end
end
end
return false
end
local function getTrackingCategories(border)
local cats = {}
if needsHorizontalLists(border) then table.insert(cats, cfg.category.horizontal_lists) end
if hasBackgroundColors() then table.insert(cats, cfg.category.background_colors) end
if isIllegible() then table.insert(cats, cfg.category.illegible) end
if hasBorders() then table.insert(cats, cfg.category.borders) end
return cats
end
local function renderTrackingCategories(builder, border)
local title = mw.title.getCurrentTitle()
if title.namespace ~= 10 then return end -- not in template space
local subpage = title.subpageText
if subpage == cfg.keyword.subpage_doc or subpage == cfg.keyword.subpage_sandbox
or subpage == cfg.keyword.subpage_testcases then return end
for _, cat in ipairs(getTrackingCategories(border)) do
builder:wikitext('[[Category:' .. cat .. ']]')
end
end
local function renderMainTable(border, listnums)
local tbl = mw.html.create('table')
:addClass(cfg.class.nowraplinks)
:addClass(args[cfg.arg.bodyclass])
local state = args[cfg.arg.state]
if args[cfg.arg.title] and state ~= cfg.keyword.state_plain and state ~= cfg.keyword.state_off then
if state == cfg.keyword.state_collapsed then
state = cfg.class.collapsed
end
tbl
:addClass(cfg.class.collapsible)
:addClass(state or cfg.class.autocollapse)
end
tbl:css('border-spacing', 0)
if border == cfg.keyword.border_subgroup or border == cfg.keyword.border_none then
tbl
:addClass(cfg.class.navbox_subgroup)
:cssText(args[cfg.arg.bodystyle])
:cssText(args[cfg.arg.style])
else -- regular navbox - bodystyle and style will be applied to the wrapper table
tbl
:addClass(cfg.class.navbox_inner)
:css('background', 'transparent')
:css('color', 'inherit')
end
tbl:cssText(args[cfg.arg.innerstyle])
renderTitleRow(tbl)
renderAboveRow(tbl)
local listnums_size = #listnums
for i, listnum in ipairs(listnums) do
renderListRow(tbl, i, listnum, listnums_size)
end
renderBelowRow(tbl)
return tbl
end
local function add_navbox_styles(hiding_templatestyles)
local frame = mw.getCurrentFrame()
-- This is a lambda so that it doesn't need the frame as a parameter
local function add_user_styles(templatestyles)
if templatestyles and templatestyles ~= '' then
return frame:extensionTag{
name = 'templatestyles', args = { src = templatestyles }
}
end
return ''
end
-- get templatestyles. load base from config so that Lua only needs to do
-- the work once of parser tag expansion
local base_templatestyles = cfg.templatestyles
local templatestyles = add_user_styles(args[cfg.arg.templatestyles])
local child_templatestyles = add_user_styles(args[cfg.arg.child_templatestyles])
-- The 'navbox-styles' div exists to wrap the styles to work around T200206
-- more elegantly. Instead of combinatorial rules, this ends up being linear
-- number of CSS rules.
return mw.html.create('div')
:addClass(cfg.class.navbox_styles)
:wikitext(
add_list_styles() .. -- see [hlist_note] applied to 'before base_templatestyles'
base_templatestyles ..
templatestyles ..
child_templatestyles ..
table.concat(hiding_templatestyles)
)
:done()
end
-- work around [[phab:T303378]]
-- for each arg: find all the templatestyles strip markers, insert them into a
-- table. then remove all templatestyles markers from the arg
local function move_hiding_templatestyles(args)
local gfind = string.gfind
local gsub = string.gsub
local templatestyles_markers = {}
local strip_marker_pattern = '(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)'
for k, arg in pairs(args) do
for marker in gfind(arg, strip_marker_pattern) do
table.insert(templatestyles_markers, marker)
end
args[k] = gsub(arg, strip_marker_pattern, '')
end
return templatestyles_markers
end
function p._navbox(navboxArgs)
args = navboxArgs
local hiding_templatestyles = move_hiding_templatestyles(args)
local listnums = {}
for k, _ in pairs(args) do
if type(k) == 'string' then
local listnum = k:match(cfg.pattern.listnum)
if listnum then table.insert(listnums, tonumber(listnum)) end
end
end
table.sort(listnums)
local border = mw.text.trim(args[cfg.arg.border] or args[1] or '')
if border == cfg.keyword.border_child then
border = cfg.keyword.border_subgroup
end
-- render the main body of the navbox
local tbl = renderMainTable(border, listnums)
local res = mw.html.create()
-- render the appropriate wrapper for the navbox, based on the border param
if border == cfg.keyword.border_none then
res:node(add_navbox_styles(hiding_templatestyles))
local nav = res:tag('div')
:attr('role', 'navigation')
:node(tbl)
-- aria-labelledby title, otherwise above, otherwise lone group
if args[cfg.arg.title] or args[cfg.arg.above] or (args[cfg.arg.group1]
and not args[cfg.arg.group2]) then
nav:attr(
'aria-labelledby',
mw.uri.anchorEncode(
args[cfg.arg.title] or args[cfg.arg.above] or args[cfg.arg.group1]
)
)
else
nav:attr('aria-label', cfg.aria_label)
end
elseif border == cfg.keyword.border_subgroup then
-- We assume that this navbox is being rendered in a list cell of a
-- parent navbox, and is therefore inside a div with padding:0em 0.25em.
-- We start with a </div> to avoid the padding being applied, and at the
-- end add a <div> to balance out the parent's </div>
res
:wikitext('</div>')
:node(tbl)
:wikitext('<div>')
else
res:node(add_navbox_styles(hiding_templatestyles))
local nav = res:tag('div')
:attr('role', 'navigation')
:addClass(cfg.class.navbox)
:addClass(args[cfg.arg.navboxclass])
:cssText(args[cfg.arg.bodystyle])
:cssText(args[cfg.arg.style])
:css('padding', '3px')
:node(tbl)
-- aria-labelledby title, otherwise above, otherwise lone group
if args[cfg.arg.title] or args[cfg.arg.above]
or (args[cfg.arg.group1] and not args[cfg.arg.group2]) then
nav:attr(
'aria-labelledby',
mw.uri.anchorEncode(args[cfg.arg.title] or args[cfg.arg.above] or args[cfg.arg.group1])
)
else
nav:attr('aria-label', cfg.aria_label)
end
end
if (args[cfg.arg.nocat] or cfg.keyword.nocat_false):lower() == cfg.keyword.nocat_false then
renderTrackingCategories(res, border)
end
return striped(tostring(res), border)
end
function p.navbox(frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
args = getArgs(frame, {wrappers = {cfg.pattern.navbox}})
-- Read the arguments in the order they'll be output in, to make references
-- number in the right order.
local _
_ = args[cfg.arg.title]
_ = args[cfg.arg.above]
-- Limit this to 20 as covering 'most' cases (that's a SWAG) and because
-- iterator approach won't work here
for i = 1, 20 do
_ = args[format(cfg.arg.group_and_num, i)]
_ = args[format(cfg.arg.list_and_num, i)]
end
_ = args[cfg.arg.below]
return p._navbox(args)
end
return p
05be9a97c035ab3f0fac69423779e261949d473c
Template:High-use
10
124
239
2023-05-30T09:39:48Z
wikipedia>Lectonar
0
Changed protection settings for "[[Template:High-use]]": [[WP:High-risk templates|High-risk template or module]] ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
{{#invoke:High-use|main|1={{{1|}}}|2={{{2|}}}|info={{{info|}}}|demo={{{demo|}}}|form={{{form|}}}|expiry={{{expiry|}}}|system={{{system|}}}}}<noinclude>
{{Documentation}}
<!-- Add categories to the /doc subpage; interwiki links go to Wikidata, thank you! -->
</noinclude>
a3322d1bd47ac03df14fa2090855cff4fede9bc7
Module:High-use
828
127
245
2023-05-30T11:20:32Z
wikipedia>Lectonar
0
Changed protection settings for "[[Module:High-use]]": [[WP:High-risk templates|High-risk template or module]] ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
Scribunto
text/plain
local p = {}
-- _fetch looks at the "demo" argument.
local _fetch = require('Module:Transclusion_count').fetch
local yesno = require('Module:Yesno')
function p.num(frame, count)
if count == nil then
if yesno(frame.args['fetch']) == false then
if (frame.args[1] or '') ~= '' then count = tonumber(frame.args[1]) end
else
count = _fetch(frame)
end
end
-- Build output string
local return_value = ""
if count == nil then
if frame.args[1] == "risk" then
return_value = "a very large number of"
else
return_value = "many"
end
else
-- Use 2 significant figures for smaller numbers and 3 for larger ones
local sigfig = 2
if count >= 100000 then
sigfig = 3
end
-- Prepare to round to appropriate number of sigfigs
local f = math.floor(math.log10(count)) - sigfig + 1
-- Round and insert "approximately" or "+" when appropriate
if (frame.args[2] == "yes") or (mw.ustring.sub(frame.args[1],-1) == "+") then
-- Round down
return_value = string.format("%s+", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) ) * (10^(f))) )
else
-- Round to nearest
return_value = string.format("approximately %s", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) + 0.5) * (10^(f))) )
end
-- Insert percentage of pages if that is likely to be >= 1% and when |no-percent= not set to yes
if count and count > 250000 and not yesno (frame:getParent().args['no-percent']) then
local percent = math.floor( ( (count/frame:callParserFunction('NUMBEROFPAGES', 'R') ) * 100) + 0.5)
if percent >= 1 then
return_value = string.format("%s pages, or roughly %s%% of all", return_value, percent)
end
end
end
return return_value
end
-- Actions if there is a large (greater than or equal to 100,000) transclusion count
function p.risk(frame)
local return_value = ""
if frame.args[1] == "risk" then
return_value = "risk"
else
local count = _fetch(frame)
if count and count >= 100000 then return_value = "risk" end
end
return return_value
end
function p.text(frame, count)
-- Only show the information about how this template gets updated if someone
-- is actually editing the page and maybe trying to update the count.
local bot_text = (frame:preprocess("{{REVISIONID}}") == "") and "\n\n----\n'''Preview message''': Transclusion count updated automatically ([[Template:High-use/doc#Technical details|see documentation]])." or ''
if count == nil then
if yesno(frame.args['fetch']) == false then
if (frame.args[1] or '') ~= '' then count = tonumber(frame.args[1]) end
else
count = _fetch(frame)
end
end
local title = mw.title.getCurrentTitle()
if title.subpageText == "doc" or title.subpageText == "sandbox" then
title = title.basePageTitle
end
local systemMessages = frame.args['system']
if frame.args['system'] == '' then
systemMessages = nil
end
-- This retrieves the project URL automatically to simplify localiation.
local templateCount = ('on [https://linkcount.toolforge.org/index.php?project=%s&page=%s %s pages]'):format(
mw.title.getCurrentTitle():fullUrl():gsub('//(.-)/.*', '%1'),
mw.uri.encode(title.fullText), p.num(frame, count))
local used_on_text = "'''This " .. (mw.title.getCurrentTitle().namespace == 828 and "Lua module" or "template") .. ' is used ';
if systemMessages then
used_on_text = used_on_text .. systemMessages ..
((count and count > 2000) and ("''', and " .. templateCount) or ("'''"))
else
used_on_text = used_on_text .. templateCount .. "'''"
end
local sandbox_text = ("%s's [[%s/sandbox|/sandbox]] or [[%s/testcases|/testcases]] subpages, or in your own [[%s]]. "):format(
(mw.title.getCurrentTitle().namespace == 828 and "module" or "template"),
title.fullText, title.fullText,
mw.title.getCurrentTitle().namespace == 828 and "Module:Sandbox|module sandbox" or "Wikipedia:User pages#SUB|user subpage"
)
local infoArg = frame.args["info"] ~= "" and frame.args["info"]
if (systemMessages or frame.args[1] == "risk" or (count and count >= 100000) ) then
local info = systemMessages and '.<br/>Changes to it can cause immediate changes to the Wikipedia user interface.' or '.'
if infoArg then
info = info .. "<br />" .. infoArg
end
sandbox_text = info .. '<br /> To avoid major disruption' ..
(count and count >= 100000 and ' and server load' or '') ..
', any changes should be tested in the ' .. sandbox_text ..
'The tested changes can be added to this page in a single edit. '
else
sandbox_text = (infoArg and ('.<br />' .. infoArg .. ' C') or ' and c') ..
'hanges may be widely noticed. Test changes in the ' .. sandbox_text
end
local discussion_text = systemMessages and 'Please discuss changes ' or 'Consider discussing changes '
if frame.args["2"] and frame.args["2"] ~= "" and frame.args["2"] ~= "yes" then
discussion_text = string.format("%sat [[%s]]", discussion_text, frame.args["2"])
else
discussion_text = string.format("%son the [[%s|talk page]]", discussion_text, title.talkPageTitle.fullText )
end
return used_on_text .. sandbox_text .. discussion_text .. " before implementing them." .. bot_text
end
function p.main(frame)
local count = nil
if yesno(frame.args['fetch']) == false then
if (frame.args[1] or '') ~= '' then count = tonumber(frame.args[1]) end
else
count = _fetch(frame)
end
local image = "[[File:Ambox warning yellow.svg|40px|alt=Warning|link=]]"
local type_param = "style"
local epilogue = ''
if frame.args['system'] and frame.args['system'] ~= '' then
image = "[[File:Ambox important.svg|40px|alt=Warning|link=]]"
type_param = "content"
local nocat = frame:getParent().args['nocat'] or frame.args['nocat']
local categorise = (nocat == '' or not yesno(nocat))
if categorise then
epilogue = frame:preprocess('{{Sandbox other||{{#switch:{{#invoke:Effective protection level|{{#switch:{{NAMESPACE}}|File=upload|#default=edit}}|{{FULLPAGENAME}}}}|sysop|templateeditor|interfaceadmin=|#default=[[Category:Pages used in system messages needing protection]]}}}}')
end
elseif (frame.args[1] == "risk" or (count and count >= 100000)) then
image = "[[File:Ambox warning orange.svg|40px|alt=Warning|link=]]"
type_param = "content"
end
if frame.args["form"] == "editnotice" then
return frame:expandTemplate{
title = 'editnotice',
args = {
["image"] = image,
["text"] = p.text(frame, count),
["expiry"] = (frame.args["expiry"] or "")
}
} .. epilogue
else
return require('Module:Message box').main('ombox', {
type = type_param,
image = image,
text = p.text(frame, count),
expiry = (frame.args["expiry"] or "")
}) .. epilogue
end
end
return p
134551888e066954a89c109d2faa8af71a4454a4
Module:Transclusion count
828
128
247
2023-05-30T20:51:38Z
wikipedia>Isabelle Belato
0
Changed protection settings for "[[Module:Transclusion count]]": [[WP:High-risk templates|Highly visible template]]; requested at [[WP:RfPP]] ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
Scribunto
text/plain
local p = {}
function p.fetch(frame)
local template = nil
local return_value = nil
-- Use demo parameter if it exists, otherswise use current template name
local namespace = mw.title.getCurrentTitle().namespace
if frame.args["demo"] and frame.args["demo"] ~= "" then
template = mw.ustring.gsub(frame.args["demo"],"^[Tt]emplate:","")
elseif namespace == 10 then -- Template namespace
template = mw.title.getCurrentTitle().text
elseif namespace == 828 then -- Module namespace
template = (mw.site.namespaces[828].name .. ":" .. mw.title.getCurrentTitle().text)
end
-- If in template or module namespace, look up count in /data
if template ~= nil then
namespace = mw.title.new(template, "Template").namespace
if namespace == 10 or namespace == 828 then
template = mw.ustring.gsub(template, "/doc$", "") -- strip /doc from end
template = mw.ustring.gsub(template, "/sandbox$", "") -- strip /sandbox from end
local index = mw.ustring.sub(mw.title.new(template).text,1,1)
local status, data = pcall(function ()
return(mw.loadData('Module:Transclusion_count/data/' .. (mw.ustring.find(index, "%a") and index or "other")))
end)
if status then
return_value = tonumber(data[mw.ustring.gsub(template, " ", "_")])
end
end
end
-- If database value doesn't exist, use value passed to template
if return_value == nil and frame.args[1] ~= nil then
local arg1=mw.ustring.match(frame.args[1], '[%d,]+')
if arg1 and arg1 ~= '' then
return_value = tonumber(frame:callParserFunction('formatnum', arg1, 'R'))
end
end
return return_value
end
-- Tabulate this data for [[Wikipedia:Database reports/Templates transcluded on the most pages]]
function p.tabulate(frame)
local list = {}
for i = 65, 91 do
local data = mw.loadData('Module:Transclusion count/data/' .. ((i == 91) and 'other' or string.char(i)))
for name, count in pairs(data) do
table.insert(list, {mw.title.new(name, "Template").fullText, count})
end
end
table.sort(list, function(a, b)
return (a[2] == b[2]) and (a[1] < b[1]) or (a[2] > b[2])
end)
local lang = mw.getContentLanguage();
for i = 1, #list do
list[i] = ('|-\n| %d || [[%s]] || %s\n'):format(i, list[i][1]:gsub('_', ' '), lang:formatNum(list[i][2]))
end
return table.concat(list)
end
return p
000ef6bcbf7b66e727870b0c300c4009da300513
Module:If preview/doc
828
270
532
2023-06-12T21:06:51Z
wikipedia>Gkiyoshinishimoto
0
wikitext
text/x-wiki
{{Module rating|protected}}
{{High-use}}
{{Lua|Module:If preview/configuration}}
{{Uses TemplateStyles|Module:If preview/styles.css}}
This module implements {{Tl|If preview}} and {{Tl|Preview warning}}. It helps templates/modules determine if they are being previewed.
Prefer implementing the template versions in other templates.
In a module to use the <code>main()</code>, you need to pass a frame table with an args table.
For the preview warning, use <code>_warning()</code>.
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<!-- Please, categories below this line and interwikis at Wikidata -->
}}</includeonly><noinclude>
[[pt:Módulo:If preview/doc]]
</noinclude>
8613bb2e7c8b53a722e4eef105b36b82ab20037d
Template:Kbd
10
285
562
2023-06-14T16:12:25Z
wikipedia>Taravyvan Adijene
0
абнаўленьне зьвестак
wikitext
text/x-wiki
<kbd {{#if:{{{class|}}}|class="{{{class}}}"}} {{#if:{{{id|}}}|id="{{{id}}}"}} style="background:#EEEEEE; {{#if:{{{spacing|}}}| padding-left:{{{padding|0.2em}}}; padding-right:{{{padding|0.2em}}};| letter-spacing:0.05em; padding-left:0.25em; padding-right:0.2em;}}{{#if:{{{style|}}}|{{{style}}}}}" {{#if:{{{lang|}}}|lang="{{{lang}}}"}} {{#if:{{{title|}}}|title="{{{title}}}"}}>{{{1|user input}}}</kbd><noinclude>
<!--Categories go near the bottom of the /doc page.-->
{{Documentation}}
</noinclude>
4717d3a6d1c5c1b826066ac2a794cc6c92b43ac3
Module:Coordinates
828
256
504
2023-06-21T17:33:40Z
wikipedia>Ladsgroup
0
Switch from proto-relative urls (//foo.bar.com) to HTTPS (https://foo.bar.com). Since we are only serving https in Wikimedia now, it always outputs https links. At the same time, proto-relative add two duplicate rows to externallinks table meaning this is adding tens of millions of extra and useless rows bloating the table
Scribunto
text/plain
--[[
This module is intended to replace the functionality of {{Coord}} and related
templates. It provides several methods, including
{{#invoke:Coordinates | coord }} : General function formatting and displaying
coordinate values.
{{#invoke:Coordinates | dec2dms }} : Simple function for converting decimal
degree values to DMS format.
{{#invoke:Coordinates | dms2dec }} : Simple function for converting DMS format
to decimal degree format.
{{#invoke:Coordinates | link }} : Export the link used to reach the tools
]]
require('strict')
local math_mod = require("Module:Math")
local coordinates = {};
local isSandbox = mw.getCurrentFrame():getTitle():find('sandbox', 1, true);
local current_page = mw.title.getCurrentTitle()
local page_name = mw.uri.encode( current_page.prefixedText, 'WIKI' );
local coord_link = 'https://geohack.toolforge.org/geohack.php?pagename=' .. page_name .. '¶ms='
--[[ Helper function, replacement for {{coord/display/title}} ]]
local function displaytitle(coords)
return mw.getCurrentFrame():extensionTag{
name = 'indicator',
args = { name = 'coordinates' },
content = '<span id="coordinates">[[Geographic coordinate system|Coordinates]]: ' .. coords .. '</span>'
}
end
--[[ Helper function, used in detecting DMS formatting ]]
local function dmsTest(first, second)
if type(first) ~= 'string' or type(second) ~= 'string' then
return nil
end
local s = (first .. second):upper()
return s:find('^[NS][EW]$') or s:find('^[EW][NS]$')
end
--[[ Wrapper function to grab args, see Module:Arguments for this function's documentation. ]]
local function makeInvokeFunc(funcName)
return function (frame)
local args = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:Coord'
})
return coordinates[funcName](args, frame)
end
end
--[[ Helper function, handle optional args. ]]
local function optionalArg(arg, supplement)
return arg and arg .. supplement or ''
end
--[[
Formats any error messages generated for display
]]
local function errorPrinter(errors)
local result = ""
for i,v in ipairs(errors) do
result = result .. '<strong class="error">Coordinates: ' .. v[2] .. '</strong><br />'
end
return result
end
--[[
Determine the required CSS class to display coordinates
Usually geo-nondefault is hidden by CSS, unless a user has overridden this for himself
default is the mode as specificied by the user when calling the {{coord}} template
mode is the display mode (dec or dms) that we will need to determine the css class for
]]
local function displayDefault(default, mode)
if default == "" then
default = "dec"
end
if default == mode then
return "geo-default"
else
return "geo-nondefault"
end
end
--[[
specPrinter
Output formatter. Takes the structure generated by either parseDec
or parseDMS and formats it for inclusion on Wikipedia.
]]
local function specPrinter(args, coordinateSpec)
local uriComponents = coordinateSpec["param"]
if uriComponents == "" then
-- RETURN error, should never be empty or nil
return "ERROR param was empty"
end
if args["name"] then
uriComponents = uriComponents .. "&title=" .. mw.uri.encode(coordinateSpec["name"])
end
local geodmshtml = '<span class="geo-dms" title="Maps, aerial photos, and other data for this location">'
.. '<span class="latitude">' .. coordinateSpec["dms-lat"] .. '</span> '
.. '<span class="longitude">' ..coordinateSpec["dms-long"] .. '</span>'
.. '</span>'
local lat = tonumber( coordinateSpec["dec-lat"] ) or 0
local geodeclat
if lat < 0 then
-- FIXME this breaks the pre-existing precision
geodeclat = tostring(coordinateSpec["dec-lat"]):sub(2) .. "°S"
else
geodeclat = (coordinateSpec["dec-lat"] or 0) .. "°N"
end
local long = tonumber( coordinateSpec["dec-long"] ) or 0
local geodeclong
if long < 0 then
-- FIXME does not handle unicode minus
geodeclong = tostring(coordinateSpec["dec-long"]):sub(2) .. "°W"
else
geodeclong = (coordinateSpec["dec-long"] or 0) .. "°E"
end
local geodechtml = '<span class="geo-dec" title="Maps, aerial photos, and other data for this location">'
.. geodeclat .. ' '
.. geodeclong
.. '</span>'
local geonumhtml = '<span class="geo">'
.. coordinateSpec["dec-lat"] .. '; '
.. coordinateSpec["dec-long"]
.. '</span>'
local inner = '<span class="' .. displayDefault(coordinateSpec["default"], "dms" ) .. '">' .. geodmshtml .. '</span>'
.. '<span class="geo-multi-punct"> / </span>'
.. '<span class="' .. displayDefault(coordinateSpec["default"], "dec" ) .. '">';
if not args["name"] then
inner = inner .. geodechtml
.. '<span style="display:none"> / ' .. geonumhtml .. '</span></span>'
else
inner = inner .. '<span class="vcard">' .. geodechtml
.. '<span style="display:none"> / ' .. geonumhtml .. '</span>'
.. '<span style="display:none"> (<span class="fn org">'
.. args["name"] .. '</span>)</span></span></span>'
end
local stylesheetLink = 'Module:Coordinates' .. ( isSandbox and '/sandbox' or '' ) .. '/styles.css'
return mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = stylesheetLink }
} .. '<span class="plainlinks nourlexpansion">[' .. coord_link .. uriComponents ..
' ' .. inner .. ']</span>'
end
--[[ Helper function, convert decimal to degrees ]]
local function convert_dec2dms_d(coordinate)
local d = math_mod._round( coordinate, 0 ) .. "°"
return d .. ""
end
--[[ Helper function, convert decimal to degrees and minutes ]]
local function convert_dec2dms_dm(coordinate)
coordinate = math_mod._round( coordinate * 60, 0 );
local m = coordinate % 60;
coordinate = math.floor( (coordinate - m) / 60 );
local d = coordinate % 360 .."°"
return d .. string.format( "%02d′", m )
end
--[[ Helper function, convert decimal to degrees, minutes, and seconds ]]
local function convert_dec2dms_dms(coordinate)
coordinate = math_mod._round( coordinate * 60 * 60, 0 );
local s = coordinate % 60
coordinate = math.floor( (coordinate - s) / 60 );
local m = coordinate % 60
coordinate = math.floor( (coordinate - m) / 60 );
local d = coordinate % 360 .."°"
return d .. string.format( "%02d′", m ) .. string.format( "%02d″", s )
end
--[[
Helper function, convert decimal latitude or longitude to
degrees, minutes, and seconds format based on the specified precision.
]]
local function convert_dec2dms(coordinate, firstPostfix, secondPostfix, precision)
local coord = tonumber(coordinate)
local postfix
if coord >= 0 then
postfix = firstPostfix
else
postfix = secondPostfix
end
precision = precision:lower();
if precision == "dms" then
return convert_dec2dms_dms( math.abs( coord ) ) .. postfix;
elseif precision == "dm" then
return convert_dec2dms_dm( math.abs( coord ) ) .. postfix;
elseif precision == "d" then
return convert_dec2dms_d( math.abs( coord ) ) .. postfix;
end
end
--[[
Convert DMS format into a N or E decimal coordinate
]]
local function convert_dms2dec(direction, degrees_str, minutes_str, seconds_str)
local degrees = tonumber(degrees_str)
local minutes = tonumber(minutes_str) or 0
local seconds = tonumber(seconds_str) or 0
local factor = 1
if direction == "S" or direction == "W" then
factor = -1
end
local precision = 0
if seconds_str then
precision = 5 + math.max( math_mod._precision(seconds_str), 0 );
elseif minutes_str and minutes_str ~= '' then
precision = 3 + math.max( math_mod._precision(minutes_str), 0 );
else
precision = math.max( math_mod._precision(degrees_str), 0 );
end
local decimal = factor * (degrees+(minutes+seconds/60)/60)
return string.format( "%." .. precision .. "f", decimal ) -- not tonumber since this whole thing is string based.
end
--[[
Checks input values to for out of range errors.
]]
local function validate( lat_d, lat_m, lat_s, long_d, long_m, long_s, source, strong )
local errors = {};
lat_d = tonumber( lat_d ) or 0;
lat_m = tonumber( lat_m ) or 0;
lat_s = tonumber( lat_s ) or 0;
long_d = tonumber( long_d ) or 0;
long_m = tonumber( long_m ) or 0;
long_s = tonumber( long_s ) or 0;
if strong then
if lat_d < 0 then
table.insert(errors, {source, "latitude degrees < 0 with hemisphere flag"})
end
if long_d < 0 then
table.insert(errors, {source, "longitude degrees < 0 with hemisphere flag"})
end
--[[
#coordinates is inconsistent about whether this is an error. If globe: is
specified, it won't error on this condition, but otherwise it will.
For not simply disable this check.
if long_d > 180 then
table.insert(errors, {source, "longitude degrees > 180 with hemisphere flag"})
end
]]
end
if lat_d > 90 then
table.insert(errors, {source, "latitude degrees > 90"})
end
if lat_d < -90 then
table.insert(errors, {source, "latitude degrees < -90"})
end
if lat_m >= 60 then
table.insert(errors, {source, "latitude minutes >= 60"})
end
if lat_m < 0 then
table.insert(errors, {source, "latitude minutes < 0"})
end
if lat_s >= 60 then
table.insert(errors, {source, "latitude seconds >= 60"})
end
if lat_s < 0 then
table.insert(errors, {source, "latitude seconds < 0"})
end
if long_d >= 360 then
table.insert(errors, {source, "longitude degrees >= 360"})
end
if long_d <= -360 then
table.insert(errors, {source, "longitude degrees <= -360"})
end
if long_m >= 60 then
table.insert(errors, {source, "longitude minutes >= 60"})
end
if long_m < 0 then
table.insert(errors, {source, "longitude minutes < 0"})
end
if long_s >= 60 then
table.insert(errors, {source, "longitude seconds >= 60"})
end
if long_s < 0 then
table.insert(errors, {source, "longitude seconds < 0"})
end
return errors;
end
--[[
parseDec
Transforms decimal format latitude and longitude into the
structure to be used in displaying coordinates
]]
local function parseDec( lat, long, format )
local coordinateSpec = {}
local errors = {}
if not long then
return nil, {{"parseDec", "Missing longitude"}}
elseif not tonumber(long) then
return nil, {{"parseDec", "Longitude could not be parsed as a number: " .. long}}
end
errors = validate( lat, nil, nil, long, nil, nil, 'parseDec', false );
coordinateSpec["dec-lat"] = lat;
coordinateSpec["dec-long"] = long;
local mode = coordinates.determineMode( lat, long );
coordinateSpec["dms-lat"] = convert_dec2dms( lat, "N", "S", mode) -- {{coord/dec2dms|{{{1}}}|N|S|{{coord/prec dec|{{{1}}}|{{{2}}}}}}}
coordinateSpec["dms-long"] = convert_dec2dms( long, "E", "W", mode) -- {{coord/dec2dms|{{{2}}}|E|W|{{coord/prec dec|{{{1}}}|{{{2}}}}}}}
if format then
coordinateSpec.default = format
else
coordinateSpec.default = "dec"
end
return coordinateSpec, errors
end
--[[
parseDMS
Transforms degrees, minutes, seconds format latitude and longitude
into the a structure to be used in displaying coordinates
]]
local function parseDMS( lat_d, lat_m, lat_s, lat_f, long_d, long_m, long_s, long_f, format )
local coordinateSpec, errors, backward = {}, {}
lat_f = lat_f:upper();
long_f = long_f:upper();
-- Check if specified backward
if lat_f == 'E' or lat_f == 'W' then
lat_d, long_d, lat_m, long_m, lat_s, long_s, lat_f, long_f, backward = long_d, lat_d, long_m, lat_m, long_s, lat_s, long_f, lat_f, true;
end
errors = validate( lat_d, lat_m, lat_s, long_d, long_m, long_s, 'parseDMS', true );
if not long_d then
return nil, {{"parseDMS", "Missing longitude" }}
elseif not tonumber(long_d) then
return nil, {{"parseDMS", "Longitude could not be parsed as a number:" .. long_d }}
end
if not lat_m and not lat_s and not long_m and not long_s and #errors == 0 then
if math_mod._precision( lat_d ) > 0 or math_mod._precision( long_d ) > 0 then
if lat_f:upper() == 'S' then
lat_d = '-' .. lat_d;
end
if long_f:upper() == 'W' then
long_d = '-' .. long_d;
end
return parseDec( lat_d, long_d, format );
end
end
coordinateSpec["dms-lat"] = lat_d.."°"..optionalArg(lat_m,"′") .. optionalArg(lat_s,"″") .. lat_f
coordinateSpec["dms-long"] = long_d.."°"..optionalArg(long_m,"′") .. optionalArg(long_s,"″") .. long_f
coordinateSpec["dec-lat"] = convert_dms2dec(lat_f, lat_d, lat_m, lat_s) -- {{coord/dms2dec|{{{4}}}|{{{1}}}|0{{{2}}}|0{{{3}}}}}
coordinateSpec["dec-long"] = convert_dms2dec(long_f, long_d, long_m, long_s) -- {{coord/dms2dec|{{{8}}}|{{{5}}}|0{{{6}}}|0{{{7}}}}}
if format then
coordinateSpec.default = format
else
coordinateSpec.default = "dms"
end
return coordinateSpec, errors, backward
end
--[[
Check the input arguments for coord to determine the kind of data being provided
and then make the necessary processing.
]]
local function formatTest(args)
local result, errors
local backward, primary = false, false
local function getParam(args, lim)
local ret = {}
for i = 1, lim do
ret[i] = args[i] or ''
end
return table.concat(ret, '_')
end
if not args[1] then
-- no lat logic
return errorPrinter( {{"formatTest", "Missing latitude"}} )
elseif not tonumber(args[1]) then
-- bad lat logic
return errorPrinter( {{"formatTest", "Unable to parse latitude as a number:" .. args[1]}} )
elseif not args[4] and not args[5] and not args[6] then
-- dec logic
result, errors = parseDec(args[1], args[2], args.format)
if not result then
return errorPrinter(errors);
end
-- formatting for geohack: geohack expects D_N_D_E notation or D;D notation
-- wikiminiatlas doesn't support D;D notation
-- #coordinates parserfunction doesn't support negative decimals with NSWE
result.param = table.concat({
math.abs(tonumber(args[1])),
((tonumber(args[1]) or 0) < 0) and 'S' or 'N',
math.abs(tonumber(args[2])),
((tonumber(args[2]) or 0) < 0) and 'W' or 'E',
args[3] or ''}, '_')
elseif dmsTest(args[4], args[8]) then
-- dms logic
result, errors, backward = parseDMS(args[1], args[2], args[3], args[4],
args[5], args[6], args[7], args[8], args.format)
if args[10] then
table.insert(errors, {'formatTest', 'Extra unexpected parameters'})
end
if not result then
return errorPrinter(errors)
end
result.param = getParam(args, 9)
elseif dmsTest(args[3], args[6]) then
-- dm logic
result, errors, backward = parseDMS(args[1], args[2], nil, args[3],
args[4], args[5], nil, args[6], args['format'])
if args[8] then
table.insert(errors, {'formatTest', 'Extra unexpected parameters'})
end
if not result then
return errorPrinter(errors)
end
result.param = getParam(args, 7)
elseif dmsTest(args[2], args[4]) then
-- d logic
result, errors, backward = parseDMS(args[1], nil, nil, args[2],
args[3], nil, nil, args[4], args.format)
if args[6] then
table.insert(errors, {'formatTest', 'Extra unexpected parameters'})
end
if not result then
return errorPrinter(errors)
end
result.param = getParam(args, 5)
else
-- Error
return errorPrinter({{"formatTest", "Unknown argument format"}}) .. '[[Category:Pages with malformed coordinate tags]]'
end
result.name = args.name
local extra_param = {'dim', 'globe', 'scale', 'region', 'source', 'type'}
for _, v in ipairs(extra_param) do
if args[v] then
table.insert(errors, {'formatTest', 'Parameter: "' .. v .. '=" should be "' .. v .. ':"' })
end
end
local ret = specPrinter(args, result)
if #errors > 0 then
ret = ret .. ' ' .. errorPrinter(errors) .. '[[Category:Pages with malformed coordinate tags]]'
end
return ret, backward
end
--[[
Generate Wikidata tracking categories.
]]
local function makeWikidataCategories(qid)
local ret
local qid = qid or mw.wikibase.getEntityIdForCurrentPage()
if mw.wikibase and current_page.namespace == 0 then
if qid and mw.wikibase.entityExists(qid) and mw.wikibase.getBestStatements(qid, "P625") and mw.wikibase.getBestStatements(qid, "P625")[1] then
local snaktype = mw.wikibase.getBestStatements(qid, "P625")[1].mainsnak.snaktype
if snaktype == 'value' then
-- coordinates exist both here and on Wikidata, and can be compared.
ret = 'Coordinates on Wikidata'
elseif snaktype == 'somevalue' then
ret = 'Coordinates on Wikidata set to unknown value'
elseif snaktype == 'novalue' then
ret = 'Coordinates on Wikidata set to no value'
end
else
-- We have to either import the coordinates to Wikidata or remove them here.
ret = 'Coordinates not on Wikidata'
end
end
if ret then
return string.format('[[Category:%s]]', ret)
else
return ''
end
end
--[[
link
Simple function to export the coordinates link for other uses.
Usage:
{{#invoke:Coordinates | link }}
]]
function coordinates.link(frame)
return coord_link;
end
--[[
dec2dms
Wrapper to allow templates to call dec2dms directly.
Usage:
{{#invoke:Coordinates | dec2dms | decimal_coordinate | positive_suffix |
negative_suffix | precision }}
decimal_coordinate is converted to DMS format. If positive, the positive_suffix
is appended (typical N or E), if negative, the negative suffix is appended. The
specified precision is one of 'D', 'DM', or 'DMS' to specify the level of detail
to use.
]]
coordinates.dec2dms = makeInvokeFunc('_dec2dms')
function coordinates._dec2dms(args)
local coordinate = args[1]
local firstPostfix = args[2] or ''
local secondPostfix = args[3] or ''
local precision = args[4] or ''
return convert_dec2dms(coordinate, firstPostfix, secondPostfix, precision)
end
--[[
Helper function to determine whether to use D, DM, or DMS
format depending on the precision of the decimal input.
]]
function coordinates.determineMode( value1, value2 )
local precision = math.max( math_mod._precision( value1 ), math_mod._precision( value2 ) );
if precision <= 0 then
return 'd'
elseif precision <= 2 then
return 'dm';
else
return 'dms';
end
end
--[[
dms2dec
Wrapper to allow templates to call dms2dec directly.
Usage:
{{#invoke:Coordinates | dms2dec | direction_flag | degrees |
minutes | seconds }}
Converts DMS values specified as degrees, minutes, seconds too decimal format.
direction_flag is one of N, S, E, W, and determines whether the output is
positive (i.e. N and E) or negative (i.e. S and W).
]]
coordinates.dms2dec = makeInvokeFunc('_dms2dec')
function coordinates._dms2dec(args)
local direction = args[1]
local degrees = args[2]
local minutes = args[3]
local seconds = args[4]
return convert_dms2dec(direction, degrees, minutes, seconds)
end
--[[
coord
Main entry point for Lua function to replace {{coord}}
Usage:
{{#invoke:Coordinates | coord }}
{{#invoke:Coordinates | coord | lat | long }}
{{#invoke:Coordinates | coord | lat | lat_flag | long | long_flag }}
...
Refer to {{coord}} documentation page for many additional parameters and
configuration options.
Note: This function provides the visual display elements of {{coord}}. In
order to load coordinates into the database, the {{#coordinates:}} parser
function must also be called, this is done automatically in the Lua
version of {{coord}}.
]]
coordinates.coord = makeInvokeFunc('_coord')
function coordinates._coord(args)
if not tonumber(args[1]) and not args[2] then
args[3] = args[1]; args[1] = nil
local entity = mw.wikibase.getEntityObject(args.qid)
if entity
and entity.claims
and entity.claims.P625
and entity.claims.P625[1].mainsnak.snaktype == 'value'
then
local precision = entity.claims.P625[1].mainsnak.datavalue.value.precision
args[1] = entity.claims.P625[1].mainsnak.datavalue.value.latitude
args[2] = entity.claims.P625[1].mainsnak.datavalue.value.longitude
if precision then
precision = -math_mod._round(math.log(precision)/math.log(10),0)
args[1] = math_mod._round(args[1],precision)
args[2] = math_mod._round(args[2],precision)
end
end
end
local contents, backward = formatTest(args)
local Notes = args.notes or ''
local Display = args.display and args.display:lower() or 'inline'
-- it and ti are short for inline,title and title,inline
local function isInline(s)
-- Finds whether coordinates are displayed inline.
return s:find('inline') ~= nil or s == 'i' or s == 'it' or s == 'ti'
end
local function isInTitle(s)
-- Finds whether coordinates are displayed in the title.
return s:find('title') ~= nil or s == 't' or s == 'it' or s == 'ti'
end
local function coord_wrapper(in_args)
-- Calls the parser function {{#coordinates:}}.
return mw.getCurrentFrame():callParserFunction('#coordinates', in_args) or ''
end
local text = ''
if isInline(Display) then
text = text .. '<span class="geo-inline">' .. contents .. Notes .. '</span>'
end
if isInTitle(Display) then
-- Add to output since indicator content is invisible to Lua later on
if not isInline(Display) then
text = text .. '<span class="geo-inline-hidden noexcerpt">' .. contents .. Notes .. '</span>'
end
text = text .. displaytitle(contents .. Notes) .. makeWikidataCategories(args.qid)
end
if not args.nosave then
local page_title, count = mw.title.getCurrentTitle(), 1
if backward then
local tmp = {}
while not string.find((args[count-1] or ''), '[EW]') do tmp[count] = (args[count] or ''); count = count+1 end
tmp.count = count; count = 2*(count-1)
while count >= tmp.count do table.insert(tmp, 1, (args[count] or '')); count = count-1 end
for i, v in ipairs(tmp) do args[i] = v end
else
while count <= 9 do args[count] = (args[count] or ''); count = count+1 end
end
if isInTitle(Display) and not page_title.isTalkPage and page_title.subpageText ~= 'doc' and page_title.subpageText ~= 'testcases' then args[10] = 'primary' end
args.notes, args.format, args.display = nil
text = text .. coord_wrapper(args)
end
return text
end
--[[
coord2text
Extracts a single value from a transclusion of {{Coord}}.
IF THE GEOHACK LINK SYNTAX CHANGES THIS FUNCTION MUST BE MODIFIED.
Usage:
{{#invoke:Coordinates | coord2text | {{Coord}} | parameter }}
Valid values for the second parameter are: lat (signed integer), long (signed integer), type, scale, dim, region, globe, source
]]
function coordinates._coord2text(coord,type)
if coord == '' or type == '' or not type then return nil end
type = mw.text.trim(type)
if type == 'lat' or type == 'long' then
local result, negative = mw.text.split((mw.ustring.match(coord,'[%.%d]+°[NS] [%.%d]+°[EW]') or ''), ' ')
if type == 'lat' then
result, negative = result[1], 'S'
else
result, negative = result[2], 'W'
end
result = mw.text.split(result, '°')
if result[2] == negative then result[1] = '-'..result[1] end
return result[1]
else
return mw.ustring.match(coord, 'params=.-_' .. type .. ':(.-)[ _]')
end
end
function coordinates.coord2text(frame)
return coordinates._coord2text(frame.args[1],frame.args[2])
end
--[[
coordinsert
Injects some text into the Geohack link of a transclusion of {{Coord}} (if that text isn't already in the transclusion). Outputs the modified transclusion of {{Coord}}.
IF THE GEOHACK LINK SYNTAX CHANGES THIS FUNCTION MUST BE MODIFIED.
Usage:
{{#invoke:Coordinates | coordinsert | {{Coord}} | parameter:value | parameter:value | … }}
Do not make Geohack unhappy by inserting something which isn't mentioned in the {{Coord}} documentation.
]]
function coordinates.coordinsert(frame)
-- for the 2nd or later integer parameter (the first is the coord template, as above)
for i, v in ipairs(frame.args) do
if i ~= 1 then
-- if we cannot find in the coord_template the i_th coordinsert parameter e.g. region
if not mw.ustring.find(frame.args[1], (mw.ustring.match(frame.args[i], '^(.-:)') or '')) then
-- find from the params= up to the first possibly-present underscore
-- and append the i_th coordinsert parameter and a space
-- IDK why we're adding a space but it does seem somewhat convenient
frame.args[1] = mw.ustring.gsub(frame.args[1], '(params=.-)_? ', '%1_'..frame.args[i]..' ')
end
end
end
if frame.args.name then
-- if we can't find the vcard class
if not mw.ustring.find(frame.args[1], '<span class="vcard">') then
-- take something that looks like a coord template and add the vcard span with class and fn org class
local namestr = frame.args.name
frame.args[1] = mw.ustring.gsub(
frame.args[1],
'(<span class="geo%-default">)(<span[^<>]*>[^<>]*</span><span[^<>]*>[^<>]*<span[^<>]*>[^<>]*</span></span>)(</span>)',
'%1<span class="vcard">%2<span style="display:none"> (<span class="fn org">' .. namestr .. '</span>)</span></span>%3'
)
-- then find anything from coordinates parameters to the 'end' and attach the title parameter
frame.args[1] = mw.ustring.gsub(
frame.args[1],
'(¶ms=[^&"<>%[%] ]*) ',
'%1&title=' .. mw.uri.encode(namestr) .. ' '
)
end
end
-- replace the existing indicator with a new indicator using the modified content
frame.args[1] = mw.ustring.gsub(
frame.args[1],
'(<span class="geo%-inline[^"]*">(.+)</span>)\127[^\127]*UNIQ%-%-indicator%-%x+%-%-?QINU[^\127]*\127',
function (inline, coord) return inline .. displaytitle(coord) end
)
return frame.args[1]
end
return coordinates
6162d7e98fcf6faab5809049e0a48bb3e67d88e3
MediaWiki:Common.css
8
73
137
2023-07-03T03:16:17Z
wikipedia>Izno
0
remove font-feature-settings as no longer necessary
css
text/css
/*
* This is the CSS common to all desktop skins on en.Wikipedia.
* Styling inside .mw-parser-output should generally use TemplateStyles.
*/
/* Reset italic styling set by user agent */
cite,
dfn {
font-style: inherit;
}
/* Straight quote marks for <q> */
q {
quotes: '"' '"' "'" "'";
}
/* Avoid collision of blockquote with floating elements by swapping margin and padding */
blockquote {
overflow: hidden;
margin: 1em 0;
padding: 0 40px;
}
/* Consistent size for <small>, <sub> and <sup> */
small {
font-size: 85%;
}
.mw-body-content sub,
.mw-body-content sup {
font-size: 80%;
}
/* Same spacing for indented and unindented paragraphs on talk pages */
.ns-talk .mw-body-content dd {
margin-top: 0.4em;
margin-bottom: 0.4em;
}
/* Reduce page jumps by hiding collapsed/dismissed content */
.client-js .collapsible:not( .mw-made-collapsible).collapsed > tbody > tr:not(:first-child),
/* Avoid FOUC/reflows on collapsed elements. */
/* This copies MediaWiki's solution for T42812 to apply to innercollapse/outercollapse (T325115). */
/* TODO: Use :is() selector at some reasonable future when support is good for Most Clients */
/* Reference: https://gerrit.wikimedia.org/g/mediawiki/core/+/ecda06cb2aef55b77c4b4d7ecda492d634419ead/resources/src/jquery/jquery.makeCollapsible.styles.less#75 */
.client-js .outercollapse .innercollapse.mw-collapsible:not( .mw-made-collapsible ) > p,
.client-js .outercollapse .innercollapse.mw-collapsible:not( .mw-made-collapsible ) > table,
.client-js .outercollapse .innercollapse.mw-collapsible:not( .mw-made-collapsible ) > thead + tbody,
.client-js .outercollapse .innercollapse.mw-collapsible:not( .mw-made-collapsible ) tr:not( :first-child ),
.client-js .outercollapse .innercollapse.mw-collapsible:not( .mw-made-collapsible ) .mw-collapsible-content,
/* Hide charinsert base for those not using the gadget */
#editpage-specialchars {
display: none;
}
/* Make the list of references smaller
* Keep in sync with Template:Refbegin/styles.css
* And Template:Reflist/styles.css
*/
ol.references {
font-size: 90%;
margin-bottom: 0.5em;
}
/* Cite customizations for Parsoid
* Once everything uses the one true parser these are just customizations
*/
span[ rel="mw:referencedBy" ] {
counter-reset: mw-ref-linkback 0;
}
span[ rel='mw:referencedBy' ] > a::before {
content: counter( mw-ref-linkback, lower-alpha );
font-size: 80%;
font-weight: bold;
font-style: italic;
}
a[ rel="mw:referencedBy" ]::before {
font-weight: bold;
content: "^";
}
span[ rel="mw:referencedBy" ]::before {
content: "^ ";
}
.mw-ref > a[data-mw-group=lower-alpha]::after {
content: '[' counter( mw-Ref, lower-alpha ) ']';
}
.mw-ref > a[data-mw-group=upper-alpha]::after {
content: '[' counter( mw-Ref, upper-alpha ) ']';
}
.mw-ref > a[data-mw-group=decimal]::after {
content: '[' counter( mw-Ref, decimal ) ']';
}
.mw-ref > a[data-mw-group=lower-roman]::after {
content: '[' counter( mw-Ref, lower-roman ) ']';
}
.mw-ref > a[data-mw-group=upper-roman]::after {
content: '[' counter( mw-Ref, upper-roman ) ']';
}
.mw-ref > a[data-mw-group=lower-greek]::after {
content: '[' counter( mw-Ref, lower-greek ) ']';
}
/* Styling for jQuery makeCollapsible, matching that of collapseButton */
.mw-parser-output .mw-collapsible-toggle:not(.mw-ui-button) {
font-weight: normal;
padding-right: 0.2em;
padding-left: 0.2em;
}
.mw-collapsible-leftside-toggle .mw-collapsible-toggle {
/* @noflip */
float: left;
}
/* Lists in wikitable data cells are always left-aligned */
.wikitable td ul,
.wikitable td ol,
.wikitable td dl {
/* @noflip */
text-align: left;
}
/* Change the external link icon to a PDF icon for all PDF files */
.mw-parser-output a[href$=".pdf"].external,
.mw-parser-output a[href*=".pdf?"].external,
.mw-parser-output a[href*=".pdf#"].external,
.mw-parser-output a[href$=".PDF"].external,
.mw-parser-output a[href*=".PDF?"].external,
.mw-parser-output a[href*=".PDF#"].external {
background: url("//upload.wikimedia.org/wikipedia/commons/4/4d/Icon_pdf_file.png") no-repeat right;
/* @noflip */
padding: 8px 18px 8px 0;
}
/* System messages styled similarly to fmbox */
/* for .mw-warning-with-logexcerpt, behavior of this line differs between
* the edit-protected notice and the special:Contribs for blocked users
* The latter has specificity of 3 classes so we have to triple up here.
*/
.mw-warning-with-logexcerpt.mw-warning-with-logexcerpt.mw-warning-with-logexcerpt,
div.mw-lag-warn-high,
div.mw-cascadeprotectedwarning,
div#mw-protect-cascadeon {
clear: both;
margin: 0.2em 0;
border: 1px solid #bb7070;
background-color: #ffdbdb;
padding: 0.25em 0.9em;
box-sizing: border-box;
}
/* default colors for partial block message */
/* gotta get over the hump introduced by the triple class above */
.mw-contributions-blocked-notice-partial .mw-warning-with-logexcerpt.mw-warning-with-logexcerpt {
border-color: #fc3;
background-color: #fef6e7;
}
/* Minimum thumb width */
figure[typeof~='mw:File/Thumb'],
figure[typeof~='mw:File/Frame'],
.thumbinner {
min-width: 100px;
}
/* Prevent floating boxes from overlapping any category listings,
file histories, edit previews, and edit [Show changes] views. */
#mw-subcategories,
#mw-pages,
#mw-category-media,
#filehistory,
#wikiPreview,
#wikiDiff {
clear: both;
}
/* Styling for tags in changes pages */
.mw-tag-markers {
font-style: italic;
font-size: 90%;
}
/* Hide stuff meant for accounts with special permissions. Made visible again in
[[MediaWiki:Group-checkuser.css]], [[MediaWiki:Group-sysop.css]], [[MediaWiki:Group-abusefilter.css]],
[[MediaWiki:Group-abusefilter-helper.css]], [[MediaWiki:Group-patroller.css]],
[[MediaWiki:Group-templateeditor.css]], [[MediaWiki:Group-extendedmover.css]],
[[MediaWiki:Group-extendedconfirmed.css]], and [[Mediawiki:Group-autoconfirmed.css]]. */
.checkuser-show,
.sysop-show,
.abusefilter-show,
.abusefilter-helper-show,
.patroller-show,
.templateeditor-show,
.extendedmover-show,
.extendedconfirmed-show,
.autoconfirmed-show,
.user-show {
display: none;
}
/* Hide the redlink generated by {{Editnotice}},
this overrides the ".sysop-show { display: none; }" above that applies
to the same link as well. See [[phab:T45013]]
Hide the images in editnotices to keep them readable in VE view.
Long term, editnotices should become a core feature so that they can be designed responsive. */
.ve-ui-mwNoticesPopupTool-item .editnotice-redlink,
.ve-ui-mwNoticesPopupTool-item .mbox-image,
.ve-ui-mwNoticesPopupTool-item .mbox-imageright {
display: none !important;
}
/* Remove bullets when there are multiple edit page warnings */
ul.permissions-errors {
margin: 0;
}
ul.permissions-errors > li {
list-style: none;
}
/* larger inline math */
span.mwe-math-mathml-inline {
font-size: 118%;
}
/* Make <math display="block"> be left aligned with one space indent for
* compatibility with style conventions
*/
.mwe-math-fallback-image-display,
.mwe-math-mathml-display {
margin-left: 1.6em !important;
margin-top: 0.6em;
margin-bottom: 0.6em;
}
.mwe-math-mathml-display math {
display: inline;
}
@media screen {
/* Put a chequered background behind images, only visible if they have transparency,
* except on main, user, and portal namespaces
*/
body:not(.ns-0):not(.ns-2):not(.ns-100) .gallerybox .thumb img {
background: #fff url(//upload.wikimedia.org/wikipedia/commons/5/5d/Checker-16x16.png) repeat;
}
/* Display "From Wikipedia, the free encyclopedia" in skins that support it,
do not apply to print mode */
#siteSub {
display: block;
}
}
/* Hide FlaggedRevs notice UI when there are no pending changes */
.flaggedrevs_draft_synced,
.flaggedrevs_stable_synced,
/* "Temporary" to remove links in sidebar T255381 */
#t-upload,
/* Hide broken download box on Special:Book pending T285400 */
.mw-special-Book #coll-downloadbox {
display: none;
}
/*
* BELOW HERE THERE BE SOONTOBE TEMPLATESTYLES THINGS;
* SEE [[MediaWiki talk:Common.css/to do]]
*/
/* Infobox template style */
.infobox {
border: 1px solid #a2a9b1;
border-spacing: 3px;
background-color: #f8f9fa;
color: black;
/* @noflip */
margin: 0.5em 0 0.5em 1em;
padding: 0.2em;
/* @noflip */
float: right;
/* @noflip */
clear: right;
font-size: 88%;
line-height: 1.5em;
width: 22em;
}
.infobox-header,
.infobox-label,
.infobox-above,
.infobox-full-data,
.infobox-data,
.infobox-below,
.infobox-subheader,
.infobox-image,
.infobox-navbar,
/* Remove element selector when every .infobox thing is using the standard module/templates */
.infobox th,
.infobox td {
vertical-align: top;
}
.infobox-label,
.infobox-data,
/* Remove element selector when every .infobox thing is using the standard module/templates */
.infobox th,
.infobox td {
/* @noflip */
text-align: left;
}
/* Remove .infobox when element selectors above are removed */
.infobox .infobox-above,
.infobox .infobox-title,
/* Remove element selector when every .infobox thing is using the standard module/templates */
.infobox caption {
font-size: 125%;
font-weight: bold;
text-align: center;
}
.infobox-title,
/* Remove element selector when every .infobox thing is using the standard module/templates */
.infobox caption {
padding: 0.2em;
}
/* Remove .infobox when element selectors above are removed */
.infobox .infobox-header,
.infobox .infobox-subheader,
.infobox .infobox-image,
.infobox .infobox-full-data,
.infobox .infobox-below {
text-align: center;
}
/* Remove .infobox when element selectors above are removed */
.infobox .infobox-navbar {
/* @noflip */
text-align: right;
}
/* Normal font styling for wikitable row headers with scope="row" tag */
.wikitable.plainrowheaders th[scope=row],
.wikitable.plainrowheaders th[scope=rowgroup] {
font-weight: normal;
/* @noflip */
text-align: left;
}
/* Remove underlines from certain links */
.nounderlines a,
.IPA a:link,
.IPA a:visited {
text-decoration: none !important;
}
/* Prevent line breaks in silly places where desired (nowrap)
and links when we don't want them to (nowraplinks a) */
.nowrap,
.nowraplinks a {
white-space: nowrap;
}
/* But allow wrapping where desired: */
.wrap,
.wraplinks a {
white-space: normal;
}
/* texhtml class for inline math (based on generic times-serif class) */
span.texhtml {
font-family: "Nimbus Roman No9 L", "Times New Roman", Times, serif;
font-size: 118%;
line-height: 1;
white-space: nowrap;
/* Force tabular and lining display for texhtml */
font-variant-numeric: lining-nums tabular-nums;
font-kerning: none;
}
span.texhtml span.texhtml {
font-size: 100%;
}
@media screen {
.nochecker .gallerybox .thumb img {
background-image: none;
}
}
/* Put anything you mean to be a sitewide addition above the TemplateStyles
* comment above.
*/
6fb8f3b49a11a996e92a6014fa1eb15459a6daa4
Module:Person height
828
159
309
2023-07-03T19:22:01Z
wikipedia>Frietjes
0
fix for leading zero
Scribunto
text/plain
-- This module implements [[Template:Infobox person/height]]
local p = {}
local function splitsuffix(s)
local suffix = ''
if mw.ustring.match(s,'^(.-)(<sup.*)$') then
local a = mw.ustring.gsub(s, '^(.-)(<sup.*)$', '%1')
local b = mw.ustring.gsub(s, '^(.-)(<sup.*)$', '%2')
s = a
suffix = b .. suffix
end
if mw.ustring.match(s,'^(.-)(%[%[[Cc]ategory:.*)$') then
local a = mw.ustring.gsub(s, '^(.-)(%[%[[Cc]ategory:.*)$', '%1')
local b = mw.ustring.gsub(s, '^(.-)(%[%[[Cc]ategory:.*)$', '%2')
s = a
suffix = b .. suffix
end
return s, suffix
end
local function clean(s)
s = mw.ustring.gsub(s, '[Mm]etre', 'm')
s = mw.ustring.gsub(s, '([^a])meter', '%1m') -- prevents "parameter" from being changed to "param"
s = mw.ustring.gsub(s, '[Cc]enti', 'c') -- changes "centim" to "cm"
s = mw.ustring.gsub(s, 'ms', 'm')
s = mw.ustring.gsub(s, 'm[%.,]', 'm')
s = mw.ustring.gsub(s, '[Ff]eet', 'ft')
s = mw.ustring.gsub(s, 'foot', 'ft')
s = mw.ustring.gsub(s, 'ft[%.,]', 'ft')
s = mw.ustring.gsub(s, '[Ii]nches', 'in')
s = mw.ustring.gsub(s, '[Ii]nch', 'in')
s = mw.ustring.gsub(s, 'ins', 'in')
s = mw.ustring.gsub(s, 'in[%.,]', 'in')
s = mw.ustring.gsub(s, '%[%[[Mm]%]%]s', '[[Metre|m]]')
s = mw.ustring.gsub(s, '%[%[[Mm]|[Mm]%]%]', '[[Metre|m]]')
s = mw.ustring.gsub(s, '%[%[[Cc]m%]%]s', '[[Centimetre|cm]]')
s = mw.ustring.gsub(s, '%[%[[Cc]m|[Cc]m%]%]', '[[Centimetre|cm]]')
s = mw.ustring.gsub(s, '%[%[[Cc]entim|cm%]%]', '[[Centimetre|cm]]')
s = mw.ustring.gsub(s, '%[%[[Ii]n|in%]%]', '[[inch|in]]')
s = mw.ustring.gsub(s, '(%d)%s+[Cc][Mm]', '%1 cm')
s = mw.ustring.gsub(s, '(%d)%s+[Mm]', '%1 m')
s = mw.ustring.gsub(s, '(%d)%s+[Ff][Tt]', '%1 ft')
s = mw.ustring.gsub(s, '(%d)%s+[Ii][Nn]', '%1 in')
s = mw.ustring.gsub(s, '(%d&[Nn][Bb][Ss][Pp];)[Cc][Mm]', '%1cm')
s = mw.ustring.gsub(s, '(%d&[Nn][Bb][Ss][Pp];)[Mm]', '%1m')
s = mw.ustring.gsub(s, '(%d&[Nn][Bb][Ss][Pp];)[Ff][Tt]', '%1ft')
s = mw.ustring.gsub(s, '(%d&[Nn][Bb][Ss][Pp];)[Ii][Nn]', '%1in')
s = mw.ustring.gsub(s, '(%d)%s*[′\']%s*([%d]%d*)%s*[\"″]', '%1 ft %2 in')
return s
end
local function isnumber(s)
if s then
s = mw.ustring.gsub(s, '%+%s*%d+%s*/%s*%d+%s*$', '')
s = mw.ustring.gsub(s, '%s*1%s*/%s*2%s*$', '0.5')
return tonumber(s)
end
return nil
end
local function trimspace(s)
if s then
s = mw.ustring.gsub(s, '^%s*(.-)%s*$', '%1')
end
return s
end
local function force_unit(s, t)
s = mw.ustring.gsub(s, '&[Nn][Bb][Ss][Pp];', '★')
if (t == 'cm') then
s = mw.ustring.gsub(s, '(%d*)%.(%d%d)(%d+[★%s]+)m', '%1%2.%3cm')
s = mw.ustring.gsub(s, '(%d*)%.(%d%d)(%d+[★%s]+)%[%[[Mm]et[re][re]|m%]%]', '%1%2.%3[[centimetre|cm]]')
s = mw.ustring.gsub(s, '(%d*)%.(%d%d)([★%s]+)m', '%1%2%3cm')
s = mw.ustring.gsub(s, '(%d*)%.(%d%d)([★%s]+)%[%[[Mm]et[re][re]|m%]%]', '%1%2%3[[centimetre|cm]]')
s = mw.ustring.gsub(s, '(%d*)%.(%d)([★%s]+)m', '%1%20%3cm')
s = mw.ustring.gsub(s, '(%d*)%.(%d)([★%s]+)%[%[[Mm]et[re][re]|m%]%]', '%1%20%3[[centimetre|cm]]')
s = mw.ustring.gsub(s, '(%d*)%.([★%s]+)m', '%100.%2cm')
s = mw.ustring.gsub(s, '(%d*)%.([★%s]+)%[%[[Mm]et[re][re]|m%]%]', '%100.%2[[centimetre|cm]]')
s = mw.ustring.gsub(s, '^(%s*%d+)([★%s]+)m', '%100%2cm')
s = mw.ustring.gsub(s, '([%(★%s]%d+)([★%s]+)m', '%100%2cm')
s = mw.ustring.gsub(s, '^(%s*%d+)([★%s]+)%[%[[Mm]et[re][re]|m%]%]', '%100%2[[centimetre|cm]]')
s = mw.ustring.gsub(s, '([%(★%s]%d+)([★%s]+)%[%[[Mm]et[re][re]|m%]%]', '%100%2[[centimetre|cm]]')
s = mw.ustring.gsub(s, '0(%d+%.?%d*[★%s]+cm)', '%1')
s = mw.ustring.gsub(s, '0(%d+%.?%d*[★%s]+%[%[[Cc]entimet[re][re]|cm%]%])', '%1')
else
s = mw.ustring.gsub(s, '(%d)(%d%d)%.(%d*[★%s]+)cm', '%1.%2%3m')
s = mw.ustring.gsub(s, '(%d)(%d%d)%.(%d*[★%s]+)%[%[[Cc]entimet[re][re]|cm%]%]', '%1.%2%3[[metre|m]]')
s = mw.ustring.gsub(s, '(%d)(%d%d)([★%s]+)cm', '%1.%2%3m')
s = mw.ustring.gsub(s, '(%d)(%d%d)([★%s]+)%[%[[Cc]entimet[re][re]|cm%]%]', '%1.%2%3[[metre|m]]')
s = mw.ustring.gsub(s, '(%d%d)%.(%d*[★%s]+)cm', '0.%1%2m')
s = mw.ustring.gsub(s, '(%d%d)%.(%d*[★%s]+)%[%[[Cc]entimet[re][re]|cm%]%]', '0.%1%2[[metre|m]]')
s = mw.ustring.gsub(s, '(%d%d)([★%s]+)cm', '0.%1%2m')
s = mw.ustring.gsub(s, '(%d%d)([★%s]+)%[%[[Cc]entimet[re][re]|cm%]%]', '0.%1%2[[metre|m]]')
end
s = mw.ustring.gsub(s, '★', ' ')
return s
end
local function get_convert_args(s, prefer, enforce, ri)
local prefer_m = (prefer or '') == 'm'
local force_m = (enforce or '') == 'm'
local prefer_cm = (prefer or '') == 'cm'
local force_cm = (enforce or '') == 'cm'
ri = (ri or '') == 'cmin' and 'cmin' or ''
unconverted = clean(s or '') -- basic unit cleaning
s = mw.ustring.gsub(unconverted, '&[Nn][Bb][Ss][Pp];', ' ')
local m = mw.ustring.find(s, 'm')
local c = mw.ustring.find(s, 'cm')
local f = mw.ustring.find(s, 'ft')
local i = mw.ustring.find(s, 'in')
if m == nil and f == nil and i == nil then
return '', unconverted
end
local adj = nil
if c ~= nil and f == nil and i == nil then
local n = mw.ustring.sub(s, 1, c - 1)
if isnumber(n) then
if force_m then
local prec = require("Module:Math")._precision(trimspace(n))
adj = (prec == 1) and 'ri3' or 'ri2'
end
if ri ~= '' then
adj = force_m and 'ri2' or 'ri0'
end
return force_m
and {n/100,'m','ftin',0,['abbr']='on', ['adj']=adj}
or {n,'cm','ftin',0,['abbr']='on', ['adj']=adj}, mw.ustring.sub(s, c+2)
end
return '', unconverted
end
if m ~= nil and c == nil and f == nil and i == nil then
local n = mw.ustring.sub(s, 1, m - 1)
if ri ~= '' then
adj = force_cm and 'ri0' or 'ri2'
end
if isnumber(n) then
return force_cm
and {n*100,'cm','ftin',0,['abbr']='on',['adj']=adj}
or {n,'m','ftin',0,['abbr']='on',['adj']=adj}, mw.ustring.sub(s, m+1)
end
return '', unconverted
end
if f ~= nil and i ~=nil and m == nil then
local n1 = mw.ustring.sub(s, 1, f - 1)
local n2 = mw.ustring.sub(s, f+2, i - 1)
if isnumber(n1) and isnumber(n2) then
if ri ~= '' then
adj = 'ri0'
end
return (force_m or prefer_m)
and {n1,'ft',n2,'in', 'm',2,['abbr']='on',['adj']=adj}
or {n1,'ft',n2,'in', 'cm',0,['abbr']='on',['adj']=adj}, mw.ustring.sub(s, i+2)
end
return '', unconverted
end
if f ~= nil and i == nil and m == nil then
local n = mw.ustring.sub(s, 1, f - 1)
if isnumber(n) then
if ri ~= '' then
local n2 = 12*(n - math.floor(n))
adj = 'ri0'
return (force_m or prefer_m)
and {math.floor(n),'ft',n2, 'in','m',2,['abbr']='on',['adj']=adj}
or {math.floor(n),'ft',n2,'in','cm',0,['abbr']='on',['adj']=adj}, mw.ustring.sub(s, f+2)
end
return (force_m or prefer_m)
and {n,'ft','m',2,['abbr']='on'}
or {n,'ft','cm',0,['abbr']='on'}, mw.ustring.sub(s, f+2)
end
return '', unconverted
end
if i ~= nil and f == nil and m == nil then
local n = mw.ustring.sub(s, 1, i - 1)
if isnumber(n) then
if ri ~= '' then
adj = 'ri0'
end
return (force_m or prefer_m)
and {n,'in','m',2,['abbr']='on'}
or {n,'in','cm',0,['abbr']='on'}, mw.ustring.sub(s, i+2)
end
return '', unconverted
end
if force_cm and c == nil then
return '', force_unit(unconverted, 'cm')
end
if force_m and c ~= nil then
return '', force_unit(unconverted, 'm')
end
return '', unconverted
end
function convert(frame, args)
local str, suffix = splitsuffix(args[1] or '')
local targs, str = get_convert_args(str, args['prefer'] or '', args['enforce'] or '', args['ri'] or '')
str = str .. suffix
if type(targs) == 'table' then
return frame:expandTemplate{ title = 'convert', args = targs} .. str
else
return str
end
end
function p.main(frame)
return convert(frame, frame.args[1] and frame.args or frame:getParent().args)
end
return p
eae45d697c1881086eab11f622b4400e5c177c63
Template:Infobox court/doc
10
260
512
2023-07-06T08:40:10Z
wikipedia>Notatimetraveller
0
/* Usage */Added content headquarters
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata -->
{{Lua|Module:Infobox|Module:InfoboxImage|Module:Check for unknown parameters}}
{{tlc|{{BASEPAGENAME}}}} can be used to provide at-a-glance information at the start of an article about a court.
== Usage ==
{{Parameter names example
| court_name
| native_name
| image
| image_upright
| imagesize
| alt
| caption
| image2
| image_upright2
| imagesize2
| alt2
| caption2
| established
| dissolved
| jurisdiction
| location
| headquarters
| coordinates
| motto
| type
| authority
| appealsto
| appealsfrom
| terms
| positions
| budget
| language
| tribunal-type
| website
| chiefjudgetitle
| chiefjudgename
| termstart
| termend
| termend2
| chiefjudgetitle2
| chiefjudgename2
| termstart2
| termend3
| termend4
| chiefjudgetitle3
| chiefjudgename3
| termstart3
| termend5
| termend6
| division_map
| division_map_upright
| division_map_size
| division_map_alt
| division_caption
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox court
| court_name =
| native_name = <!-- native name of the court, if different -->
| image =
| image_upright = <!-- [[Wikipedia:Autosizing images|image scaling factor]] for image, if applicable -->
| imagesize = Image_upright if preferred
| alt =
| caption =
| image2 =
| image_upright2 =
| imagesize2 =
| alt2 =
| caption2 =
| established = <!-- use {{start date|YYYY|MM|DD}} -->
| dissolved = <!-- use {{end date|YYYY|MM|DD}} -->
| jurisdiction = <!-- Official jurisdiction -->
| location = <!-- city, state/province, country -->
| coordinates = <!-- {{coord|45.000|-122.000|display=inline,title}} -->
| motto =
| type = <!-- partisan election/non-partisan election/legislative selection/executive selection/co-option/etc -->
| authority = <!-- constitution/statute/monarch or | at = -->
| appealsto = <!-- appeals from this court go where -->
| appealsfrom = <!-- appeals from what other courts are heard by this -->
| terms = <!-- length of court term for judges -->
| positions = <!-- number of positions/seats on court -->
| budget = <!-- amount of annual budget -->
| language =
| tribunal-type =
| website = <!-- official website. Use {{Tl|URL}} -->
| chiefjudgetitle = <!-- title of the top judge such as chief justice/senior judge -->
| chiefjudgename = <!-- current chief's name -->
| termstart = <!-- year current chief became chief -->
| termend = <!-- lead position ends -->
| termend2 = <!-- jurist term ends -->
| chiefjudgetitle2 = <!-- title of the second top judge if applicable -->
| chiefjudgename2 = <!-- current deputy chief's name -->
| termstart2 = <!-- year current deputy chief became chief -->
| termend3 = <!-- lead position ends -->
| termend4 = <!-- jurist term ends -->
| chiefjudgetitle3 = <!-- title of the second top judge if applicable -->
| chiefjudgename3 = <!-- current deputy chief's name -->
| termstart3 = <!-- year current deputy chief became chief -->
| termend5 = <!-- lead position ends -->
| termend6 = <!-- jurist term ends -->
| division_map = <!-- image for a map of division separations, if applicable -->
| division_map_upright = <!-- [[Wikipedia:Autosizing images|image scaling factor]] for map of division, if applicable -->
| division_map_size = <!-- size of division map above, if applicable -->
| division_map_alt = <!-- alt text for division map above, if applicable -->
| division_caption =
}}
</syntaxhighlight>
{{clear}}
== Example ==
{{Infobox court
| court_name = District Court of New South Wales
| image = Coat of Arms of New South Wales.svg
| alt = Coat of Arms of New South Wales
| image2 = SLNSW 479525 22 Court House Darlinghurst front view SH 571.jpg
| alt2 = Darlinghurst Courthouse, pictured in 1872, a seat of the District Court
| caption2 = [[Darlinghurst Courthouse]], pictured in 1872, a seat of the District Court
| established = 1858
| jurisdiction = [[New South Wales]]
| location = Full time sittings are held in the [[Sydney central business district|Sydney CBD]], and at [[Parramatta]], [[Penrith, New South Wales|Penrith]], [[Campbelltown, New South Wales|Campbelltown]], [[Newcastle, New South Wales|Newcastle]], [[Gosford]], [[Wollongong]] and [[Lismore, New South Wales|Lismore]]. Part time sittings are held in a range of major regional centres.
| type = [[Governor of New South Wales|Vice-regal]] appointment upon nomination by the [[Premier of New South Wales|Premier]] following the advice of the [[Attorney General of New South Wales|Attorney General]] and [[Executive Council of New South Wales|Cabinet]]<!-- partisan election/non-partisan election/legislative selection/executive selection/co-option/etc -->
| authority = [[Parliament of New South Wales|New South Wales Parliament]] via the {{Cite Legislation AU|NSW|act||District Court Act 1973}} (formerly the {{Cite Legislation AU|NSW|act||District Courts Act 1858}})<!-- constitution/statute/monarch-->
| appealsto = [[Supreme Court of New South Wales]] <!-- appeals from this court go where -->
| appealsfrom = [[Local Court of New South Wales]]<!-- appeals from what other courts are heard by this -->
| website = [http://www.lawlink.nsw.gov.au/lawlink/district_court/ll_districtcourt.nsf/pages/dc_index www.lawlink.nsw.gov.au/dc]<!-- official website -->
| chiefjudgetitle = Chief Judge<!-- title of the top judge such as chief justice/senior judge -->
| chiefjudgename = Derek Michael Price {{post-nominals|country=AUS|AM}}<!-- current chief's name -->
| termstart = 2014<!-- year current chief became chief -->
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox court
| court_name = District Court of New South Wales
| image = Coat of Arms of New South Wales.svg
| alt = Coat of Arms of New South Wales
| image2 = SLNSW 479525 22 Court House Darlinghurst front view SH 571.jpg
| alt2 = Darlinghurst Courthouse, pictured in 1872, a seat of the District Court
| caption2 = [[Darlinghurst Courthouse]], pictured in 1872, a seat of the District Court
| established = 1858
| jurisdiction = [[New South Wales]]
| location = Full time sittings are held in the [[Sydney central business district|Sydney CBD]], and at [[Parramatta]], [[Penrith, New South Wales|Penrith]], [[Campbelltown, New South Wales|Campbelltown]], [[Newcastle, New South Wales|Newcastle]], [[Gosford]], [[Wollongong]] and [[Lismore, New South Wales|Lismore]]. Part time sittings are held in a range of major regional centres.
| type = [[Governor of New South Wales|Vice-regal]] appointment upon nomination by the [[Premier of New South Wales|Premier]] following the advice of the [[Attorney General of New South Wales|Attorney General]] and [[Executive Council of New South Wales|Cabinet]]<!-- partisan election/non-partisan election/legislative selection/executive selection/co-option/etc -->
| authority = [[Parliament of New South Wales|New South Wales Parliament]] via the {{Cite Legislation AU|NSW|act||District Court Act 1973}} (formerly the {{Cite Legislation AU|NSW|act||District Courts Act 1858}})<!-- constitution/statute/monarch-->
| appealsto = [[Supreme Court of New South Wales]] <!-- appeals from this court go where -->
| appealsfrom = [[Local Court of New South Wales]]<!-- appeals from what other courts are heard by this -->
| website = [http://www.lawlink.nsw.gov.au/lawlink/district_court/ll_districtcourt.nsf/pages/dc_index www.lawlink.nsw.gov.au/dc]<!-- official website -->
| chiefjudgetitle = Chief Judge<!-- title of the top judge such as chief justice/senior judge -->
| chiefjudgename = Derek Michael Price {{post-nominals|country=AUS|AM}}<!-- current chief's name -->
| termstart = 2014<!-- year current chief became chief -->
}}
</syntaxhighlight>
{{clear}}
== Microformat ==
{{UF-hcard-org}}
== TemplateData ==
{{TemplateData header}}
<templatedata>
{
"params": {
"court_name": {},
"native_name": {},
"image": {},
"image_upright": {},
"imagesize": {},
"caption": {},
"image2": {},
"image_upright2": {},
"imagesize2": {},
"caption2": {},
"dissolved": {},
"coordinates": {},
"motto": {},
"at": {},
"appealsto": {
"aliases": [
"appeals"
]
},
"appealsfrom": {},
"terms": {},
"budget": {},
"chiefjudgetitle": {},
"chiefjudgename": {},
"termstart": {},
"termend": {},
"termend2": {},
"chiefjudgetitle2": {},
"chiefjudgename2": {},
"termstart2": {},
"termend3": {},
"termend4": {},
"alt": {},
"alt2": {},
"established": {},
"authority": {},
"positions": {},
"language": {},
"tribunal-type": {},
"website": {},
"jurisdiction": {},
"location": {},
"type": {},
"chiefjudgetitle3": {},
"chiefjudgename3": {},
"termstart3": {},
"termend5": {},
"termend6": {},
"division_map": {},
"division_map_upright": {},
"division_map_size": {},
"division_map_alt": {},
"division_caption": {}
},
"paramOrder": [
"court_name",
"native_name",
"image",
"image_upright",
"imagesize",
"alt",
"caption",
"image2",
"image_upright2",
"imagesize2",
"alt2",
"caption2",
"established",
"dissolved",
"coordinates",
"motto",
"at",
"authority",
"appealsto",
"appealsfrom",
"terms",
"positions",
"budget",
"language",
"tribunal-type",
"website",
"chiefjudgetitle",
"chiefjudgename",
"termstart",
"termend",
"termend2",
"chiefjudgetitle2",
"chiefjudgename2",
"termstart2",
"termend3",
"termend4",
"jurisdiction",
"location",
"type",
"chiefjudgetitle3",
"chiefjudgename3",
"termstart3",
"termend5",
"termend6",
"division_map",
"division_map_upright",
"division_map_size",
"division_map_alt",
"division_caption"
],
"description": "infobox template for courts",
"format": "block"
}
</templatedata>
== Tracking categories ==
* {{clc|Category:Pages using infobox court with unknown parameters}}
== See also ==
* {{tl|Infobox judge}}
* {{tl|Infobox U.S. federal court}}
{{Organization infoboxes}}
<includeonly>{{sandbox other||
<!-- Categories below this line; interwikis at Wikidata -->
[[Category:Law infobox templates|Court]]
[[Category:Politics and government infobox templates|Court]]
[[Category:Templates that add a tracking category|{{PAGENAME}}]]
}}</includeonly>
67b70e74185af1c43dcbbb33f50bdc81fe45d839
Module:Parameter names example
828
130
251
2023-07-10T09:41:44Z
wikipedia>Gonnym
0
if these are wanted, they should be handled differently (by passing a parameter to this module) as these cause pages to appear as unknown parameters for templates that don't use them
Scribunto
text/plain
-- This module implements {{parameter names example}}.
local p = {}
local function makeParam(s)
local lb = '{'
local rb = '}'
return lb:rep(3) .. s .. rb:rep(3)
end
local function italicize(s)
return "''" .. s .. "''"
end
local function plain(s)
return s
end
function p._main(args, frame)
-- Find how we want to format the arguments to the template.
local formatFunc
if args._display == 'italics' or args._display == 'italic' then
formatFunc = italicize
elseif args._display == 'plain' then
formatFunc = plain
else
formatFunc = makeParam
end
-- Build the table of template arguments.
local targs = {}
for k, v in pairs(args) do
if type(k) == 'number' then
targs[v] = formatFunc(v)
elseif not k:find('^_') then
targs[k] = v
end
end
--targs['nocat'] = 'yes';
--targs['categories'] = 'no';
--targs['demo'] = 'yes';
-- Find the template name.
local template
if args._template then
template = args._template
else
local currentTitle = mw.title.getCurrentTitle()
if currentTitle.prefixedText:find('/sandbox$') then
template = currentTitle.prefixedText
else
template = currentTitle.basePageTitle.prefixedText
end
end
-- Call the template with the arguments.
frame = frame or mw.getCurrentFrame()
local success, result = pcall(
frame.expandTemplate,
frame,
{title = template, args = targs}
)
if success then
return result
else
return ''
end
end
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:Parameter names example'
})
return p._main(args, frame)
end
return p
fdf94fb7a5dc1fabf118d60488a02f1e65b0df24
Module:Wd/i18n
828
277
546
2023-07-10T18:07:36Z
wikipedia>Pppery
0
per edit request
Scribunto
text/plain
-- The values and functions in this submodule should be localized per wiki.
local p = {}
function p.init(aliasesP)
p = {
["errors"] = {
["unknown-data-type"] = "Unknown or unsupported datatype '$1'.",
["missing-required-parameter"] = "No required parameters defined, needing at least one",
["extra-required-parameter"] = "Parameter '$1' must be defined as optional",
["no-function-specified"] = "You must specify a function to call", -- equal to the standard module error message
["main-called-twice"] = 'The function "main" cannot be called twice',
["no-such-function"] = 'The function "$1" does not exist', -- equal to the standard module error message
["malformed-reference"] = "Error: Unable to display the reference properly. See [[Module:wd/doc#References|the documentation]] for details.[[Category:Module:Wd reference errors]]"
},
["info"] = {
["edit-on-wikidata"] = "Edit this on Wikidata"
},
["numeric"] = {
["decimal-mark"] = ".",
["delimiter"] = ","
},
["datetime"] = {
["prefixes"] = {
["decade-period"] = ""
},
["suffixes"] = {
["decade-period"] = "s",
["millennium"] = " millennium",
["century"] = " century",
["million-years"] = " million years",
["billion-years"] = " billion years",
["year"] = " year",
["years"] = " years"
},
["julian-calendar"] = "Julian calendar", -- linked page title
["julian"] = "Julian",
["BCE"] = "BCE",
["CE"] = "CE",
["common-era"] = "Common Era" -- linked page title
},
["coord"] = {
["latitude-north"] = "N",
["latitude-south"] = "S",
["longitude-east"] = "E",
["longitude-west"] = "W",
["degrees"] = "°",
["minutes"] = "'",
["seconds"] = '"',
["separator"] = ", "
},
["values"] = {
["unknown"] = "unknown",
["none"] = "none"
},
["cite"] = {
["version"] = "4", -- increment this each time the below parameters are changed to avoid conflict errors
["web"] = {
-- <= left side: all allowed reference properties for *web page sources* per https://www.wikidata.org/wiki/Help:Sources
-- => right side: corresponding parameter names in (equivalent of) [[:en:Template:Cite web]] (if non-existent, keep empty i.e. "")
[aliasesP.statedIn] = "website",
[aliasesP.referenceURL] = "url",
[aliasesP.publicationDate] = "date",
[aliasesP.retrieved] = "access-date",
[aliasesP.title] = "title",
[aliasesP.archiveURL] = "archive-url",
[aliasesP.archiveDate] = "archive-date",
[aliasesP.language] = "language",
[aliasesP.author] = "author", -- existence of author1, author2, author3, etc. is assumed
[aliasesP.authorNameString] = "author",
[aliasesP.publisher] = "publisher",
[aliasesP.quote] = "quote",
[aliasesP.pages] = "pages", -- extra option
[aliasesP.publishedIn] = "website"
},
["q"] = {
-- <= left side: all allowed reference properties for *sources other than web pages* per https://www.wikidata.org/wiki/Help:Sources
-- => right side: corresponding parameter names in (equivalent of) [[:en:Template:Cite Q]] (if non-existent, keep empty i.e. "")
[aliasesP.statedIn] = "1",
[aliasesP.pages] = "pages",
[aliasesP.column] = "at",
[aliasesP.chapter] = "chapter",
[aliasesP.sectionVerseOrParagraph] = "section",
["external-id"] = "id", -- used for any type of database property ID
[aliasesP.title] = "title",
[aliasesP.publicationDate] = "date",
[aliasesP.retrieved] = "access-date"
}
}
}
p.getOrdinalSuffix = function(num)
if tostring(num):sub(-2,-2) == '1' then
return "th" -- 10th, 11th, 12th, 13th, ... 19th
end
num = tostring(num):sub(-1)
if num == '1' then
return "st"
elseif num == '2' then
return "nd"
elseif num == '3' then
return "rd"
else
return "th"
end
end
p.addDelimiters = function(n)
local left, num, right = string.match(n, "^([^%d]*%d)(%d*)(.-)$")
if left and num and right then
return left .. (num:reverse():gsub("(%d%d%d)", "%1" .. p['numeric']['delimiter']):reverse()) .. right
else
return n
end
end
return p
end
return p
a860785cf3b9ad3ba0c8096d5627eae877d4e9ab
Template:Country data United Kingdom
10
233
458
2023-07-15T21:20:28Z
wikipedia>Skjoldbro
0
navy link
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = United Kingdom
| flag alias = Flag of the United Kingdom.svg
| flag alias-1707 = Naval ensign of Great Britain (1707–1800).svg
| flag alias-air force = Ensign of the Royal Air Force.svg
| flag alias-army = Flag of the British Army.svg
| flag alias-civil = Civil Ensign of the United Kingdom.svg
| flag alias-civil-air = Civil Air Ensign of the United Kingdom.svg
| flag alias-coast guard = Flag of Her Majesty's Coastguard.svg
| flag alias-consulate = UK-Consular.svg
| flag alias-embassy = British Ambassador Ensign.svg
| flag alias-government = Government Ensign of the United Kingdom.svg
| flag alias-marines = Flag of the Royal Marines.svg
| flag alias-military = Flag of the United Kingdom (3-5).svg
| flag alias-naval = Naval Ensign of the United Kingdom.svg
| flag alias-GS = Government Service Ensign.svg
| flag alias-merchant = Civil Ensign of the United Kingdom.svg
| flag alias-RFA = British-Royal-Fleet-Auxiliary-Ensign.svg
| flag alias-RMAS = British Royal Maritime Auxiliary Ensign.svg
| flag alias-RNLI = Flag of the Royal National Lifeboat Institution.svg
| flag alias-naval-1707 = Naval ensign of Great Britain (1707–1800).svg
| flag alias-naval-GS = Government Service Ensign.svg
| flag alias-naval-merchant = Civil Ensign of the United Kingdom.svg
| flag alias-naval-RFA = British-Royal-Fleet-Auxiliary-Ensign.svg
| flag alias-naval-RMAS = British Royal Maritime Auxiliary Ensign.svg
| flag alias-naval-RNLI = Flag of the Royal National Lifeboat Institution.svg
| flag alias-navy = Naval Ensign of the United Kingdom.svg
| link alias-air force = Royal Air Force
| link alias-army = British Army
| link alias-coast guard = His Majesty's Coastguard
| link alias-marines = Royal Marines
| link alias-military = British Armed Forces
| link alias-navy = Royal Navy
| link alias-naval = {{#switch:{{{variant|}}}
| merchant = Merchant Navy (United Kingdom){{!}}Merchant Navy
| reserve = Royal Naval Reserve
| RFA = Royal Fleet Auxiliary
| RMAS = Royal Maritime Auxiliary Service
| RNLI = Royal National Lifeboat Institution
| naval-merchant = Merchant Navy (United Kingdom){{!}}Merchant Navy
| naval-reserve = Royal Naval Reserve
| naval-RFA = Royal Fleet Auxiliary
| naval-RMAS = Royal Maritime Auxiliary Service
| naval-RNLI = Royal National Lifeboat Institution
| #default = Royal Navy
}}
| size = {{{size|}}}
| name = {{#ifeq:{{{name|}}}|Britain|United Kingdom|{{{name|}}}}}
| altlink = {{{altlink|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = civil
| var2 = government
| var3 = 1707
| var4 = civil-air
| var5 = embassy
| var6 = consulate
| var7 = GS
| var8 = merchant
| var9 = RFA
| var10 = RMAS
| var11 = RNLI
| var12 = naval-1707
| var13 = naval-GS
| var14 = naval-merchant
| var15 = naval-RFA
| var16 = naval-RMAS
| var17 = naval-RNLI
| redir1 = UK
| redir2 = U.K.
| redir3 = the United Kingdom
| related1 = Great Britain
| related2 = London
| related3 = Kingdom of Great Britain
| related4 = British Empire
| related5 = United Kingdom of Great Britain and Ireland
| related6 = Kingdom of England
| related7 = Kingdom of Scotland
</noinclude>
}}
f35f7e64c499db65b9894d7fb917c4c07d791aa4
Module:Plain text
828
151
293
2023-07-24T05:28:17Z
wikipedia>Jonesey95
0
keep contents of sub, sup, and underline (see talk)
Scribunto
text/plain
--converts text with wikilinks to plain text, e.g "[[foo|gah]] is [[bar]]" to "gah is bar"
--removes anything enclosed in tags that isn't nested, mediawiki strip markers (references etc), files, italic and bold markup
require[[strict]]
local p = {}
function p.main(frame)
local text = frame.args[1]
local encode = require('Module:yesno')(frame.args.encode)
return p._main(text, encode)
end
function p._main(text, encode)
if not text then return end
text = mw.text.killMarkers(text)
:gsub(' ', ' ') --replace nbsp spaces with regular spaces
:gsub('<br ?/?>', ', ') --replace br with commas
:gsub('<span.->(.-)</span>', '%1') --remove spans while keeping text inside
:gsub('<i.->(.-)</i>', '%1') --remove italics while keeping text inside
:gsub('<b.->(.-)</b>', '%1') --remove bold while keeping text inside
:gsub('<em.->(.-)</em>', '%1') --remove emphasis while keeping text inside
:gsub('<strong.->(.-)</strong>', '%1') --remove strong while keeping text inside
:gsub('<sub.->(.-)</sub>', '%1') --remove subscript markup; retain contents
:gsub('<sup.->(.-)</sup>', '%1') --remove superscript markup; retain contents
:gsub('<u.->(.-)</u>', '%1') --remove underline markup; retain contents
:gsub('<.->.-<.->', '') --strip out remaining tags and the text inside
:gsub('<.->', '') --remove any other tag markup
:gsub('%[%[%s*[Ff][Ii][Ll][Ee]%s*:.-%]%]', '') --strip out files
:gsub('%[%[%s*[Ii][Mm][Aa][Gg][Ee]%s*:.-%]%]', '') --strip out use of image:
:gsub('%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:.-%]%]', '') --strip out categories
:gsub('%[%[[^%]]-|', '') --strip out piped link text
:gsub('([^%[])%[[^%[%]][^%]]-%s', '%1') --strip out external link text
:gsub('^%[[^%[%]][^%]]-%s', '') --strip out external link text
:gsub('[%[%]]', '') --then strip out remaining [ and ]
:gsub("'''''", "") --strip out bold italic markup
:gsub("'''?", "") --not stripping out '''' gives correct output for bolded text in quotes
:gsub('----+', '') --remove ---- lines
:gsub("^%s+", "") --strip leading
:gsub("%s+$", "") --and trailing spaces
:gsub("%s+", " ") --strip redundant spaces
if encode then
return mw.text.encode(text)
else
return text
end
end
return p
8d406c43e8cf1dadf34be7d3b395f44ba4c48b75
Module:Footnotes/anchor id list
828
58
109
2023-08-08T18:24:26Z
wikipedia>Trappist the monk
0
Scribunto
text/plain
require('strict');
local data = mw.loadData ('Module:Footnotes/anchor id list/data');
local whitelist = mw.loadData ('Module:Footnotes/whitelist');
local Lang_obj = mw.language.getContentLanguage(); -- used by template_list_add() to uppercase first letter of template name TODO: better way to do that?
local redirects_date = {
['date'] = true,
['datetomos'] = true,
['formatdate'] = true,
['isotodmymdy'] = true,
['isotomos'] = true,
}
local redirects_patent = { -- special case cs1-like templates because uses different parameters for name and date in anchor ID
['Cite patent'] = true,
['Citeref patent'] = true,
['Ref patent'] = true,
}
local redirects_sfnref = {
['sfnref'] = true,
['harvid'] = true,
}
local aliases_author = { -- these use pseudo-patterns in the same way as cs1|2; '#' represents 1 or more enumerator digits
'last#',
'author#',
'surname#',
'author-last#',
'author#-last',
'subject#',
'host#',
}
local aliases_contributor = {
'contributor#',
'contributor-last#',
'contributor#-last',
'contributor-surname#',
'contributor#-surname',
}
local aliases_editor = {
'editor#',
'editor-last#',
'editor#-last',
'editor-surname#',
'editor#-surname',
}
local aliases_harvc_author = {
'last#',
'author#',
}
local aliases_inventor = { -- cite patent
'inventor#',
'inventor-last#',
'inventor#-last',
'inventor-surname#',
'inventor#-surname',
'invent#',
'invent-#',
}
local alias_patterns_date = { -- normal lua patterns for most cs1|2-like templates
'|%s*year%s*=%s*',
'|%s*date%s*=%s*',
'|%s*publication%-?date%s*=%s*',
'|%s*air%-?date%s*=%s*',
}
local alias_patterns_harvc_date = { -- normal lua patterns for harvc template
'|%s*anchor%-year%s*=%s*',
'|%s*year%s*=%s*',
}
local alias_patterns_patent_date = { -- normal lua patterns for cite patent templates
'|%s*issue%-date%s*=%s*',
'|%s*gdate%s*=%s*',
'|%s*publication%-date%s*=%s*',
'|%s*pubdate%s*=%s*',
}
local patterns_date = { -- normal lua patterns
-- '(%d%d%d%d–%d%d%d%d%l?)$', -- YYYY–YYYY four-digit year range at end (Season YYYY–YYYY); with or without dab
'(%d%d%d%d)%D+(%d%d%d%d%l?)$', -- any range with four-digit years; with or without dab; not two captures
'^(%d%d%d%d–%d%d%l?)$', -- YYYY–YY two-digit year range; with or without dab
'^(c%. %d%d%d%d?%l?)$', -- three- or four-digit circa year; with or without dab
'(%d%d%d%d?%l?)$', -- three- or four-digit year at end of date (dmy or mdy); with or without dab
'^(%d%d%d%d?%l?)', -- three- or four-digit year at beginning of date (ymd or YYYY); with or without dab
'^(n%.d%.%l?)$', -- 'no date' with dots; with or without dab
'^(nd%l?)$', -- 'no date' without dots; with or without dab
}
local patterns_tags = {
'<nowiki>.-</nowiki>',
'<!%-%-.-%-%->',
'<pre>.-</pre>',
'<syntaxhighlight.->.-</syntaxhighlight>',
'<source.->.-</source>', -- deprecated alias of syntaxhighlight tag
}
local template_skip = { -- templates to be skipped for whatever reason; mostly because they resemble cs1-like templates
['Citation-attribution'] = true,
}
local Article_content;
local anchor_id_list = {}; -- exported tables
local template_list = {};
local article_whitelist = {};
--[[--------------------------< A R T I C L E _ C O N T E N T _ G E T >----------------------------------------
get article content, remove certain html-like tags and their content so that this code doesn't include any citation
templates inside the tags as valid tagets; they are not.
]]
local function article_content_get ()
if not Article_content then
Article_content = mw.title.getCurrentTitle():getContent() or ''; -- get the content of the article or ''; new pages edited w/ve do not have 'content' until saved; ve does not preview; phab:T221625
for _, tag in ipairs (patterns_tags) do
Article_content = Article_content:gsub (tag, ''); -- remove certain html-like tags and their content
end
end
end
--[[--------------------------< S F N R E F _ G E T >----------------------------------------------------------
make an anchor id from the contents of {{sfnref}} or {{harvid}}. this function assumes that {{sfnref}} and {{harvid}}
are correctly formed.
]]
local function sfnref_get (template)
template = template:gsub ('{{%s*(.-)%s*}}', '%1'); -- strip bounding template markup and trim
local parts = mw.text.split (template, '%s*|%s*'); -- split at the pipe and remove extraneous space characters
local anchor_id = {};
if redirects_sfnref[parts[1]:lower()] then
anchor_id[1] = 'CITEREF';
else
return nil; -- not an sfnref or harvid template
end
local i = 2; -- indexer into parts{} table
local j = 2; -- indexer into anchor_id{} table which already has 'CITEREF' at [1]
while parts[i] and 7 > j do -- loop through what should be just positional parameters for names and year (2-6 four names and a date)
if not parts[i]:find ('=') then -- look for equal sign (named paraneter in a template that doesn't support named parameters)
anchor_id[j] = parts[i]; -- positional parameters are saved
j = j+1; -- bump the anchor_id{} indexer
end
i = i+ 1; -- bump the parts{} indexer
end
return table.concat (anchor_id, '');
end
--[[--------------------------< D A T E _ G E T >--------------------------------------------------------------
extract year from one of |year=, |date=, |publicationdate=, or |publication-date in that order. Does not error
check (that is left to the cs1|2 templates to do)
also gets date from |<date alias>={{date|...}}
]]
local function date_get (template, aliases)
local rvalue;
for _, pattern in ipairs (aliases) do -- spin through the date alias patterns
rvalue = tostring(template):match (pattern); -- is this |<date alias>= used (tostring() because something makes match() think template is a table)
if rvalue then
rvalue = tostring(template):match (pattern .. '(%b{})'); -- is rvalue a template?
if rvalue then
rvalue = rvalue:gsub ('{{%s*(.-)%s*}}', '%1'); -- strip bounding template markup and trim
local parts = mw.text.split (rvalue, '%s*|%s*'); -- split at the pipe and remove extraneous space characters
if redirects_date[parts[1]:lower()] then -- if parts[1] names {{date}} or redirect
rvalue = parts[2]; -- assume that date template is properly formed, first positional parameter is the date
else
return ''; -- |date= holds some other template than {{date}} or redirect
end
else
rvalue = template:match (pattern .. '([^|}]+)');
if rvalue then -- if rvalue is something
rvalue = mw.text.trim (rvalue); -- trim it
end
if not rvalue or '' == rvalue then -- if rvale was nothing or trimed to nothing
rvalue = nil; -- ensure that it is unset so we can try the next parameter in the list
end
end
if rvalue then
for _, pattern in ipairs (patterns_date) do -- spin through the recognized date formats
-- date = rvalue:match (pattern); -- attempt to extract year portion according to the pattern
local date, date2 = rvalue:match (pattern); -- attempt to extract year portion according to the pattern; <date2> gets second year in any range
if date then
if date2 then -- when a second year
date = table.concat ({date, '–', date2}); -- build a date range
end
return date; -- matched so return;
end
end
break; -- found a date but it was malformed so abandon
end
end
end
return ''; -- no date param or date param doesn't hold a recognized date; empty string for concatenation
end
--[[--------------------------< V N A M E S _ G E T >----------------------------------------------------------
extract names from |vauthors= or |veditors=; there is no |vcontributors= parameter.
splits the v parameter value at the comma; correctly handles accept-as-witten markup when used to wrap a comma-
separated names (corporate)
]]
local function vnames_get (params, vparam)
local vnames = {}; -- first four author or editor names go here
local split = {}; -- temp table to assist in decoding accept-as-witten-markup
if params[vparam] then -- test for |vauthors= or |veditor=
split = mw.text.split (params[vparam], '%s*,%s*'); -- this will separate portions of ((Black, Brown, White, an Co.))
local i = 1; -- an indexer
while split[i] do
if split[i]:match ('^%(%(.*[^%)][^%)]$') then -- first segment of comma-separated accept-as-witten; this segment has the opening doubled parens
local name = split[i];
i=i+1; -- bump indexer to next segment
while split[i] do
name = name .. ', ' .. split[i]; -- concatenate with previous segments
if split[i]:match ('^.*%)%)$') then -- if this table member has the closing doubled parens
break; -- and done reassembling so
end
i=i+1; -- bump indexer
end
table.insert (vnames, name); -- and add accept-as-witten name to the vnames table
else
table.insert (vnames, split[i]); -- and add name to the vnames table
end
i=i+1; -- bump indexer
if 5 == i then break; end -- limit to four names
end
for i, vname in ipairs (vnames) do
if not vname:match ('%(%(.-%)%)') then -- without accept-this-value-as-written markup
vnames[i] = vname:gsub ('(.-)%s+%u+$', '%1'); -- extract and save surname(s)
end
end
for i, vname in ipairs (vnames) do -- repeat, this time for accept-this-value-as-written markup
vnames[i] = vname:gsub ('%(%((.-)%)%)', '%1'); -- remove markup if present and save the whole name
end
end
return 0 ~= #vnames and table.concat (vnames) or nil -- return a concatenation of the vnames; nil else
end
--[[--------------------------< N A M E S _ G E T >------------------------------------------------------------
cs1|2 makes anchor id from contributor, author, or editor name-lists in that order
get the names from the cs1|2 template; if there are no contributor names, try author names, then try editor names.
returns concatenated names in enumeration order when successful; nil else
empty name (nameholding parameter n is present without value) and missing name (nameholding parameter n is not
present) are included as empty string with all other names
]]
local function names_get (params, aliases_list)
local names = {}; -- first four author or editor names go here
local enum_alias; -- alias with '#' replaced with a digit
for enum=1, 4 do -- four names only
for i, alias in ipairs (aliases_list) do
if not names[enum] then -- hanven't found a previous alias with this [enum]? see if we can find this alias with this enum
enum_alias = alias:gsub ('#', enum); -- replace '#' to make 'lastn'
if 1 == enum then -- because |last= and last1= are exact aliases
if params[enum_alias] then -- test |last1= first
names[enum] = params[enum_alias]; -- found so save the value assigned to |last1=
break; -- next enum
else
enum_alias = alias:gsub ('#', ''); -- replace '#' to make 'last'
if params[enum_alias] then
names[enum] = params[enum_alias]; -- found so save the value assigned to |last=
break; -- next enum
end
end
else -- here for enum 2, 3, 4
if params[enum_alias] then
names[enum] = params[enum_alias]; -- found so save the value assigned to |lastn=
break; -- next enum
end
end
end
end
end
for enum=1, 4 do -- spin through the names table and
local name = names[enum];
if not name then -- when nameholding parameter n is not present (nil)
name = ''; -- convert to empty string for concatenation
end
name = name:gsub('%(%((.-)%)%)', '%1'); -- remove accept-as-written markup if present
names[enum] = name; -- save the modified name
end
local name_str = table.concat (names); -- concatenate the names
return '' ~= name_str and name_str or nil; -- return the concatenation if not empty string; nil else
end
--[[--------------------------< T E M P L A T E _ S T R I P >--------------------------------------------------
removes the citation or havrc template's {{ and }} markup then removes, in whole, any templates found inside the
citation or harvc template.
Templates are not allowed in parameters that are made part of COinS metadata; yet, they will appear. cs1|2 does
not see the template markup but instead sees the result of the template as html. cs1|2 strips the html which
leaves the displayed value for the anchor id. We can't do that here so, because templates aren't allowed in
parameters, we simply discard any templates found in the cs1|2 template.
this may leave a |lastn= parameter empty which will be treated as if it were really empty as cs1|2 do (three authors,
|last2= empty -> CITEREFLast1Last3YYYY (the harv and sfn render: 'Last1, & Last3 YYYY' with CITEREFLast1Last3YYYY).
]]
local function template_strip (template)
template = template:gsub ('^{{%s*', ''):gsub ('%s*}}$', '', 1); -- remove outer {{ and }} (cs1|2 template delimiters with trailing/leading whitespace)
template = template:gsub ('%b{}', ''); -- remove any templates from the cs1|2 template
return template;
end
--[[--------------------------< E S C A P E _ L U A _ M A G I C _ C H A R S >----------------------------------
Returns a string where all of lua's magic characters have been escaped. This is important because functions like
string.gsub() treat their pattern and replace strings as patterns, not literal strings.
]]
local function escape_lua_magic_chars (argument)
argument = argument:gsub("%%", "%%%%"); -- replace % with %%
argument = argument:gsub("([%^%$%(%)%.%[%]%*%+%-%?])", "%%%1"); -- replace all other lua magic pattern characters
return argument;
end
--[=[-------------------------< W I K I L I N K _ S T R I P >--------------------------------------------------
Wikilink markup does not belong in an anchor id and can / does confuse the code that parses apart citation and
harvc templates so here we remove any wiki markup:
[[link|label]] -> label
[[link]] -> link
]=]
local function wikilink_strip (template)
for wikilink in template:gmatch ('%[%b[]%]') do -- get a wikilink
template = template:gsub ('%[%b[]%]', '__57r1P__', 1); -- install a marker
if wikilink:match ('%[%[.-|(.-)%]%]') then
wikilink = wikilink:match ('%[%[.-|(.-)%]%]'); -- extract label from complex [[link|label]] wikilink
else
wikilink = wikilink:match ('%[%[(.-)%]%]'); -- extract link from simple [[link]] wikilinks
end
wikilink = escape_lua_magic_chars (wikilink); -- in case there are lua magic characters in wikilink
template = template:gsub ('__57r1P__', wikilink, 1); -- replace the marker with the appropriate text
end
return template;
end
--[[--------------------------< T E M P L A T E _ N A M E _ G E T >--------------------------------------------
return the citation or harvc template's name; convert to lower case and trim leading and trailing whitespace;
when the template is a sandbox the subpage portion of the template name is omitted from the returned template name
{{Cite book/new |...}} returns cite book
]]
local function template_name_get (template)
local template_name = template:match ('^{{%s*([^/|}]+)'); -- get template name; ignore subpages ~/new, ~/sandbox; parser functions
if not template_name or template_name:match ('^#') then -- parser functions, magic words don't count as templates
return nil; -- could not get template name from (possibly corrupt) template; extraneous opening { mid template can cause this;
end;
template_name = template_name:gsub ('%s*$', ''); -- trim trailing whitespace; leading whitespace already removed
return Lang_obj:ucfirst (template_name); -- first character in template name must be uppercase (same as canonical template name) TODO: better way to do this?
end
--[[--------------------------< T E M P L A T E _ P A R A M S _ G E T >----------------------------------------
parse apart a template's parameters and store in the params table where key is the parameter's name and value is
the parameter's value; empty parameters are not saved
]]
local function template_params_get (template, params_t)
template = wikilink_strip (template); -- because piped wikilinks confuse code that builds params_t{} and because wikilinks not allowed in an anchor id
-- strip templates after getting |ref= value because |ref={{sfnref}} and |ref={{harvid}} are allowed
template = template_strip (template); -- because template markup can confuse code that builds params_t{} and because templates in name parameters are not allowed
local temp_t = mw.text.split (template, '%s*|%s*'); --split on the pipe
for _, param in ipairs (temp_t) do
if param:find ('=', 1, true) then -- a named parameter?
local k, v = param:match ('%s*([^=]-)%s*=%s*([^|}]+)');
if v then -- there must be a value
if '' ~= v and not v:match ('^%s$') then -- skip when value is empty string or only whitespace
params_t[k] = mw.text.trim (v); -- add trimmed value else
end
end
end
end
end
--[[--------------------------< C I T E R E F _ M A K E _ H A R V C >------------------------------------------
makes anchor_id from {{harvc}} or redirects
]]
local function anchor_id_make_harvc (template)
local date = date_get (template, alias_patterns_harvc_date); -- get date; done here because might be in {{date}}; return date if valid; empty string else
local anchor_id;
local params = {}; -- table of harvc parameters
local id; -- custom anchor id for this {{harvc}} template
id = template:match ('|%s*id%s*=%s*(%b{})'); -- in case |id={{sfnref}}; done here because templates will be stripped
template_params_get (template, params); -- build a table of template parameters and their values; this strips wikilinks and templates
if id then -- when set is {{sfnref}} or {{harvid}} template
return sfnref_get (id); -- returns content of {{sfnref}} or {{harvid}}; nil else
end
if params.id then -- custom anchor for this {{harvc}} template (text)
return params.id; -- |id= value as written
end
anchor_id = names_get (params, aliases_harvc_author); -- get the harvc contributor names
if anchor_id then -- if names were gotten
return 'CITEREF' .. anchor_id .. date;
end
return nil; -- no names; no anchor_id
end
--[[--------------------------< A N C H O R _ I D _ M A K E _ W R A P P E R >----------------------------------
for wrapper templates
inspect externally visible |ref= to decide what to do:
|ref= - empty or missing: get names and date from whitelist defaults; override defaults from externally visible template parameters
|ref=harv - same as empty or missing
|ref={{SfnRef|name|name|name|name|year}} - assemble an anchor id from {{sfnref}} positional parameters
|ref={{Harvid|name|name|name|name|year}} - assemble an anchor id from {{harvid}} positional parameters
|ref=none - skip; do nothing because an anchor id intentionally suppressed; TODO: keep with a type code of '0'?
|ref=<text> - save param value because may match an anchor id override value in {{harv}} template |ref= parameter or {{harvc}} |id= parameter
]]
local function anchor_id_make_wrapper (template)
local ref; -- content of |ref=
local template_name; -- name of the template
local anchor_id; -- the assembled anchor id from this template
local date;
local name_default;
local date_default;
local vol;
local params = {}; -- table of template parameters
template_name = template_name_get (template); -- get first char uppercase trimmed template name; ignore subpages ~/new, ~/sandbox
if not template_name or template_skip[template_name] then
return nil; -- could not extract template name from (possibly corrupted) template (extraneous opening { in the template will cause this)
end
date = date_get (template, alias_patterns_date); -- get date; done here because might be in {{date}}
-- if '' == date then
-- date = whitelist.wrapper_templates[template_name][2] or ''; -- no externally visible date so get default date
-- end
ref = template:match ('|%s*ref%s*=%s*(%b{})'); -- first look for |ref={{sfnref}} or |ref={{harvid}} because we will strip templates from the wrapper template
if not ref then
if template:match ('|%s*ref%s*=([^|}]+)') then -- |ref={{template}} not found; if there is a |ref= param with an assigned value
ref = template:match ('|%s*ref%s*=([^|}]+)'); -- get the value; whitespace is a 'value'
if ref then -- nil when |ref=|... or when |ref=}} (no spaces between assignment operator and pipe or closing brace)
ref = mw.text.trim (ref); -- something, could be just whitespace, so trim leading / trailing whitespace
if '' == ref then -- trimming a string of whitespace makes an empty string
ref = nil; -- make empty ref same as missing ref
end
end
end
end
template_params_get (template, params); -- build a table of template parameters and their values
if whitelist.wrapper_templates[template_name][1] then -- is this wrapper a simple-default wrapper?
name_default = whitelist.wrapper_templates[template_name][1]; -- get the default names
date_default = whitelist.wrapper_templates[template_name][2]; -- get the default date
else
vol = params['volume'] or 'default';
if not whitelist.wrapper_templates[template_name][vol] then -- make sure this volume exists
vol = 'default'; -- doesn't exist, use default volume
end
name_default = whitelist.wrapper_templates[template_name][vol][1]; -- get the default names
date_default = whitelist.wrapper_templates[template_name][vol][2]; -- get the default date
end
if 'harv' == ref or not ref then -- |ref=harv specified or |ref= missing or empty
anchor_id = names_get (params, aliases_contributor) or -- get contributor, author, or editor names
names_get (params, aliases_author) or
vnames_get (params, 'vauthors') or -- |vauthors=
names_get (params, aliases_editor) or
vnames_get (params, 'veditors') or -- |veditors=
name_default; -- default names from whitelist
-- whitelist.wrapper_templates[template_name][1]; -- default names from whitelist
if '' == date then -- if date not provided in the template
date = date_default; -- use the default date from whitelist
end
if anchor_id then -- if names were gotten
anchor_id = 'CITEREF' .. anchor_id .. date;
end
elseif ref:match ('%b{}') then -- ref holds a template
anchor_id = sfnref_get (ref); -- returns content of {{sfnref}} or {{harvid}}; nil else
elseif 'none' == ref then -- |ref=none
return nil; -- anchor id expicitly suppressed
else
anchor_id = ref; -- |ref=<text> may match an anchor id override value in {{harv}} template |ref= parameter
end
return anchor_id; -- anchor_id text; nil else
end
--[[--------------------------< A N C H O R _ I D _ M A K E _ C S 1 2 >----------------------------------------
for cs1|2 template and cs1-like templates
inspect |ref= to decide what to do:
|ref= - empty or missing: get names and date from template parameters; all cs1|2 create CITEREF anchor IDs
|ref=harv - get names and date from template parameters
|ref={{SfnRef|name|name|name|name|year}} - assemble an anchor id from {{sfnref}} positional parameters
|ref={{Harvid|name|name|name|name|year}} - assemble an anchor id from {{harvid}} positional parameters
|ref=none - skip; do nothing because an anchor id intentionally suppressed; TODO: keep with a type code of '0'?
|ref=<text> - save param value because may match an anchor id override value in {{harv}} template |ref= parameter or {{harvc}} |id= parameter
]]
local function anchor_id_make_cs12 (template)
local ref; -- content of |ref=
local template_name; -- name of the template
local anchor_id; -- the assembled anchor id from this template
local date;
local params = {}; -- table of template parameters
template_name = template_name_get (template); -- get first char uppercase trimmed template name; ignore subpages ~/new, ~/sandbox
if not template_name or template_skip[template_name] then
return nil; -- could not extract template name from (possibly corrupted) template (extraneous opening { in the template will cause this)
end
if redirects_patent[template_name] then
date = date_get (template, alias_patterns_patent_date); -- get date; done here because might be in {{date}}
else
date = date_get (template, alias_patterns_date);
end
ref = template:match ('|%s*ref%s*=%s*(%b{})'); -- first look for |ref={{sfnref}} or |ref={{harvid}} because we will strip templates from the cs1|2 template
if not ref then
if template:match ('|%s*ref%s*=([^|}]+)') then -- |ref={{template}} not found; if there is a |ref= param with an assigned value
ref = template:match ('|%s*ref%s*=([^|}]+)'); -- get the value; whitespace is a 'value'
if ref then -- nil when |ref=|... or when |ref=}} (no spaces between assignment operator and pipe or closing brace)
ref = mw.text.trim (ref); -- something, could be just whitespace, so trim leading / trailing whitespace
if '' == ref then -- trimming a string of whitespace makes an empty string
ref = nil; -- make empty ref same as missing ref
end
end
end
end
template_params_get (template, params); -- build a table of template parameters and their values
if not ref then -- |ref= not set, might be cite LSA which doesn't support |ref=
if 'cite lsa' == template_name then
return 'CITEREF' .. (params.last or '') .. (params.year or ''); -- cite LSA always creates an anchor id using only |last= and |year= (no aliases)
end
end
if 'harv' == ref or not ref then -- |ref=harv specified or |ref= missing or empty
if redirects_patent[template_name] then -- if this is a cite patent template
anchor_id = names_get (params, aliases_inventor); -- inventor names only
else -- cs1|2 template
anchor_id = names_get (params, aliases_contributor) or -- get contributor, author, or editor names
names_get (params, aliases_author) or
vnames_get (params, 'vauthors') or -- |vauthors=
names_get (params, aliases_editor) or
vnames_get (params, 'veditors'); -- |veditors=
end
if anchor_id then -- if names were gotten
anchor_id = 'CITEREF' .. anchor_id .. date;
end
elseif ref:match ('%b{}') then -- ref holds a template
anchor_id = sfnref_get (ref); -- returns content of {{sfnref}} or {{harvid}}; nil else
elseif 'none' == ref and not redirects_patent[template_name] then -- |ref=none; not supported by cite patent
return nil; -- anchor id expicitly suppressed
else
anchor_id = ref; -- |ref=<text> may match an anchor id override value in {{harv}} template |ref= parameter
end
return anchor_id; -- anchor_id text; nil else
end
--[[--------------------------< L I S T _ A D D >--------------------------------------------------------------
adds an <item> to <list> table; for anchor IDs, the boolean <encode> argument must be set true; no return value
]]
local function list_add (item, list, encode)
if item then -- if there was an item
if encode then -- for anchor IDs ...
item = mw.uri.anchorEncode (item); -- encode to remove wikimarkup, convert spaces to underscores etc
end
if not list[item] then -- if not already saved
list[item] = 1; -- save it
else -- here when this item already saved
list[item] = list[item] + 1; -- to indicate that there are multiple items
end
end
end
--[[--------------------------< A N C H O R _ I D _ M A K E _ A N C H O R >------------------------------------
make anchor IDs from {{anchor}}; there may be more than one because {{anchor}} is not limited to the number of
anchors it may hold.
]]
local function anchor_id_make_anchor (template, anchor_id_list)
template = template:gsub ('^{{[^|]+|', ''):gsub ('}}$', '', 1); -- remove outer {{ and }} and template name
template = wikilink_strip (template); -- strip any wikilink markup (there shouldn't be any but just in case)
local params = {};
local anchor_id;
for param in template:gmatch ('%b{}') do -- loop through the template; remove and save templates (presumed to be sfnref or harvid)
table.insert (params, param); -- save it
template = template:gsub ('%b{}', '', 1); -- remove it from source template
end
for _, t in ipairs (params) do -- spin through the templates in params
anchor_id = sfnref_get (t); -- attempt to decode {{sfnref}} and {{harvid}}
if anchor_id then -- nil when not {{sfnref}} or {{harvid}}
list_add (anchor_id, anchor_id_list, true); -- add anchor ID to the list
end
end
template = template:gsub ('|%s*|', '|'); -- when pipe follows pipe with or without white space, remove extraneous pipe
template = template:gsub ('^|', ''):gsub('|$', ''); -- remove extraneous leading and trailing pipes
params = mw.text.split (template, '%s*|%s*'); -- split at the pipe and remove extraneous space characters
for _, t in ipairs (params) do -- spin through the anchor IDs
anchor_id = mw.text.trim (t); -- trim white space
if '' ~= anchor_id then -- should always have something
list_add (anchor_id, anchor_id_list, true); -- add anchor ID to the list
end
end
end
--[[--------------------------< T E M P L A T E _ L I S T _ A D D >--------------------------------------------
makes a list of templates use in the article.
]]
local function template_list_add (template)
local template = template:match ('{{%s*(.-)[|}]'); -- keep the case of the template - this is different from template_name_get()
if template and not template:match ('^#') then -- found a template or magic word; ignore magic words
template=mw.text.trim (template); -- trim whitespace
template = Lang_obj:ucfirst (template); -- first character in template name must be uppercase (same as canonical template name) TODO: better way to do this?
list_add (template, template_list); -- add to list with (unused) tally
end
end
--[[--------------------------< A N C H O R _ I D _ L I S T _ M A K E >----------------------------------------
makes a list of anchor ids from cs1|2, cs1|2-like, vcite xxx, harvc, anchor, wikicite templates
Because cs1|2 wrapper templates can, and often do, hide the author and date parameters inside the wrapper,
these parameters are not available in the article's wikisource so {{harv}}, {{sfn}}, and {{harvc}} templates that
link correctly to those wrapper templates will incorrectly show error messages. Use |ignore-err=yes in the {{harv}},
{{sfn}}, and {{harvc}} templates to supress the error message.
creates a list of templates used in the article for use with the whitelist
creates a list of article-local whitelisted anchor IDs from {{sfn whitelist}}
]]
local function anchor_id_list_make ()
article_content_get (); -- attempt to get this article's content
if '' == Article_content then -- when there is no article content
return ''; -- no point in continuing
end
local template; -- place to hold the template that we found
local template_name;
local anchor_id; -- place to hold an anchor id as it is extracted / decoded
local find_pattern = '%f[{]{{[^{]';
local tstart, tend = Article_content:find (find_pattern); -- find the first template; do not find template variables: {{{template var|}}}
while tstart do
template = Article_content:match ('%b{}', tstart); -- get the whole template
if not template then
break; -- template is nil for some reason (last template missing closing }} for example) so declare ourselves done
end
template_name = template_name_get (template); -- get first char uppercase trimmed template name; ignore subpages ~/new, ~/sandbox
template_list_add (template); -- add this template's name to the list
if data.known_templates_cs12 [template_name] then
anchor_id = anchor_id_make_cs12 (template); -- extract an anchor id from this template
list_add (anchor_id, anchor_id_list, true)
elseif data.known_templates_vcite [template_name] then
local ref = template:match ('|%s*ref%s*=%s*(%b{})'); -- first look for |ref={{sfnref}} or |ref={{harvid}} because we will strip templates from the vcite template
if ref then -- |ref={{template}}
anchor_id = sfnref_get (ref); -- returns content of {{sfnref}} or {{harvid}}; nil else
list_add (anchor_id, anchor_id_list, true);
else
local params = {};
template_params_get (template, params); -- build a table of template parameters and their values
anchor_id = params['ref']; -- when both set, vcite uses value from |ref=
if not anchor_id and params['harvid'] then
anchor_id = 'CITEREF' .. params['harvid']; -- in vcite, |harvid= auto-adds 'CITEREF' prefix to the value in |harvid=
end
list_add (anchor_id, anchor_id_list, true);
end
elseif data.known_templates_harvc [template_name] then
anchor_id = anchor_id_make_harvc (template); -- extract an anchor id from this template
list_add (anchor_id, anchor_id_list, true);
elseif data.known_templates_wikicite [template_name] then
local ref = template:match ('|%s*ref%s*=%s*(%b{})'); -- first look for |ref={{sfnref}} or |ref={{harvid}}
if ref then
anchor_id = sfnref_get (ref);
elseif template:match ('|%s*ref%s*=([^|}]+)') then
anchor_id = template:match ('|%s*ref%s*=([^|}]+)'); -- plain-text
elseif template:match ('|%s*id%s*=%s*(%b{})') then
ref = template:match ('|%s*id%s*=%s*(%b{})');
anchor_id = 'Reference-' .. sfnref_get (ref);
elseif template:match ('|%s*id%s*=([^|}]+)') then
anchor_id = 'Reference-' .. template:match ('|%s*id%s*=([^|}]+)'); -- plain-text
else
anchor_id = nil; -- no matches, ensure that anchor_id has no value
end
if anchor_id then
list_add (anchor_id, anchor_id_list, true);
end
elseif data.known_templates_anchor [template_name] then
anchor_id_make_anchor (template, anchor_id_list); -- extract anchor ids from this template if any
elseif data.known_templates_sfn_whitelist [template_name] then
template = template:gsub ('^{{[^|]+|', ''):gsub ('}}$', '', 1); -- remove outer {{ and }} and template name
template = mw.text.trim (template, '%s|'); -- trim leading trailing white space and pipes
template = mw.text.split (template, '%s*|%s*'); -- make a table of the template's parameters
for _, anchor_id in ipairs (template) do -- spin through this template's parameter
if '' ~= anchor_id and not article_whitelist[anchor_id] then
anchor_id = mw.uri.anchorEncode (anchor_id)
article_whitelist[anchor_id] = 1; -- add to the whitelist
end
end
elseif template_name and whitelist.wrapper_templates[template_name] then
anchor_id = anchor_id_make_wrapper (template); -- extract an anchor id from this template if possible
list_add (anchor_id, anchor_id_list, true);
elseif template_name and template_name:match ('^Cit[ea]') then -- not known, not known wrapper; last gasp, try as cs1-like
anchor_id = anchor_id_make_cs12 (template); -- extract an anchor id from this template if possible
list_add (anchor_id, anchor_id_list, true);
end
tstart, tend = Article_content:find (find_pattern, tend); -- search for another template; begin at end of last search
end
mw.logObject (anchor_id_list, 'anchor_id_list');
mw.logObject (template_list, 'template_list');
mw.logObject (article_whitelist, 'article_whitelist');
return anchor_id_list;
end
--[[--------------------------< E X P O R T E D _ T A B L E S >------------------------------------------------
]]
return {
anchor_id_list = anchor_id_list_make(), -- table of anchor ids available in this article
article_whitelist = article_whitelist, -- table of anchor ids with false-positive error message to be suppressed
template_list = template_list, -- table of templates used in this article
}
a827820b3af4a53f9ce6c4a2293bd7f418785903
Module:Citation/CS1/COinS
828
23
39
2023-08-12T19:19:02Z
wikipedia>Trappist the monk
0
sync from sandbox;
Scribunto
text/plain
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
]]
local has_accept_as_written, is_set, in_array, remove_wiki_link, strip_apostrophe_markup; -- functions in Module:Citation/CS1/Utilities
local cfg; -- table of configuration tables that are defined in Module:Citation/CS1/Configuration
--[[--------------------------< M A K E _ C O I N S _ T I T L E >----------------------------------------------
Makes a title for COinS from Title and / or ScriptTitle (or any other name-script pairs)
Apostrophe markup (bold, italics) is stripped from each value so that the COinS metadata isn't corrupted with strings
of %27%27...
]]
local function make_coins_title (title, script)
title = has_accept_as_written (title);
if is_set (title) then
title = strip_apostrophe_markup (title); -- strip any apostrophe markup
else
title = ''; -- if not set, make sure title is an empty string
end
if is_set (script) then
script = script:gsub ('^%l%l%s*:%s*', ''); -- remove language prefix if present (script value may now be empty string)
script = strip_apostrophe_markup (script); -- strip any apostrophe markup
else
script = ''; -- if not set, make sure script is an empty string
end
if is_set (title) and is_set (script) then
script = ' ' .. script; -- add a space before we concatenate
end
return title .. script; -- return the concatenation
end
--[[--------------------------< E S C A P E _ L U A _ M A G I C _ C H A R S >----------------------------------
Returns a string where all of Lua's magic characters have been escaped. This is important because functions like
string.gsub() treat their pattern and replace strings as patterns, not literal strings.
]]
local function escape_lua_magic_chars (argument)
argument = argument:gsub("%%", "%%%%"); -- replace % with %%
argument = argument:gsub("([%^%$%(%)%.%[%]%*%+%-%?])", "%%%1"); -- replace all other Lua magic pattern characters
return argument;
end
--[[--------------------------< G E T _ C O I N S _ P A G E S >------------------------------------------------
Extract page numbers from external wikilinks in any of the |page=, |pages=, or |at= parameters for use in COinS.
]]
local function get_coins_pages (pages)
local pattern;
if not is_set (pages) then return pages; end -- if no page numbers then we're done
while true do
pattern = pages:match("%[(%w*:?//[^ ]+%s+)[%w%d].*%]"); -- pattern is the opening bracket, the URL and following space(s): "[url "
if nil == pattern then break; end -- no more URLs
pattern = escape_lua_magic_chars (pattern); -- pattern is not a literal string; escape Lua's magic pattern characters
pages = pages:gsub(pattern, ""); -- remove as many instances of pattern as possible
end
pages = pages:gsub("[%[%]]", ""); -- remove the brackets
pages = pages:gsub("–", "-" ); -- replace endashes with hyphens
pages = pages:gsub("&%w+;", "-" ); -- and replace HTML entities (– etc.) with hyphens; do we need to replace numerical entities like   and the like?
return pages;
end
--[=[-------------------------< C O I N S _ R E P L A C E _ M A T H _ S T R I P M A R K E R >------------------
There are three options for math markup rendering that depend on the editor's math preference settings. These
settings are at [[Special:Preferences#mw-prefsection-rendering]] and are
PNG images
TeX source
MathML with SVG or PNG fallback
All three are heavy with HTML and CSS which doesn't belong in the metadata.
Without this function, the metadata saved in the raw wikitext contained the rendering determined by the settings
of the last editor to save the page.
This function gets the rendered form of an equation according to the editor's preference before the page is saved. It
then searches the rendering for the text equivalent of the rendered equation and replaces the rendering with that so
that the page is saved without extraneous HTML/CSS markup and with a reasonably readable text form of the equation.
When a replacement is made, this function returns true and the value with replacement; otherwise false and the initial
value. To replace multipe equations it is necessary to call this function from within a loop.
]=]
local function coins_replace_math_stripmarker (value)
local stripmarker = cfg.stripmarkers['math'];
local rendering = value:match (stripmarker); -- is there a math stripmarker
if not rendering then -- when value doesn't have a math stripmarker, abandon this test
return false, value;
end
rendering = mw.text.unstripNoWiki (rendering); -- convert stripmarker into rendered value (or nil? ''? when math render error)
if rendering:match ('alt="[^"]+"') then -- if PNG math option
rendering = rendering:match ('alt="([^"]+)"'); -- extract just the math text
elseif rendering:match ('$%s+.+%s+%$') then -- if TeX math option; $ is legit character that is escapes as \$
rendering = rendering:match ('$%s+(.+)%s+%$') -- extract just the math text
elseif rendering:match ('<annotation[^>]+>.+</annotation>') then -- if MathML math option
rendering = rendering:match ('<annotation[^>]+>(.+)</annotation>') -- extract just the math text
else
return false, value; -- had math stripmarker but not one of the three defined forms
end
return true, value:gsub (stripmarker, rendering, 1);
end
--[[--------------------------< C O I N S _ C L E A N U P >----------------------------------------------------
Cleanup parameter values for the metadata by removing or replacing invisible characters and certain HTML entities.
2015-12-10: there is a bug in mw.text.unstripNoWiki (). It replaces math stripmarkers with the appropriate content
when it shouldn't. See https://phabricator.wikimedia.org/T121085 and Wikipedia_talk:Lua#stripmarkers_and_mw.text.unstripNoWiki.28.29
TODO: move the replacement patterns and replacement values into a table in /Configuration similar to the invisible
characters table?
]]
local function coins_cleanup (value)
local replaced = true; -- default state to get the do loop running
while replaced do -- loop until all math stripmarkers replaced
replaced, value = coins_replace_math_stripmarker (value); -- replace math stripmarker with text representation of the equation
end
value = value:gsub (cfg.stripmarkers['math'], "MATH RENDER ERROR"); -- one or more couldn't be replaced; insert vague error message
value = mw.text.unstripNoWiki (value); -- replace nowiki stripmarkers with their content
value = value:gsub ('<span class="nowrap" style="padding%-left:0%.1em;">'(s?)</span>', "'%1"); -- replace {{'}} or {{'s}} with simple apostrophe or apostrophe-s
value = value:gsub (' ', ' '); -- replace entity with plain space
value = value:gsub ('\226\128\138', ' '); -- replace hair space with plain space
if not mw.ustring.find (value, cfg.indic_script) then -- don't remove zero-width joiner characters from indic script
value = value:gsub ('‍', ''); -- remove ‍ entities
value = mw.ustring.gsub (value, '[\226\128\141\226\128\139\194\173]', ''); -- remove zero-width joiner, zero-width space, soft hyphen
end
value = value:gsub ('[\009\010\013 ]+', ' '); -- replace horizontal tab, line feed, carriage return with plain space
return value;
end
--[[--------------------------< C O I N S >--------------------------------------------------------------------
COinS metadata (see <http://ocoins.info/>) allows automated tools to parse the citation information.
]]
local function COinS(data, class)
if 'table' ~= type(data) or nil == next(data) then
return '';
end
for k, v in pairs (data) do -- spin through all of the metadata parameter values
if 'ID_list' ~= k and 'Authors' ~= k then -- except the ID_list and Author tables (author nowiki stripmarker done when Author table processed)
data[k] = coins_cleanup (v);
end
end
local ctx_ver = "Z39.88-2004";
-- treat table strictly as an array with only set values.
local OCinSoutput = setmetatable( {}, {
__newindex = function(self, key, value)
if is_set(value) then
rawset( self, #self+1, table.concat{ key, '=', mw.uri.encode( remove_wiki_link( value ) ) } );
end
end
});
if in_array (class, {'arxiv', 'biorxiv', 'citeseerx', 'medrxiv', 'ssrn', 'journal', 'news', 'magazine'}) or
(in_array (class, {'conference', 'interview', 'map', 'press release', 'web'}) and is_set(data.Periodical)) or
('citation' == class and is_set(data.Periodical) and not is_set (data.Encyclopedia)) then
OCinSoutput.rft_val_fmt = "info:ofi/fmt:kev:mtx:journal"; -- journal metadata identifier
if in_array (class, {'arxiv', 'biorxiv', 'citeseerx', 'medrxiv', 'ssrn'}) then -- set genre according to the type of citation template we are rendering
OCinSoutput["rft.genre"] = "preprint"; -- cite arxiv, cite biorxiv, cite citeseerx, cite medrxiv, cite ssrn
elseif 'conference' == class then
OCinSoutput["rft.genre"] = "conference"; -- cite conference (when Periodical set)
elseif 'web' == class then
OCinSoutput["rft.genre"] = "unknown"; -- cite web (when Periodical set)
else
OCinSoutput["rft.genre"] = "article"; -- journal and other 'periodical' articles
end
OCinSoutput["rft.jtitle"] = data.Periodical; -- journal only
OCinSoutput["rft.atitle"] = data.Title; -- 'periodical' article titles
-- these used only for periodicals
OCinSoutput["rft.ssn"] = data.Season; -- keywords: winter, spring, summer, fall
OCinSoutput["rft.quarter"] = data.Quarter; -- single digits 1->first quarter, etc.
OCinSoutput["rft.chron"] = data.Chron; -- free-form date components
OCinSoutput["rft.volume"] = data.Volume; -- does not apply to books
OCinSoutput["rft.issue"] = data.Issue;
OCinSoutput['rft.artnum'] = data.ArticleNumber; -- {{cite journal}} only
OCinSoutput["rft.pages"] = data.Pages; -- also used in book metadata
elseif 'thesis' ~= class then -- all others except cite thesis are treated as 'book' metadata; genre distinguishes
OCinSoutput.rft_val_fmt = "info:ofi/fmt:kev:mtx:book"; -- book metadata identifier
if 'report' == class or 'techreport' == class then -- cite report and cite techreport
OCinSoutput["rft.genre"] = "report";
elseif 'conference' == class then -- cite conference when Periodical not set
OCinSoutput["rft.genre"] = "conference";
OCinSoutput["rft.atitle"] = data.Chapter; -- conference paper as chapter in proceedings (book)
elseif in_array (class, {'book', 'citation', 'encyclopaedia', 'interview', 'map'}) then
if is_set (data.Chapter) then
OCinSoutput["rft.genre"] = "bookitem";
OCinSoutput["rft.atitle"] = data.Chapter; -- book chapter, encyclopedia article, interview in a book, or map title
else
if 'map' == class or 'interview' == class then
OCinSoutput["rft.genre"] = 'unknown'; -- standalone map or interview
else
OCinSoutput["rft.genre"] = 'book'; -- book and encyclopedia
end
end
else -- {'audio-visual', 'AV-media-notes', 'DVD-notes', 'episode', 'interview', 'mailinglist', 'map', 'newsgroup', 'podcast', 'press release', 'serial', 'sign', 'speech', 'web'}
OCinSoutput["rft.genre"] = "unknown";
end
OCinSoutput["rft.btitle"] = data.Title; -- book only
OCinSoutput["rft.place"] = data.PublicationPlace; -- book only
OCinSoutput["rft.series"] = data.Series; -- book only
OCinSoutput["rft.pages"] = data.Pages; -- book, journal
OCinSoutput["rft.edition"] = data.Edition; -- book only
OCinSoutput["rft.pub"] = data.PublisherName; -- book and dissertation
else -- cite thesis
OCinSoutput.rft_val_fmt = "info:ofi/fmt:kev:mtx:dissertation"; -- dissertation metadata identifier
OCinSoutput["rft.title"] = data.Title; -- dissertation (also patent but that is not yet supported)
OCinSoutput["rft.degree"] = data.Degree; -- dissertation only
OCinSoutput['rft.inst'] = data.PublisherName; -- book and dissertation
end
-- NB. Not currently supported are "info:ofi/fmt:kev:mtx:patent", "info:ofi/fmt:kev:mtx:dc", "info:ofi/fmt:kev:mtx:sch_svc", "info:ofi/fmt:kev:mtx:ctx"
-- and now common parameters (as much as possible)
OCinSoutput["rft.date"] = data.Date; -- book, journal, dissertation
for k, v in pairs( data.ID_list ) do -- what to do about these? For now assume that they are common to all?
if k == 'ISBN' then v = v:gsub( "[^-0-9X]", "" ); end
local id = cfg.id_handlers[k].COinS;
if string.sub( id or "", 1, 4 ) == 'info' then -- for ids that are in the info:registry
OCinSoutput["rft_id"] = table.concat{ id, "/", v };
elseif string.sub (id or "", 1, 3 ) == 'rft' then -- for isbn, issn, eissn, etc. that have defined COinS keywords
OCinSoutput[ id ] = v;
elseif 'url' == id then -- for urls that are assembled in ~/Identifiers; |asin= and |ol=
OCinSoutput["rft_id"] = table.concat ({data.ID_list[k], "#id-name=", cfg.id_handlers[k].label});
elseif id then -- when cfg.id_handlers[k].COinS is not nil so urls created here
OCinSoutput["rft_id"] = table.concat{ cfg.id_handlers[k].prefix, v, cfg.id_handlers[k].suffix or '', "#id-name=", cfg.id_handlers[k].label }; -- others; provide a URL and indicate identifier name as #fragment (human-readable, but transparent to browsers)
end
end
local last, first;
for k, v in ipairs( data.Authors ) do
last, first = coins_cleanup (v.last), coins_cleanup (v.first or ''); -- replace any nowiki stripmarkers, non-printing or invisible characters
if k == 1 then -- for the first author name only
if is_set(last) and is_set(first) then -- set these COinS values if |first= and |last= specify the first author name
OCinSoutput["rft.aulast"] = last; -- book, journal, dissertation
OCinSoutput["rft.aufirst"] = first; -- book, journal, dissertation
elseif is_set(last) then
OCinSoutput["rft.au"] = last; -- book, journal, dissertation -- otherwise use this form for the first name
end
else -- for all other authors
if is_set(last) and is_set(first) then
OCinSoutput["rft.au"] = table.concat{ last, ", ", first }; -- book, journal, dissertation
elseif is_set(last) then
OCinSoutput["rft.au"] = last; -- book, journal, dissertation
end
-- TODO: At present we do not report "et al.". Add anything special if this condition applies?
end
end
OCinSoutput.rft_id = data.URL;
OCinSoutput.rfr_id = table.concat{ "info:sid/", mw.site.server:match( "[^/]*$" ), ":", data.RawPage };
-- TODO: Add optional extra info:
-- rfr_dat=#REVISION<version> (referrer private data)
-- ctx_id=<data.RawPage>#<ref> (identifier for the context object)
-- ctx_tim=<ts> (timestamp in format yyyy-mm-ddThh:mm:ssTZD or yyyy-mm-dd)
-- ctx_enc=info:ofi/enc:UTF-8 (character encoding)
OCinSoutput = setmetatable( OCinSoutput, nil );
-- sort with version string always first, and combine.
-- table.sort( OCinSoutput );
table.insert( OCinSoutput, 1, "ctx_ver=" .. ctx_ver ); -- such as "Z39.88-2004"
return table.concat(OCinSoutput, "&");
end
--[[--------------------------< S E T _ S E L E C T E D _ M O D U L E S >--------------------------------------
Sets local cfg table and imported functions table to same (live or sandbox) as that used by the other modules.
]]
local function set_selected_modules (cfg_table_ptr, utilities_page_ptr)
cfg = cfg_table_ptr;
has_accept_as_written = utilities_page_ptr.has_accept_as_written; -- import functions from selected Module:Citation/CS1/Utilities module
is_set = utilities_page_ptr.is_set;
in_array = utilities_page_ptr.in_array;
remove_wiki_link = utilities_page_ptr.remove_wiki_link;
strip_apostrophe_markup = utilities_page_ptr.strip_apostrophe_markup;
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {
make_coins_title = make_coins_title,
get_coins_pages = get_coins_pages,
COinS = COinS,
set_selected_modules = set_selected_modules,
}
4fe549c532af319223cc4d9da2c6d33a786131c1
Template:UF-hcard-person
10
179
349
2023-08-22T10:48:21Z
wikipedia>PK2
0
bypass redirect to [[Template:Flatlist]]
wikitext
text/x-wiki
The HTML markup produced by this template includes an [[HCard|hCard microformat]], which makes the person's details [[Parsing|parsable]] by computers, either acting automatically to catalogue articles across Wikipedia or via a browser tool operated by a reader, to (for example) add the subject to an address book or database. For more information about the use of [[microformat]]s on Wikipedia, please see [[Wikipedia:WikiProject Microformats|the microformat project]].
=== Sub-templates ===
Date-of-birth ("bday") information will only be included in the microformat if {{tl|birth date}}, or {{tl|birth date and age}} are used in the infobox. ([[Wikipedia:WikiProject Microformats/dates|Do not use these if the date is before 1583]]). Be cautious about using these if the person is still living, per [[WP:DOB]].
To include a URL, use {{Tl|URL}}.
'''Please do not remove instances of these sub-templates.'''
=== Classes ===
hCard uses HTML classes including:
{{Flatlist|
*adr
*agent
*bday
*birthplace
*category
*country-name
*deathdate
*deathplace
*extended-address
*family-name
*fn (required)
*given-name
*honorific-prefix
*honorific-suffix
*label
*locality
*n
*nickname
*note
*org
*role
*url
*vcard
}}
'''Please do not rename or remove these classes nor collapse nested elements which use them.'''<includeonly>{{#ifeq:{{SUBPAGENAME}}|doc | |{{#ifeq:{{SUBPAGENAME}}|sandbox | |[[Category:Templates generating hCards]]}} }}</includeonly><noinclude>
[[Category:Templates generating hCards]]
[[Category:Microformat (uF) message templates]]
</noinclude>
cf7d7c17b9e4a925f11599e609ceb43d23ba29ea
Module:Pagetype/config
828
27
47
2023-08-28T13:36:34Z
wikipedia>Mr. Stradivarius
0
update from [[Module:Pagetype/config/sandbox]]
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Module:Pagetype configuration data --
-- This page holds localisation and configuration data for Module:Pagetype. --
--------------------------------------------------------------------------------
local cfg = {} -- Don't edit this line.
--------------------------------------------------------------------------------
-- Start configuration data --
--------------------------------------------------------------------------------
-- This table holds the default page types for each namespace. Keys to this
-- table should be integers that can be used as keys to mw.site.namespaces.
cfg.pagetypes = {
[0] = 'article', -- Main namespace
[2] = 'user page',
[4] = 'project page',
[6] = 'file',
[8] = 'interface page', -- MediaWiki namespace
[10] = 'template',
[12] = 'help page',
[14] = 'category',
[100] = 'portal',
[118] = 'draft',
[710] = 'Timed Text page',
[828] = 'module',
[2300] = 'gadget',
[2302] = 'gadget definition',
[-1] = 'special page',
[-2] = 'file', -- Media namespace
}
-- This table holds the namespaces to be looked up from cfg.pagetypes by
-- default.
cfg.defaultNamespaces = {
[0] = true, -- main
[6] = true, -- file
[10] = true, -- template
[14] = true, -- category
[828] = true, -- module
}
-- This table holds the namespaces to be looked up from cfg.pagetypes if
-- cfg.defaultnsExtended is set.
cfg.extendedNamespaces = {
[0] = true, -- main
[2] = true, -- user
[4] = true, -- project
[6] = true, -- file
[8] = true, -- mediawiki
[10] = true, -- template
[12] = true, -- help
[14] = true, -- category
[100] = true, -- portal
[118] = true, -- draft
[828] = true, -- module
}
-- This table holds custom aliases for each namespace.
cfg.customNamespaceAliases = {
[0] = {'main'},
}
-- The parameter name to set which default namespace values to be looked up from
-- cfg.pagetypes.
cfg.defaultns = 'defaultns'
-- The value of cfg.defaultns to set all namespaces, including talk.
cfg.defaultnsAll = 'all'
-- The value of cfg.defaultns to set the namespaces listed in
-- cfg.extendedNamespaces
cfg.defaultnsExtended = 'extended'
-- The value of cfg.defaultns to set no default namespaces.
cfg.defaultnsNone = 'none'
-- The parameter name to use for talk pages.
cfg.talk = 'talk'
-- The default value for talk pages.
cfg.talkDefault = 'talk page'
-- The parameter name to use for disambiguation pages page.
cfg.dab = 'dab'
-- This table holds the different possible aliases for disambiguation-class
-- pages. These should be lower-case.
cfg.dabAliases = {
['disambiguation'] = true,
['disambig'] = true,
['disamb'] = true,
['dab'] = true,
}
-- The default value for disambiguation pages.
cfg.dabDefault = 'page'
-- The parameter name to use for N/A-class page.
cfg.na = 'na'
-- This table holds the different possible aliases for N/A-class pages. These
-- should be lower-case.
cfg.naAliases = {
['na'] = true,
['n/a'] = true,
}
-- The default value for N/A-class pages.
cfg.naDefault = 'page'
-- The parameter name to use for redirects.
cfg.redirect = 'redirect'
-- The default value to use for redirects.
cfg.redirectDefault = 'redirect'
-- The parameter name for undefined namespaces.
cfg.other = 'other'
-- The value used if the module detects an undefined namespace.
cfg.otherDefault = 'page'
-- The usual suffix denoting a plural.
cfg.plural = 's'
-- This table holds plurals not formed by a simple suffix.
cfg.irregularPlurals = {
["category"] = "categories"
}
--------------------------------------------------------------------------------
-- End configuration data --
--------------------------------------------------------------------------------
return cfg -- Don't edit this line
5360b93ef5fd7551e38026f1b8df00bed8b34b2d
Module:Pagetype
828
26
45
2023-08-28T13:37:34Z
wikipedia>Mr. Stradivarius
0
switch back to using [[Module:Pagetype/config]], as it has now been updated
Scribunto
text/plain
--------------------------------------------------------------------------------
-- --
-- PAGETYPE --
-- --
-- This is a meta-module intended to replace {{pagetype}} and similar --
-- templates. It automatically detects namespaces, and allows for a --
-- great deal of customisation. It can easily be ported to other --
-- wikis by changing the values in the [[Module:Pagetype/config]]. --
-- --
--------------------------------------------------------------------------------
-- Load config.
local cfg = mw.loadData('Module:Pagetype/config')
-- Load required modules.
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local mDisambiguation = require('Module:Disambiguation')
local p = {}
-- Look up a namespace argument in the args table.
local function lookUpNamespaceArg(args, key)
local arg = args[key]
-- Convert "yes", "1" etc. to true, "no", "0" etc. to false, and leave
-- other values the same.
return yesno(arg, arg)
end
-- Append multiple values to an array
local function appendMultiple(target, source)
for _, value in ipairs(source) do
table.insert(target, value)
end
end
-- Get argument keys for a title's namespace
local function getNamespaceArgKeys(title, cfg)
local nsInfo = mw.site.namespaces[title.namespace]
local customAliases = cfg.customNamespaceAliases[title.namespace] or {}
local keys = {}
if nsInfo.name ~= '' then
table.insert(keys, nsInfo.name)
end
if nsInfo.canonicalName ~= nsInfo.name and nsInfo.canonicalName ~= '' then
table.insert(keys, nsInfo.canonicalName)
end
appendMultiple(keys, nsInfo.aliases)
appendMultiple(keys, customAliases)
return keys
end
-- Get the argument for a title's namespace, if it was specified in the args
-- table.
local function getNamespaceArg(title, args, cfg)
if title.isTalkPage then
return lookUpNamespaceArg(args, cfg.talk)
end
for _, key in ipairs(getNamespaceArgKeys(title, cfg)) do
local arg = lookUpNamespaceArg(args, mw.ustring.lower(key))
if arg ~= nil then
return arg
end
end
return nil
end
-- Look up a page type specific to the title's namespace
local function getExplicitPageType(title, cfg)
if title.isTalkPage then
return cfg.talkDefault
else
return cfg.pagetypes[title.namespace]
end
end
-- Get a default page type that is not specific to the title's namespace
local function getDefaultPageType(args, cfg)
local other = lookUpNamespaceArg(args, cfg.other)
if type(other) == 'string' then
return other
else
return cfg.otherDefault
end
end
local function detectRedirects(title, args)
local redirect = lookUpNamespaceArg(args, cfg.redirect)
if redirect == false then
-- Don't detect redirects if they have been specifically disallowed.
return nil
end
-- Allow custom values for redirects.
if not title.isRedirect then
return nil
elseif type(redirect) == 'string' then
return redirect
else
return cfg.redirectDefault
end
end
local function detectDisambiguationPages(title, args, cfg)
if title.namespace ~= 0 then
-- Only detect disambiguation pages in mainspace
return nil
end
local dab = lookUpNamespaceArg(args, cfg.dab)
if dab == false then
-- Don't detect disambiguation pages if explicitly disallowed
return nil
end
if not mDisambiguation.isDisambiguation(title:getContent()) then
return nil
elseif type(dab) == 'string' then
return dab
else
return cfg.dabDefault
end
end
-- Gets the pagetype from a class specified from the first positional
-- parameter.
local function getPageTypeFromClass(args, class, key, aliasTable, default)
local arg = lookUpNamespaceArg(args, key)
if arg == false then
-- Don't check for this class if it is specifically disallowed.
return nil
end
if aliasTable[class] then
if type(arg) == 'string' then
return arg
else
return default
end
end
return nil
end
-- Get page types for mainspaces pages with an explicit class specified
local function getMainNamespaceClassPageType(title, args, cfg)
if title.namespace ~= 0 then
return nil
end
local class = args[1]
if type(class) == 'string' then
-- Put in lower case so e.g. "na" and "NA" will both match.
class = mw.ustring.lower(class)
end
return getPageTypeFromClass(
args,
class,
cfg.na,
cfg.naAliases,
cfg.naDefault
)
end
-- Get page type specified by an explicit namespace argument.
local function getNamespaceArgPageType(title, args, cfg)
local namespaceArg = getNamespaceArg(title, args, cfg)
if namespaceArg == true then
-- Namespace has been explicitly enabled, so return the default for
-- this namespace
return getExplicitPageType(title, cfg)
elseif namespaceArg == false then
-- Namespace has been explicitly disabled
return getDefaultPageType(args, cfg)
elseif namespaceArg then
-- This namespaces uses custom text
return namespaceArg
else
return nil
end
end
-- Whether the title is in the set of default active namespaces which are
-- looked up in cfg.pagetypes.
local function isInDefaultActiveNamespace(title, args, cfg)
local defaultNamespacesKey = args[cfg.defaultns]
if defaultNamespacesKey == cfg.defaultnsAll then
return true
end
local defaultNamespaces
if defaultNamespacesKey == cfg.defaultnsExtended then
defaultNamespaces = cfg.extendedNamespaces
elseif defaultNamespacesKey == cfg.defaultnsNone then
defaultNamespaces = {}
else
defaultNamespaces = cfg.defaultNamespaces
end
return defaultNamespaces[title.namespace] or false
end
-- Get page type not specified or detected by other means
local function getOtherPageType(title, args, cfg)
if isInDefaultActiveNamespace(title, args, cfg) then
return getExplicitPageType(title, cfg)
else
return getDefaultPageType(args, cfg)
end
end
local function getPageType(title, args, cfg)
return (
detectRedirects(title, args, cfg)
or detectDisambiguationPages(title, args, cfg)
or getMainNamespaceClassPageType(title, args, cfg)
or getNamespaceArgPageType(title, args, cfg)
or getOtherPageType(title, args, cfg)
)
end
local function shouldUseSubjectTitle(args, cfg)
return not yesno(args.talk, true) and args[cfg.defaultns] ~= cfg.defaultnsAll
end
-- Get the Scribunto title object to fetch the page type of
local function getTitle(args, cfg)
local title
if args.page then
title = mw.title.new(args.page)
if not title then
return nil
end
else
title = mw.title.getCurrentTitle()
end
if shouldUseSubjectTitle(args, cfg) then
return title.subjectPageTitle
else
return title
end
end
local function pluralize(pageType, cfg)
if cfg.irregularPlurals[pageType] then
return cfg.irregularPlurals[pageType]
else
return pageType .. cfg.plural -- often 's'
end
end
local function capitalize(pageType)
local first = mw.ustring.sub(pageType, 1, 1)
local rest = mw.ustring.sub(pageType, 2)
return mw.ustring.upper(first) .. rest
end
function p._main(args)
local title = getTitle(args, cfg)
local pageType = getPageType(title, args, cfg)
if yesno(args.plural, false) then
pageType = pluralize(pageType, cfg)
end
if yesno(args.caps, false) then
pageType = capitalize(pageType)
end
return pageType
end
function p.main(frame)
local args = getArgs(frame)
return p._main(args)
end
return p
ab72b17cbd3e423817484aedfd33b480e9ba3611
Module:Message box
828
74
139
2023-09-02T22:54:30Z
wikipedia>Anomie
0
[[:File:Cscr-featured.svg]] needs a link to the description page for license and attribution. Add the ability for the configuration to specify a flag to accomplish this.
Scribunto
text/plain
require('strict')
local getArgs
local yesno = require('Module:Yesno')
local lang = mw.language.getContentLanguage()
local CONFIG_MODULE = 'Module:Message box/configuration'
local DEMOSPACES = {talk = 'tmbox', image = 'imbox', file = 'imbox', category = 'cmbox', article = 'ambox', main = 'ambox'}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function getTitleObject(...)
-- Get the title object, passing the function through pcall
-- in case we are over the expensive function count limit.
local success, title = pcall(mw.title.new, ...)
if success then
return title
end
end
local function union(t1, t2)
-- Returns the union of two arrays.
local vals = {}
for i, v in ipairs(t1) do
vals[v] = true
end
for i, v in ipairs(t2) do
vals[v] = true
end
local ret = {}
for k in pairs(vals) do
table.insert(ret, k)
end
table.sort(ret)
return ret
end
local function getArgNums(args, prefix)
local nums = {}
for k, v in pairs(args) do
local num = mw.ustring.match(tostring(k), '^' .. prefix .. '([1-9]%d*)$')
if num then
table.insert(nums, tonumber(num))
end
end
table.sort(nums)
return nums
end
--------------------------------------------------------------------------------
-- Box class definition
--------------------------------------------------------------------------------
local MessageBox = {}
MessageBox.__index = MessageBox
function MessageBox.new(boxType, args, cfg)
args = args or {}
local obj = {}
-- Set the title object and the namespace.
obj.title = getTitleObject(args.page) or mw.title.getCurrentTitle()
-- Set the config for our box type.
obj.cfg = cfg[boxType]
if not obj.cfg then
local ns = obj.title.namespace
-- boxType is "mbox" or invalid input
if args.demospace and args.demospace ~= '' then
-- implement demospace parameter of mbox
local demospace = string.lower(args.demospace)
if DEMOSPACES[demospace] then
-- use template from DEMOSPACES
obj.cfg = cfg[DEMOSPACES[demospace]]
elseif string.find( demospace, 'talk' ) then
-- demo as a talk page
obj.cfg = cfg.tmbox
else
-- default to ombox
obj.cfg = cfg.ombox
end
elseif ns == 0 then
obj.cfg = cfg.ambox -- main namespace
elseif ns == 6 then
obj.cfg = cfg.imbox -- file namespace
elseif ns == 14 then
obj.cfg = cfg.cmbox -- category namespace
else
local nsTable = mw.site.namespaces[ns]
if nsTable and nsTable.isTalk then
obj.cfg = cfg.tmbox -- any talk namespace
else
obj.cfg = cfg.ombox -- other namespaces or invalid input
end
end
end
-- Set the arguments, and remove all blank arguments except for the ones
-- listed in cfg.allowBlankParams.
do
local newArgs = {}
for k, v in pairs(args) do
if v ~= '' then
newArgs[k] = v
end
end
for i, param in ipairs(obj.cfg.allowBlankParams or {}) do
newArgs[param] = args[param]
end
obj.args = newArgs
end
-- Define internal data structure.
obj.categories = {}
obj.classes = {}
-- For lazy loading of [[Module:Category handler]].
obj.hasCategories = false
return setmetatable(obj, MessageBox)
end
function MessageBox:addCat(ns, cat, sort)
if not cat then
return nil
end
if sort then
cat = string.format('[[Category:%s|%s]]', cat, sort)
else
cat = string.format('[[Category:%s]]', cat)
end
self.hasCategories = true
self.categories[ns] = self.categories[ns] or {}
table.insert(self.categories[ns], cat)
end
function MessageBox:addClass(class)
if not class then
return nil
end
table.insert(self.classes, class)
end
function MessageBox:setParameters()
local args = self.args
local cfg = self.cfg
-- Get type data.
self.type = args.type
local typeData = cfg.types[self.type]
self.invalidTypeError = cfg.showInvalidTypeError
and self.type
and not typeData
typeData = typeData or cfg.types[cfg.default]
self.typeClass = typeData.class
self.typeImage = typeData.image
self.typeImageNeedsLink = typeData.imageNeedsLink
-- Find if the box has been wrongly substituted.
self.isSubstituted = cfg.substCheck and args.subst == 'SUBST'
-- Find whether we are using a small message box.
self.isSmall = cfg.allowSmall and (
cfg.smallParam and args.small == cfg.smallParam
or not cfg.smallParam and yesno(args.small)
)
-- Add attributes, classes and styles.
self.id = args.id
self.name = args.name
if self.name then
self:addClass('box-' .. string.gsub(self.name,' ','_'))
end
if yesno(args.plainlinks) ~= false then
self:addClass('plainlinks')
end
for _, class in ipairs(cfg.classes or {}) do
self:addClass(class)
end
if self.isSmall then
self:addClass(cfg.smallClass or 'mbox-small')
end
self:addClass(self.typeClass)
self:addClass(args.class)
self.style = args.style
self.attrs = args.attrs
-- Set text style.
self.textstyle = args.textstyle
-- Find if we are on the template page or not. This functionality is only
-- used if useCollapsibleTextFields is set, or if both cfg.templateCategory
-- and cfg.templateCategoryRequireName are set.
self.useCollapsibleTextFields = cfg.useCollapsibleTextFields
if self.useCollapsibleTextFields
or cfg.templateCategory
and cfg.templateCategoryRequireName
then
if self.name then
local templateName = mw.ustring.match(
self.name,
'^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$'
) or self.name
templateName = 'Template:' .. templateName
self.templateTitle = getTitleObject(templateName)
end
self.isTemplatePage = self.templateTitle
and mw.title.equals(self.title, self.templateTitle)
end
-- Process data for collapsible text fields. At the moment these are only
-- used in {{ambox}}.
if self.useCollapsibleTextFields then
-- Get the self.issue value.
if self.isSmall and args.smalltext then
self.issue = args.smalltext
else
local sect
if args.sect == '' then
sect = 'This ' .. (cfg.sectionDefault or 'page')
elseif type(args.sect) == 'string' then
sect = 'This ' .. args.sect
end
local issue = args.issue
issue = type(issue) == 'string' and issue ~= '' and issue or nil
local text = args.text
text = type(text) == 'string' and text or nil
local issues = {}
table.insert(issues, sect)
table.insert(issues, issue)
table.insert(issues, text)
self.issue = table.concat(issues, ' ')
end
-- Get the self.talk value.
local talk = args.talk
-- Show talk links on the template page or template subpages if the talk
-- parameter is blank.
if talk == ''
and self.templateTitle
and (
mw.title.equals(self.templateTitle, self.title)
or self.title:isSubpageOf(self.templateTitle)
)
then
talk = '#'
elseif talk == '' then
talk = nil
end
if talk then
-- If the talk value is a talk page, make a link to that page. Else
-- assume that it's a section heading, and make a link to the talk
-- page of the current page with that section heading.
local talkTitle = getTitleObject(talk)
local talkArgIsTalkPage = true
if not talkTitle or not talkTitle.isTalkPage then
talkArgIsTalkPage = false
talkTitle = getTitleObject(
self.title.text,
mw.site.namespaces[self.title.namespace].talk.id
)
end
if talkTitle and talkTitle.exists then
local talkText
if self.isSmall then
local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk)
talkText = string.format('([[%s|talk]])', talkLink)
else
talkText = 'Relevant discussion may be found on'
if talkArgIsTalkPage then
talkText = string.format(
'%s [[%s|%s]].',
talkText,
talk,
talkTitle.prefixedText
)
else
talkText = string.format(
'%s the [[%s#%s|talk page]].',
talkText,
talkTitle.prefixedText,
talk
)
end
end
self.talk = talkText
end
end
-- Get other values.
self.fix = args.fix ~= '' and args.fix or nil
local date
if args.date and args.date ~= '' then
date = args.date
elseif args.date == '' and self.isTemplatePage then
date = lang:formatDate('F Y')
end
if date then
self.date = string.format(" <span class='date-container'><i>(<span class='date'>%s</span>)</i></span>", date)
end
self.info = args.info
if yesno(args.removalnotice) then
self.removalNotice = cfg.removalNotice
end
end
-- Set the non-collapsible text field. At the moment this is used by all box
-- types other than ambox, and also by ambox when small=yes.
if self.isSmall then
self.text = args.smalltext or args.text
else
self.text = args.text
end
-- Set the below row.
self.below = cfg.below and args.below
-- General image settings.
self.imageCellDiv = not self.isSmall and cfg.imageCellDiv
self.imageEmptyCell = cfg.imageEmptyCell
-- Left image settings.
local imageLeft = self.isSmall and args.smallimage or args.image
if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none'
or not cfg.imageCheckBlank and imageLeft ~= 'none'
then
self.imageLeft = imageLeft
if not imageLeft then
local imageSize = self.isSmall
and (cfg.imageSmallSize or '30x30px')
or '40x40px'
self.imageLeft = string.format('[[File:%s|%s%s|alt=]]', self.typeImage
or 'Information icon4.svg', imageSize, self.typeImageNeedsLink and "" or "|link=" )
end
end
-- Right image settings.
local imageRight = self.isSmall and args.smallimageright or args.imageright
if not (cfg.imageRightNone and imageRight == 'none') then
self.imageRight = imageRight
end
-- set templatestyles
self.base_templatestyles = cfg.templatestyles
self.templatestyles = args.templatestyles
end
function MessageBox:setMainspaceCategories()
local args = self.args
local cfg = self.cfg
if not cfg.allowMainspaceCategories then
return nil
end
local nums = {}
for _, prefix in ipairs{'cat', 'category', 'all'} do
args[prefix .. '1'] = args[prefix]
nums = union(nums, getArgNums(args, prefix))
end
-- The following is roughly equivalent to the old {{Ambox/category}}.
local date = args.date
date = type(date) == 'string' and date
local preposition = 'from'
for _, num in ipairs(nums) do
local mainCat = args['cat' .. tostring(num)]
or args['category' .. tostring(num)]
local allCat = args['all' .. tostring(num)]
mainCat = type(mainCat) == 'string' and mainCat
allCat = type(allCat) == 'string' and allCat
if mainCat and date and date ~= '' then
local catTitle = string.format('%s %s %s', mainCat, preposition, date)
self:addCat(0, catTitle)
catTitle = getTitleObject('Category:' .. catTitle)
if not catTitle or not catTitle.exists then
self:addCat(0, 'Articles with invalid date parameter in template')
end
elseif mainCat and (not date or date == '') then
self:addCat(0, mainCat)
end
if allCat then
self:addCat(0, allCat)
end
end
end
function MessageBox:setTemplateCategories()
local args = self.args
local cfg = self.cfg
-- Add template categories.
if cfg.templateCategory then
if cfg.templateCategoryRequireName then
if self.isTemplatePage then
self:addCat(10, cfg.templateCategory)
end
elseif not self.title.isSubpage then
self:addCat(10, cfg.templateCategory)
end
end
-- Add template error categories.
if cfg.templateErrorCategory then
local templateErrorCategory = cfg.templateErrorCategory
local templateCat, templateSort
if not self.name and not self.title.isSubpage then
templateCat = templateErrorCategory
elseif self.isTemplatePage then
local paramsToCheck = cfg.templateErrorParamsToCheck or {}
local count = 0
for i, param in ipairs(paramsToCheck) do
if not args[param] then
count = count + 1
end
end
if count > 0 then
templateCat = templateErrorCategory
templateSort = tostring(count)
end
if self.categoryNums and #self.categoryNums > 0 then
templateCat = templateErrorCategory
templateSort = 'C'
end
end
self:addCat(10, templateCat, templateSort)
end
end
function MessageBox:setAllNamespaceCategories()
-- Set categories for all namespaces.
if self.invalidTypeError then
local allSort = (self.title.namespace == 0 and 'Main:' or '') .. self.title.prefixedText
self:addCat('all', 'Wikipedia message box parameter needs fixing', allSort)
end
if self.isSubstituted then
self:addCat('all', 'Pages with incorrectly substituted templates')
end
end
function MessageBox:setCategories()
if self.title.namespace == 0 then
self:setMainspaceCategories()
elseif self.title.namespace == 10 then
self:setTemplateCategories()
end
self:setAllNamespaceCategories()
end
function MessageBox:renderCategories()
if not self.hasCategories then
-- No categories added, no need to pass them to Category handler so,
-- if it was invoked, it would return the empty string.
-- So we shortcut and return the empty string.
return ""
end
-- Convert category tables to strings and pass them through
-- [[Module:Category handler]].
return require('Module:Category handler')._main{
main = table.concat(self.categories[0] or {}),
template = table.concat(self.categories[10] or {}),
all = table.concat(self.categories.all or {}),
nocat = self.args.nocat,
page = self.args.page
}
end
function MessageBox:export()
local root = mw.html.create()
-- Add the subst check error.
if self.isSubstituted and self.name then
root:tag('b')
:addClass('error')
:wikitext(string.format(
'Template <code>%s[[Template:%s|%s]]%s</code> has been incorrectly substituted.',
mw.text.nowiki('{{'), self.name, self.name, mw.text.nowiki('}}')
))
end
local frame = mw.getCurrentFrame()
root:wikitext(frame:extensionTag{
name = 'templatestyles',
args = { src = self.base_templatestyles },
})
-- Add support for a single custom templatestyles sheet. Undocumented as
-- need should be limited and many templates using mbox are substed; we
-- don't want to spread templatestyles sheets around to arbitrary places
if self.templatestyles then
root:wikitext(frame:extensionTag{
name = 'templatestyles',
args = { src = self.templatestyles },
})
end
-- Create the box table.
local boxTable = root:tag('table')
boxTable:attr('id', self.id or nil)
for i, class in ipairs(self.classes or {}) do
boxTable:addClass(class or nil)
end
boxTable
:cssText(self.style or nil)
:attr('role', 'presentation')
if self.attrs then
boxTable:attr(self.attrs)
end
-- Add the left-hand image.
local row = boxTable:tag('tr')
if self.imageLeft then
local imageLeftCell = row:tag('td'):addClass('mbox-image')
if self.imageCellDiv then
-- If we are using a div, redefine imageLeftCell so that the image
-- is inside it. Divs use style="width: 52px;", which limits the
-- image width to 52px. If any images in a div are wider than that,
-- they may overlap with the text or cause other display problems.
imageLeftCell = imageLeftCell:tag('div'):addClass('mbox-image-div')
end
imageLeftCell:wikitext(self.imageLeft or nil)
elseif self.imageEmptyCell then
-- Some message boxes define an empty cell if no image is specified, and
-- some don't. The old template code in templates where empty cells are
-- specified gives the following hint: "No image. Cell with some width
-- or padding necessary for text cell to have 100% width."
row:tag('td')
:addClass('mbox-empty-cell')
end
-- Add the text.
local textCell = row:tag('td'):addClass('mbox-text')
if self.useCollapsibleTextFields then
-- The message box uses advanced text parameters that allow things to be
-- collapsible. At the moment, only ambox uses this.
textCell:cssText(self.textstyle or nil)
local textCellDiv = textCell:tag('div')
textCellDiv
:addClass('mbox-text-span')
:wikitext(self.issue or nil)
if (self.talk or self.fix) then
textCellDiv:tag('span')
:addClass('hide-when-compact')
:wikitext(self.talk and (' ' .. self.talk) or nil)
:wikitext(self.fix and (' ' .. self.fix) or nil)
end
textCellDiv:wikitext(self.date and (' ' .. self.date) or nil)
if self.info and not self.isSmall then
textCellDiv
:tag('span')
:addClass('hide-when-compact')
:wikitext(self.info and (' ' .. self.info) or nil)
end
if self.removalNotice then
textCellDiv:tag('span')
:addClass('hide-when-compact')
:tag('i')
:wikitext(string.format(" (%s)", self.removalNotice))
end
else
-- Default text formatting - anything goes.
textCell
:cssText(self.textstyle or nil)
:wikitext(self.text or nil)
end
-- Add the right-hand image.
if self.imageRight then
local imageRightCell = row:tag('td'):addClass('mbox-imageright')
if self.imageCellDiv then
-- If we are using a div, redefine imageRightCell so that the image
-- is inside it.
imageRightCell = imageRightCell:tag('div'):addClass('mbox-image-div')
end
imageRightCell
:wikitext(self.imageRight or nil)
end
-- Add the below row.
if self.below then
boxTable:tag('tr')
:tag('td')
:attr('colspan', self.imageRight and '3' or '2')
:addClass('mbox-text')
:cssText(self.textstyle or nil)
:wikitext(self.below or nil)
end
-- Add error message for invalid type parameters.
if self.invalidTypeError then
root:tag('div')
:addClass('mbox-invalid-type')
:wikitext(string.format(
'This message box is using an invalid "type=%s" parameter and needs fixing.',
self.type or ''
))
end
-- Add categories.
root:wikitext(self:renderCategories() or nil)
return tostring(root)
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p, mt = {}, {}
function p._exportClasses()
-- For testing.
return {
MessageBox = MessageBox
}
end
function p.main(boxType, args, cfgTables)
local box = MessageBox.new(boxType, args, cfgTables or mw.loadData(CONFIG_MODULE))
box:setParameters()
box:setCategories()
return box:export()
end
function mt.__index(t, k)
return function (frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
return t.main(k, getArgs(frame, {trim = false, removeBlanks = false}))
end
end
return setmetatable(p, mt)
f2fb84f7b817d2d88747f57c40902a0d8be8158a
Template:Infobox court
10
250
492
2023-09-18T02:38:13Z
wikipedia>Davemck
0
renumber duplicate parm
wikitext
text/x-wiki
{{Infobox
| above = {{if empty|{{{court_name|}}}|<includeonly>{{PAGENAME}}</includeonly>}}
| abovestyle = background-color: #Ededed;
| subheader = {{{native_name|}}}
| imagestyle = padding-bottom:0.4em; border-bottom:solid 1px #aaa;
| image = {{#invoke:InfoboxImage|InfoboxImage |image={{if empty|{{{image|}}} }}|size={{{imagesize|}}} |upright={{if empty|{{{image_upright|}}}|1}} |alt={{{alt|}}}}}
| caption = {{{caption|}}}
| image2 = {{#invoke:InfoboxImage|InfoboxImage |image={{if empty|{{{image2|}}}}}|size={{{imagesize2|}}} |upright={{if empty|{{{image_upright2|}}}|1}} |alt={{{alt2|}}}}}
| caption2 = {{{caption2|}}}
| image3 = {{#invoke:Infobox mapframe|auto|mapframe-marker=|mapframe-marker-color=|mapframe-zoom=13|mapframe-frame-width=250|onByDefault={{#if:{{{map|}}}{{{map_image|}}}|no|yes}}}}
| caption3 = {{#invoke:Infobox mapframe|autocaption|onByDefault={{#if:{{{map|}}}{{{map_image|}}}|no|yes}}}}
| data1 = {{#if:{{{coordinates|}}}
|{{#invoke:Coordinates|coordinsert|{{{coordinates}}}|type:landmark|{{#if:{{{country|}}}|region:{{Country abbreviation|{{{country}}}}}}}}} |}}
| headerstyle = background-color: #Ededed;
| label2 = Established
| data2 = {{{established|}}}
| label3 = Dissolved
| data3 = {{{dissolved|}}}
| label4 = Jurisdiction
| data4 = {{{jurisdiction|}}}
| label5 = Location
| data5 = {{{location|}}}
| label6 = [[Geographic coordinate system|Coordinates]]
| data6 = {{{coordinates|}}}
| label7 = Motto
| data7 = {{{motto|}}}
| label8 = Composition method
| data8 = {{{type|}}}
| label9 = {{{at|Authorized}}} by
| data9 = {{{authority|}}}
| label10 = [[Appellate court|Appeals to]]
| data10 = {{{appealsto|{{{appeals|}}}}}}
| label11 = {{nowrap|[[Appeal|Appeals from]]}}
| data11 = {{{appealsfrom|}}}
| label12 = Judge term length
| data12 = {{{terms|}}}
| label13 = Number of positions
| data13 = {{{positions|}}}
| label14 = Annual budget
| data14 = {{{budget|}}}
| label15 = Language
| data15 = {{{language|}}}
| label16 = Type of tribunal
| data16 = {{{tribunal-type|}}}
| label17 = Website
| data17 = {{{website|}}}
| header18 = {{{chiefjudgetitle|}}}
| label19 = Currently
| data19 = {{{chiefjudgename|}}}
| label20 = Since
| data20 = {{{termstart|}}}
| label21 = Lead position ends
| data21 = {{{termend|}}}
| label22 = Jurist term ends
| data22 = {{{termend2|}}}
| header23 = {{{chiefjudgetitle2|}}}
| label24 = Currently
| data24 = {{{chiefjudgename2|}}}
| label25 = Since
| data25 = {{{termstart2|}}}
| label26 = Lead position ends
| data26 = {{{termend3|}}}
| label27 = Jurist term ends
| data27 = {{{termend4|}}}
| header28 = {{{chiefjudgetitle3|}}}
| label29 = Currently
| data29 = {{{chiefjudgename3|}}}
| label30 = Since
| data30 = {{{termstart3|}}}
| label31 = Lead position ends
| data31 = {{{termend5|}}}
| label32 = Jurist term ends
| data32 = {{{termend6|}}}
| header33 = {{#if:{{{division_map|}}}|Division map}}
| data34 = {{#invoke:InfoboxImage|InfoboxImage|image={{{division_map|}}}|size={{{division_map_size|}}}|alt={{{division_map_alt|}}}}}
| data35 = {{#if:{{{division_map|}}}|{{{division_caption|}}}}}
}}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox court with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox court]] with unknown parameter "_VALUE_"|ignoreblank=y| court_name | native_name | image | imagesize | alt | caption | image2 | imagesize2 | image_upright | image_upright2 | alt2 | caption2 | established | dissolved | jurisdiction | location | coordinates | motto | type | authority | appealsto | appealsfrom | terms | positions | budget | language | tribunal-type | website | chiefjudgetitle | chiefjudgename | termstart | termend | termend2 | chiefjudgetitle2 | chiefjudgename2 | termstart2 | termend3 | termend4 | chiefjudgetitle3 | chiefjudgename3 | termstart3 | termend5 | termend6 | division_map | division_map_size | division_map_alt | division_caption }}<noinclude>
{{Documentation}}<!-- Add categories to the /doc subpage, interwikis to Wikidata, not here -->
</noinclude>
6dfb165045bb97a739b09f6097b522f4621ff0a3
Module:Disambiguation
828
67
127
2023-09-19T18:27:51Z
wikipedia>MSGJ
0
deploy new version, code by [[User:Mr. Stradivarius]]
Scribunto
text/plain
local p = {}
local mRedirect = require('Module:Redirect')
local disambiguationTemplates = mw.loadData('Module:Disambiguation/templates')
local function capitalize(s)
-- This function only works on ASCII strings. If your wiki has
-- disambiguation templates that use Unicode strings, use the commented-out
-- line instead. Enwiki uses ASCII string manipulation only here to improve
-- performance.
return s:sub(1, 1):upper() .. s:sub(2, -1)
-- return mw.ustring.upper(mw.ustring.sub(1, 1)) .. mw.ustring.sub(2, -1)
end
local function isDisambiguationTemplate(template)
return disambiguationTemplates[capitalize(template)] or false
end
p.isDisambiguation = function(content)
-- false if there is no content
if content == nil then
return false
end
-- redirects are not disambiguation pages
if mRedirect.getTargetFromText(content) ~= nil then
return false
end
-- check for disambiguation templates in the content
local templateNames = {}
for template in string.gmatch(content, "{{%s*([^|}]-)%s*[|}]") do
if isDisambiguationTemplate(template) then
return true
end
end
-- check for magic word
if string.find(content, "__DISAMBIG__", 1, true) ~= nil then
return true
end
return false
end
p._isDisambiguationPage = function(page)
-- Look "(disambiguation)" in the title
if string.find(page, "(disambiguation)",0,true) ~= nil then
return true;
end
-- Look for disamiguation template in page content
local title = mw.title.new(page)
if not title then return false end
local content = title:getContent()
return p.isDisambiguation(content)
end
-- Entry points for templates
p.isDisambiguationPage = function(frame)
local title = frame.args[1]
return p._isDisambiguationPage(title) and "yes" or ""
end
return p
fedda4d3046080cab39fcd65ab9a9318912a8d57
Template:Person infobox header
10
181
353
2023-09-20T04:58:38Z
wikipedia>Jonesey95
0
add documentation template
wikitext
text/x-wiki
{{ombox|type=content|text=The design and content of biographical infoboxes must follow Wikipedia's [[Wikipedia:Verifiability|verifiability policy]], as well as [[Wikipedia:Manual of Style/Infoboxes|infobox]] and [[Wikipedia:Manual of Style/Biography|biographical style guideline]].
All content displayed in this template must adhere to the '''[[Wikipedia:Biographies of living persons|biographies of living persons]]''' policy if applicable. [[Wikipedia:Citing sources|Unsourced or poorly sourced]] contentious material '''must be removed immediately''' from the article and its infobox, especially if potentially [[Wikipedia:Libel|libellous]].}}
<noinclude>
{{documentation
|content=
{{no documentation}}
{{Uncat}}
}}
</noinclude>
9f982493e161c304a75d9b6b06d5b730ee1bb282
Template:Infobox election/shortname
10
223
438
2023-09-25T18:02:46Z
wikipedia>Number 57
0
+
wikitext
text/x-wiki
{{#if:{{{name|}}}
|{{#ifeq:{{{link}}}|no
|{{{name}}}
|{{#ifeq:{{delink|{{{name}}}|wikilinks=target}}|{{{name}}}
|{{#switch:{{{name}}}
| Independent | Independents = [[Independent politician|{{{name}}}]]
| Miscellaneous = [[Independent politician|DIV]]
| Other | Others = Others
| Regionalists = [[Regionalism (politics)|Regionalists]]
| Vacant = [[Casual vacancy|Vacant]]
| [[{{{name}}}|{{#invoke:Political party|fetch|{{{name}}}|shortname}}]]
}}
|{{{name}}}
}}
}}
}}<noinclude>
{{documentation}}</noinclude>
f658604d53e60703b125cff21f46afbfd71c8969
Template:Organization infoboxes
10
205
402
2023-09-27T23:17:19Z
wikipedia>Jonesey95
0
fix redirect
wikitext
text/x-wiki
{{Navbox
| name = Organization infoboxes
| state = {{{state<includeonly>|expanded</includeonly>}}}
| bodyclass = hlist
| title = [[Wikipedia:Template index|Wikipedia templates]]: [[organization]] [[Template:Infobox|infoboxes]]
| above = [[Wikipedia:Manual of Style/Infoboxes]]
| group1 = General
| list1 =
* {{Tl|Infobox organization}}
* {{Tl|Infobox official post}}
* {{tl|Infobox criminal organization}}
* {{tl|Infobox fictional organisation}}
| group2 = {{longitem|Government<br/>and politics}}
| list2 =
* {{Tl|Infobox government}}
* {{Tl|Infobox government agency}}
* {{Tl|Infobox legislature}}
* {{Tl|Infobox political party}}
* {{Tl|Infobox court}}
* {{Tl|Infobox detention facility}}
* {{tl|Infobox fire department}}
* {{Tl|Infobox law enforcement agency}}
* {{Tl|Infobox space agency}}
| group3 = Military
| list3 =
* {{Tl|Infobox national military}}
* {{Tl|Infobox military unit}}
* {{tl|Infobox military rank}}
* {{Tl|Infobox military gear}}
| group4 = Religion
| list4 =
* {{Tl|Infobox religious group}}
* {{Tl|Infobox religion}}
* {{Tl|Infobox diocese}}
* {{Tl|Infobox church}}
* {{Tl|Infobox monastery}}
| group5 = People
| list5 =
* {{Tl|Infobox ethnic group}}
* {{Tl|Infobox caste}}
* {{Tl|Infobox clan}}
* {{Tl|Infobox family}}
* {{Tl|Infobox iwi}}
* {{Tl|Infobox hereditary title}}
* {{Tl|Infobox monarchy}}
* {{Tl|Infobox officeholder}}
* {{Tl|Infobox tribe}}
| group6 = {{longitem|Typically<br/>non-profit}}
| list6 =
* {{tl|Infobox hospital}}
* {{Tl|Infobox institute}}
* {{Tl|Infobox laboratory}}{{smallsup|1}}
* {{tl|Infobox museum}}
* {{Tl|Infobox observatory}}
* {{Tl|Infobox school}}
* {{tl|Infobox school district}}
* {{Tl|Infobox university}}{{smallsup|2}}
| group7 = Publications
| list7 =
* {{Tl|Infobox journal}}
* {{Tl|Infobox magazine}}
* {{Tl|Infobox newspaper}}
* {{Tl|Infobox publisher}}
| group8 = Business
| list8 =
* {{Tl|Infobox company}}
* {{tl|Infobox brewery}}
* {{Tl|Infobox law firm}}
* {{tl|Infobox restaurant}}
* {{tl|Infobox website}} – ''type of business or publication''
| group9 = Distinctions
| list9 =
* {{Tl|Infobox order}}
* {{Tl|Infobox fraternity}}
* {{Tl|Infobox Grand Lodge}}
| group10 = Subtemplates
| list10 =
* '''Coordinates''' {{Tl|coord}}
* '''Dates'''
** {{Tl|start date}}}—for {{para|established}}, {{para|founded}}, {{para|opened}} etc.
** {{Tl|end date}}}—for {{para|dissolved}}, {{para|defunct}}
* '''Lists'''
**{{tl|plainlist}}
** {{tl|flatlist}}
** {{tl|unbulleted list}}
* '''Non-English text''' {{Tl|lang}}
* '''Website'''
** {{tl|URL}}
** {{tl|Official URL}}
** {{tl|Official website}}
* '''Documentation'''
** {{Tl|mf-adr}}}—Address
** {{Tl|UF-hcard-org}}—[[Microformat]]/metadata
| below =
* {{smallsup|1}} or research institution
* {{smallsup|2}} or college
* [[:Category:Infobox templates|Category]]
* [[Help:Infobox|Help]]
* [[Wikipedia:List of infoboxes|List of infoboxes]]
}}<noinclude>{{documentation}}</noinclude>
8e81fe7179216c1823e098fa600be889f26cbeba
Template:Parameter names example
10
132
255
2023-10-08T00:30:05Z
wikipedia>Shkuru Afshar
0
wikitext
text/x-wiki
<includeonly>{{#invoke:Parameter names example|main}}</includeonly><noinclude>
{{documentation}}<!-- Add categories to the /doc subpage, interwikis to Wikidata, not here -->
</noinclude>
256a11b9ae7ac7e492b3d9de86ade1ffa96bffd1
Template:Refbegin
10
51
95
2023-10-08T12:55:12Z
wikipedia>Paine Ellsworth
0
per edit request on talk page - update - see [[Template talk:Refbegin#Template-protected edit request on 7 October 2023|talk page]]
wikitext
text/x-wiki
<includeonly><templatestyles src="Refbegin/styles.css" /><!--
--><div class="refbegin <!--
-->{{#if: {{{indent|}}} | refbegin-hanging-indents }} <!--
-->{{#if: {{{1|{{{colwidth|}}}}}} |
{{#ifeq: {{{1}}} | 1
| <!--default to no columns-->
| refbegin-columns references-column-width
}}
}}
" style="<!--
-->{{#if: {{{1|}}}
|{{#ifeq: {{{1}}} | 1
|<!--default to no columns-->
| {{#iferror: {{#ifexpr: {{{1|1}}} > 1 }}
| column-width: {{#if:1|{{{1|30em}}}}}
| column-width: 30em
}}
}}
| {{#if: {{{colwidth|}}}
| column-width: {{{colwidth|30em}}}
}}
}}"></includeonly><noinclude>
{{Documentation}}
</noinclude>
ef78d644991e74866d1adf16edde6ea255263230
Module:Navbar
828
103
197
2023-10-10T22:34:57Z
wikipedia>Pppery
0
Per edit request on talk
Scribunto
text/plain
local p = {}
local cfg = mw.loadData('Module:Navbar/configuration')
local function get_title_arg(is_collapsible, template)
local title_arg = 1
if is_collapsible then title_arg = 2 end
if template then title_arg = 'template' end
return title_arg
end
local function choose_links(template, args)
-- The show table indicates the default displayed items.
-- view, talk, edit, hist, move, watch
-- TODO: Move to configuration.
local show = {true, true, true, false, false, false}
if template then
show[2] = false
show[3] = false
local index = {t = 2, d = 2, e = 3, h = 4, m = 5, w = 6,
talk = 2, edit = 3, hist = 4, move = 5, watch = 6}
-- TODO: Consider removing TableTools dependency.
for _, v in ipairs(require ('Module:TableTools').compressSparseArray(args)) do
local num = index[v]
if num then show[num] = true end
end
end
local remove_edit_link = args.noedit
if remove_edit_link then show[3] = false end
return show
end
local function add_link(link_description, ul, is_mini, font_style)
local l
if link_description.url then
l = {'[', '', ']'}
else
l = {'[[', '|', ']]'}
end
ul:tag('li')
:addClass('nv-' .. link_description.full)
:wikitext(l[1] .. link_description.link .. l[2])
:tag(is_mini and 'abbr' or 'span')
:attr('title', link_description.html_title)
:cssText(font_style)
:wikitext(is_mini and link_description.mini or link_description.full)
:done()
:wikitext(l[3])
:done()
end
local function make_list(title_text, has_brackets, displayed_links, is_mini, font_style)
local title = mw.title.new(mw.text.trim(title_text), cfg.title_namespace)
if not title then
error(cfg.invalid_title .. title_text)
end
local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or ''
-- TODO: Get link_descriptions and show into the configuration module.
-- link_descriptions should be easier...
local link_descriptions = {
{ ['mini'] = 'v', ['full'] = 'view', ['html_title'] = 'View this template',
['link'] = title.fullText, ['url'] = false },
{ ['mini'] = 't', ['full'] = 'talk', ['html_title'] = 'Discuss this template',
['link'] = talkpage, ['url'] = false },
{ ['mini'] = 'e', ['full'] = 'edit', ['html_title'] = 'Edit this template',
['link'] = 'Special:EditPage/' .. title.fullText, ['url'] = false },
{ ['mini'] = 'h', ['full'] = 'hist', ['html_title'] = 'History of this template',
['link'] = 'Special:PageHistory/' .. title.fullText, ['url'] = false },
{ ['mini'] = 'm', ['full'] = 'move', ['html_title'] = 'Move this template',
['link'] = mw.title.new('Special:Movepage'):fullUrl('target='..title.fullText), ['url'] = true },
{ ['mini'] = 'w', ['full'] = 'watch', ['html_title'] = 'Watch this template',
['link'] = title:fullUrl('action=watch'), ['url'] = true }
}
local ul = mw.html.create('ul')
if has_brackets then
ul:addClass(cfg.classes.brackets)
:cssText(font_style)
end
for i, _ in ipairs(displayed_links) do
if displayed_links[i] then add_link(link_descriptions[i], ul, is_mini, font_style) end
end
return ul:done()
end
function p._navbar(args)
-- TODO: We probably don't need both fontstyle and fontcolor...
local font_style = args.fontstyle
local font_color = args.fontcolor
local is_collapsible = args.collapsible
local is_mini = args.mini
local is_plain = args.plain
local collapsible_class = nil
if is_collapsible then
collapsible_class = cfg.classes.collapsible
if not is_plain then is_mini = 1 end
if font_color then
font_style = (font_style or '') .. '; color: ' .. font_color .. ';'
end
end
local navbar_style = args.style
local div = mw.html.create():tag('div')
div
:addClass(cfg.classes.navbar)
:addClass(cfg.classes.plainlinks)
:addClass(cfg.classes.horizontal_list)
:addClass(collapsible_class) -- we made the determination earlier
:cssText(navbar_style)
if is_mini then div:addClass(cfg.classes.mini) end
local box_text = (args.text or cfg.box_text) .. ' '
-- the concatenated space guarantees the box text is separated
if not (is_mini or is_plain) then
div
:tag('span')
:addClass(cfg.classes.box_text)
:cssText(font_style)
:wikitext(box_text)
end
local template = args.template
local displayed_links = choose_links(template, args)
local has_brackets = args.brackets
local title_arg = get_title_arg(is_collapsible, template)
local title_text = args[title_arg] or (':' .. mw.getCurrentFrame():getParent():getTitle())
local list = make_list(title_text, has_brackets, displayed_links, is_mini, font_style)
div:node(list)
if is_collapsible then
local title_text_class
if is_mini then
title_text_class = cfg.classes.collapsible_title_mini
else
title_text_class = cfg.classes.collapsible_title_full
end
div:done()
:tag('div')
:addClass(title_text_class)
:cssText(font_style)
:wikitext(args[1])
end
local frame = mw.getCurrentFrame()
-- hlist -> navbar is best-effort to preserve old Common.css ordering.
return frame:extensionTag{
name = 'templatestyles', args = { src = cfg.hlist_templatestyles }
} .. frame:extensionTag{
name = 'templatestyles', args = { src = cfg.templatestyles }
} .. tostring(div:done())
end
function p.navbar(frame)
return p._navbar(require('Module:Arguments').getArgs(frame))
end
return p
047f307758c878eb3e99ed1768cc40920a6ec5fa
Module:Footnotes/whitelist
828
60
113
2023-10-15T16:37:35Z
wikipedia>Mathglot
0
Include redirect for Legifrance in local whitelist (around [[Module:Footnotes/whitelist#L-1090|L. 1090]]); see [[Module talk:Footnotes#Legifrance]].
Scribunto
text/plain
--[[--------------------------< W R A P P E R _ T E M P L A T E _ D E F A U L T S >----------------------------
A list of wrapper templates by their canonical names – spelling and capitalization is important. Each wrapper
template has a table of two values: [1] is the wrapper's default name-list as it is used in an anchor ID; [2] is
the default year. This table is indexed indirectly through the wrapper_templates table.
This table is not available externally.
]]
local wrapper_template_defaults = { -- keys are canonical template names
['Americana'] = {'Rines', '1920'}, -- tables with default name and default year
['Cite EB1911'] = {'Chisholm', '1911'}, -- tables with default name and default year
['EB1911'] = {'Chisholm', '1911'},
['EI3'] = {'FleetKrämerMatringeNawas', ''},
['ODNB'] = {'', ''}, -- there is no default anchor ID; this forces evaluation of {{cite ODNB}} redirects
}
--[[--------------------------< W R A P P E R _ T E M P L A T E _ D E F A U L T S _ V O L >--------------------
For wrapper templates that use |volume= to specify default name (often editor names) and year. Wrapper templates
are indexed by their canonical names – spelling and capitalization is important. Each wrapper template has a table
of values for every volume. Volumes may be indexed by Arabic or Roman numerals. Each volume index has a table of
twp values" [1] is the wrapper's default name-list as it is used in an anchor ID; [2] is the default year. Each
wrapper template in this table must have a ['default'] key for those occasions when |volume= is omitted or empty.
This table is indexed indirectly through the wrapper_templates table.
This table is not available externally.
]]
local wrapper_template_defaults_vol = { -- primary keys are canonical template names; TODO: do these keys have to be canonical template names?
['Cite Catholic Encyclopedia'] = { -- secondary keys are volume
['1'] = {'Herbermann', '1907'},
['2'] = {'Herbermann', '1907'},
['3'] = {'Herbermann', '1908'},
['4'] = {'Herbermann', '1908'},
['5'] = {'Herbermann', '1909'},
['6'] = {'Herbermann', '1909'},
['7'] = {'Herbermann', '1910'},
['8'] = {'Herbermann', '1910'},
['9'] = {'Herbermann', '1910'},
['10'] = {'Herbermann', '1911'},
['11'] = {'Herbermann', '1911'},
['12'] = {'Herbermann', '1911'},
['13'] = {'Herbermann', '1912'},
['14'] = {'Herbermann', '1912'},
['15'] = {'Herbermann', '1912'},
['default'] = {'Herbermann', '1913'},
},
['Cite EB9'] = {
['1'] = {'Baynes', '1878'}, ['I'] = {'Baynes', '1878'},
['2'] = {'Baynes', '1878'}, ['II'] = {'Baynes', '1878'},
['3'] = {'Baynes', '1878'}, ['III'] = {'Baynes', '1878'},
['4'] = {'Baynes', '1878'}, ['IV'] = {'Baynes', '1878'},
['5'] = {'Baynes', '1878'}, ['V'] = {'Baynes', '1878'},
['6'] = {'Baynes', '1878'}, ['VI'] = {'Baynes', '1878'},
['7'] = {'Baynes', '1878'}, ['VII'] = {'Baynes', '1878'},
['8'] = {'Baynes', '1878'}, ['VIII'] = {'Baynes', '1878'},
['9'] = {'Baynes', '1879'}, ['IX'] = {'Baynes', '1879'},
['10'] = {'Baynes', '1879'}, ['X'] = {'Baynes', '1879'},
['11'] = {'BaynesSmith', '1880'}, ['XI'] = {'BaynesSmith', '1880'},
['12'] = {'BaynesSmith', '1881'}, ['XII'] = {'BaynesSmith', '1881'},
['13'] = {'BaynesSmith', '1881'}, ['XIII'] = {'BaynesSmith', '1881'},
['14'] = {'BaynesSmith', '1882'}, ['XIV'] = {'BaynesSmith', '1882'},
['15'] = {'BaynesSmith', '1883'}, ['XV'] = {'BaynesSmith', '1883'},
['16'] = {'BaynesSmith', '1883'}, ['XVI'] = {'BaynesSmith', '1883'},
['17'] = {'BaynesSmith', '1884'}, ['XVII'] = {'BaynesSmith', '1884'},
['18'] = {'BaynesSmith', '1885'}, ['XVIII'] = {'BaynesSmith', '1885'},
['19'] = {'BaynesSmith', '1885'}, ['XIX'] = {'BaynesSmith', '1885'},
['20'] = {'BaynesSmith', '1886'}, ['XX'] = {'BaynesSmith', '1886'},
['21'] = {'BaynesSmith', '1886'}, ['XXI'] = {'BaynesSmith', '1886'},
['22'] = {'BaynesSmith', '1887'}, ['XXII'] = {'BaynesSmith', '1887'},
['23'] = {'BaynesSmith', '1888'}, ['XXIII'] = {'BaynesSmith', '1888'},
['24'] = {'BaynesSmith', '1888'}, ['XXIV'] = {'BaynesSmith', '1888'},
['default'] = {'Baynes', '1875–1889'},
},
['Encyclopaedia of Islam, New Edition'] = {
['1'] = {'GibbKramersLévi-ProvençalSchacht', '1960'},
['2'] = {'LewisPellatSchacht', '1965'},
['3'] = {'LewisMénagePellatSchacht', '1971'},
['4'] = {'van_DonzelLewisPellatBosworth', '1978'},
['5'] = {'Bosworthvan_DonzelLewisPellat', '1986'},
['6'] = {'Bosworthvan_DonzelPellat', '1991'},
['7'] = {'Bosworthvan_DonzelHeinrichsPellat', '1993'},
['8'] = {'Bosworthvan_DonzelHeinrichsLecomte', '1995'},
['9'] = {'Bosworthvan_DonzelHeinrichsLecomte', '1997'},
['10'] = {'BearmanBianquisBosworthvan_Donzel', '2000'},
['11'] = {'BearmanBianquisBosworthvan_Donzel', '2002'},
['12'] = {'BearmanBianquisBosworthvan_Donzel', '2004'},
['atlas'] = {'Brice', '1981'},
['abridged'] = {'van_Donzel', '1994'},
['default'] = {'BearmanBianquisBosworthvan_Donzel', '1960–2005'},
},
['New Cambridge Medieval History'] = {
['1'] = {'Fouracre', '2005'},
['2'] = {'McKitterick', '1995'},
['3'] = {'Reuter', '2000'},
['4a'] = {'LuscombeRiley-Smith', '2004'},
['4b'] = {'LuscombeRiley-Smith', '2004'},
['5'] = {'Abulafia', '1999'},
['6'] = {'Jones', '2000'},
['7'] = {'Allmand', '1998'},
['default'] = {'', '1995–2005'},
},
['The History of al-Tabari'] = {
['1'] = {'Rosenthal', '1989'},
['2'] = {'Brinner', '1986'},
['3'] = {'Brinner', '1991'},
['4'] = {'Perlmann', '1987'},
['5'] = {'Bosworth', '1999'},
['6'] = {'WattMcDonald', '1989'},
['7'] = {'McDonald', '1987'},
['8'] = {'Fishbein', '1997'},
['9'] = {'Poonawala', '1990'},
['10'] = {'Donner', '1993'},
['11'] = {'Blankinship', '1993'},
['12'] = {'Friedmann', '1992'},
['13'] = {'Juynboll', '1989'},
['14'] = {'Smith', '1994'},
['15'] = {'Humphreys', '1990'},
['16'] = {'Brockett', '1997'},
['17'] = {'Hawting', '1996'},
['18'] = {'Morony', '1987'},
['19'] = {'Howard', '1990'},
['20'] = {'Hawting', '1989'},
['21'] = {'Fishbein', '1990'},
['22'] = {'Rowson', '1989'},
['23'] = {'Hinds', '1990'},
['24'] = {'Powers', '1989'},
['25'] = {'Blankinship', '1989'},
['26'] = {'Hillenbrand', '1989'},
['27'] = {'Williams', '1985'},
['28'] = {'McAuliffe', '1995'},
['29'] = {'Kennedy', '1990'},
['30'] = {'Bosworth', '1989'},
['31'] = {'Fishbein', '1992'},
['32'] = {'Bosworth', '1987'},
['33'] = {'Bosworth', '1991'},
['34'] = {'Kraemer', '1989'},
['35'] = {'Saliba', '1985'},
['36'] = {'Waines', '1992'},
['37'] = {'Fields', '1987'},
['38'] = {'Rosenthal', '1985'},
['39'] = {'Landau-Tasseron', '1998'},
['40'] = {'Popovkin', '2007'},
['default'] = {'Yarshater', '1985–2007'},
},
}
--[[--------------------------< W R A P P E R _ T E M P L A T E S >--------------------------------------------
A list of wrapper templates and their redirects – spelling and capitalization is important; first character is
always uppercase. Each wrapper template gets its value from a k/v pair in the wrapper_template_defaults table.
article reader queries this table to see if template_name is a wrapper template
]]
local wrapper_templates = { -- keys are names of wrapper templates and their redirects
['Americana'] = wrapper_template_defaults['Americana'], -- canonical name; this template calls Cite Americana
['Catholic Encyclopedia'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['1913Catholic'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['Catholic'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['Catholic encyclopedia'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['CatholicEncyclopedia'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['CE13'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['CE1913'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['Cite Americana'] = wrapper_template_defaults['Americana'], -- canonical name
['Cite Catholic Encyclopedia'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['CathEncy'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['Cite Catholic Encyclopædia'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['Cite CE1913'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['Cite EB1911'] = wrapper_template_defaults['Cite EB1911'], -- canonical name
['1911EB'] = wrapper_template_defaults['Cite EB1911'], -- redirects
['EB1911 cite'] = wrapper_template_defaults['Cite EB1911'],
['Wikisource1911Enc Citation'] = wrapper_template_defaults['Cite EB1911'],
['Wikisource1911Enc citation'] = wrapper_template_defaults['Cite EB1911'],
['Cite EB9'] = wrapper_template_defaults_vol['Cite EB9'], -- canonical
['Eb9'] = wrapper_template_defaults_vol['Cite EB9'],
['Cite ODNB'] = wrapper_template_defaults['ODNB'], -- canonical
['Cite odnb'] = wrapper_template_defaults['ODNB'],
['DNBweb'] = wrapper_template_defaults['ODNB'],
['OBDNweb'] = wrapper_template_defaults['ODNB'],
['ODNB'] = wrapper_template_defaults['ODNB'],
['ODNBref'] = wrapper_template_defaults['ODNB'],
['ODNBweb'] = wrapper_template_defaults['ODNB'],
['EB1911'] = wrapper_template_defaults['EB1911'], -- canonical name; this template calls Cite EB1911
['1911'] = wrapper_template_defaults['EB1911'], -- redirects
['1911s'] = wrapper_template_defaults['EB1911'],
['Britannica 1911'] = wrapper_template_defaults['EB1911'],
['Encyclopedia Britannica 1911'] = wrapper_template_defaults['EB1911'],
['Encyclopædia Britannica 1911'] = wrapper_template_defaults['EB1911'],
['EB9'] = wrapper_template_defaults_vol['Cite EB9'], -- canonical; this template calls Cite EB9
['Encyclopaedia of Islam, New Edition'] = wrapper_template_defaults_vol['Encyclopaedia of Islam, New Edition'], -- canonical
['EI2'] = wrapper_template_defaults_vol['Encyclopaedia of Islam, New Edition'],
['Encyclopaedia of Islam, THREE'] = wrapper_template_defaults['EI3'], -- canonical
['EI3'] = wrapper_template_defaults['EI3'],
['New Cambridge Medieval History'] = wrapper_template_defaults_vol['New Cambridge Medieval History'], -- canonical
['The History of al-Tabari'] = wrapper_template_defaults_vol['The History of al-Tabari'], -- canonical
['The History of Al-Tabari'] = wrapper_template_defaults_vol['The History of al-Tabari'], -- redirects
['The History of al-Ṭabarī'] = wrapper_template_defaults_vol['The History of al-Tabari'], -- redirects
}
--[[--------------------------< T E M P L A T E _ N A M E S >--------------------------------------------------
This table holds the names of templates and the names of their redirects. Template names must be written exactly
as they are named at their templatespace page. This same also applies to redirects.
The indexes in this table are not critical but should be short and concise.
]]
local template_names = {
['ADB'] = {'Allgemeine Deutsche Biographie', 'Cite ADB'},
['Butt_Stations'] = {'Butt-Stations', 'Butt-stations'},
['Cam_Hist_Iran'] = {'Cambridge History of Iran', 'The Cambridge History of Iran'},
['DNB'] = {'Cite DNB', 'DNB', 'DNB Cite', 'Cite DNBSupp', 'DNBSupp', 'Cite DNB12', 'Cite DNBIE', 'DNB12', 'DNBIE', 'DNBfirst'},
['ME-ref'] = {'ME-ref', 'Me-ref'},
['ODB'] = {'ODB', 'Oxford Dictionary of Byzantium'},
['ODLA'] = {'ODLA', 'Oxford Dictionary of Late Antiquity'},
['NDB'] = {'Cite NDB', 'NDB'},
['Iranica'] = {'Encyclopædia Iranica Online', 'Encyclopædia Iranica', 'Encyclopaedia Iranica', 'Cite Encyclopædia Iranica Online'},
}
--[[--------------------------< S P E C I A L _ P A T T E R N S >----------------------------------------------
Lua patterns. These are scanned sequentially which costs time and processing far and above the time and processing
needed to index into whitelist{}. Do not create a pattern here if a normal whitelist entry or entries can be created.
]]
local special_patterns = {
'CITEREFACAD%u%u%u?%u?%d+%u%u?', -- {{Acad}} ID appears to be 2-4 letters, then 3 numbers, then 1-2 letters
'CITEREFAHD%d+', -- {{Cite AHD}}
'CITEREFHistoric_England%d+', -- {{National Heritage List for England}} & {{PastScape}}
'CITEREFHistoric_Environment_Scotland%u%u%u?%u?%d', -- {{Historic Environment Scotland}} %u can be BTL, GLD, HMPA, LB, SM
'CITEREFQHR%d+', -- {{Cite QHR}}
'CITEREF[%d%a_%pöüäß→]+_at_Bach_Digital', -- {{BDh}}
'CITEREF[BR]GBl_[12]%d%d%d%-?I?I?%/%d+', -- {{Cite Austrian gazette}}
'CITEREFStGBl_[12]%d%d%d%/%d+', -- {{Cite Austrian gazette}}
'CITEREFGBlÖ_[12]%d%d%d%/%d+', -- {{Cite Austrian gazette}}
}
--[[--------------------------< D N B _ S P E C I A L _ P A T T E R N S >--------------------------------------
Lua patterns. Note at special_patterns applies. These for the DNB templates only; these will be tried only when
there is a DNB template in the article.
Pretty much any author name during the period 1885–1901 inclusive, and 1912.
The DNBIE was published in 1903, and Template:DNBIE says that its use is deprecated, but we do not fight that battle here.
]]
local DNB_special_patterns = {
'CITEREF%a[%a%-_\']*188[5-9]', -- 1885–1889
'CITEREF%a[%a%-_\']*189%d', -- 1890–1899
'CITEREF%a[%a%-_\']*190[0-1]', -- 1900–1901
'CITEREF%a[%a%-_\']*1903', -- 1903 IE
'CITEREF%a[%a%-_\']*1912', -- 1912 supplement
}
--[[--------------------------< W H I T E L I S T >------------------------------------------------------------
This is a list of anchor IDs known to be associated with specific wrapper templates. The anchor ID serves as an
index into the table. The assigned value is another table that lists the associated template and any redirects.
Except for year disambiguators, anchor IDs must have the same form as the anchor creator makes; must be the
anchor-encoded form. Remove the year disambiguator.
Template names must be written exactly as they are named at their templatespace page. This same also applies to
redirects. Module:Footnotes reads the template names left to right so most-commonly-used template or redirect name
should appear first. When there are more than one name and when those templates have various anchor IDs the template
namelist should be added to the template_names{} table.
Note that references to Template:EB1911 are listed under "E" in the alphabetical list below to keep them organized.
]]
local whitelist = {
----------< # >----------
['CITEREF2013_Statistical_Yearbook_of_the_Republic_of_Croatia'] = {'Croatia Yearbook 2013'},
----------< A >----------
['CITEREFAGA_1884–1897'] = {'Schubert\'s compositions (references)'},
['CITEREFATOC2009'] = {'ATOCConnectingCommunitiesReportS10'},
['CITEREFAbaevBailey1985'] = template_names['Iranica'],
['CITEREFAbbas1988'] = template_names['Iranica'],
['CITEREFAbbas1989'] = template_names['Iranica'],
['CITEREFAbramowitzStegun1983'] = {'Abramowitz Stegun ref'},
['CITEREFActa_Lipsiensium1723'] = {'Bach\'s compositions (sources)'},
['CITEREFAdamsFranzosa2009'] = {'Adams Franzosa Introduction to Topology Pure and Applied'},
['CITEREFAdaschErnstKeim1978'] = {'Adasch Topological Vector Spaces'},
['CITEREFAffleck1978'] = {'Affleck-On Track'},
['CITEREFAhlgrimm1969'] = {'Bach\'s compositions (sources)'},
['CITEREFAhmadiNegahban2013'] = {'Encyclopaedia Islamica'},
['CITEREFAhrons1927'] = {'Book-Ahrons-British Steam Railway Locomotive'},
['CITEREFAl-Kindi1912'] = {'The Governors and Judges of Egypt'},
['CITEREFAlbert_Schumann1886'] = {'Cite ADB'},
['CITEREFAlden1916'] = {'Shakespeare sonnets bibliography'},
['CITEREFAldrich1969'] = {'Aldrich-LocosGER7'},
['CITEREFAleksidze2018'] = template_names['ODLA'],
['CITEREFAlexiou2010'] = {'Cite flatiron'},
['CITEREFAlgar1983'] = template_names['Iranica'],
['CITEREFAlgar1989'] = template_names['Iranica'],
['CITEREFAlgar1990'] = template_names['Iranica'],
['CITEREFAlgar2003'] = template_names['Iranica'],
['CITEREFAliprantisBorder2006'] = {'Aliprantis Border Infinite Dimensional Analysis A Hitchhiker\'s Guide Third Edition'},
['CITEREFAlizadeh1990'] = template_names['Iranica'],
['CITEREFAllamaniPanagiotopoulou1978'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFAllcockDaviesle_FlemingMaskelyne1968'] = {'RCTS-LocosGWR-1'},
['CITEREFAllenBoddyBrownFry1970'] = {'RCTS-LocosLNER-8A', 'RCTS-LocosLNER'},
['CITEREFAllenBoddyBrownFry1971'] = {'RCTS-LocosLNER-8B', 'RCTS-LocosLNER'},
['CITEREFAllenBoddyBrownFry1983'] = {'RCTS-LocosLNER-8A', 'RCTS-LocosLNER'},
['CITEREFAmanat1985'] = template_names['Iranica'],
['CITEREFAmanat1998'] = template_names['Iranica'],
['CITEREFAmanat1999'] = template_names['Iranica'],
['CITEREFAmbartsumian2014'] = template_names['Iranica'],
['CITEREFAmerican_Railway_Association1922'] = {'1922 Locomotive Cyclopedia'},
['CITEREFAnderson1952'] = {'Naval Wars in the Levant 1559–1853'},
['CITEREFAndo2000'] = template_names['Iranica'],
['CITEREFAngelov2018'] = template_names['ODLA'],
['CITEREFAnwārEIr1985'] = template_names['Iranica'],
['CITEREFApostol1976'] = {'Apostol IANT'},
['CITEREFArkhangel'skiiPonomarev1984'] = {'Arkhangel\'skii Ponomarev Fundamentals of General Topology Problems and Exercises'},
['CITEREFArrey_von_Dommer1875'] = {'Cite ADB'},
['CITEREFAshraf2006'] = template_names['Iranica'],
['CITEREFAslanianBerberian2009'] = template_names['Iranica'],
['CITEREFAsmus1966'] = template_names['NDB'],
['CITEREFAsmussen1985'] = template_names['Iranica'],
['CITEREFAspreas1929'] = {'Great Military and Naval Encyclopaedia'},
['CITEREFAtkins2007'] = {'Shakespeare sonnets bibliography'},
['CITEREFAube2011'] = template_names['Iranica'],
['CITEREFAudiKondevWangHuang2017'] = {'NUBASE2016'},
['CITEREFAvdoyan2018'] = template_names['ODLA'],
['CITEREFAwdry1990'] = {'Awdry-RailCo', 'Carnarvonshire Railway'},
['CITEREFAzarnoosh2021'] = template_names['Iranica'],
['CITEREFRamelli2018'] = {'Oxford Dictionary of Late Antiquity'},['CITEREFA_History_of_the_Crusades'] = {'Setton-A History of the Crusades'},
----------< B >----------
['CITEREFBabinger1962'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFBabinger1978'] = {'Mehmed the Conqueror and His Time'},
['CITEREFBabinger1992'] = {'Mehmed the Conqueror and His Time'},
['CITEREFBachAgricola1754'] = {'Bach\'s compositions (sources)'},
['CITEREFBadura-SkodaBranscombe2008'] = {'Schubert\'s compositions (references)'},
['CITEREFBagley1999'] = {'Cite Cambridge History of China'},
['CITEREFBahramianHirtensteinGholami2013'] = {'Encyclopaedia Islamica'},
['CITEREFBalcer1990'] = template_names['Iranica'],
['CITEREFBaldwin1969'] = {'Setton-A History of the Crusades'},
['CITEREFBaldwin1985'] = {'Setton-A History of the Crusades'},
['CITEREFBaldwin1991'] = template_names['ODB'],
['CITEREFBaldwinKazhdan1991'] = template_names['ODB'],
['CITEREFBaldwinTalbot1991'] = template_names['ODB'],
['CITEREFBaltzer1916'] = {'Baltzer-Kolonialbahnen'},
['CITEREFBanach1932'] = {'Banach Théorie des Opérations Linéaires'},
['CITEREFBandy2021'] = template_names['Iranica'],
['CITEREFBartusis1991'] = template_names['ODB'],
['CITEREFBaxter1971'] = {'Baxter-BritishLocoCat1'},
['CITEREFBaxter1977'] = {'Baxter-BritishLocoCat1'},
['CITEREFBaxter1978'] = {'Baxter-BritishLocoCat2A'},
['CITEREFBaxter1979'] = {'Baxter-BritishLocoCat2B'},
['CITEREFBaxter1982'] = {'Baxter-BritishLocoCat3A', 'Baxter-BritishLocoCat3B'},
['CITEREFBaxter1984'] = {'Baxter-BritishLocoCat4'},
['CITEREFBaxter1986'] = {'Baxter-BritishLocoCat5A'},
['CITEREFBaxter1988'] = {'Baxter-BritishLocoCat5B'},
['CITEREFBaxter2012'] = {'Baxter-BritishLocoCat6'},
['CITEREFBeattie1986'] = template_names['Iranica'],
['CITEREFBeißwenger1991'] = {'Bach\'s compositions (sources)'},
['CITEREFBek2001'] = {'Cite Grove'},
['CITEREFBelke1996'] = {'Tabula Imperii Byzantini'},
['CITEREFBelkeMersisch1990'] = {'Tabula Imperii Byzantini'},
['CITEREFBelkeRestle1984'] = {'Tabula Imperii Byzantini'},
['CITEREFBellini2008'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFBernardini2003'] = template_names['Iranica'],
['CITEREFBernhard_von_Poten1889'] = template_names['ADB'],
['CITEREFBernhard_von_Poten1898'] = template_names['ADB'],
['CITEREFBernjian2008'] = {'Encyclopaedia Islamica'},
['CITEREFBezilla1980'] = {'Bezilla-PRR-Electric-Traction'},
['CITEREFBianquis1998'] = {'The Cambridge History of Egypt', 'Cambridge History of Egypt'},
['CITEREFBickerman1983'] = template_names['Cam_Hist_Iran'],
['CITEREFBierstedt1988'] = {'Bierstedt An Introduction to Locally Convex Inductive Limits'},
['CITEREFBiran2009'] = template_names['Iranica'],
['CITEREFBirken1976'] = {'Die Provinzen des Osmanischen Reiches'},
['CITEREFBivar1983'] = template_names['Cam_Hist_Iran'],
['CITEREFBivar2003'] = template_names['Iranica'],
['CITEREFBlair2002'] = template_names['Iranica'],
['CITEREFBlair2021'] = template_names['Iranica'],
['CITEREFBlake1966'] = {'DisraeliRef'},
['CITEREFBlanken2019'] = {'Bach\'s compositions (sources)'},
['CITEREFBlankinship1994'] = {'The End of the Jihâd State', 'The End of the Jihad State'},
['CITEREFBlautSchulze2008'] = {'Bach\'s compositions (sources)'},
['CITEREFBloom2007'] = {'Cite Routledge Broadway', 'Cite Broadway Routledge', 'Cite Routledge Guide to Broadway', 'Routledge Guide to Broadway'},
['CITEREFBock1978'] = {'Audie-bock-directors'},
['CITEREFBodde1986'] = {'Cite Cambridge History of China'},
['CITEREFBoddyBrownFryHennigan1968'] = {'RCTS-LocosLNER-4', 'RCTS-LocosLNER'},
['CITEREFBoddyBrownFryHennigan1975'] = {'RCTS-LocosLNER-2B', 'RCTS-LocosLNER'},
['CITEREFBoddyBrownFryHennigan1977'] = {'RCTS-LocosLNER-9A', 'RCTS-LocosLNER-9B', 'RCTS-LocosLNER'},
['CITEREFBoddyBrownFryHennigan1979'] = {'RCTS-LocosLNER-3A', 'RCTS-LocosLNER'},
['CITEREFBoddyBrownHenniganHoole1984'] = {'RCTS-LocosLNER-6C', 'RCTS-LocosLNER'},
['CITEREFBoddyBrownHenniganNeve1981'] = {'RCTS-LocosLNER-3B', 'RCTS-LocosLNER'},
['CITEREFBoddyBrownNeveYeadon1983'] = {'RCTS-LocosLNER-6B', 'RCTS-LocosLNER'},
['CITEREFBoddyFryHenniganHoole1990'] = {'RCTS-LocosLNER-10B', 'RCTS-LocosLNER'},
['CITEREFBoddyFryHenniganProud1963'] = {'RCTS-LocosLNER-1', 'RCTS-LocosLNER'},
['CITEREFBoddyNeveTeeYeadon1982'] = {'RCTS-LocosLNER-6A', 'RCTS-LocosLNER'},
['CITEREFBoddyNeveYeadon1973'] = {'RCTS-LocosLNER-2A', 'RCTS-LocosLNER'},
['CITEREFBody1989'] = {'Body-Railways-Vol2'},
['CITEREFBon1969'] = {'La Morée franque'},
['CITEREFBonebakker1997'] = template_names['Iranica'],
['CITEREFBonner2010'] = {'New Cambridge History of Islam'},
['CITEREFBonnett2005'] = {'Bonnett Practical Rail Engineering'},
['CITEREFBonporti1712'] = {'Bach\'s compositions (sources)'},
['CITEREFBooth2000'] = {'Shakespeare sonnets bibliography'},
['CITEREFBorsari1964'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFBossert1914'] = {'Schaff-Herzog'},
['CITEREFBosworth1968'] = template_names['Cam_Hist_Iran'],
['CITEREFBosworth1975'] = template_names['Cam_Hist_Iran'],
['CITEREFBosworth1983'] = template_names['Iranica'],
['CITEREFBosworth1984'] = template_names['Iranica'],
['CITEREFBosworth1987'] = template_names['Iranica'],
['CITEREFBosworth1988'] = template_names['Iranica'],
['CITEREFBosworth1989'] = template_names['Iranica'],
['CITEREFBosworth1994'] = template_names['Iranica'],
['CITEREFBosworth1995'] = template_names['Iranica'],
['CITEREFBosworth1997'] = template_names['Iranica'],
['CITEREFBosworth1998'] = template_names['Iranica'],
['CITEREFBosworth1999'] = template_names['Iranica'],
['CITEREFBosworth2000'] = template_names['Iranica'],
['CITEREFBosworth2001'] = template_names['Iranica'],
['CITEREFBosworth2002'] = template_names['Iranica'],
['CITEREFBosworth2003'] = template_names['Iranica'],
['CITEREFBosworth2008'] = template_names['Iranica'],
['CITEREFBosworth2009'] = template_names['Iranica'],
['CITEREFBosworth2010'] = template_names['Iranica'],
['CITEREFBosworth2011'] = template_names['Iranica'],
['CITEREFBosworthCrane1984'] = template_names['Iranica'],
['CITEREFBottoMitchell2002'] = {'Cite ATT Broadway', 'Cite At This Theatre Broadway', 'Cite Broadway At This Theatre', 'Cite Broadway ATT'},
['CITEREFBourbaki1987'] = {'Bourbaki Topological Vector Spaces', 'Bourbaki Topological Vector Spaces Part 1 Chapters 1–5'},
['CITEREFBourbaki1989'] = {'Bourbaki General Topology Part I Chapters 1-4', 'Bourbaki General Topology Part II Chapters 5-10', 'Bourbaki Algebra I Chapters 1-3 Springer'},
['CITEREFBourbaki1994'] = {'Bourbaki EHM'},
['CITEREFBournoutian2018'] = {'Cite Armenia and Imperial Decline'},
['CITEREFBowen1928'] = {'The Life and Times of Ali ibn Isa'},
['CITEREFBowmanCameronGarnsey2005'] = {'Cambridge Ancient History'},
['CITEREFBoyce1983'] = template_names['Iranica'],
['CITEREFBoyce1986'] = template_names['Iranica'],
['CITEREFBoyce1989'] = template_names['Iranica'],
['CITEREFBoyce2000'] = template_names['Iranica'],
['CITEREFBoyce2009'] = template_names['Iranica'],
['CITEREFBoyd1970'] = {'Boyd-MidWales'},
['CITEREFBoyd1975'] = {'Boyd-FR1'},
['CITEREFBoyd1985'] = {'Boyd-NCaerns2Penrhyn'},
['CITEREFBoyd1986'] = {'Boyd-NCaerns3Dinorwic'},
['CITEREFBoyd1988'] = {'Boyd-SCaerns1'},
['CITEREFBoyd1989'] = {'Boyd-SCaerns2'},
['CITEREFBoyd1990'] = {'Boyd-NCaerns1'},
['CITEREFBradshaw1968'] = {'Bradshaw-1910April'},
['CITEREFBradshaw1985'] = {'Bradshaw-1922July'},
['CITEREFBradshaw2011'] = {'Bradshaw-1895December'},
['CITEREFBradshaw2012'] = {'Bradshaw-1850March'},
['CITEREFBrand1968'] = {'Byzantium Confronts the West'},
['CITEREFBrand1991'] = {'DBI', 'ODB', 'Oxford Dictionary of Byzantium'},
['CITEREFBray2010'] = {'Bray-SDJR'},
['CITEREFBrett2010'] = {'New Cambridge History of Islam'},
['CITEREFBriant1985'] = template_names['Iranica'],
['CITEREFBrosius2000'] = template_names['Iranica'],
['CITEREFBrown2000'] = template_names['Iranica'],
['CITEREFBrown2008'] = {'The Cambridge History of the Byzantine Empire'},
['CITEREFBrown2021'] = {'Cite Gaia EDR3'},
['CITEREFBrunner1975'] = template_names['Cam_Hist_Iran'],
['CITEREFBrunner1983'] = template_names['Cam_Hist_Iran'],
['CITEREFBrunner1984'] = template_names['Iranica'],
['CITEREFBrunner1986'] = template_names['Iranica'],
['CITEREFBryan1886'] = {'Bryan (3rd edition)'},
['CITEREFBryan1889'] = {'Bryan (3rd edition)'},
['CITEREFBuhle1909'] = {'Bach\'s compositions (sources)'},
['CITEREFBulliet1984'] = template_names['Iranica'],
['CITEREFBulookbashiNegahban2008'] = {'Encyclopaedia Islamica'},
['CITEREFBunbury1857'] = {'DGRG'},
['CITEREFBurant1987'] = {'Cite DCB'},
['CITEREFBurch1911'] = {'Burch Electric Traction'},
['CITEREFBurke1866'] = {'O\'Donnell family tree'},
['CITEREFBurn1985'] = template_names['Cam_Hist_Iran'],
['CITEREFBurrowsWallace1999'] = {'Cite gotham'},
['CITEREFBury1911'] = {'The Imperial Administrative System of the Ninth Century'},
['CITEREFBusse1975'] = template_names['Cam_Hist_Iran'],
['CITEREFBusse1982'] = template_names['Iranica'],
['CITEREFButcherNicholson2018'] = template_names['ODLA'],
['CITEREFButt1995'] = template_names['Butt_Stations'],
['CITEREFBöwering1995'] = template_names['Iranica'],
['CITEREFBürgelMottahedeh1988'] = template_names['Iranica'],
----------< C >----------
['CITEREFCIC1983'] = {'CIC1983bib'},
['CITEREFCalifornia1988'] = {'CA-Rail Passenger Development Plan-1988'},
['CITEREFCallwell1999'] = {'Muni Chronology'},
['CITEREFCalmard1988'] = template_names['Iranica'],
['CITEREFCalmard1999'] = template_names['Iranica'],
['CITEREFCaltrans1984'] = {'Countrystudy'},
['CITEREFCameronWard-PerkinsWhitby2000'] = {'Cambridge Ancient History'},
['CITEREFCanepa2018'] = template_names['ODLA'],
['CITEREFCanny2008'] = {'O\'Donnell family tree'},
['CITEREFCappelCutlerKazhdan1991'] = template_names['ODB'],
['CITEREFCarl_von_Prantl1879'] = {'Cite ADB'},
['CITEREFCarlson2010'] = {'Dlmf'},
['CITEREFCaro1974'] = {'Cite Power Broker'},
['CITEREFCarpenter1977'] = template_names['ME-ref'],
['CITEREFCarpenter1981'] = template_names['ME-ref'],
['CITEREFCarra_de_VauxHodgson1965'] = {'EI2'},
['CITEREFCarter2006'] = {'Carter-RailwaysMotivePowerArgentina'},
['CITEREFCasserley1968'] = {'Casserley-joint'},
['CITEREFCasserleyJohnston1966'] = {'Casserley-LocoGrouping3'},
['CITEREFCasserleyJohnston1974'] = {'Casserley-LocoGrouping3', 'Casserley-LocoGrouping2', '0-7110-0554-0'},
['CITEREFCasway1984'] = {'O\'Donnell family tree'},
['CITEREFCavanna_Ciappina2001'] = {'DBI'},
['CITEREFCawley2001'] = {'Medieval Lands by Charles Cawley', 'MLCC'},
['CITEREFCawley2001'] = {'Medieval Lands by Charles Cawley'},
['CITEREFCawley2010'] = {'MLCC'},
['CITEREFCawley2011'] = {'MLCC'},
['CITEREFCawley2012'] = {'Medieval Lands by Charles Cawley'},
['CITEREFChaléardChanson-JabeurBéranger2006'] = {'Chaléard-Le cdf en Afrique'},
['CITEREFChambers1728'] = {'Cyclopaedia 1728'},
['CITEREFChasiotis1975'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFChaumont1985'] = template_names['Iranica'],
['CITEREFChaumont1986'] = template_names['Iranica'],
['CITEREFChaumont1987'] = template_names['Iranica'],
['CITEREFChaumont1990'] = template_names['Iranica'],
['CITEREFChaumontSchippmann1988'] = template_names['Iranica'],
['CITEREFCheyneBlack1899'] = {'Biblica', 'Cite Biblica'},
['CITEREFCheyneBlack1899–1903'] = {'Cite Biblica'},
['CITEREFCheyneBlack1901'] = {'Cite Biblica'},
['CITEREFCheyneBlack1902'] = {'Cite Biblica'},
['CITEREFCheyneBlack1903'] = {'Cite Biblica'},
['CITEREFChisholm1922'] = {'EB1922', 'Cite EB1922'},
['CITEREFChittick1997'] = template_names['Iranica'],
['CITEREFChkeidze2001'] = template_names['Iranica'],
['CITEREFChoniates1984'] = {'O City of Byzantium'},
['CITEREFChrista_Jost1999'] = template_names['NDB'],
['CITEREFChung1994'] = {'Country study'},
['CITEREFChurchmanHurst2001'] = {'Churchman & Hurst Railways of New Zealand'},
['CITEREFChurchman_&_Hurst2001'] = {'Churchman & Hurst Railways of New Zealand'},
['CITEREFChurella2013'] = {'Churella-PRR-1'},
['CITEREFClementsMcMahon2008'] = {'ClementsMcMahon-GSR Locomotives'},
['CITEREFClinker1978'] = {'Clinker-Stations'},
['CITEREFClinker1988'] = {'Clinker-Stations'},
['CITEREFCoates1990'] = {'Coates-Reading'},
['CITEREFColbyWilliams1916'] = {'New International Encyclopedia', 'NIE'},
['CITEREFColledgeWarlow2006'] = {'Colledge', 'Cite Colledge2006'},
['CITEREFColledgeWarlow2010'] = {'Cite Colledge2010'},
['CITEREFCollins2016'] = {'Cite Collins 2016'},
['CITEREFColvin1947'] = {'Colvin1947'},
['CITEREFConolly1998'] = {'IanAllan-PreGroup-Atlas1998'},
['CITEREFConway1990'] = {'Conway A Course in Functional Analysis'},
['CITEREFCosentino2008'] = {'DBI'},
['CITEREFCoulthard-Clark2002'] = {'Australian Dictionary of Biography'},
['CITEREFCousin1910'] = {'A Short Biographical Dictionary of English Literature', 'Cite SBDEL'},
['CITEREFCoverdale_&_Colpitts1946'] = {'Coverdale & Colpitts 1', 'Coverdale & Colpitts 2', 'Coverdale & Colpitts 3'},
['CITEREFCox1967'] = {'Cox-Upper Darby'},
['CITEREFCox2011'] = {'Cox-Dixie'},
['CITEREFCrevier1993'] = {'Crevier 1993'},
['CITEREFCrockett2007'] = {'Australian Dictionary of Biography'},
['CITEREFCroke2018'] = template_names['ODLA'],
['CITEREFCrone1980'] = {'Slaves on Horses'},
['CITEREFCrone2003'] = {'Slaves on Horses'},
['CITEREFCronin2011'] = template_names['Iranica'],
['CITEREFCroughtonKidnerYoung1982'] = {'Croughton-PrivateStations'},
['CITEREFCruickshanks1970'] = {'HistoryofParliament'},
['CITEREFCsászár1978'] = {'Császár General Topology'},
['CITEREFCudahy2002'] = {'Cudahy-Hudson'},
['CITEREFCudahy2003'] = {'Cudahy-Subways'},
['CITEREFCurta2006'] = {'Southeastern Europe in the Middle Ages, 500–1250'},
----------< D >----------
['CITEREFDBI'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFDZS2015'] = {'Croatia Yearbook 2015'},
['CITEREFDadelsen1957'] = {'Bach\'s compositions (sources)'},
['CITEREFDaftary1990'] = {'Daftary-The Ismailis'},
['CITEREFDaftary2003'] = template_names['Iranica'],
['CITEREFDaftary2007'] = {'Daftary-The Ismailis'},
['CITEREFDaftary2015'] = template_names['Iranica'],
['CITEREFDaiber1988'] = template_names['Iranica'],
['CITEREFDandamayevShahbaziLecoq1986'] = template_names['Iranica'],
['CITEREFDaniel2000'] = template_names['Iranica'],
['CITEREFDaniel2010'] = {'New Cambridge History of Islam'},
['CITEREFDanielsDench1963'] = {'Daniels-NoMore'},
['CITEREFDanielsDench1973'] = {'Daniels-NoMore'},
['CITEREFDanner1975'] = template_names['Cam_Hist_Iran'],
['CITEREFDarleyCanepa2018'] = {'Oxford Dictionary of Late Antiquity'},
['CITEREFDaryaee2009'] = template_names['Iranica'],
['CITEREFDaryaee2018'] = template_names['ODLA'],
['CITEREFDaryaeeCanepa2018'] = template_names['ODLA'],
['CITEREFDavid1961'] = {'Bach\'s compositions (sources)'},
['CITEREFDavidson2010'] = {'HistoryofParliament'},
['CITEREFDavidsonThrush2010'] = {'HistoryofParliament'},
['CITEREFDavies1996'] = {'Davies-PLMLocoList'},
['CITEREFDavies1997'] = {'Davies-NordLocoList'},
['CITEREFDavies2001'] = {'Davies-EstLocoList3', 'Davies-ÉtatLocoList'},
['CITEREFDavies2003'] = {'Davies-SNCFLocoList'},
['CITEREFDaviesFirthLuckingThomas1966'] = {'RCTS-LocosGWR-10'},
['CITEREFDavud2018'] = {'Encyclopaedia Islamica'},
['CITEREFDavudNazerian2008'] = {'Encyclopaedia Islamica'},
['CITEREFDe_Negri1997'] = {'DBI'},
['CITEREFDemircan2010'] = {'TDV Encyclopedia of Islam'},
['CITEREFDer_Matossian2020'] = {'Cite The First Republic of Armenia'},
['CITEREFDeutsch1951'] = {'Schubert\'s compositions (references)'},
['CITEREFDeutsch1978'] = {'Schubert\'s compositions (references)'},
['CITEREFDeutsche_Autos,_Band_2,2001'] = {'Deutsche Autos-2'},
['CITEREFDeutsche_Autos,_Band_3,2001'] = {'Deutsche Autos-3'},
['CITEREFDeutsche_Autos,_Band_4,2001'] = {'Deutsche Autos-4'},
['CITEREFDeutsche_Autos,_Band_5,2001'] = {'Deutsche Autos-5'},
['CITEREFDeutsche_Autos,_Band_6,2001'] = {'Deutsche Autos-6'},
['CITEREFDewick2005'] = {'Dewick-Atlas'},
['CITEREFDiamonstein-Spielvogel2011'] = {'Cite landmarks'},
['CITEREFDickens2018'] = template_names['ODLA'],
['CITEREFDirksen1998'] = {'Bach\'s compositions (sources)'},
['CITEREFDirksen2010'] = {'Bach\'s compositions (sources)'},
['CITEREFDirksen2016'] = {'Bach\'s compositions (sources)'},
['CITEREFDixmier1984'] = {'Dixmier General Topology'},
['CITEREFDoerfer1989'] = template_names['Iranica'],
['CITEREFDoganis1930'] = {'Great Military and Naval Encyclopaedia'},
['CITEREFDoleckiMynard2016'] = {'Dolecki Mynard Convergence Foundations Of Topology'},
['CITEREFDolkart1998'] = {'Cite morningside'},
['CITEREFDonaghy1972'] = {'Donaghy-LMR'},
['CITEREFDonner1995'] = template_names['Iranica'],
['CITEREFDonohue2003'] = {'The Buwayhid Dynasty in Iraq'},
['CITEREFDorin1972'] = {'Dorin-North Western'},
['CITEREFDow1962'] = {'Dow-GC2'},
['CITEREFDow1965'] = {'Dow-GC3'},
['CITEREFDow1985'] = {'Dow-GC1'},
['CITEREFDowney2007'] = {'Downey-Chicago'},
['CITEREFDrechsler2005'] = template_names['Iranica'],
['CITEREFDrummond1964'] = {'HistoryofParliament'},
['CITEREFDrury1985'] = {'Drury Historical Guide 1985'},
['CITEREFDrury1993'] = {'Drury-North American Steam'},
['CITEREFDuchesne-Guillemin1994'] = template_names['Iranica'],
['CITEREFDugundji1966'] = {'Dugundji Topology'},
['CITEREFDuke1995'] = {'Duke-Santa Fe-1'},
['CITEREFDukeKeilty1990'] = {'Duke-RDC'},
['CITEREFDumbarton_Oaks_Hagiography_Database'] = {'Dumbarton Oaks Hagiography Database'},
['CITEREFDunbar1969'] = {'Dunbar-Railroads'},
['CITEREFDuncan-Jones2010'] = {'Shakespeare sonnets bibliography'},
['CITEREFDunlop1895'] = {'O\'Donnell family tree'},
['CITEREFDunlop1985'] = template_names['Iranica'],
['CITEREFDunn2013'] = {'Dunn-Comeng-5'},
['CITEREFDurand-Guédy2008'] = template_names['Iranica'],
['CITEREFDurand-Guédy2010'] = template_names['Iranica'],
['CITEREFDurand-Guédy2013'] = {'Encyclopaedia Islamica'},
['CITEREFDurham1998'] = {'California\'s Geographic Names'},
['CITEREFDurrant1972'] = {'Durrant-Steam Locos Eastern Europe'},
['CITEREFDurrant1981'] = {'Durrant-Garratt-Rev'},
['CITEREFDurrantLewisJorgensen1981'] = {'Durrant-SteamAfrica'},
['CITEREFDömlingKohlhase1971'] = {'Bach\'s compositions (sources)'},
['CITEREFDürr1952'] = {'Bach\'s compositions (sources)'},
['CITEREFDürr1954'] = {'Bach\'s compositions (sources)'},
['CITEREFDürr1987'] = {'Bach\'s compositions (sources)'},
['CITEREFDürrJones2006'] = {'Bach\'s compositions (sources)'},
['CITEREFDürrKobayashi1998'] = {'Bach\'s compositions (sources)'},
['CITEREFde_Blois2000'] = template_names['Iranica'],
['CITEREFde_Planhol1987'] = template_names['Iranica'],
['CITEREFde_Planhol1988'] = template_names['Iranica'],
----------< E >----------
['CITEREFEIr.1994'] = template_names['Iranica'],
['CITEREFEarle2018'] = {'Gymnosperm Database'},
['CITEREFEaston1897'] = {'Eastons', 'EBD'},
['CITEREFEbata2019'] = {'BDh'},
['CITEREFEbata2020'] = {'BDh'},
['CITEREFEbrahimKhodaverdian2018'] = {'Encyclopaedia Islamica'},
['CITEREFEdwards1995'] = {'Edwards Functional Analysis Theory and Applications'},
['CITEREFEichberg1976'] = {'Bach\'s compositions (sources)'},
['CITEREFEilers1983'] = template_names ['Cam_Hist_Iran'],
['CITEREFEkbal1991'] = template_names['Iranica'],
['CITEREFEl-Hibri2010'] = {'New Cambridge History of Islam'},
['CITEREFEl-Hibri2021'] = {'The Abbasid Caliphate: A History'},
['CITEREFEldredgeHorenstein2014'] = {'Cite concrete'},
['CITEREFElsholz1982'] = {'Schubert\'s compositions (references)'},
['CITEREFElwell-Sutton1984'] = template_names['Iranica'],
['CITEREFEppstein1966'] = {'Bach\'s compositions (sources)'},
['CITEREFEppstein1982'] = {'Bach\'s compositions (sources)'},
['CITEREFEquasis'] = {'Csr', 'Cite ship register'},
['CITEREFEuDaly2009'] = {'Complete Book of North American Railroading'},
['CITEREFEuDalySchaferJessupBoyd2009'] = {'Complete Book of North American Railroading'},
----------< F >----------
['CITEREFFacella2021'] = template_names['Iranica'],
['CITEREFFang1943'] = {'Cite ECCP'},
['CITEREFFarinella2001'] = {'DBI'},
['CITEREFFatehi-NezhadAzarnooshNegahban2008'] = {'Encyclopaedia Islamica'},
['CITEREFFatehi-nezhadRahimi2008'] = {'Encyclopaedia Islamica'},
['CITEREFFeder1958'] = {'Bach\'s compositions (sources)'},
['CITEREFFederal_Writers'_Project1939'] = {'Cite fednyc'},
['CITEREFFelixMadelung1995'] = template_names['Iranica'],
['CITEREFFernandez1983'] = {'Fernandez1983'},
['CITEREFFerneyhough1980'] = {'Ferneyhough-LMR'},
['CITEREFFesharaki2015'] = {'Encyclopaedia Islamica'},
['CITEREFFiaccadori1991'] = template_names['ODB'],
['CITEREFFikratUmar2008'] = template_names['Iranica'],
['CITEREFFine1991'] = {'The Early Medieval Balkans'},
['CITEREFFine1994'] = {'The Late Medieval Balkans'},
['CITEREFFletcher,_Great_Tank_Scandal'] = {'Book-Fletcher-Great Tank Scandal'},
['CITEREFFletcher,_Universal_Tank'] = {'Book-Fletcher-Universal Tank'},
['CITEREFFloor1992'] = template_names['Iranica'],
['CITEREFFloor2005'] = template_names['Iranica'],
['CITEREFFlora_of_North_America'] = {'EFloras'},
['CITEREFFlora_of_North_America2009'] = {'EFloras'},
['CITEREFFluckMarshallWilson1996'] = {'FluMarWil-LocRailCR'},
['CITEREFFonstad1991'] = template_names['ME-ref'],
['CITEREFFordCrowther1922'] = {'Ford1922'},
['CITEREFForkelTerry1920'] = {'Bach\'s compositions (sources)'},
['CITEREFFornaçon,_Siegfried1957'] = template_names['NDB'],
['CITEREFForrestal1999'] = {'Forrestal-Wineries'},
['CITEREFForster1990'] = {'Cite DCB'},
['CITEREFFoss1991'] = template_names['ODB'],
['CITEREFFoster1971'] = template_names['ME-ref'],
['CITEREFFoster1996'] = {'Foster-Field Guide'},
['CITEREFFrailey2010'] = {'Frailey-Twilight'},
['CITEREFFranke1994'] = {'Cite Cambridge History of China', 'The Cambridge History of China'},
['CITEREFFranke1994'] = {'Cite Cambridge History of China'},
['CITEREFFranz_Schnorr_von_Carolsfeld1883'] = {'Cite ADB'},
['CITEREFFriedrich_Wilhelm_Bautz1975'] = {'BBKL'},
['CITEREFFriedrich_Wilhelm_Bautz1990'] = {'BBKL'},
['CITEREFFry1964'] = {'RCTS-LocosLNER-7', 'RCTS-LocosLNER'},
['CITEREFFry1966'] = {'RCTS-LocosLNER-5', 'RCTS-LocosLNER'},
['CITEREFFrye1975'] = template_names['Cam_Hist_Iran'],
['CITEREFFrye1983'] = template_names['Cam_Hist_Iran'],
['CITEREFFrye2004'] = template_names['Iranica'],
['CITEREFFubini2012'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFFudenbergTirole1991'] = {'Cite Fudenberg Tirole 1991'},
['CITEREFFultonHarris1991'] = {'Fulton-Harris'},
----------< G >----------
['CITEREFGaines2008'] = {'Cite Gaines 2008'},
['CITEREFGarakaniBrown2013'] = {'Encyclopaedia Islamica'},
['CITEREFGardner2005'] = {'MSW3 Microbiotheria'},
['CITEREFGardoni2015'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFGareyJohnson1979'] = {'Garey-Johnson'},
['CITEREFGarsoian2000'] = template_names['Iranica'],
['CITEREFGarsoian2004'] = template_names['Iranica'],
['CITEREFGarsoian2005'] = template_names['Iranica'],
['CITEREFGarth2003'] = template_names['ME-ref'],
['CITEREFGazette27462'] = {'London Gazette'},
['CITEREFGazette34205'] = {'London Gazette'},
['CITEREFGazette34339'] = {'London Gazette'},
['CITEREFGazette34390'] = {'London Gazette'},
['CITEREFGazette34427'] = {'London Gazette'},
['CITEREFGazette34558'] = {'London Gazette'},
['CITEREFGazette34870'] = {'London Gazette'},
['CITEREFGazette34978'] = {'London Gazette'},
['CITEREFGazette34989'] = {'London Gazette'},
['CITEREFGazette35037'] = {'London Gazette'},
['CITEREFGazette35107'] = {'London Gazette'},
['CITEREFGazette35134'] = {'London Gazette'},
['CITEREFGazette35284'] = {'London Gazette'},
['CITEREFGazette37560'] = {'London Gazette'},
['CITEREFGazette37590'] = {'London Gazette'},
['CITEREFGazette37598'] = {'London Gazette'},
['CITEREFGazette37610'] = {'London Gazette'},
['CITEREFGazette38020'] = {'London Gazette'},
['CITEREFGazette38611'] = {'London Gazette'},
['CITEREFGeanakoplos1959'] = {'Emperor Michael Palaeologus and the West'},
['CITEREFGeorg_von_Dadelsen1953'] = template_names['NDB'],
['CITEREFGhanoonparvar1989'] = template_names['Iranica'],
['CITEREFGhereghlou2009'] = template_names['Iranica'],
['CITEREFGhereghlou2016'] = template_names['Iranica'],
['CITEREFGhulamiyan2015'] = template_names['Iranica'],
['CITEREFGhulamiyan2015'] = {'Encyclopaedia Islamica'},
['CITEREFGiannasi1975'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFGibb1923'] = {'The Arab Conquests in Central Asia'},
['CITEREFGignoux1983'] = template_names['Iranica'],
['CITEREFGignoux1994'] = template_names['Iranica'],
['CITEREFGil1997'] = {'A History of Palestine, 634-1099', 'A History of Palestine, 634–1099'},
['CITEREFGillham2001'] = {'Gillham-Waterloo-City'},
['CITEREFGilliland1969'] = {'Gilliland'},
['CITEREFGilliland1994'] = {'Pop Chronicles 40s'},
['CITEREFGilliverMarshallWeiner2006'] = template_names['ME-ref'],
['CITEREFGilmanPeckColby1905'] = {'Cite NIE', 'New International Encyclopedia', 'NIE'},
['CITEREFGilmanPeckColby1916'] = {'New International Encyclopedia', 'NIE'},
['CITEREFGiunashvili2016'] = template_names['Iranica'],
['CITEREFGleaves1921'] = {'Gleaves'},
['CITEREFGlischinski1997'] = {'Glischinski-Santa Fe'},
['CITEREFGlöckner1983'] = {'Bach\'s compositions (sources)'},
['CITEREFGoldberg1981'] = {'Goldberg-Amtrak'},
['CITEREFGordon2001'] = {'Gordon-The Breaking of a Thousand Swords'},
['CITEREFGraham1974'] = {'Cite DCB'},
['CITEREFGrant1994'] = {'Grant-Death'},
['CITEREFGrant2010'] = {'Grant-Twilight'},
['CITEREFGrant2017'] = {'Grant-RailCo'},
['CITEREFGrassi2018'] = template_names['Iranica'],
['CITEREFGray1986'] = template_names['Cam_Hist_Iran'],
['CITEREFGreenlaw2007'] = {'Greenlaw-Via Rail'},
['CITEREFGreenwoodEarnshaw1997'] = {'Greenwood&Earnshaw2nd'},
['CITEREFGregory1991'] = template_names['ODB'],
['CITEREFGregoryKazhdan1991'] = template_names['ODB'],
['CITEREFGregoryŠevčenko1991'] = template_names['ODB'],
['CITEREFGrete_Schemann1957'] = template_names['NDB'],
['CITEREFGrey2002'] = {'Australian Dictionary of Biography'},
['CITEREFGrierson1903'] = {'Cite LSI', 'LSI', 'Linguistic Survey of India'},
['CITEREFGrierson1908'] = {'Cite LSI', 'LSI', 'Linguistic Survey of India'},
['CITEREFGrierson1919'] = {'Cite LSI', 'LSI', 'Linguistic Survey of India'},
['CITEREFGrierson1967'] = {'Cite LSI', 'LSI', 'Linguistic Survey of India'},
['CITEREFGriffith1991'] = template_names['ODB'],
['CITEREFGriffithsSmith1999'] = {'Griffiths-Sheds1'},
['CITEREFGriffithsSmith2000'] = {'Griffiths-Sheds2'},
['CITEREFGrothendieck1955'] = {'Grothendieck Produits Tensoriels Topologiques et Espaces Nucléaires'},
['CITEREFGrothendieck1973'] = {'Grothendieck Topological Vector Spaces'},
['CITEREFGrothendieckDieudonné1960'] = {'EGA'},
['CITEREFGrothendieckDieudonné1961'] = {'EGA'},
['CITEREFGrothendieckDieudonné1963'] = {'EGA'},
['CITEREFGrothendieckDieudonné1964'] = {'EGA'},
['CITEREFGrothendieckDieudonné1965'] = {'EGA'},
['CITEREFGrothendieckDieudonné1966'] = {'EGA'},
['CITEREFGrothendieckDieudonné1967'] = {'EGA'},
['CITEREFGrothendieckDieudonné1971'] = {'EGA'},
['CITEREFGroves2005'] = {'MSW3 Primates', 'MSW3 Groves'},
['CITEREFGrubb2005'] = {'MSW3 Artiodactyla'},
['CITEREFGuilland1967'] = {'Recherches sur les institutions byzantines'},
['CITEREFGulino2005'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFGunzburg1984'] = {'Gunzburg-History WAGR Steam'},
['CITEREFGurneyNabavi1993'] = template_names['Iranica'],
['CITEREFGutas1987'] = template_names['Iranica'],
['CITEREFGvakharia2001'] = template_names['Iranica'],
['CITEREFGüner1997'] = {'TDV Encyclopedia of Islam'},
----------< H >----------
['CITEREFHaarer2018'] = template_names['ODLA'],
['CITEREFHabibi2021'] = template_names['Iranica'],
['CITEREFHadidi2000'] = template_names['Iranica'],
['CITEREFHaji2008'] = template_names['Iranica'],
['CITEREFHaldon1999'] = {'Warfare, State and Society in the Byzantine World, 565–1204'},
['CITEREFHalliday1985'] = {'Halliday-AustWineCompend'},
['CITEREFHalliday2008'] = {'Halliday-JHWAtlasAust2008'},
['CITEREFHalliday2009'] = {'Halliday-AustWineEncyc'},
['CITEREFHalm1991'] = {'Das Reich des Mahdi'},
['CITEREFHalm1998'] = template_names['Iranica'],
['CITEREFHalm2003'] = {'Die Kalifen von Kairo'},
['CITEREFHalm2014'] = {'Kalifen und Assassinen'},
['CITEREFHalmos1982'] = {'Halmos A Hilbert Space Problem Book 1982'},
['CITEREFHalpenny1990'] = {'Canadabio'},
['CITEREFHambly1990'] = template_names['Cam_Hist_Iran'],
['CITEREFHambly1991'] = template_names['Cam_Hist_Iran'],
['CITEREFHammondAnderson1993'] = template_names['ME-ref'],
['CITEREFHammondScull1995'] = template_names['ME-ref'],
['CITEREFHammondScull2005'] = template_names['ME-ref'],
['CITEREFHammondScull2006'] = template_names['ME-ref'],
['CITEREFHanaway1988'] = template_names['Iranica'],
['CITEREFHanaway1989'] = template_names['Iranica'],
['CITEREFHanawayLewisohn2004'] = template_names['Iranica'],
['CITEREFHans_Heinrich_Borcherdt1955'] = template_names['NDB'],
['CITEREFHans_Knudsen1972'] = template_names['NDB'],
['CITEREFHansen1988'] = {'Book-Hansen-US Nuclear Weapons'},
['CITEREFHansman1991'] = template_names['Iranica'],
['CITEREFHartshorne1977'] = {'Hartshorne AG'},
['CITEREFHassanpour1989'] = template_names['Iranica'],
['CITEREFHassanpour1995'] = template_names['Iranica'],
['CITEREFHasumi2003'] = {'Hasumi-shiguehiko-ozu-2003'},
['CITEREFHaswell-Smith2004'] = {'Haswell-Smith'},
['CITEREFHaugic1908'] = {'Schaff-Herzog'},
['CITEREFHawting1987'] = {'The First Dynasty of Islam'},
['CITEREFHawting2000'] = {'The First Dynasty of Islam'},
['CITEREFHaynes2011'] = {'RubberBible92nd'},
['CITEREFHeinichen1728'] = {'Bach\'s compositions (sources)'},
['CITEREFHeinrich_Welti1890'] = {'Cite ADB'},
['CITEREFHelgen2005'] = {'MSW3 Scandentia'},
['CITEREFHellmann1965'] = {'Bach\'s compositions (sources)'},
['CITEREFHenrici1725'] = {'Bach\'s compositions (sources)'},
['CITEREFHenryOrsmond1928'] = {'Raiatea family tree'},
['CITEREFHermann_Palm1876'] = {'Cite ADB'},
['CITEREFHerr2000'] = {'Herr-LN'},
['CITEREFHeschel2007'] = {'Encyclopaedia Judaica', 'Cite EJ', 'Cite Encyclopaedia Judaica'},
['CITEREFHewsen1988'] = template_names['Iranica'],
['CITEREFHidyHidyScottHofsummer2004'] = {'Hidy-Great Northern'},
['CITEREFHildHellenkemper1990'] = {'Tabula Imperii Byzantini'},
['CITEREFHildHellenkemper1994'] = {'Tabula Imperii Byzantini'},
['CITEREFHildRestle1981'] = {'Tabula Imperii Byzantini'},
['CITEREFHillenbrand1986'] = template_names['Iranica'],
['CITEREFHills,_Power_from_Steam'] = {'Book-Hills-Power from Steam'},
['CITEREFHills1989'] = {'Book-Hills-Power from Steam'},
['CITEREFHilmarJestremski2004'] = {'Schubert\'s compositions (references)'},
['CITEREFHilton1980'] = {'Hilton-Amtrak'},
['CITEREFHilton1990'] = {'Hilton Narrow Gauge'},
['CITEREFHiltonDue1960'] = {'Hilton-Interurban'},
['CITEREFHinton1986'] = {'HistoryofParliament'},
['CITEREFHirsch1906'] = {'Cite JE1906'},
['CITEREFHistoric_England'] = {'NHLE', 'National Heritage List for England'},
['CITEREFHistoric_England_Benty_Grange'] = {'NHLE'},
['CITEREFHistoric_Environment_Scotland'] = {'Canmore'},
['CITEREFHistoric_Environment_Scotland1972'] = {'Historic Environment Scotland'},
['CITEREFHistoric_Environment_Scotland1976'] = {'Historic Environment Scotland'},
['CITEREFHistoric_Environment_Scotland2020'] = {'Historic Environment Scotland'},
['CITEREFHistoric_Environment_Scotland:_Rusco_Tower2020'] = {'Historic Environment Scotland'},
['CITEREFHistoric_Environment_ScotlandLB33744'] = {'Historic Environment Scotland'},
['CITEREFHistoric_Environment_ScotlandLB50114'] = {'Historic Environment Scotland'},
['CITEREFHitchins2001'] = template_names['Iranica'],
['CITEREFHob.'] = {'Schubert\'s compositions (references)'},
['CITEREFHoffmanSmith2005'] = {'MSW3 Lagomorpha'},
['CITEREFHoffmann1738'] = {'Bach\'s compositions (sources)'},
['CITEREFHofmann1983'] = {'Bach\'s compositions (sources)'},
['CITEREFHofmann1987'] = {'Bach\'s compositions (sources)'},
['CITEREFHofmann1999'] = {'Bach\'s compositions (sources)'},
['CITEREFHolland1972'] = {'Holland-Vol 2'},
['CITEREFHolland1988'] = {'Cite DCB'},
['CITEREFHolland1989'] = {'Holland1989'},
['CITEREFHolland2001'] = {'Holland-Classic'},
['CITEREFHollingsworth1980'] = {'Hollingsworth-Atlas-Rigby'},
['CITEREFHollingsworth1991'] = template_names['ODB'],
['CITEREFHollingsworthCutler1991'] = template_names['ODB'],
['CITEREFHolmgren2003'] = {'EFloras'},
['CITEREFHoltBiddle1986'] = {'Holt-NorthWest'},
['CITEREFHolton1989'] = {'Holton-Reading-1'},
['CITEREFHonigmann1935'] = {'Byzance et les Arabes'},
['CITEREFHopley1983'] = {'Australian Dictionary of Biography'},
['CITEREFHort1911'] = {'DCBL'},
['CITEREFHorváth1966'] = {'Horváth Topological Vector Spaces and Distributions Volume 1 1966'},
['CITEREFHosseini2017'] = template_names['Iranica'],
['CITEREFHounshell1984'] = {'Hounshell1984'},
['CITEREFHovannisian1967'] = {'Cite Armenia on the Road to Independence'},
['CITEREFHovannisian1971'] = {'Cite The Republic of Armenia Volume 1'},
['CITEREFHovannisian1982'] = {'Cite The Republic of Armenia Volume 2'},
['CITEREFHovannisian1996'] = {'Cite The Republic of Armenia Volume 3', 'Cite The Republic of Armenia Volume 4'},
['CITEREFHowes1995'] = {'Howes Modern Analysis and Topology 1995'},
['CITEREFHudson1997'] = {'Country study'},
['CITEREFHughes1990'] = {'Hughes-IndianLocos1'},
['CITEREFHughes1992'] = {'Hughes-IndianLocos2'},
['CITEREFHughes1994'] = {'Hughes-IndianLocos3'},
['CITEREFHughes1996'] = {'Hughes-IndianLocos4'},
['CITEREFHummel1943'] = {'Cite ECCP'},
['CITEREFHumphreys2018'] = template_names['ODLA'],
['CITEREFHunter-Crawley2018'] = template_names['ODLA'],
['CITEREFHunter2008'] = {'Country study'},
['CITEREFHunter2012'] = {'Cite HGOC', 'Cite Hunter'},
['CITEREFHutter2009'] = template_names['Iranica'],
['CITEREFHutterer2005'] = {'MSW3 Soricomorpha'},
['CITEREFHütter2012'] = {'Hütter-50bis53'},
['CITEREFHütter2015'] = {'Hütter-54bis59'},
['CITEREFHütter2021'] = {'Hütter-60bis91'},
----------< I >----------
['CITEREFIacocca1984'] = {'Iacocca1984'},
['CITEREFIbn_Khallikan1843'] = {'Ibn Khallikan\'s Biographical Dictionary'},
['CITEREFImber2002'] = {'Imber-The Ottoman Empire, 1300–1650'},
['CITEREFInalcik1989'] = {'Setton-A History of the Crusades'},
['CITEREFIranica:_Bahrām'] = template_names['Iranica'],
['CITEREFIrvine2006'] = template_names['Iranica'],
['CITEREFIshino1998'] = {'Teishajo'},
['CITEREFIshkevariNejad2008'] = {'Encyclopaedia Islamica'},
['CITEREFIvey1919'] = {'Ivey-Marquette'},
----------< J >----------
['CITEREFJackson1908'] = {'Schaff-Herzog'},
['CITEREFJackson1988'] = template_names['Iranica'],
['CITEREFJackson1989'] = template_names['Iranica'],
['CITEREFJackson1995'] = {'Cite enc-nyc'},
['CITEREFJackson2010'] = {'Cite enc-nyc2'},
['CITEREFJacksonMelville2001'] = template_names['Iranica'],
['CITEREFJacobs1904'] = {'Cite Jewish Encyclopedia'},
['CITEREFJarchow1981'] = {'Jarchow Locally Convex Spaces'},
['CITEREFJavadiBurrill1988'] = template_names['Iranica'],
['CITEREFJohn_O'Donovan1856'] = {'Cite AFM'},
['CITEREFJohnson1906'] = {'BDA1906', 'Cite BDA1906'},
['CITEREFJohnstonWelshSchafer2001'] = {'Johnston-Streamliner'},
['CITEREFJones2011'] = {'Cite EPD'},
['CITEREFJordan2002'] = {'Jordan-WineWABest'},
['CITEREFJoshi1983'] = {'Joshi Introduction to General Topology'},
['CITEREFJoslen2003'] = {'Joslen-OOB'},
['CITEREFJowett1867'] = {'DGRBM', 'Cite DGRBM'},
['CITEREFJowett1989'] = {'Jowett-Atlas', 'Carnarvonshire Railway'},
['CITEREFJowett2000'] = {'Jowett-Nationalised'},
['CITEREFJullien2018'] = template_names['ODLA'],
['CITEREFJupp1986'] = {'HistoryofParliament'},
----------< K >----------
['CITEREFK.'] = {'Schubert\'s compositions (references)'},
['CITEREFKadinsky2016'] = {'Cite Hidden Waters NYC'},
['CITEREFKaegi1991'] = template_names['ODB'],
['CITEREFKamaly2006'] = template_names['Iranica'],
['CITEREFKamp1981'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFKang2008'] = {'Country study'},
['CITEREFKaramatiMelvin-Koushki2021'] = template_names['Iranica'],
['CITEREFKaramatiMelvin-Koushki2021'] = {'Encyclopaedia Islamica'},
['CITEREFKarimi-Hakkak1997'] = template_names['Iranica'],
['CITEREFKarimiMaghsoodi2013'] = {'Encyclopaedia Islamica'},
['CITEREFKarl_Frohnmeyer1953'] = template_names['NDB'],
['CITEREFKarnow1989'] = {'Cite-Karnow'},
['CITEREFKasheff2001'] = template_names['Iranica'],
['CITEREFKayvaniGholami2008'] = {'Encyclopaedia Islamica'},
['CITEREFKazemzadeh1951'] = {'Cite The Struggle for Transcaucasia'},
['CITEREFKazemzadeh1951'] = {'The Struggle for Transcaucasia'},
['CITEREFKazhdan1991'] = template_names['ODB'],
['CITEREFKazhdanCutler1991'] = template_names['ODB'],
['CITEREFKazhdanJeffreys1991'] = template_names['ODB'],
['CITEREFKazhdanŠevčenko1991'] = template_names['ODB'],
['CITEREFKeall1987'] = template_names['Iranica'],
['CITEREFKeefe2006'] = {'Schubert\'s compositions (references)'},
['CITEREFKeightley1999'] = {'Cite Cambridge History of China'},
['CITEREFKeller1937'] = {'Bach\'s compositions (sources)'},
['CITEREFKelley1975'] = {'Kelley General Topology'},
['CITEREFKelly1988'] = {'Cite GEIL'},
['CITEREFKellyBurrage1920'] = {'Cite AMB1920'},
['CITEREFKennedy1998'] = {'The Cambridge History of Egypt', 'Cite Kennedy 1998', 'Cambridge History of Egypt'},
['CITEREFKennedy2001'] = {'Kennedy-The Armies of the Caliphs'},
['CITEREFKennedy2004'] = {'The Prophet and the Age of the Caliphates'},
['CITEREFKennedy2007'] = {'Kennedy-The Great Arab Conquests'},
['CITEREFKennedy2016'] = {'The Prophet and the Age of the Caliphates'},
['CITEREFKenyon2011'] = {'Bach\'s compositions (sources)'},
['CITEREFKerrigan1995'] = {'Shakespeare sonnets bibliography'},
['CITEREFKettenhofen1995'] = template_names['Iranica'],
['CITEREFKettenhofen2001'] = template_names['Iranica'],
['CITEREFKettenhofenBournoutianHewsen1998'] = template_names['Iranica'],
['CITEREFKhaleelulla1982'] = {'Khaleelulla Counterexamples in Topological Vector Spaces'},
['CITEREFKhaleghi-Motlagh1999'] = template_names['Iranica'],
['CITEREFKhaleghi-Motlagh2001'] = template_names['Iranica'],
['CITEREFKhan2012'] = {'Cite Banglapedia'},
['CITEREFKhatibiNegahban2013'] = {'Encyclopaedia Islamica'},
['CITEREFKim1994'] = {'Country study'},
['CITEREFKirnberger1774'] = {'Bach\'s compositions (sources)'},
['CITEREFKirnberger1780'] = {'Bach\'s compositions (sources)'},
['CITEREFKlein2006'] = {'Klein-UP-2'},
['CITEREFKlíma1988'] = template_names['Iranica'],
['CITEREFKobayashi1978'] = {'Bach\'s compositions (sources)'},
['CITEREFKoderHild1976'] = {'Tabula Imperii Byzantini'},
['CITEREFKoderSoustalKoder1998'] = {'Tabula Imperii Byzantini'},
['CITEREFKoeppel2015'] = {'Cite citygrid'},
['CITEREFKofos1977'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFKohler1902'] = {'Cite Jewish Encyclopedia'},
['CITEREFKolde1914'] = {'Schaff-Herzog'},
['CITEREFKoliopoulos1978'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFKolmogorovFomin1957'] = {'Kolmogorov Fomin Elements of the Theory of Functions and Functional Analysis'},
['CITEREFKonrad_Ameln1985'] = template_names['NDB'],
['CITEREFKorkotyan1932'] = {'Cite The Population of Soviet Armenia'},
['CITEREFKoska2011'] = {'Bach\'s compositions (sources)'},
['CITEREFKratville1962'] = {'Kratville-SSL'},
['CITEREFKretzschmar1910'] = {'Bach\'s compositions (sources)'},
['CITEREFKube2009'] = {'Schubert\'s compositions (references)'},
['CITEREFKubrusly2011'] = {'Kubrusly The Elements of Operator Theory 2nd Edition 2011'},
['CITEREFKurz1983'] = template_names['Cam_Hist_Iran'],
['CITEREFKuznik2008'] = {'Bach\'s compositions (sources)'},
['CITEREFKöthe1969'] = {'Köthe Topological Vector Spaces I'},
['CITEREFKöthe1979'] = {'Köthe Topological Vector Spaces II'},
['CITEREFKöthe1983'] = {'Köthe Topological Vector Spaces I'},
['CITEREFKülzer2008'] = {'Tabula Imperii Byzantini'},
['CITEREFKüçükaşcı2001'] = {'TDV Encyclopedia of Islam'},
----------< L >----------
['CITEREFLa_Porta2018'] = template_names['ODLA'],
['CITEREFLacourcière1974'] = {'Cite DCB'},
['CITEREFLadefogedMaddieson1996'] = {'SOWL'},
['CITEREFLandau-Tasseron2010'] = {'New Cambridge History of Islam'},
['CITEREFLandauCondit1996'] = {'Cite nysky'},
['CITEREFLandmann1907'] = {'Bach\'s compositions (sources)'},
['CITEREFLang1983'] = template_names['Cam_Hist_Iran'],
['CITEREFLang2002'] = {'Lang Algebra'},
['CITEREFLangaroodiCooper2008'] = {'Encyclopaedia Islamica'},
['CITEREFLangaroodiCooper2015'] = template_names['Iranica'],
['CITEREFLangaroodiCooper2015'] = {'Encyclopaedia Islamica'},
['CITEREFLangaroodiNegahban2008'] = {'Encyclopaedia Islamica'},
['CITEREFLangaroodiNegahban2015'] = template_names['Iranica'],
['CITEREFLangaroodiNegahban2015'] = {'Encyclopaedia Islamica'},
['CITEREFLangaroudi2001'] = template_names['Iranica'],
['CITEREFLatham1982–2021'] = template_names['Iranica'],
['CITEREFLazard1975'] = template_names['Cam_Hist_Iran'],
['CITEREFLaërtius1925'] = {'Cite Lives of the Eminent Philosophers', 'Cite LotEP'},
['CITEREFLeCoq1986'] = template_names['Iranica'],
['CITEREFLe_Quien1740'] = {'Oriens Christianus'},
['CITEREFLe_Strange1900'] = {'Baghdad During the Abbasid Caliphate'},
['CITEREFLe_Strange1905'] = {'Lands of the Eastern Caliphate'},
['CITEREFLe_Strange1922'] = {'Baghdad During the Abbasid Caliphate'},
['CITEREFLeblanc1979'] = {'Cite DCB'},
['CITEREFLee1903'] = {'Cite DNBIE'},
['CITEREFLee2018'] = template_names['ODLA'],
['CITEREFLegifrance'] = {'Cite Legifrance', 'Cite Légifrance'},
['CITEREFLeisingerWollny1993'] = {'Bach\'s compositions (sources)'},
['CITEREFLerner1988'] = template_names['Iranica'],
['CITEREFLev1999'] = {'Saladin in Egypt'},
['CITEREFLevitan2001'] = {'Springer'},
['CITEREFLewin1925'] = {'Lewin-EarlyRail'},
['CITEREFLewis1969'] = {'Setton-A History of the Crusades'},
['CITEREFLewis1986'] = {'Lewis-Shortline-1986'},
['CITEREFLewis1991'] = {'Lewis-Shortline-1991'},
['CITEREFLewis1996'] = {'Lewis-Shortline-1996'},
['CITEREFLewis2001'] = template_names['Iranica'],
['CITEREFLi2002'] = {'Cite Cambridge History of China'},
['CITEREFLiederNet_Archive'] = {'Schubert\'s compositions (references)'},
['CITEREFLieu1997'] = template_names['Iranica'],
['CITEREFLighthouses_of_Australia_Inc'] = {'Cite loa'},
['CITEREFLilieLudwigPratschZielke1998–2013'] = {'Prosopographie der mittelbyzantinischen Zeit'},
['CITEREFLilieLudwigPratschZielke1999'] = {'Prosopographie der mittelbyzantinischen Zeit', 'PMBZ'},
['CITEREFLilieLudwigPratschZielke2000'] = {'Prosopographie der mittelbyzantinischen Zeit'},
['CITEREFLilieLudwigPratschZielke2001'] = {'Prosopographie der mittelbyzantinischen Zeit'},
['CITEREFLilieLudwigPratschZielke2002'] = {'Prosopographie der mittelbyzantinischen Zeit'},
['CITEREFLilieLudwigPratschZielke2009'] = {'Prosopographie der mittelbyzantinischen Zeit'},
['CITEREFLilieLudwigPratschZielke2013'] = {'Prosopographie der mittelbyzantinischen Zeit'},
['CITEREFLind1986'] = {'Lind-Limiteds'},
['CITEREFLittle1974'] = {'Cite DCB'},
['CITEREFLongnon1969'] = {'Setton-A History of the Crusades'},
['CITEREFLosensky2003'] = template_names['Iranica'],
['CITEREFLoverance2018'] = template_names['ODLA'],
['CITEREFLukonin1983'] = {'Cambridge History of Iran'},
['CITEREFLurie'] = {'Lurie-HA'},
['CITEREFLurje2010'] = template_names['Iranica'],
['CITEREFLuttrell1975'] = {'Setton-A History of the Crusades'},
['CITEREFLuttrell1987'] = {'DBI'},
['CITEREFLynch2004'] = {'Lynch-Penn Central'},
['CITEREFLynch2005'] = {'Lynch-New Haven passenger'},
['CITEREFLynch2018'] = template_names['ODLA'],
['CITEREFLéger1990'] = {'Cite DCB'},
['CITEREFle_Fleming1953'] = {'RCTS-LocosGWR-8'},
['CITEREFle_Fleming1960'] = {'RCTS-LocosGWR-8'},
----------< M >----------
['CITEREFMacDermot1927'] = {'Infobox GWR'},
['CITEREFMacDermot1931'] = {'Infobox GWR'},
['CITEREFMacEoin1988'] = template_names['Iranica'],
['CITEREFMacKenzie1992'] = template_names['Iranica'],
['CITEREFMachinery's_Handbook1996'] = {'MachinerysHandbook25e'},
['CITEREFMadelung1975'] = template_names['Cam_Hist_Iran'],
['CITEREFMadelung1978'] = {'EI2'},
['CITEREFMadelung1983'] = template_names['Iranica'],
['CITEREFMadelung1984'] = template_names['Iranica'],
['CITEREFMadelung1988'] = template_names['Iranica'],
['CITEREFMadelung1993'] = template_names['Iranica'],
['CITEREFMadelung2003'] = template_names['Iranica'],
['CITEREFMadelungFelix1995'] = template_names['Iranica'],
['CITEREFMaeda2009'] = template_names['Iranica'],
['CITEREFMagdalino2002'] = {'The Empire of Manuel I Komnenos'},
['CITEREFMaiken1989'] = {'Maiken-Night Trains'},
['CITEREFMailer2004'] = {'Mailer-Omaha Road'},
['CITEREFMajidiNegahban'] = {'Encyclopaedia Islamica'},
['CITEREFMalandra2009'] = template_names['Iranica'],
['CITEREFManfred_Knedlik2007'] = {'BBKL'},
['CITEREFMarshak1994'] = template_names['Iranica'],
['CITEREFMarshak2002'] = template_names['Iranica'],
['CITEREFMarshall1823'] = {'Cite RNB1823'},
['CITEREFMarshall1824'] = {'Cite RNB1823'},
['CITEREFMarshall1825'] = {'Cite RNB1823'},
['CITEREFMarshall1827'] = {'Cite RNB1823'},
['CITEREFMarshall1828'] = {'Cite RNB1823'},
['CITEREFMarshall1829'] = {'Cite RNB1823'},
['CITEREFMarshall1830'] = {'Cite RNB1823'},
['CITEREFMarshall1831'] = {'Cite RNB1823'},
['CITEREFMarshall1832'] = {'Cite RNB1823'},
['CITEREFMarshall1833'] = {'Cite RNB1823'},
['CITEREFMarshall1835'] = {'Cite RNB1823'},
['CITEREFMarshall1972'] = {'Lancashire & Yorkshire Railway 3'},
['CITEREFMarshall2001'] = {'Marshall-INGSR'},
['CITEREFMartin_Persch1992'] = {'BBKL'},
['CITEREFMartin_Persch1993'] = {'BBKL'},
['CITEREFMartin_Persch1996'] = {'BBKL'},
['CITEREFMartindale1980'] = {'Prosopography of the Later Roman Empire', 'PLRE'},
['CITEREFMartindale1992'] = {'Prosopography of the Later Roman Empire', 'PLRE'},
['CITEREFMartindaleJonesMorris1971'] = {'Prosopography of the Later Roman Empire', 'PLRE'},
['CITEREFMasoud_Jalali-Moqaddam2015'] = {'Encyclopaedia Islamica'},
['CITEREFMatini1987'] = template_names['Iranica'],
['CITEREFMatthee2008'] = template_names['Iranica'],
['CITEREFMatthee2012'] = template_names['Iranica'],
['CITEREFMatthee2015'] = template_names['Iranica'],
['CITEREFMaul2005'] = {'Bach\'s compositions (sources)'},
['CITEREFMayGray2006'] = {'MayGray-WAGRPassCar'},
['CITEREFMazzaoui2002'] = template_names['Iranica'],
['CITEREFMcArthurMcArthur2003'] = {'Cite ogn', 'Cite Oregon Geographic Names'},
['CITEREFMcCaffrey1990'] = template_names['Iranica'],
['CITEREFMcCorduck2004'] = {'McCorduck 2004'},
['CITEREFMcCurdyRogers1902'] = {'Cite Jewish Encyclopedia'},
['CITEREFMcDonnell2015'] = {'McDonnell-Locomotives-2nd'},
['CITEREFMcGeerNesbittOikonomides2001'] = {'Catalogue of Byzantine Seals at Dumbarton Oaks and in the Fogg Museum of Art'},
['CITEREFMcGeerNesbittOikonomides2005'] = {'Catalogue of Byzantine Seals at Dumbarton Oaks and in the Fogg Museum of Art'},
['CITEREFMcGhee2008'] = {'Cite McGhee 2008'},
['CITEREFMeiningen1704'] = {'Bach\'s compositions (sources)'},
['CITEREFMeints1992'] = {'Meints-Companies'},
['CITEREFMeints2005'] = {'Meints-Lines'},
['CITEREFMelamed1988'] = {'Bach\'s compositions (sources)'},
['CITEREFMelamed1995'] = {'Bach\'s compositions (sources)'},
['CITEREFMelville1997'] = template_names['Iranica'],
['CITEREFMelville2003'] = template_names['Iranica'],
['CITEREFMennell1892'] = {'Dictionary of Australasian Biography'},
['CITEREFMetcalfe2009'] = {'The Muslims of Medieval Italy'},
['CITEREFMiddleton1961'] = {'Middleton-Interurban'},
['CITEREFMiddleton2001'] = {'Middleton-Electrified-2nd'},
['CITEREFMiddleton2002'] = {'Middleton-PRR-Under-Wire'},
['CITEREFMiddletonSmerkDiehl2007'] = {'Encyclopedia of North American Railroads'},
['CITEREFMiles1975'] = template_names['Cam_Hist_Iran'],
['CITEREFMillar2011'] = {'NZR Steam Locomotive'},
['CITEREFMiller'] = {'Encyclopaedia Islamica'},
['CITEREFMiller1908'] = {'The Latins in the Levant', 'Latins in the Levant'},
['CITEREFMiller1921'] = {'Essays on the Latin Orient'},
['CITEREFMinnich2008'] = {'Country study'},
['CITEREFMiramar_Ship_Index'] = {'Csr', 'Cite ship register'},
['CITEREFMitchell1965'] = {'Mitchell TOC'},
['CITEREFMittermeierKonstantHawkinsLouis2006'] = {'LoM2'},
['CITEREFMittermeierLouisRichardsonSchwitzer2010'] = {'LoM3'},
['CITEREFMittermeierTattersallKonstantMeyers1994'] = {'LoM1'},
['CITEREFMoore1875'] = {'Cite CEM'},
['CITEREFMorana1993'] = {'Bach\'s compositions (sources)'},
['CITEREFMorony2009'] = template_names['Iranica'],
['CITEREFMoschonas1975'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFMottahedeh1975'] = template_names['Cam_Hist_Iran'],
['CITEREFMozartHaydnHaydn2008'] = {'Schubert\'s compositions (references)'},
['CITEREFMullié1852'] = {'Cite Mullié', 'Mullié'},
['CITEREFMunkres1974'] = {'Munkres Topology'},
['CITEREFMunkres2000'] = {'Munkres Topology'},
['CITEREFMurray2006'] = {'Murray-Illinois Central'},
['CITEREFMusserCarleton2005'] = {'MSW3 Muroidea'},
['CITEREFMyersWang2002'] = {'Cite Cambridge History of China'},
['CITEREFMüller,_Hans-Christian1966'] = template_names['NDB'],
----------< N >----------
['CITEREFNSA_II,_15'] = {'Schubert\'s compositions (references)'},
['CITEREFNSA_scores'] = {'Schubert\'s compositions (references)'},
['CITEREFNSA_website'] = {'Schubert\'s compositions (references)'},
['CITEREFNagel1990'] = template_names['Iranica'],
['CITEREFNariciBeckenstein2011'] = {'Narici Beckenstein Topological Vector Spaces'},
['CITEREFNavāʾī1988'] = template_names['Iranica'],
['CITEREFNegahban2008'] = {'Encyclopaedia Islamica'},
['CITEREFNemiroffBonnell1998'] = {'Cite APOD'},
['CITEREFNemiroffBonnell2004'] = {'Cite APOD'},
['CITEREFNemiroffBonnell2005'] = {'Cite APOD'},
['CITEREFNemiroffBonnell2006'] = {'Cite APOD'},
['CITEREFNemiroffBonnell2007'] = {'Cite APOD'},
['CITEREFNersessian2018'] = template_names['ODLA'],
['CITEREFNesbittMorrisson2009'] = {'Catalogue of Byzantine Seals at Dumbarton Oaks and in the Fogg Museum of Art'},
['CITEREFNesbittOikonomides1991'] = {'Catalogue of Byzantine Seals at Dumbarton Oaks and in the Fogg Museum of Art'},
['CITEREFNesbittOikonomides1994'] = {'Catalogue of Byzantine Seals at Dumbarton Oaks and in the Fogg Museum of Art'},
['CITEREFNesbittOikonomides1996'] = {'Catalogue of Byzantine Seals at Dumbarton Oaks and in the Fogg Museum of Art'},
['CITEREFNestruev2020'] = {'Nestruev Smooth Manifolds and Observables 2020'},
['CITEREFNetzer1998'] = template_names['Iranica'],
['CITEREFNetzer2007'] = template_names['Iranica'],
['CITEREFNeukirch1999'] = {'Neukirch ANT'},
['CITEREFNeukirchSchmidtWingberg2000'] = {'Neukirch et al. CNF'},
['CITEREFNew_York_City_Landmarks_Preservation_CommissionDolkartPostal2009'] = {'Cite nycland'},
['CITEREFNewbould1999'] = {'Schubert\'s compositions (references)'},
['CITEREFNewman1994'] = template_names['Iranica'],
['CITEREFNicholson2018'] = template_names['ODLA'],
['CITEREFNicholsonCanepaDaryaee2018'] = template_names['ODLA'],
['CITEREFNicol1968'] = {'The Byzantine Family of Kantakouzenos'},
['CITEREFNicol1984'] = {'The Despotate of Epiros, 1267–1479'},
['CITEREFNicol1988'] = {'Byzantium and Venice: A Study in Diplomatic and Cultural Relations'},
['CITEREFNicol1992'] = {'The Immortal Emperor: The Life and Legend of Constantine Palaiologos, Last Emperor of the Romans'},
['CITEREFNicol1993'] = {'The Last Centuries of Byzantium, 1261–1453', 'The Last Centuries of Byzantium'},
['CITEREFNicol1994'] = {'The Byzantine Lady: Ten Portraits, 1250–1500'},
['CITEREFNock1974'] = {'Nock-EustonGlasgow'},
----------< O >----------
['CITEREFO'Byrne1849'] = {'Cite NBD1849'},
['CITEREFO'ConnorRobertson'] = {'MacTutor Biography', 'MacTutor'},
['CITEREFO'ConnorRobertson1996'] = {'MacTutor Biography', 'MacTutor'},
['CITEREFO'ConnorRobertson2000'] = {'MacTutor Biography', 'MacTutor'},
['CITEREFO'ConnorRobertson2004'] = {'MacTutor Biography', 'MacTutor'},
['CITEREFO'Donoghue1897'] = {'Cite DNB'},
['CITEREFODB'] = template_names['ODB'],
['CITEREFODLA'] = template_names['ODLA'],
['CITEREFOberling1984'] = template_names['Iranica'],
['CITEREFOberling2008'] = template_names['Iranica'],
['CITEREFOberling2010'] = template_names['Iranica'],
['CITEREFOdisheli2018'] = template_names['ODLA'],
['CITEREFOfficial_Guide_of_the_Railways1950'] = {'Official Guide of the Railways'},
['CITEREFOgorek2012'] = {'Ogorek-South Shore'},
['CITEREFOikonomides1991'] = template_names['ODB'],
['CITEREFOikonomou1977'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFOlbrycht2021'] = template_names['Iranica'],
['CITEREFOrmsby1982'] = {'Cite DCB'},
----------< P >----------
['CITEREFPLP'] = {'Prosopographisches Lexikon der Palaiologenzeit', 'PLP'},
['CITEREFPalmer1875'] = {'Cite ADB'},
['CITEREFPalmerStewart1965'] = {'Palmer & Stewart'},
['CITEREFPanainoAbdollahyBalland1990'] = template_names['Iranica'],
['CITEREFPandariHirtensteinNegahban2013'] = {'Encyclopaedia Islamica'},
['CITEREFParvin2003'] = template_names['Iranica'],
['CITEREFParvin2009'] = template_names['Iranica'],
['CITEREFPatience1996'] = {'Patience-SteamTwilight'},
['CITEREFPatton2005'] = {'MSW3 Geomyidae'},
['CITEREFPaul2000'] = template_names['Iranica'],
['CITEREFPawson1979'] = {'Pawson-Delaware Valley'},
['CITEREFPaxtonBourne1985'] = {'Paxton-Bourne'},
['CITEREFPeacock2011'] = template_names['Iranica'],
['CITEREFPeck1898'] = {'HDCA'},
['CITEREFPerlis2001'] = {'Springer'},
['CITEREFPerreault2004'] = {'Bach\'s compositions (sources)'},
['CITEREFPerry1983'] = template_names['Cam_Hist_Iran'],
['CITEREFPerry1990'] = template_names['Cam_Hist_Iran'],
['CITEREFPerry1991'] = template_names['Cam_Hist_Iran'],
['CITEREFPetropoulosKoumarianou1977'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFPetrucci1982'] = {'DBI'},
['CITEREFPezeshk2017'] = {'Encyclopaedia Islamica'},
['CITEREFPezeshkKhaleeli2017'] = template_names['Iranica'],
['CITEREFPezeshkKhaleeli2017'] = {'Encyclopaedia Islamica'},
['CITEREFPfau2008'] = {'Bach\'s compositions (sources)'},
['CITEREFPikros1977'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFPinkepank1973'] = {'Pinkepank diesel spotters guide 2'},
['CITEREFPlantlist2016'] = {'Plantlist'},
['CITEREFPlaten1976'] = {'Bach\'s compositions (sources)'},
['CITEREFPloumidisAlexiou1974'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFPmbZ'] = {'Prosopographie der mittelbyzantinischen Zeit', 'PMBZ'},
['CITEREFPolemis1968'] = {'Polemis-The Doukai'},
['CITEREFPope2007'] = {'Encyclopaedia Judaica', 'Cite EJ', 'Cite Encyclopaedia Judaica'},
['CITEREFPopplewell'] = {'Popplewell-Gazetteer'},
['CITEREFPotts2018'] = template_names['ODLA'],
['CITEREFPottsCanepa2018'] = template_names['ODLA'],
['CITEREFPourshariati2017'] = {'Encyclopædia Iranica Online'},
['CITEREFPozza1992'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFPrawer1985'] = {'Setton-A History of the Crusades'},
['CITEREFPritsak1991'] = template_names['ODB'],
['CITEREFProsopographie_der_mittelbyz._Zeit'] = {'Prosopographie der mittelbyzantinischen Zeit'},
----------< Q >----------
['CITEREFQuick2009'] = {'Quick-Stations'},
['CITEREFQuick2019'] = {'Quick-stations-5'},
['CITEREFQuick2020'] = {'Quick-stations-5'},
['CITEREFQuick2022'] = {'Quick-stations-5'},
['CITEREFQuinn2003'] = template_names['Iranica'],
----------< R >----------
['CITEREFRaditsa1983'] = template_names['Cam_Hist_Iran'],
['CITEREFRahman1983'] = template_names['Iranica'],
['CITEREFRaja'i1987'] = template_names['Iranica'],
['CITEREFRamaer1974'] = {'Ramaer-SteamLocosEAR'},
['CITEREFRansome-Wallis1971'] = {'Ransome-Wallis 1'},
['CITEREFRateliff2007'] = template_names['ME-ref'],
['CITEREFRavegnano2000'] = {'DBI'},
['CITEREFReed1953'] = {'RCTS-LocosGWR-2'},
['CITEREFReed1975'] = {'Reed-Streamline era'},
['CITEREFReed1997'] = {'Schubert\'s compositions (references)'},
['CITEREFReinhard_Tenberg1990'] = {'BBKL'},
['CITEREFRettinghaus2020'] = {'BDh'},
['CITEREFReynolds1921'] = {'Cite Collier\'s', 'Collier\'s'},
['CITEREFReynoldsOroszi2000'] = {'Reynolds-BO'},
['CITEREFRezaHirtensteinGholami2021'] = {'Encyclopaedia Islamica'},
['CITEREFRezakhani2018'] = template_names['ODLA'],
['CITEREFRezvani2014'] = template_names['Iranica'],
['CITEREFRichter-Bernburg2003'] = template_names['Iranica'],
['CITEREFRichter2018'] = {'BDh'},
['CITEREFRigo2005'] = template_names['ODB'],
['CITEREFRipleyDana1863'] = {'New American Cyclopedia'},
['CITEREFRipleyDana1864'] = {'New American Cyclopedia'},
['CITEREFRipleyDana1879'] = {'Cite AmCyc'},
['CITEREFRistaino1988'] = {'Country study'},
['CITEREFRobert_Eitner1891'] = {'Cite ADB'},
['CITEREFRobertson1983'] = {'Robertson-OriginScot'},
['CITEREFRockafellarWets2009'] = {'Rockafellar Wets Variational Analysis 2009 Springer'},
['CITEREFRoe1916'] = {'Roe1916'},
['CITEREFRoe1937'] = {'Roe1937'},
['CITEREFRoemer1986'] = template_names['Cam_Hist_Iran'],
['CITEREFRoemer1989'] = template_names['Iranica'],
['CITEREFRoemer2004'] = template_names['Iranica'],
['CITEREFRolt1965'] = {'Rolt1965'},
['CITEREFRoltKichenside1982'] = {'Rolt-Red'},
['CITEREFRose1857'] = {'Cite Newgenbio'},
['CITEREFRosenfeld1974'] = template_names['NDB'],
['CITEREFRosenzweigBlackmar1992'] = {'Cite Central Park History', 'Cite Central Park history'},
['CITEREFRowe2002'] = {'Cite Cambridge History of China'},
['CITEREFRowledge1975'] = {'Rowledge-Engines of the LMS'},
['CITEREFRowledge1993'] = {'Rowledge-Irish Steam Register'},
['CITEREFRowlett'] = {'Cite rowlett', 'Cite Rowlett'},
['CITEREFRowlett2007'] = {'Cite rowlett', 'Cite Rowlett'},
['CITEREFRowlett2012'] = {'Cite rowlett', 'Cite Rowlett'},
['CITEREFRowlett2013'] = {'Cite rowlett', 'Cite Rowlett'},
['CITEREFRowlett2016'] = {'Cite rowlett', 'Cite Rowlett'},
['CITEREFRowlett2017'] = {'Cite rowlett', 'Cite Rowlett'},
['CITEREFRowson1998'] = template_names['Iranica'],
['CITEREFRudin1973'] = {'Rudin Walter Functional Analysis'},
['CITEREFRudin1991'] = {'Rudin Walter Functional Analysis'},
['CITEREFRunciman1951'] = {'Runciman-A History of the Crusades'},
['CITEREFRunciman1951–1954'] = {'Runciman-A History of the Crusades'},
['CITEREFRunciman1952'] = {'Runciman-A History of the Crusades'},
['CITEREFRunciman1954'] = {'Runciman-A History of the Crusades'},
['CITEREFRunciman1989'] = {'Runciman-A History of the Crusades'},
['CITEREFRussell1985'] = {'Setton-A History of the Crusades', 'Encyclopædia Iranica Online', 'Encyclopædia Iranica', 'Encyclopaedia Iranica', 'Cite Encyclopædia Iranica Online'},
['CITEREFRussell1986'] = template_names['Iranica'],
['CITEREFRussell1987'] = template_names['Iranica'],
['CITEREFRussellNorvig2003'] = {'Russell Norvig 2003'},
['CITEREFRybczynski2000'] = {'Rybczynski2000'},
['CITEREFRypka1968'] = template_names['Cam_Hist_Iran'],
----------< S >----------
['CITEREFSR_staff2013'] = {'Houston family tree'},
['CITEREFSadeghiTehrani2008'] = {'Encyclopaedia Islamica'},
['CITEREFSadıkoğlu1996'] = {'TDV Encyclopedia of Islam'},
['CITEREFSafa1987'] = template_names['Iranica'],
['CITEREFSafa1988'] = template_names['Iranica'],
['CITEREFSafa1989'] = template_names['Iranica'],
['CITEREFSafa1994'] = template_names['Iranica'],
['CITEREFSafa2003'] = template_names['Iranica'],
['CITEREFSajjadiAsatryanMelvin-Koushki'] = {'Encyclopaedia Islamica Online'},
['CITEREFSajjadiAsatryanMelvin-Koushki'] = {'Encyclopaedia Islamica'},
['CITEREFSajjadiAsatryanMelvin-Koushki2021'] = template_names['Iranica'],
['CITEREFSalbiev2021'] = template_names['Iranica'],
['CITEREFSalo2004'] = template_names['ME-ref'],
['CITEREFSamiʿiMelvin-Koushki2013'] = {'Encyclopaedia Islamica'},
['CITEREFSanders1998'] = {'The Cambridge History of Egypt', 'Cambridge History of Egypt'},
['CITEREFSanders2003'] = {'Sanders-Indiana'},
['CITEREFSanders2006'] = {'Sanders-Heartland'},
['CITEREFSanders2007'] = {'Sanders-Akron'},
['CITEREFSarikakis1974'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFSaunders2001'] = {'Saunders-Merging Lines'},
['CITEREFSaunders2013'] = {'Saunders-Giants of the Seas'},
['CITEREFSavadaShaw1992'] = {'Country study'},
['CITEREFSavoryKaramustafa1998'] = template_names['Iranica'],
['CITEREFScarce1986'] = template_names['Iranica'],
['CITEREFSchaeferWolff1999'] = {'Schaefer Wolff Topological Vector Spaces'},
['CITEREFSchafer1996'] = {'Schafer-Classic-Railroads-1'},
['CITEREFSchafer1998'] = {'Schafer-Vintage Diesel'},
['CITEREFSchafer2000'] = {'Schafer-More-Classic'},
['CITEREFSchafer2003'] = {'Schafer-Classic-Railroads-3'},
['CITEREFSchaferSolomon1997'] = {'Schafer-Pennsylvania'},
['CITEREFSchaferWelsh1997'] = {'Schafer-Classic'},
['CITEREFSchaferWelsh2002'] = {'Schafer-Streamliners'},
['CITEREFSchaferWelshHolland2001'] = {'Schafer-American passenger train'},
['CITEREFSchaff-Herzog'] = {'Schaff-Herzog'},
['CITEREFSchechter1996'] = {'Schechter Handbook of Analysis and Its Foundations'},
['CITEREFScheide1960'] = {'Bach\'s compositions (sources)'},
['CITEREFSchicht1805'] = {'Bach\'s compositions (sources)'},
['CITEREFSchilling1997'] = {'Schilling-pop-culture'},
['CITEREFSchindel2013'] = template_names['Iranica'],
['CITEREFSchippmann1986'] = template_names['Iranica'],
['CITEREFSchippmann1987'] = template_names['Iranica'],
['CITEREFSchlitter2005'] = {'MSW3 Tubulidentata'},
['CITEREFSchlumberger1983'] = template_names['Cam_Hist_Iran'],
['CITEREFSchmieder1950'] = {'Bach\'s compositions (sources)'},
['CITEREFSchmieder1990'] = {'Bach\'s compositions (sources)'},
['CITEREFSchmitt1986'] = template_names['Iranica'],
['CITEREFSchmitt1989'] = template_names['Iranica'],
['CITEREFSchmitt1993'] = template_names['Iranica'],
['CITEREFSchmitt1994'] = template_names['Iranica'],
['CITEREFSchmitt1995'] = template_names['Iranica'],
['CITEREFSchmitt2002'] = template_names['Iranica'],
['CITEREFSchmitt2004'] = template_names['Iranica'],
['CITEREFSchmitt2005'] = template_names['Iranica'],
['CITEREFSchmitt2018'] = template_names['Iranica'],
['CITEREFSchmittBailey1986'] = template_names['Iranica'],
['CITEREFSchmitz1870'] = {'Cite DGRBM'},
['CITEREFSchneider1907'] = {'Bach\'s compositions (sources)'},
['CITEREFSchneider1912'] = {'Bach\'s compositions (sources)'},
['CITEREFScholze1736'] = {'Bach\'s compositions (sources)'},
['CITEREFSchroeter1961'] = {'Schroeter-Eisenbahnen'},
['CITEREFSchroeterRamaer1993'] = {'Schroeter-Ramaer-Eisenbahnen'},
['CITEREFSchubert-online'] = {'Schubert\'s compositions (references)'},
['CITEREFSchubert1968'] = {'Schubert Topology'},
['CITEREFSchulenberg2010'] = {'Bach\'s compositions (sources)'},
['CITEREFSchulenberg2013'] = {'Bach\'s compositions (sources)'},
['CITEREFSchulze1980'] = {'Bach\'s compositions (sources)'},
['CITEREFSchulze1983'] = {'Bach\'s compositions (sources)'},
['CITEREFSchulze1984'] = {'Bach\'s compositions (sources)'},
['CITEREFSchwieterman2001'] = {'Schwieterman-Leaves-Eastern'},
['CITEREFScottNegus2011'] = {'Scott-Negus-Cellar Door'},
['CITEREFScribbins1970'] = {'Scribbins-Hiawatha'},
['CITEREFScribbins2008'] = {'Scribbins-400-2008', 'Scribbins-Remembered'},
['CITEREFSearle'] = {'Cite sslidx'},
['CITEREFSearle1980'] = {'Searle 1980'},
['CITEREFSegal1982'] = template_names['Iranica'],
['CITEREFSellwood1983'] = template_names['Cam_Hist_Iran'],
['CITEREFSemmensGoldfinch2003'] = {'Book-Semmens-Goldfinch-How Steam Locomotives Really Work'},
['CITEREFSemsarZand2008'] = {'Encyclopaedia Islamica'},
['CITEREFSetton1975'] = {'Setton-A History of the Crusades'},
['CITEREFSetton1976'] = {'The Papacy and the Levant'},
['CITEREFSetton1978'] = {'The Papacy and the Levant'},
['CITEREFSetton1984'] = {'The Papacy and the Levant'},
['CITEREFSettonHazard1975'] = {'Setton-A History of the Crusades'},
['CITEREFSfyroeras1975'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFShahbazi1986'] = template_names['Iranica'],
['CITEREFShahbazi1987'] = template_names['Iranica'],
['CITEREFShahbazi1988'] = template_names['Iranica'],
['CITEREFShahbazi1989'] = template_names['Iranica'],
['CITEREFShahbazi1991'] = template_names['Iranica'],
['CITEREFShahbazi1994'] = template_names['Iranica'],
['CITEREFShahbazi2002'] = template_names['Iranica'],
['CITEREFShahbazi2003'] = template_names['Iranica'],
['CITEREFShahbazi2004'] = template_names['Iranica'],
['CITEREFShahbazi2005'] = template_names['Iranica'],
['CITEREFShahbaziBosworth1990'] = template_names['Iranica'],
['CITEREFShahbaziRichter-Bernburg2002'] = template_names['Iranica'],
['CITEREFShaki1991'] = template_names['Iranica'],
['CITEREFShaughnessy1997'] = {'Shaughnessy-DH'},
['CITEREFShaw1978'] = {'Shaw-RailroadAccidents'},
['CITEREFShayegan2004'] = template_names['Iranica'],
['CITEREFShayesteh2013'] = template_names['Iranica'],
['CITEREFSheikhsofla2018'] = {'Encyclopaedia Islamica'},
['CITEREFShindo2004'] = {'Kaneto-shindo-shinario-jinsei'},
['CITEREFShippey2005'] = template_names['ME-ref'],
['CITEREFShoarian-SattariRezaeeNegahban2008'] = {'Encyclopaedia Islamica'},
['CITEREFShoshani2005'] = {'MSW3 Shoshani'},
['CITEREFShtern2001'] = {'Springer', 'SpringerEOM'},
['CITEREFSiegele1957'] = {'Bach\'s compositions (sources)'},
['CITEREFSilanos2014'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFSilke2006'] = {'O\'Donnell family tree'},
['CITEREFSimmons2005'] = {'MSW3 Chiroptera'},
['CITEREFSimon1966'] = {'Simon-Wines Australia'},
['CITEREFSimonWarner2011'] = {'Amtrak By the Numbers'},
['CITEREFSinclair1911'] = {'DCBL'},
['CITEREFSinger1905'] = {'Jewish Encyclopedia'},
['CITEREFSix1934'] = {'Cite Six', 'Cite six'},
['CITEREFSkjærvø2018'] = template_names['ODLA'],
['CITEREFSkoulatos1980'] = {'Les personnages byzantins de l\'Alexiade'},
['CITEREFSloan1964'] = {'Sloan1964'},
['CITEREFSmid2008'] = {'Smid2008'},
['CITEREFSmid2010'] = {'Smid2010'},
['CITEREFSmith1854'] = {'Cite DGRG', 'DGRG'},
['CITEREFSmith1870'] = {'DGRBM', 'Cite DGRBM'},
['CITEREFSmith1873'] = {'DGRBM', 'Cite DGRBM'},
['CITEREFSmith1876'] = {'DGRBM', 'Cite DGRBM'},
['CITEREFSmith1880'] = {'DGRBM', 'Cite DGRBM'},
['CITEREFSmith2010'] = {'Smith-Cruise Ships-2010'},
['CITEREFSolomentsev2001'] = {'Springer', 'SpringerEOM'},
['CITEREFSolomon2000'] = {'Solomon-American Diesel', 'Solomon-UP'},
['CITEREFSolomon2003'] = {'Solomon-Masterpieces'},
['CITEREFSolomon2004'] = {'Solomon-Amtrak'},
['CITEREFSolomon2005'] = {'Solomon-SP-Passenger'},
['CITEREFSolomon2006'] = {'Solomon-EMD Locomotives'},
['CITEREFSolomon2011'] = {'Solomon-Modern Diesel'},
['CITEREFSolomon2014'] = {'Solomon-GE and EMD'},
['CITEREFSolomonSchafer2007'] = {'Solomon-New York Central'},
['CITEREFSolopova2009'] = template_names['ME-ref'],
['CITEREFSorensen1956'] = {'Sorensen1956'},
['CITEREFSoucek1982'] = template_names['Iranica'],
['CITEREFSoucek1983'] = template_names['Iranica'],
['CITEREFSoustal1991'] = {'Tabula Imperii Byzantini'},
['CITEREFSoustalKoder1981'] = {'Tabula Imperii Byzantini'},
['CITEREFSpielhoff1991'] = {'Spielhoff-EL'},
['CITEREFSpitta1894'] = {'Bach\'s compositions (sources)'},
['CITEREFSpitta1899'] = {'Bach\'s compositions (sources)'},
['CITEREFSpringirth2016'] = {'Springirth-Philadelphia'},
['CITEREFSpuhler1986'] = template_names['Cam_Hist_Iran'],
['CITEREFSpuler1983'] = template_names['Iranica'],
['CITEREFSpuler1987'] = template_names['Iranica'],
['CITEREFSpyropoulos1928'] = {'Great Military and Naval Encyclopaedia'},
['CITEREFStagner1993'] = {'Stagner-Transition'},
['CITEREFStansfield1999'] = {'Stansfield-AyrRenfrew'},
['CITEREFStatistical_Yearbook_of_the_Republic_of_Croatia_2015'] = {'Croatia Yearbook 2015'},
['CITEREFStaufer1993'] = {'Staufer-Pennsy_III'},
['CITEREFStauferPennypacker1962'] = {'Staufer-Pennsy'},
['CITEREFStauferPennypacker1968'] = {'Staufer-Pennsy Power II'},
['CITEREFStaunton1988'] = {'Australian Dictionary of Biography'},
['CITEREFSternFishmanTilove2006'] = {'Cite New York 2000', 'Cite NY2000', 'Cite ny2000', 'Cite NY 2000', 'Cite ny 2000'},
['CITEREFSternGilmartinMassengale1983'] = {'Cite New York 1900', 'Cite NY1900'},
['CITEREFSternGilmartinMellins1987'] = {'Cite New York 1930', 'Cite NY 1930', 'Cite NY1930', 'Cite ny1930', 'Cite ny 1930'},
['CITEREFSternMellinsFishman1995'] = {'Cite New York 1960', 'Cite NY1960', 'Cite NY 1960', 'Cite ny1960', 'Cite ny 1960'},
['CITEREFSternMellinsFishman1999'] = {'Cite New York 1880', 'Cite NY1880', 'Cite NY 1880', 'Cite ny1880', 'Cite ny 1880'},
['CITEREFStewart1974'] = {'When Steam Was King'},
['CITEREFStrachey1981'] = template_names['ME-ref'],
['CITEREFStrickland1983'] = {'Strickland Locomotive Directory'},
['CITEREFStähelin1909'] = {'Schaff-Herzog'},
['CITEREFSuetin2001'] = {'Springer', 'SpringerEOM'},
['CITEREFSundermann1988'] = template_names['Iranica'],
['CITEREFSusanne_Schurr1992'] = {'BBKL'},
['CITEREFSusanne_Siebert1992'] = {'BBKL'},
['CITEREFSvolopoulos1977'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFSwartz1992'] = {'Swartz An Introduction to Functional Analysis'},
----------< T >----------
['CITEREFLondon_Gazette'] = {'London Gazette'},
['CITEREFTaber1977'] = {'Taber-DLW-19th'},
['CITEREFTaberTaber1980'] = {'Taber-DLW-20th-1'},
['CITEREFTaberTaber1981'] = {'Taber-DLW-20th-2'},
['CITEREFTafazzoli1999'] = template_names['Iranica'],
['CITEREFTafazzoli1999'] = {'Encyclopaedia Islamica'},
['CITEREFTafazzoli2000'] = template_names['Iranica'],
['CITEREFTalbot1991'] = template_names['ODB'],
['CITEREFTalbotKazhdan1991'] = template_names['ODB'],
['CITEREFTanındı2008'] = template_names['Iranica'],
['CITEREFTao2009'] = {'Cite Cambridge History of China', 'The Cambridge History of China'},
['CITEREFTao2009'] = {'Cite Cambridge History of China'},
['CITEREFTer-Ghewondyan1976'] = {'The Arab Emirates in Bagratid Armenia'},
['CITEREFThe_London_Gazette1950'] = {'London Gazette'},
['CITEREFThe_London_Gazette_26_September_1919'] = {'London Gazette'},
['CITEREFThielemann2012'] = {'Bach\'s compositions (sources)'},
['CITEREFThomas1970'] = {'HistoryofParliament'},
['CITEREFThomas1971'] = {'Thomas-History-VI'},
['CITEREFThrush2010'] = {'HistoryofParliament'},
['CITEREFTikhomirov2001'] = {'Springer'},
['CITEREFTittel1966'] = {'Bach\'s compositions (sources)'},
['CITEREFTodt1996'] = {'BBKL'},
['CITEREFTodtVest2014'] = {'Tabula Imperii Byzantini'},
['CITEREFTolkien1937'] = template_names['ME-ref'],
['CITEREFTolkien1954'] = template_names['ME-ref'],
['CITEREFTolkien1955'] = template_names['ME-ref'],
['CITEREFTolkien1964'] = template_names['ME-ref'],
['CITEREFTolkien1966'] = template_names['ME-ref'],
['CITEREFTolkien1977'] = template_names['ME-ref'],
['CITEREFTolkien1979'] = {'ME-ref'},
['CITEREFTolkien1980'] = template_names['ME-ref'],
['CITEREFTolkien1982'] = template_names['ME-ref'],
['CITEREFTolkien1983'] = template_names['ME-ref'],
['CITEREFTolkien1984'] = template_names['ME-ref'],
['CITEREFTolkien1985'] = template_names['ME-ref'],
['CITEREFTolkien1986'] = template_names['ME-ref'],
['CITEREFTolkien1987'] = template_names['ME-ref'],
['CITEREFTolkien1988'] = template_names['ME-ref'],
['CITEREFTolkien1989'] = template_names['ME-ref'],
['CITEREFTolkien1990'] = template_names['ME-ref'],
['CITEREFTolkien1992'] = template_names['ME-ref'],
['CITEREFTolkien1993'] = template_names['ME-ref'],
['CITEREFTolkien1994'] = template_names['ME-ref'],
['CITEREFTolkien1996'] = template_names['ME-ref'],
['CITEREFTolkien1998'] = template_names['ME-ref'],
['CITEREFTolkien1999'] = template_names['ME-ref'],
['CITEREFTolkien2007'] = template_names['ME-ref'],
['CITEREFTolkienSwann1978'] = template_names['ME-ref'],
['CITEREFTolkienSwann2002'] = {'ME-ref'},
['CITEREFTolkienTolkien1992'] = template_names['ME-ref'],
['CITEREFTonks1988'] = {'Tonks ironstone'},
['CITEREFTonks1989'] = {'Tonks ironstone'},
['CITEREFTonks1992'] = {'Tonks ironstone'},
['CITEREFTopping1975'] = {'Setton-A History of the Crusades', 'Wisconsin History of the Crusades'},
['CITEREFTorri2013'] = {'Bach\'s compositions (sources)'},
['CITEREFTougher2018'] = template_names['ODLA'],
['CITEREFToumanoff1986'] = template_names['Iranica'],
['CITEREFToumanoff2010'] = template_names['Iranica'],
['CITEREFToumanoffChaumont1987'] = template_names['Iranica'],
['CITEREFTourret1995'] = {'Tourret-Allied Military Locomotives'},
['CITEREFTrapp1991'] = template_names['ODB'],
['CITEREFTrappBeyerSturm-Schnabl1983'] = {'Prosopographisches Lexikon der Palaiologenzeit'},
['CITEREFTrappWaltherBeyer1976'] = {'Prosopographisches Lexikon der Palaiologenzeit'},
['CITEREFTrappWaltherBeyerSturm-Schnabl1978'] = {'Prosopographisches Lexikon der Palaiologenzeit'},
['CITEREFTreadgold1988'] = {'The Byzantine Revival, 780–842'},
['CITEREFTreadgold1997'] = {'A History of the Byzantine State and Society'},
['CITEREFTrèves2006'] = {'Trèves François Topological vector spaces, distributions and kernels'},
['CITEREFTsutsiev2014'] = {'Cite Atlas of the Ethno-Political History of the Caucasus'},
['CITEREFTucker2009'] = {'Encyclopaedia Islamica'},
['CITEREFTurim1998'] = {'Turim-oshima'},
['CITEREFTuring1950'] = {'Turing 1950'},
----------< U >----------
['CITEREFUS-NHub_Music_Deposit_31_(Klavierbüchlein_für_W._F._Bach)_at_Bach_Digital'] = {'Bach\'s compositions (sources)'},
['CITEREFUtas2002'] = template_names['Iranica'],
['CITEREFUwe_Eckardt2001'] = {'BBKL'},
['CITEREFunknown_author1881'] = {'Cite ADB'},
['CITEREFunknown_author1882'] = {'Cite ADB'},
----------< V >----------
['CITEREFVakalopoulos1975'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFVan_Cleve1969'] = {'Setton-A History of the Crusades'},
['CITEREFVan_Hoorickx1971'] = {'Schubert\'s compositions (references)'},
['CITEREFVan_Hoorickx_1974–1976'] = {'Schubert\'s compositions (references)'},
['CITEREFVan_Lint2018'] = template_names['ODLA'],
['CITEREFVan_Riemsdijk,_Compound_Locomotives'] = {'Book-Van Riemsdijk-Compound Locomotives'},
['CITEREFVan_Riemsdijk1994'] = {'Book-Van Riemsdijk-Compound Locomotives'},
['CITEREFVan_Tricht2011'] = {'The Latin Renovatio of Byzantium'},
['CITEREFVandenberghen1989'] = {'Vandenberghen-SNCB12.2'},
['CITEREFVarzos1984'] = {'Η Γενεαλογία των Κομνηνών', 'Varzos-Genealogy of the Komnenoi'},
['CITEREFVasiliev1935'] = {'Byzance et les Arabes'},
['CITEREFVasiliev1968'] = {'Byzance et les Arabes'},
['CITEREFVenables1911'] = {'DCBL'},
['CITEREFVendler1997'] = {'Shakespeare sonnets bibliography'},
['CITEREFVenetis2012'] = template_names['Iranica'],
['CITEREFVenn1954'] = {'VennAC'},
['CITEREFVentura1963'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFVesel1999'] = template_names['Iranica'],
['CITEREFVetter1713'] = {'Bach\'s compositions (sources)'},
['CITEREFVevainaCanepa2018'] = template_names['ODLA'],
['CITEREFVeysey1958'] = {'Veysey-PE-1958'},
['CITEREFVischer1912'] = {'Schaff-Herzog'},
['CITEREFVogelsang2003'] = template_names['Iranica'],
['CITEREFVolkmer1991'] = {'Volkmer-Pennsy-Electric'},
['CITEREFvan_Leyden1956'] = {'Bach\'s compositions (sources)'},
['CITEREFvan_Lint2018'] = template_names['ODLA'],
['CITEREFvon_Prantl1879'] = {'Cite ADB'},
----------< W >----------
['CITEREFWagnerBäzoldZschechLüderitz1990'] = {'Wagner-EFA2.3.2'},
['CITEREFWalter1967'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFWalter_Asmus1966'] = template_names['NDB'],
['CITEREFWayner1972'] = {'Wayner - Car names, numbers, consists'},
['CITEREFWayner1973'] = {'Wayner-Spotter-2nd'},
['CITEREFWebb2018'] = template_names['ODLA'],
['CITEREFWeber2016'] = template_names['Iranica'],
['CITEREFWechsler1979'] = {'Cite Cambridge History of China', 'The Cambridge History of China'},
['CITEREFWechsler1979'] = {'Cite Cambridge History of China'},
['CITEREFWegman2008'] = {'Wegman-Illustrated'},
['CITEREFWeibel1994'] = {'Weibel IHA'},
['CITEREFWeinrebHibbertKeayKeay2008'] = {'London encyclopedia'},
['CITEREFWeisbrod1991'] = {'Weisbrod-EFA1.5'},
['CITEREFWeisbrodMüllerPetznik1978'] = {'Weisbrod-EFA1.2'},
['CITEREFWeiskopf1987'] = template_names['Iranica'],
['CITEREFWeiskopf1989'] = template_names['Iranica'],
['CITEREFWeiskopf1990'] = template_names['Iranica'],
['CITEREFWeiskopf1993'] = template_names['Iranica'],
['CITEREFWellhausen1927'] = {'The Arab Kingdom and its Fall'},
['CITEREFWells1982'] = {'Accents of English'},
['CITEREFWells1990'] = {'Cite LPD'},
['CITEREFWells2000'] = {'Cite LPD'},
['CITEREFWells2008'] = {'Cite LPD'},
['CITEREFWelsh2006'] = {'Welsh-Broadway'},
['CITEREFWelsh2008'] = {'Welsh-UP'},
['CITEREFWerner_Raupp2001'] = {'BBKL'},
['CITEREFWestcott1911'] = {'DCBL'},
['CITEREFWestermayer,_Georg1882'] = {'Cite ADB'},
['CITEREFWham1997'] = {'Wham-Ayrshire'},
['CITEREFWharton1991'] = template_names['ODB'],
['CITEREFWhishaw1842'] = {'Whishaw-RailofGB-2ndEd'},
['CITEREFWhishaw1969'] = {'Whishaw-RailofGB'},
['CITEREFWhite1985'] = {'White-Passenger-1985'},
['CITEREFWhite1993'] = {'White - American railroad freight car'},
['CITEREFWhiteWillenskyLeadon2010'] = {'Cite aia5'},
['CITEREFWhitehurst1973'] = {'Whitehurst GW Engines from 1940'},
['CITEREFWhittow1996'] = {'The Making of Byzantium, 600–1025'},
['CITEREFWickman1982'] = {'Country study'},
['CITEREFWiesehöfer1986'] = template_names['Iranica'],
['CITEREFWiesehöfer2018'] = template_names['ODLA'],
['CITEREFWilansky2008'] = {'Wilansky Topology for Analysis 2008'},
['CITEREFWilansky2013'] = {'Wilansky Modern Methods in Topological Vector Spaces'},
['CITEREFWillard2004'] = {'Willard General Topology'},
['CITEREFWilliams1998'] = {'Williams-Philadelphia'},
['CITEREFWilliams2003'] = {'Bach\'s compositions (sources)'},
['CITEREFWilliams2014'] = template_names['Iranica'],
['CITEREFWillis1750'] = {'Cite Notitia Parliamentaria'},
['CITEREFWilson2017'] = {'Wilson-Guide'},
['CITEREFWilsonFiske1889'] = {'Appletons\'', 'Cite Appletons\'', 'Appletons'},
['CITEREFWilsonFiske1891'] = {'Appletons\'', 'Cite Appletons\'', 'Appletons'},
['CITEREFWilsonFiske1892'] = {'Appletons\'', 'Cite Appletons\'', 'Appletons'},
['CITEREFWilsonFiske1900'] = {'Appletons\'', 'Cite Appletons\'', 'Appletons'},
['CITEREFWiltshire2000'] = {'Lloyd-Margaret River'},
['CITEREFWinfieldLyon2004'] = {'Winfield'},
['CITEREFWinkler1883'] = template_names['ADB'],
['CITEREFWitakowski2018'] = template_names['ODLA'],
['CITEREFWolff1969'] = {'Setton-A History of the Crusades'},
['CITEREFWollny2015'] = {'Bach\'s compositions (sources)'},
['CITEREFWood1907'] = {'Cite Nuttall', 'Nuttall'},
['CITEREFWoodsKilpatrick2005'] = {'MSW3 Hystricognathi'},
['CITEREFWorden2008'] = {'Country study'},
['CITEREFWortley2010'] = {'John Skylitzes: A Synopsis of Byzantine History, 811–1057'},
['CITEREFWozencraft2005'] = {'MSW3 Carnivora'},
['CITEREFWright1979'] = {'Cite Cambridge History of China', 'The Cambridge History of China'},
['CITEREFWright1979'] = {'Cite Cambridge History of China'},
['CITEREFWright2000'] = {'Bach\'s compositions (sources)'},
['CITEREFWägliJacobi2010'] = {'Schienennetz Schweiz'},
['CITEREFWürsch2013'] = template_names['Iranica'],
----------< X >----------
----------< Y >----------
['CITEREFYakubova2016'] = template_names['Iranica'],
['CITEREFYarshater1983'] = template_names['Iranica'],
['CITEREFYarshater1986'] = template_names['Cam_Hist_Iran'],
['CITEREFYarshater1988'] = template_names['Iranica'],
['CITEREFYarshater2018'] = template_names['Iranica'],
['CITEREFYarshater2021'] = template_names['Iranica'],
['CITEREFYazici2002'] = template_names['Iranica'],
['CITEREFYenne2005'] = {'Yenne-Chiefs'},
['CITEREFYildiz2004'] = template_names['Iranica'],
['CITEREFYonge1990'] = {'Quail-4'},
['CITEREFYonge1994'] = {'Quail-5'},
['CITEREFYonge2002'] = {'Quail-5'},
['CITEREFYonge2008'] = {'Quail-5'},
['CITEREFYonge2016'] = {'Quail-2-2016'},
['CITEREFYongePadgettSzwenk2013'] = {'Quail-4-Paper-3rdEd'},
['CITEREFYu1986'] = {'Cite Cambridge History of China'},
['CITEREFYusofi1990'] = template_names['Iranica'],
----------< Z >----------
['CITEREFZahn1889–1893'] = {'Bach\'s compositions (sources)'},
['CITEREFZakeri2021'] = template_names['Iranica'],
['CITEREFZarrinkoubNegahban2008'] = {'Encyclopaedia Islamica'},
['CITEREFZarrinkub1975'] = template_names['Cam_Hist_Iran'],
['CITEREFZeiniWiesehöfer2018'] = template_names['ODLA'],
['CITEREFZekulich2000'] = {'Zekulich-WineWA'},
['CITEREFZimmermann2004'] = {'Zimmermann-Burlington'},
['CITEREFZimmermann2007'] = {'Zimmermann-GrandLuxe'},
['CITEREFZuccaric._1747'] = {'Bach\'s compositions (sources)'},
['CITEREFZălinescu2002'] = {'Zălinescu Convex Analysis in General Vector Spaces 2002'},
----------< OTHER >----------
----------< UNSORTED >----------
['CITEREFDaniel2001'] = template_names['Iranica'],
['CITEREFΙστορία_του_Ελληνικού_Έθνους'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFÖz1993'] = {'TDV Encyclopedia of Islam'},
['CITEREFÖzgüdenli2008'] = template_names['Iranica'],
['CITEREFÖzaydın2002'] = {'TDV Encyclopedia of Islam'},
['CITEREFÖzaydın2006'] = {'TDV Encyclopedia of Islam'},
['CITEREFÖzkuyumcu2006'] = {'TDV Encyclopedia of Islam'},
['CITEREFÖztürk2013'] = {'TDV Encyclopedia of Islam'},
['CITEREFΜεγάλη_Στρατιωτικὴ_καὶ_Ναυτικὴ_Ἐγκυκλοπαιδεία'] = {'Great Military and Naval Encyclopaedia'},
['CITEREFŞeşen1988'] = {'TDV Encyclopedia of Islam'},
['CITEREFCotsonis2020'] = {'Catalogue of Byzantine Seals at Dumbarton Oaks and in the Fogg Museum of Art'},
['CITEREFКавказский_календарь_на_1913_год'] = {'Cite Kavkazskiy Kalendar 1913'},
['CITEREFКавказский_календарь_на_1917_год'] = {'Cite Kavkazskiy Kalendar 1917'},
['CITEREFКавказский_календарь_на_1910_год'] = {'Cite Kavkazskiy Kalendar 1910'},
['CITEREFКавказский_календарь_на_1915_год'] = {'Cite Kavkazskiy Kalendar 1915'},
}
--[[--------------------------< E X P O R T E D T A B L E S >------------------------------------------------
]]
return {
DNB_special_patterns = DNB_special_patterns,
DNB_template_names = template_names['DNB'],
special_patterns = special_patterns,
whitelist = whitelist,
wrapper_templates = wrapper_templates,
}
196d9221006f9bf6ed5402ba071fb7c5fe320258
Template:Auto short description
10
207
406
2023-10-19T09:56:18Z
wikipedia>GhostInTheMachine
0
tests OK, sync from sandbox
wikitext
text/x-wiki
{{Ombox
| type = notice
| text = This template {{#if:{{{sometimes|}}}|sometimes{{sp}}}}adds an automatically generated '''[[Wikipedia:Short description|short description]]'''{{#if:{{{category|}}}|{{sp}}({{{category}}})|}}{{#if:{{{indirect|}}}|{{sp}}via an embedded template}}{{#if:{{{conditions|}}}|{{space}}{{{conditions}}}}}. If the automatic short description is not optimal, replace it by adding {{tl|Short description}} at the top of the article.
}}<includeonly>{{Subpage other|<!-- do not categorise -->|[[Category:Templates that generate short descriptions{{#if:{{{category|}}}|{{sp}}for {{{category}}}|}}]]}}</includeonly><noinclude>
{{Documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
e05ca99e1d986f5fcc83593ae854151d2a7dcea0
Template:Country data Bolivia
10
236
464
2023-10-20T02:36:25Z
wikipedia>Paine Ellsworth
0
per edit request on talk page - update football flag
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = Bolivia
| flag alias = Bandera de Bolivia (Estado).svg
| flag alias-state = Bandera de Bolivia (Estado).svg
| flag alias-football = Flag of Bolivia.svg
| flag alias-spain = Flag of Cross of Burgundy.svg
| flag alias-1825 = State flag of Bolivia (1825-1826).svg
| flag alias-1825a = Civil flag of Bolivia (1825-1826).svg
| flag alias-1831 = Flag of Bolivia (state, 1826-1851).svg
| flag alias-1831a = Flag of Bolivia (1826-1851).svg
| flag alias-confederation = Flag of the Peru-Bolivian Confederation.svg
| flag alias-wiphala = Banner of the Qulla Suyu.svg
| flag alias-patuju =
| flag alias-army=Flag of Bolivia (military).svg
| link alias-army=Bolivian Army
| flag alias-air force=Flag of Bolivia (military).svg
| link alias-air force=Bolivian Air Force
| flag alias-naval = Naval Ensign of Bolivia.svg
| link alias-naval = Bolivian Naval Force
| flag alias-naval old = Naval Ensign of Bolivia (1966-2013).svg
| flag alias-naval jack = Naval Jack of Bolivia.svg
| flag alias-military = Flag of Bolivia (military).svg
| link alias-military = Bolivian Armed Forces
| flag alias-navy = Naval Ensign of Bolivia.svg
| link alias-navy = Bolivian Naval Force
| flag alias-civil = Flag of Bolivia.svg
| size = {{{size|}}}
| name = {{{name|}}}
| altvar = {{{altvar|}}}
| altlink = {{{altlink|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = state
| var2 = football
| var3 = spain
| var4 = 1825
| var5 = 1825a
| var6 = 1831
| var7 = 1831a
| var8 = confederation
| var9 = wiphala
| var10 = patuju
| var11 = naval old
| var12 = naval jack
| var13 = civil
| redir1 = BOL
</noinclude>
}}
fc39b1f8371694f21ce6a216dd3737657a3ebd07
Module:String
828
35
63
2023-10-25T18:17:50Z
wikipedia>Trappist the monk
0
Scribunto
text/plain
--[[
This module is intended to provide access to basic string functions.
Most of the functions provided here can be invoked with named parameters,
unnamed parameters, or a mixture. If named parameters are used, Mediawiki will
automatically remove any leading or trailing whitespace from the parameter.
Depending on the intended use, it may be advantageous to either preserve or
remove such whitespace.
Global options
ignore_errors: If set to 'true' or 1, any error condition will result in
an empty string being returned rather than an error message.
error_category: If an error occurs, specifies the name of a category to
include with the error message. The default category is
[Category:Errors reported by Module String].
no_category: If set to 'true' or 1, no category will be added if an error
is generated.
Unit tests for this module are available at Module:String/tests.
]]
local str = {}
--[[
len
This function returns the length of the target string.
Usage:
{{#invoke:String|len|target_string|}}
OR
{{#invoke:String|len|s=target_string}}
Parameters
s: The string whose length to report
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the target string.
]]
function str.len( frame )
local new_args = str._getParameters( frame.args, {'s'} )
local s = new_args['s'] or ''
return mw.ustring.len( s )
end
--[[
sub
This function returns a substring of the target string at specified indices.
Usage:
{{#invoke:String|sub|target_string|start_index|end_index}}
OR
{{#invoke:String|sub|s=target_string|i=start_index|j=end_index}}
Parameters
s: The string to return a subset of
i: The first index of the substring to return, defaults to 1.
j: The last index of the string to return, defaults to the last character.
The first character of the string is assigned an index of 1. If either i or j
is a negative value, it is interpreted the same as selecting a character by
counting from the end of the string. Hence, a value of -1 is the same as
selecting the last character of the string.
If the requested indices are out of range for the given string, an error is
reported.
]]
function str.sub( frame )
local new_args = str._getParameters( frame.args, { 's', 'i', 'j' } )
local s = new_args['s'] or ''
local i = tonumber( new_args['i'] ) or 1
local j = tonumber( new_args['j'] ) or -1
local len = mw.ustring.len( s )
-- Convert negatives for range checking
if i < 0 then
i = len + i + 1
end
if j < 0 then
j = len + j + 1
end
if i > len or j > len or i < 1 or j < 1 then
return str._error( 'String subset index out of range' )
end
if j < i then
return str._error( 'String subset indices out of order' )
end
return mw.ustring.sub( s, i, j )
end
--[[
This function implements that features of {{str sub old}} and is kept in order
to maintain these older templates.
]]
function str.sublength( frame )
local i = tonumber( frame.args.i ) or 0
local len = tonumber( frame.args.len )
return mw.ustring.sub( frame.args.s, i + 1, len and ( i + len ) )
end
--[[
_match
This function returns a substring from the source string that matches a
specified pattern. It is exported for use in other modules
Usage:
strmatch = require("Module:String")._match
sresult = strmatch( s, pattern, start, match, plain, nomatch )
Parameters
s: The string to search
pattern: The pattern or string to find within the string
start: The index within the source string to start the search. The first
character of the string has index 1. Defaults to 1.
match: In some cases it may be possible to make multiple matches on a single
string. This specifies which match to return, where the first match is
match= 1. If a negative number is specified then a match is returned
counting from the last match. Hence match = -1 is the same as requesting
the last match. Defaults to 1.
plain: A flag indicating that the pattern should be understood as plain
text. Defaults to false.
nomatch: If no match is found, output the "nomatch" value rather than an error.
For information on constructing Lua patterns, a form of [regular expression], see:
* http://www.lua.org/manual/5.1/manual.html#5.4.1
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns
]]
-- This sub-routine is exported for use in other modules
function str._match( s, pattern, start, match_index, plain_flag, nomatch )
if s == '' then
return str._error( 'Target string is empty' )
end
if pattern == '' then
return str._error( 'Pattern string is empty' )
end
start = tonumber(start) or 1
if math.abs(start) < 1 or math.abs(start) > mw.ustring.len( s ) then
return str._error( 'Requested start is out of range' )
end
if match_index == 0 then
return str._error( 'Match index is out of range' )
end
if plain_flag then
pattern = str._escapePattern( pattern )
end
local result
if match_index == 1 then
-- Find first match is simple case
result = mw.ustring.match( s, pattern, start )
else
if start > 1 then
s = mw.ustring.sub( s, start )
end
local iterator = mw.ustring.gmatch(s, pattern)
if match_index > 0 then
-- Forward search
for w in iterator do
match_index = match_index - 1
if match_index == 0 then
result = w
break
end
end
else
-- Reverse search
local result_table = {}
local count = 1
for w in iterator do
result_table[count] = w
count = count + 1
end
result = result_table[ count + match_index ]
end
end
if result == nil then
if nomatch == nil then
return str._error( 'Match not found' )
else
return nomatch
end
else
return result
end
end
--[[
match
This function returns a substring from the source string that matches a
specified pattern.
Usage:
{{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}}
OR
{{#invoke:String|match|s=source_string|pattern=pattern_string|start=start_index
|match=match_number|plain=plain_flag|nomatch=nomatch_output}}
Parameters
s: The string to search
pattern: The pattern or string to find within the string
start: The index within the source string to start the search. The first
character of the string has index 1. Defaults to 1.
match: In some cases it may be possible to make multiple matches on a single
string. This specifies which match to return, where the first match is
match= 1. If a negative number is specified then a match is returned
counting from the last match. Hence match = -1 is the same as requesting
the last match. Defaults to 1.
plain: A flag indicating that the pattern should be understood as plain
text. Defaults to false.
nomatch: If no match is found, output the "nomatch" value rather than an error.
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from each string. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
If the match_number or start_index are out of range for the string being queried, then
this function generates an error. An error is also generated if no match is found.
If one adds the parameter ignore_errors=true, then the error will be suppressed and
an empty string will be returned on any failure.
For information on constructing Lua patterns, a form of [regular expression], see:
* http://www.lua.org/manual/5.1/manual.html#5.4.1
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns
]]
-- This is the entry point for #invoke:String|match
function str.match( frame )
local new_args = str._getParameters( frame.args, {'s', 'pattern', 'start', 'match', 'plain', 'nomatch'} )
local s = new_args['s'] or ''
local start = tonumber( new_args['start'] ) or 1
local plain_flag = str._getBoolean( new_args['plain'] or false )
local pattern = new_args['pattern'] or ''
local match_index = math.floor( tonumber(new_args['match']) or 1 )
local nomatch = new_args['nomatch']
return str._match( s, pattern, start, match_index, plain_flag, nomatch )
end
--[[
pos
This function returns a single character from the target string at position pos.
Usage:
{{#invoke:String|pos|target_string|index_value}}
OR
{{#invoke:String|pos|target=target_string|pos=index_value}}
Parameters
target: The string to search
pos: The index for the character to return
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the target string. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
The first character has an index value of 1.
If one requests a negative value, this function will select a character by counting backwards
from the end of the string. In other words pos = -1 is the same as asking for the last character.
A requested value of zero, or a value greater than the length of the string returns an error.
]]
function str.pos( frame )
local new_args = str._getParameters( frame.args, {'target', 'pos'} )
local target_str = new_args['target'] or ''
local pos = tonumber( new_args['pos'] ) or 0
if pos == 0 or math.abs(pos) > mw.ustring.len( target_str ) then
return str._error( 'String index out of range' )
end
return mw.ustring.sub( target_str, pos, pos )
end
--[[
str_find
This function duplicates the behavior of {{str_find}}, including all of its quirks.
This is provided in order to support existing templates, but is NOT RECOMMENDED for
new code and templates. New code is recommended to use the "find" function instead.
Returns the first index in "source" that is a match to "target". Indexing is 1-based,
and the function returns -1 if the "target" string is not present in "source".
Important Note: If the "target" string is empty / missing, this function returns a
value of "1", which is generally unexpected behavior, and must be accounted for
separatetly.
]]
function str.str_find( frame )
local new_args = str._getParameters( frame.args, {'source', 'target'} )
local source_str = new_args['source'] or ''
local target_str = new_args['target'] or ''
if target_str == '' then
return 1
end
local start = mw.ustring.find( source_str, target_str, 1, true )
if start == nil then
start = -1
end
return start
end
--[[
find
This function allows one to search for a target string or pattern within another
string.
Usage:
{{#invoke:String|find|source_str|target_string|start_index|plain_flag}}
OR
{{#invoke:String|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}}
Parameters
source: The string to search
target: The string or pattern to find within source
start: The index within the source string to start the search, defaults to 1
plain: Boolean flag indicating that target should be understood as plain
text and not as a Lua style regular expression, defaults to true
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the parameter. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
This function returns the first index >= "start" where "target" can be found
within "source". Indices are 1-based. If "target" is not found, then this
function returns 0. If either "source" or "target" are missing / empty, this
function also returns 0.
This function should be safe for UTF-8 strings.
]]
function str.find( frame )
local new_args = str._getParameters( frame.args, {'source', 'target', 'start', 'plain' } )
local source_str = new_args['source'] or ''
local pattern = new_args['target'] or ''
local start_pos = tonumber(new_args['start']) or 1
local plain = new_args['plain'] or true
if source_str == '' or pattern == '' then
return 0
end
plain = str._getBoolean( plain )
local start = mw.ustring.find( source_str, pattern, start_pos, plain )
if start == nil then
start = 0
end
return start
end
--[[
replace
This function allows one to replace a target string or pattern within another
string.
Usage:
{{#invoke:String|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}}
OR
{{#invoke:String|replace|source=source_string|pattern=pattern_string|replace=replace_string|
count=replacement_count|plain=plain_flag}}
Parameters
source: The string to search
pattern: The string or pattern to find within source
replace: The replacement text
count: The number of occurences to replace, defaults to all.
plain: Boolean flag indicating that pattern should be understood as plain
text and not as a Lua style regular expression, defaults to true
]]
function str.replace( frame )
local new_args = str._getParameters( frame.args, {'source', 'pattern', 'replace', 'count', 'plain' } )
local source_str = new_args['source'] or ''
local pattern = new_args['pattern'] or ''
local replace = new_args['replace'] or ''
local count = tonumber( new_args['count'] )
local plain = new_args['plain'] or true
if source_str == '' or pattern == '' then
return source_str
end
plain = str._getBoolean( plain )
if plain then
pattern = str._escapePattern( pattern )
replace = mw.ustring.gsub( replace, "%%", "%%%%" ) --Only need to escape replacement sequences.
end
local result
if count ~= nil then
result = mw.ustring.gsub( source_str, pattern, replace, count )
else
result = mw.ustring.gsub( source_str, pattern, replace )
end
return result
end
--[[
simple function to pipe string.rep to templates.
]]
function str.rep( frame )
local repetitions = tonumber( frame.args[2] )
if not repetitions then
return str._error( 'function rep expects a number as second parameter, received "' .. ( frame.args[2] or '' ) .. '"' )
end
return string.rep( frame.args[1] or '', repetitions )
end
--[[
escapePattern
This function escapes special characters from a Lua string pattern. See [1]
for details on how patterns work.
[1] https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
Usage:
{{#invoke:String|escapePattern|pattern_string}}
Parameters
pattern_string: The pattern string to escape.
]]
function str.escapePattern( frame )
local pattern_str = frame.args[1]
if not pattern_str then
return str._error( 'No pattern string specified' )
end
local result = str._escapePattern( pattern_str )
return result
end
--[[
count
This function counts the number of occurrences of one string in another.
]]
function str.count(frame)
local args = str._getParameters(frame.args, {'source', 'pattern', 'plain'})
local source = args.source or ''
local pattern = args.pattern or ''
local plain = str._getBoolean(args.plain or true)
if plain then
pattern = str._escapePattern(pattern)
end
local _, count = mw.ustring.gsub(source, pattern, '')
return count
end
--[[
endswith
This function determines whether a string ends with another string.
]]
function str.endswith(frame)
local args = str._getParameters(frame.args, {'source', 'pattern'})
local source = args.source or ''
local pattern = args.pattern or ''
if pattern == '' then
-- All strings end with the empty string.
return "yes"
end
if mw.ustring.sub(source, -mw.ustring.len(pattern), -1) == pattern then
return "yes"
else
return ""
end
end
--[[
join
Join all non empty arguments together; the first argument is the separator.
Usage:
{{#invoke:String|join|sep|one|two|three}}
]]
function str.join(frame)
local args = {}
local sep
for _, v in ipairs( frame.args ) do
if sep then
if v ~= '' then
table.insert(args, v)
end
else
sep = v
end
end
return table.concat( args, sep or '' )
end
--[[
Helper function that populates the argument list given that user may need to use a mix of
named and unnamed parameters. This is relevant because named parameters are not
identical to unnamed parameters due to string trimming, and when dealing with strings
we sometimes want to either preserve or remove that whitespace depending on the application.
]]
function str._getParameters( frame_args, arg_list )
local new_args = {}
local index = 1
local value
for _, arg in ipairs( arg_list ) do
value = frame_args[arg]
if value == nil then
value = frame_args[index]
index = index + 1
end
new_args[arg] = value
end
return new_args
end
--[[
Helper function to handle error messages.
]]
function str._error( error_str )
local frame = mw.getCurrentFrame()
local error_category = frame.args.error_category or 'Errors reported by Module String'
local ignore_errors = frame.args.ignore_errors or false
local no_category = frame.args.no_category or false
if str._getBoolean(ignore_errors) then
return ''
end
local error_str = '<strong class="error">String Module Error: ' .. error_str .. '</strong>'
if error_category ~= '' and not str._getBoolean( no_category ) then
error_str = '[[Category:' .. error_category .. ']]' .. error_str
end
return error_str
end
--[[
Helper Function to interpret boolean strings
]]
function str._getBoolean( boolean_str )
local boolean_value
if type( boolean_str ) == 'string' then
boolean_str = boolean_str:lower()
if boolean_str == 'false' or boolean_str == 'no' or boolean_str == '0'
or boolean_str == '' then
boolean_value = false
else
boolean_value = true
end
elseif type( boolean_str ) == 'boolean' then
boolean_value = boolean_str
else
error( 'No boolean value found' )
end
return boolean_value
end
--[[
Helper function that escapes all pattern characters so that they will be treated
as plain text.
]]
function str._escapePattern( pattern_str )
return mw.ustring.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" )
end
return str
2ad0905c56ef4955950b75a8f00974fe82aed5e4
Module:Documentation/config
828
118
227
2023-10-28T01:25:16Z
wikipedia>Pppery
0
Split [[Category:Templates sandboxes]] per CfD
Scribunto
text/plain
----------------------------------------------------------------------------------------------------
--
-- Configuration for Module:Documentation
--
-- Here you can set the values of the parameters and messages used in Module:Documentation to
-- localise it to your wiki and your language. Unless specified otherwise, values given here
-- should be string values.
----------------------------------------------------------------------------------------------------
local cfg = {} -- Do not edit this line.
----------------------------------------------------------------------------------------------------
-- Protection template configuration
----------------------------------------------------------------------------------------------------
-- cfg['protection-reason-edit']
-- The protection reason for edit-protected templates to pass to
-- [[Module:Protection banner]].
cfg['protection-reason-edit'] = 'template'
--[[
----------------------------------------------------------------------------------------------------
-- Sandbox notice configuration
--
-- On sandbox pages the module can display a template notifying users that the current page is a
-- sandbox, and the location of test cases pages, etc. The module decides whether the page is a
-- sandbox or not based on the value of cfg['sandbox-subpage']. The following settings configure the
-- messages that the notices contains.
----------------------------------------------------------------------------------------------------
--]]
-- cfg['sandbox-notice-image']
-- The image displayed in the sandbox notice.
cfg['sandbox-notice-image'] = '[[File:Sandbox.svg|50px|alt=|link=]]'
--[[
-- cfg['sandbox-notice-pagetype-template']
-- cfg['sandbox-notice-pagetype-module']
-- cfg['sandbox-notice-pagetype-other']
-- The page type of the sandbox page. The message that is displayed depends on the current subject
-- namespace. This message is used in either cfg['sandbox-notice-blurb'] or
-- cfg['sandbox-notice-diff-blurb'].
--]]
cfg['sandbox-notice-pagetype-template'] = '[[Wikipedia:Template test cases|template sandbox]] page'
cfg['sandbox-notice-pagetype-module'] = '[[Wikipedia:Template test cases|module sandbox]] page'
cfg['sandbox-notice-pagetype-other'] = 'sandbox page'
--[[
-- cfg['sandbox-notice-blurb']
-- cfg['sandbox-notice-diff-blurb']
-- cfg['sandbox-notice-diff-display']
-- Either cfg['sandbox-notice-blurb'] or cfg['sandbox-notice-diff-blurb'] is the opening sentence
-- of the sandbox notice. The latter has a diff link, but the former does not. $1 is the page
-- type, which is either cfg['sandbox-notice-pagetype-template'],
-- cfg['sandbox-notice-pagetype-module'] or cfg['sandbox-notice-pagetype-other'] depending what
-- namespace we are in. $2 is a link to the main template page, and $3 is a diff link between
-- the sandbox and the main template. The display value of the diff link is set by
-- cfg['sandbox-notice-compare-link-display'].
--]]
cfg['sandbox-notice-blurb'] = 'This is the $1 for $2.'
cfg['sandbox-notice-diff-blurb'] = 'This is the $1 for $2 ($3).'
cfg['sandbox-notice-compare-link-display'] = 'diff'
--[[
-- cfg['sandbox-notice-testcases-blurb']
-- cfg['sandbox-notice-testcases-link-display']
-- cfg['sandbox-notice-testcases-run-blurb']
-- cfg['sandbox-notice-testcases-run-link-display']
-- cfg['sandbox-notice-testcases-blurb'] is a sentence notifying the user that there is a test cases page
-- corresponding to this sandbox that they can edit. $1 is a link to the test cases page.
-- cfg['sandbox-notice-testcases-link-display'] is the display value for that link.
-- cfg['sandbox-notice-testcases-run-blurb'] is a sentence notifying the user that there is a test cases page
-- corresponding to this sandbox that they can edit, along with a link to run it. $1 is a link to the test
-- cases page, and $2 is a link to the page to run it.
-- cfg['sandbox-notice-testcases-run-link-display'] is the display value for the link to run the test
-- cases.
--]]
cfg['sandbox-notice-testcases-blurb'] = 'See also the companion subpage for $1.'
cfg['sandbox-notice-testcases-link-display'] = 'test cases'
cfg['sandbox-notice-testcases-run-blurb'] = 'See also the companion subpage for $1 ($2).'
cfg['sandbox-notice-testcases-run-link-display'] = 'run'
-- cfg['sandbox-category'] - A category to add to all template sandboxes.
-- cfg['module-sandbox-category'] - A category to add to all module sandboxes.
-- cfg['module-sandbox-category'] - A category to add to all sandboxe not in templates or modules.
cfg['sandbox-category'] = 'Template sandboxes'
cfg['module-sandbox-category'] = 'Module sandboxes'
cfg['other-sandbox-category'] = 'Sandboxes outside of template or module namespace'
----------------------------------------------------------------------------------------------------
-- Start box configuration
----------------------------------------------------------------------------------------------------
-- cfg['documentation-icon-wikitext']
-- The wikitext for the icon shown at the top of the template.
cfg['documentation-icon-wikitext'] = '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]'
-- cfg['template-namespace-heading']
-- The heading shown in the template namespace.
cfg['template-namespace-heading'] = 'Template documentation'
-- cfg['module-namespace-heading']
-- The heading shown in the module namespace.
cfg['module-namespace-heading'] = 'Module documentation'
-- cfg['file-namespace-heading']
-- The heading shown in the file namespace.
cfg['file-namespace-heading'] = 'Summary'
-- cfg['other-namespaces-heading']
-- The heading shown in other namespaces.
cfg['other-namespaces-heading'] = 'Documentation'
-- cfg['view-link-display']
-- The text to display for "view" links.
cfg['view-link-display'] = 'view'
-- cfg['edit-link-display']
-- The text to display for "edit" links.
cfg['edit-link-display'] = 'edit'
-- cfg['history-link-display']
-- The text to display for "history" links.
cfg['history-link-display'] = 'history'
-- cfg['purge-link-display']
-- The text to display for "purge" links.
cfg['purge-link-display'] = 'purge'
-- cfg['create-link-display']
-- The text to display for "create" links.
cfg['create-link-display'] = 'create'
----------------------------------------------------------------------------------------------------
-- Link box (end box) configuration
----------------------------------------------------------------------------------------------------
-- cfg['transcluded-from-blurb']
-- Notice displayed when the docs are transcluded from another page. $1 is a wikilink to that page.
cfg['transcluded-from-blurb'] = 'The above [[Wikipedia:Template documentation|documentation]] is [[Help:Transclusion|transcluded]] from $1.'
--[[
-- cfg['create-module-doc-blurb']
-- Notice displayed in the module namespace when the documentation subpage does not exist.
-- $1 is a link to create the documentation page with the preload cfg['module-preload'] and the
-- display cfg['create-link-display'].
--]]
cfg['create-module-doc-blurb'] = 'You might want to $1 a documentation page for this [[Wikipedia:Lua|Scribunto module]].'
----------------------------------------------------------------------------------------------------
-- Experiment blurb configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['experiment-blurb-template']
-- cfg['experiment-blurb-module']
-- The experiment blurb is the text inviting editors to experiment in sandbox and test cases pages.
-- It is only shown in the template and module namespaces. With the default English settings, it
-- might look like this:
--
-- Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.
--
-- In this example, "sandbox", "edit", "diff", "testcases", and "edit" would all be links.
--
-- There are two versions, cfg['experiment-blurb-template'] and cfg['experiment-blurb-module'], depending
-- on what namespace we are in.
--
-- Parameters:
--
-- $1 is a link to the sandbox page. If the sandbox exists, it is in the following format:
--
-- cfg['sandbox-link-display'] (cfg['sandbox-edit-link-display'] | cfg['compare-link-display'])
--
-- If the sandbox doesn't exist, it is in the format:
--
-- cfg['sandbox-link-display'] (cfg['sandbox-create-link-display'] | cfg['mirror-link-display'])
--
-- The link for cfg['sandbox-create-link-display'] link preloads the page with cfg['template-sandbox-preload']
-- or cfg['module-sandbox-preload'], depending on the current namespace. The link for cfg['mirror-link-display']
-- loads a default edit summary of cfg['mirror-edit-summary'].
--
-- $2 is a link to the test cases page. If the test cases page exists, it is in the following format:
--
-- cfg['testcases-link-display'] (cfg['testcases-edit-link-display'] | cfg['testcases-run-link-display'])
--
-- If the test cases page doesn't exist, it is in the format:
--
-- cfg['testcases-link-display'] (cfg['testcases-create-link-display'])
--
-- If the test cases page doesn't exist, the link for cfg['testcases-create-link-display'] preloads the
-- page with cfg['template-testcases-preload'] or cfg['module-testcases-preload'], depending on the current
-- namespace.
--]]
cfg['experiment-blurb-template'] = "Editors can experiment in this template's $1 and $2 pages."
cfg['experiment-blurb-module'] = "Editors can experiment in this module's $1 and $2 pages."
----------------------------------------------------------------------------------------------------
-- Sandbox link configuration
----------------------------------------------------------------------------------------------------
-- cfg['sandbox-subpage']
-- The name of the template subpage typically used for sandboxes.
cfg['sandbox-subpage'] = 'sandbox'
-- cfg['template-sandbox-preload']
-- Preload file for template sandbox pages.
cfg['template-sandbox-preload'] = 'Template:Documentation/preload-sandbox'
-- cfg['module-sandbox-preload']
-- Preload file for Lua module sandbox pages.
cfg['module-sandbox-preload'] = 'Template:Documentation/preload-module-sandbox'
-- cfg['sandbox-link-display']
-- The text to display for "sandbox" links.
cfg['sandbox-link-display'] = 'sandbox'
-- cfg['sandbox-edit-link-display']
-- The text to display for sandbox "edit" links.
cfg['sandbox-edit-link-display'] = 'edit'
-- cfg['sandbox-create-link-display']
-- The text to display for sandbox "create" links.
cfg['sandbox-create-link-display'] = 'create'
-- cfg['compare-link-display']
-- The text to display for "compare" links.
cfg['compare-link-display'] = 'diff'
-- cfg['mirror-edit-summary']
-- The default edit summary to use when a user clicks the "mirror" link. $1 is a wikilink to the
-- template page.
cfg['mirror-edit-summary'] = 'Create sandbox version of $1'
-- cfg['mirror-link-display']
-- The text to display for "mirror" links.
cfg['mirror-link-display'] = 'mirror'
-- cfg['mirror-link-preload']
-- The page to preload when a user clicks the "mirror" link.
cfg['mirror-link-preload'] = 'Template:Documentation/mirror'
----------------------------------------------------------------------------------------------------
-- Test cases link configuration
----------------------------------------------------------------------------------------------------
-- cfg['testcases-subpage']
-- The name of the template subpage typically used for test cases.
cfg['testcases-subpage'] = 'testcases'
-- cfg['template-testcases-preload']
-- Preload file for template test cases pages.
cfg['template-testcases-preload'] = 'Template:Documentation/preload-testcases'
-- cfg['module-testcases-preload']
-- Preload file for Lua module test cases pages.
cfg['module-testcases-preload'] = 'Template:Documentation/preload-module-testcases'
-- cfg['testcases-link-display']
-- The text to display for "testcases" links.
cfg['testcases-link-display'] = 'testcases'
-- cfg['testcases-edit-link-display']
-- The text to display for test cases "edit" links.
cfg['testcases-edit-link-display'] = 'edit'
-- cfg['testcases-run-link-display']
-- The text to display for test cases "run" links.
cfg['testcases-run-link-display'] = 'run'
-- cfg['testcases-create-link-display']
-- The text to display for test cases "create" links.
cfg['testcases-create-link-display'] = 'create'
----------------------------------------------------------------------------------------------------
-- Add categories blurb configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['add-categories-blurb']
-- Text to direct users to add categories to the /doc subpage. Not used if the "content" or
-- "docname fed" arguments are set, as then it is not clear where to add the categories. $1 is a
-- link to the /doc subpage with a display value of cfg['doc-link-display'].
--]]
cfg['add-categories-blurb'] = 'Add categories to the $1 subpage.'
-- cfg['doc-link-display']
-- The text to display when linking to the /doc subpage.
cfg['doc-link-display'] = '/doc'
----------------------------------------------------------------------------------------------------
-- Subpages link configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['subpages-blurb']
-- The "Subpages of this template" blurb. $1 is a link to the main template's subpages with a
-- display value of cfg['subpages-link-display']. In the English version this blurb is simply
-- the link followed by a period, and the link display provides the actual text.
--]]
cfg['subpages-blurb'] = '$1.'
--[[
-- cfg['subpages-link-display']
-- The text to display for the "subpages of this page" link. $1 is cfg['template-pagetype'],
-- cfg['module-pagetype'] or cfg['default-pagetype'], depending on whether the current page is in
-- the template namespace, the module namespace, or another namespace.
--]]
cfg['subpages-link-display'] = 'Subpages of this $1'
-- cfg['template-pagetype']
-- The pagetype to display for template pages.
cfg['template-pagetype'] = 'template'
-- cfg['module-pagetype']
-- The pagetype to display for Lua module pages.
cfg['module-pagetype'] = 'module'
-- cfg['default-pagetype']
-- The pagetype to display for pages other than templates or Lua modules.
cfg['default-pagetype'] = 'page'
----------------------------------------------------------------------------------------------------
-- Doc link configuration
----------------------------------------------------------------------------------------------------
-- cfg['doc-subpage']
-- The name of the subpage typically used for documentation pages.
cfg['doc-subpage'] = 'doc'
-- cfg['docpage-preload']
-- Preload file for template documentation pages in all namespaces.
cfg['docpage-preload'] = 'Template:Documentation/preload'
-- cfg['module-preload']
-- Preload file for Lua module documentation pages.
cfg['module-preload'] = 'Template:Documentation/preload-module-doc'
----------------------------------------------------------------------------------------------------
-- HTML and CSS configuration
----------------------------------------------------------------------------------------------------
-- cfg['templatestyles']
-- The name of the TemplateStyles page where CSS is kept.
-- Sandbox CSS will be at Module:Documentation/sandbox/styles.css when needed.
cfg['templatestyles'] = 'Module:Documentation/styles.css'
-- cfg['container']
-- Class which can be used to set flex or grid CSS on the
-- two child divs documentation and documentation-metadata
cfg['container'] = 'documentation-container'
-- cfg['main-div-classes']
-- Classes added to the main HTML "div" tag.
cfg['main-div-classes'] = 'documentation'
-- cfg['main-div-heading-class']
-- Class for the main heading for templates and modules and assoc. talk spaces
cfg['main-div-heading-class'] = 'documentation-heading'
-- cfg['start-box-class']
-- Class for the start box
cfg['start-box-class'] = 'documentation-startbox'
-- cfg['start-box-link-classes']
-- Classes used for the [view][edit][history] or [create] links in the start box.
-- mw-editsection-like is per [[Wikipedia:Village pump (technical)/Archive 117]]
cfg['start-box-link-classes'] = 'mw-editsection-like plainlinks'
-- cfg['end-box-class']
-- Class for the end box.
cfg['end-box-class'] = 'documentation-metadata'
-- cfg['end-box-plainlinks']
-- Plainlinks
cfg['end-box-plainlinks'] = 'plainlinks'
-- cfg['toolbar-class']
-- Class added for toolbar links.
cfg['toolbar-class'] = 'documentation-toolbar'
-- cfg['clear']
-- Just used to clear things.
cfg['clear'] = 'documentation-clear'
----------------------------------------------------------------------------------------------------
-- Tracking category configuration
----------------------------------------------------------------------------------------------------
-- cfg['display-strange-usage-category']
-- Set to true to enable output of cfg['strange-usage-category'] if the module is used on a /doc subpage
-- or a /testcases subpage. This should be a boolean value (either true or false).
cfg['display-strange-usage-category'] = true
-- cfg['strange-usage-category']
-- Category to output if cfg['display-strange-usage-category'] is set to true and the module is used on a
-- /doc subpage or a /testcases subpage.
cfg['strange-usage-category'] = 'Wikipedia pages with strange ((documentation)) usage'
--[[
----------------------------------------------------------------------------------------------------
-- End configuration
--
-- Don't edit anything below this line.
----------------------------------------------------------------------------------------------------
--]]
return cfg
56b6127664e31128dea1cecf2e392cf9313df6a3
Module:Documentation
828
117
225
2023-10-28T01:26:52Z
wikipedia>Pppery
0
Split [[Category:Template sandboxes]] per CfD
Scribunto
text/plain
-- This module implements {{documentation}}.
-- Get required modules.
local getArgs = require('Module:Arguments').getArgs
-- Get the config table.
local cfg = mw.loadData('Module:Documentation/config')
local p = {}
-- Often-used functions.
local ugsub = mw.ustring.gsub
local format = mw.ustring.format
----------------------------------------------------------------------------
-- Helper functions
--
-- These are defined as local functions, but are made available in the p
-- table for testing purposes.
----------------------------------------------------------------------------
local function message(cfgKey, valArray, expectType)
--[[
-- Gets a message from the cfg table and formats it if appropriate.
-- The function raises an error if the value from the cfg table is not
-- of the type expectType. The default type for expectType is 'string'.
-- If the table valArray is present, strings such as $1, $2 etc. in the
-- message are substituted with values from the table keys [1], [2] etc.
-- For example, if the message "foo-message" had the value 'Foo $2 bar $1.',
-- message('foo-message', {'baz', 'qux'}) would return "Foo qux bar baz."
--]]
local msg = cfg[cfgKey]
expectType = expectType or 'string'
if type(msg) ~= expectType then
error('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2)
end
if not valArray then
return msg
end
local function getMessageVal(match)
match = tonumber(match)
return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. cfgKey, 4)
end
return ugsub(msg, '$([1-9][0-9]*)', getMessageVal)
end
p.message = message
local function makeWikilink(page, display)
if display then
return format('[[%s|%s]]', page, display)
else
return format('[[%s]]', page)
end
end
p.makeWikilink = makeWikilink
local function makeCategoryLink(cat, sort)
local catns = mw.site.namespaces[14].name
return makeWikilink(catns .. ':' .. cat, sort)
end
p.makeCategoryLink = makeCategoryLink
local function makeUrlLink(url, display)
return format('[%s %s]', url, display)
end
p.makeUrlLink = makeUrlLink
local function makeToolbar(...)
local ret = {}
local lim = select('#', ...)
if lim < 1 then
return nil
end
for i = 1, lim do
ret[#ret + 1] = select(i, ...)
end
-- 'documentation-toolbar'
return format(
'<span class="%s">(%s)</span>',
message('toolbar-class'),
table.concat(ret, ' | ')
)
end
p.makeToolbar = makeToolbar
----------------------------------------------------------------------------
-- Argument processing
----------------------------------------------------------------------------
local function makeInvokeFunc(funcName)
return function (frame)
local args = getArgs(frame, {
valueFunc = function (key, value)
if type(value) == 'string' then
value = value:match('^%s*(.-)%s*$') -- Remove whitespace.
if key == 'heading' or value ~= '' then
return value
else
return nil
end
else
return value
end
end
})
return p[funcName](args)
end
end
----------------------------------------------------------------------------
-- Entry points
----------------------------------------------------------------------------
function p.nonexistent(frame)
if mw.title.getCurrentTitle().subpageText == 'testcases' then
return frame:expandTemplate{title = 'module test cases notice'}
else
return p.main(frame)
end
end
p.main = makeInvokeFunc('_main')
function p._main(args)
--[[
-- This function defines logic flow for the module.
-- @args - table of arguments passed by the user
--]]
local env = p.getEnvironment(args)
local root = mw.html.create()
root
:wikitext(p._getModuleWikitext(args, env))
:wikitext(p.protectionTemplate(env))
:wikitext(p.sandboxNotice(args, env))
:tag('div')
-- 'documentation-container'
:addClass(message('container'))
:attr('role', 'complementary')
:attr('aria-labelledby', args.heading ~= '' and 'documentation-heading' or nil)
:attr('aria-label', args.heading == '' and 'Documentation' or nil)
:newline()
:tag('div')
-- 'documentation'
:addClass(message('main-div-classes'))
:newline()
:wikitext(p._startBox(args, env))
:wikitext(p._content(args, env))
:tag('div')
-- 'documentation-clear'
:addClass(message('clear'))
:done()
:newline()
:done()
:wikitext(p._endBox(args, env))
:done()
:wikitext(p.addTrackingCategories(env))
-- 'Module:Documentation/styles.css'
return mw.getCurrentFrame():extensionTag (
'templatestyles', '', {src=cfg['templatestyles']
}) .. tostring(root)
end
----------------------------------------------------------------------------
-- Environment settings
----------------------------------------------------------------------------
function p.getEnvironment(args)
--[[
-- Returns a table with information about the environment, including title
-- objects and other namespace- or path-related data.
-- @args - table of arguments passed by the user
--
-- Title objects include:
-- env.title - the page we are making documentation for (usually the current title)
-- env.templateTitle - the template (or module, file, etc.)
-- env.docTitle - the /doc subpage.
-- env.sandboxTitle - the /sandbox subpage.
-- env.testcasesTitle - the /testcases subpage.
--
-- Data includes:
-- env.protectionLevels - the protection levels table of the title object.
-- env.subjectSpace - the number of the title's subject namespace.
-- env.docSpace - the number of the namespace the title puts its documentation in.
-- env.docpageBase - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace.
-- env.compareUrl - URL of the Special:ComparePages page comparing the sandbox with the template.
--
-- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value
-- returned will be nil.
--]]
local env, envFuncs = {}, {}
-- Set up the metatable. If triggered we call the corresponding function in the envFuncs table. The value
-- returned by that function is memoized in the env table so that we don't call any of the functions
-- more than once. (Nils won't be memoized.)
setmetatable(env, {
__index = function (t, key)
local envFunc = envFuncs[key]
if envFunc then
local success, val = pcall(envFunc)
if success then
env[key] = val -- Memoise the value.
return val
end
end
return nil
end
})
function envFuncs.title()
-- The title object for the current page, or a test page passed with args.page.
local title
local titleArg = args.page
if titleArg then
title = mw.title.new(titleArg)
else
title = mw.title.getCurrentTitle()
end
return title
end
function envFuncs.templateTitle()
--[[
-- The template (or module, etc.) title object.
-- Messages:
-- 'sandbox-subpage' --> 'sandbox'
-- 'testcases-subpage' --> 'testcases'
--]]
local subjectSpace = env.subjectSpace
local title = env.title
local subpage = title.subpageText
if subpage == message('sandbox-subpage') or subpage == message('testcases-subpage') then
return mw.title.makeTitle(subjectSpace, title.baseText)
else
return mw.title.makeTitle(subjectSpace, title.text)
end
end
function envFuncs.docTitle()
--[[
-- Title object of the /doc subpage.
-- Messages:
-- 'doc-subpage' --> 'doc'
--]]
local title = env.title
local docname = args[1] -- User-specified doc page.
local docpage
if docname then
docpage = docname
else
docpage = env.docpageBase .. '/' .. message('doc-subpage')
end
return mw.title.new(docpage)
end
function envFuncs.sandboxTitle()
--[[
-- Title object for the /sandbox subpage.
-- Messages:
-- 'sandbox-subpage' --> 'sandbox'
--]]
return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage'))
end
function envFuncs.testcasesTitle()
--[[
-- Title object for the /testcases subpage.
-- Messages:
-- 'testcases-subpage' --> 'testcases'
--]]
return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage'))
end
function envFuncs.protectionLevels()
-- The protection levels table of the title object.
return env.title.protectionLevels
end
function envFuncs.subjectSpace()
-- The subject namespace number.
return mw.site.namespaces[env.title.namespace].subject.id
end
function envFuncs.docSpace()
-- The documentation namespace number. For most namespaces this is the
-- same as the subject namespace. However, pages in the Article, File,
-- MediaWiki or Category namespaces must have their /doc, /sandbox and
-- /testcases pages in talk space.
local subjectSpace = env.subjectSpace
if subjectSpace == 0 or subjectSpace == 6 or subjectSpace == 8 or subjectSpace == 14 then
return subjectSpace + 1
else
return subjectSpace
end
end
function envFuncs.docpageBase()
-- The base page of the /doc, /sandbox, and /testcases subpages.
-- For some namespaces this is the talk page, rather than the template page.
local templateTitle = env.templateTitle
local docSpace = env.docSpace
local docSpaceText = mw.site.namespaces[docSpace].name
-- Assemble the link. docSpace is never the main namespace, so we can hardcode the colon.
return docSpaceText .. ':' .. templateTitle.text
end
function envFuncs.compareUrl()
-- Diff link between the sandbox and the main template using [[Special:ComparePages]].
local templateTitle = env.templateTitle
local sandboxTitle = env.sandboxTitle
if templateTitle.exists and sandboxTitle.exists then
local compareUrl = mw.uri.canonicalUrl(
'Special:ComparePages',
{ page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText}
)
return tostring(compareUrl)
else
return nil
end
end
return env
end
----------------------------------------------------------------------------
-- Auxiliary templates
----------------------------------------------------------------------------
p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')
function p._getModuleWikitext(args, env)
local currentTitle = mw.title.getCurrentTitle()
if currentTitle.contentModel ~= 'Scribunto' then return end
pcall(require, currentTitle.prefixedText) -- if it fails, we don't care
local moduleWikitext = package.loaded["Module:Module wikitext"]
if moduleWikitext then
return moduleWikitext.main()
end
end
function p.sandboxNotice(args, env)
--[=[
-- Generates a sandbox notice for display above sandbox pages.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'sandbox-notice-image' --> '[[File:Sandbox.svg|50px|alt=|link=]]'
-- 'sandbox-notice-blurb' --> 'This is the $1 for $2.'
-- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).'
-- 'sandbox-notice-pagetype-template' --> '[[Wikipedia:Template test cases|template sandbox]] page'
-- 'sandbox-notice-pagetype-module' --> '[[Wikipedia:Template test cases|module sandbox]] page'
-- 'sandbox-notice-pagetype-other' --> 'sandbox page'
-- 'sandbox-notice-compare-link-display' --> 'diff'
-- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.'
-- 'sandbox-notice-testcases-link-display' --> 'test cases'
-- 'sandbox-category' --> 'Template sandboxes'
-- 'module-sandbox-category' --> 'Module sandboxes'
-- 'other-sandbox-category' --> 'Sandboxes outside of template or module namespace'
--]=]
local title = env.title
local sandboxTitle = env.sandboxTitle
local templateTitle = env.templateTitle
local subjectSpace = env.subjectSpace
if not (subjectSpace and title and sandboxTitle and templateTitle
and mw.title.equals(title, sandboxTitle)) then
return nil
end
-- Build the table of arguments to pass to {{ombox}}. We need just two fields, "image" and "text".
local omargs = {}
omargs.image = message('sandbox-notice-image')
-- Get the text. We start with the opening blurb, which is something like
-- "This is the template sandbox for [[Template:Foo]] (diff)."
local text = ''
local pagetype, sandboxCat
if subjectSpace == 10 then
pagetype = message('sandbox-notice-pagetype-template')
sandboxCat = message('sandbox-category')
elseif subjectSpace == 828 then
pagetype = message('sandbox-notice-pagetype-module')
sandboxCat = message('module-sandbox-category')
else
pagetype = message('sandbox-notice-pagetype-other')
sandboxCat = message('other-sandbox-category')
end
local templateLink = makeWikilink(templateTitle.prefixedText)
local compareUrl = env.compareUrl
if compareUrl then
local compareDisplay = message('sandbox-notice-compare-link-display')
local compareLink = makeUrlLink(compareUrl, compareDisplay)
text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink})
else
text = text .. message('sandbox-notice-blurb', {pagetype, templateLink})
end
-- Get the test cases page blurb if the page exists. This is something like
-- "See also the companion subpage for [[Template:Foo/testcases|test cases]]."
local testcasesTitle = env.testcasesTitle
if testcasesTitle and testcasesTitle.exists then
if testcasesTitle.contentModel == "Scribunto" then
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink})
else
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink})
end
end
-- Add the sandbox to the sandbox category.
omargs.text = text .. makeCategoryLink(sandboxCat)
-- 'documentation-clear'
return '<div class="' .. message('clear') .. '"></div>'
.. require('Module:Message box').main('ombox', omargs)
end
function p.protectionTemplate(env)
-- Generates the padlock icon in the top right.
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'protection-template' --> 'pp-template'
-- 'protection-template-args' --> {docusage = 'yes'}
local protectionLevels = env.protectionLevels
if not protectionLevels then
return nil
end
local editProt = protectionLevels.edit and protectionLevels.edit[1]
local moveProt = protectionLevels.move and protectionLevels.move[1]
if editProt then
-- The page is edit-protected.
return require('Module:Protection banner')._main{
message('protection-reason-edit'), small = true
}
elseif moveProt and moveProt ~= 'autoconfirmed' then
-- The page is move-protected but not edit-protected. Exclude move
-- protection with the level "autoconfirmed", as this is equivalent to
-- no move protection at all.
return require('Module:Protection banner')._main{
action = 'move', small = true
}
else
return nil
end
end
----------------------------------------------------------------------------
-- Start box
----------------------------------------------------------------------------
p.startBox = makeInvokeFunc('_startBox')
function p._startBox(args, env)
--[[
-- This function generates the start box.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- The actual work is done by p.makeStartBoxLinksData and p.renderStartBoxLinks which make
-- the [view] [edit] [history] [purge] links, and by p.makeStartBoxData and p.renderStartBox
-- which generate the box HTML.
--]]
env = env or p.getEnvironment(args)
local links
local content = args.content
if not content or args[1] then
-- No need to include the links if the documentation is on the template page itself.
local linksData = p.makeStartBoxLinksData(args, env)
if linksData then
links = p.renderStartBoxLinks(linksData)
end
end
-- Generate the start box html.
local data = p.makeStartBoxData(args, env, links)
if data then
return p.renderStartBox(data)
else
-- User specified no heading.
return nil
end
end
function p.makeStartBoxLinksData(args, env)
--[[
-- Does initial processing of data to make the [view] [edit] [history] [purge] links.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'view-link-display' --> 'view'
-- 'edit-link-display' --> 'edit'
-- 'history-link-display' --> 'history'
-- 'purge-link-display' --> 'purge'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'docpage-preload' --> 'Template:Documentation/preload'
-- 'create-link-display' --> 'create'
--]]
local subjectSpace = env.subjectSpace
local title = env.title
local docTitle = env.docTitle
if not title or not docTitle then
return nil
end
if docTitle.isRedirect then
docTitle = docTitle.redirectTarget
end
-- Create link if /doc doesn't exist.
local preload = args.preload
if not preload then
if subjectSpace == 828 then -- Module namespace
preload = message('module-preload')
else
preload = message('docpage-preload')
end
end
return {
title = title,
docTitle = docTitle,
-- View, display, edit, and purge links if /doc exists.
viewLinkDisplay = message('view-link-display'),
editLinkDisplay = message('edit-link-display'),
historyLinkDisplay = message('history-link-display'),
purgeLinkDisplay = message('purge-link-display'),
preload = preload,
createLinkDisplay = message('create-link-display')
}
end
function p.renderStartBoxLinks(data)
--[[
-- Generates the [view][edit][history][purge] or [create][purge] links from the data table.
-- @data - a table of data generated by p.makeStartBoxLinksData
--]]
local docTitle = data.docTitle
-- yes, we do intend to purge the template page on which the documentation appears
local purgeLink = makeWikilink("Special:Purge/" .. data.title.prefixedText, data.purgeLinkDisplay)
if docTitle.exists then
local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay)
local editLink = makeWikilink("Special:EditPage/" .. docTitle.prefixedText, data.editLinkDisplay)
local historyLink = makeWikilink("Special:PageHistory/" .. docTitle.prefixedText, data.historyLinkDisplay)
return "[" .. viewLink .. "] [" .. editLink .. "] [" .. historyLink .. "] [" .. purgeLink .. "]"
else
local createLink = makeUrlLink(docTitle:canonicalUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay)
return "[" .. createLink .. "] [" .. purgeLink .. "]"
end
return ret
end
function p.makeStartBoxData(args, env, links)
--[=[
-- Does initial processing of data to pass to the start-box render function, p.renderStartBox.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error.
--
-- Messages:
-- 'documentation-icon-wikitext' --> '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]'
-- 'template-namespace-heading' --> 'Template documentation'
-- 'module-namespace-heading' --> 'Module documentation'
-- 'file-namespace-heading' --> 'Summary'
-- 'other-namespaces-heading' --> 'Documentation'
-- 'testcases-create-link-display' --> 'create'
--]=]
local subjectSpace = env.subjectSpace
if not subjectSpace then
-- Default to an "other namespaces" namespace, so that we get at least some output
-- if an error occurs.
subjectSpace = 2
end
local data = {}
-- Heading
local heading = args.heading -- Blank values are not removed.
if heading == '' then
-- Don't display the start box if the heading arg is defined but blank.
return nil
end
if heading then
data.heading = heading
elseif subjectSpace == 10 then -- Template namespace
data.heading = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading')
elseif subjectSpace == 828 then -- Module namespace
data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading')
elseif subjectSpace == 6 then -- File namespace
data.heading = message('file-namespace-heading')
else
data.heading = message('other-namespaces-heading')
end
-- Heading CSS
local headingStyle = args['heading-style']
if headingStyle then
data.headingStyleText = headingStyle
else
-- 'documentation-heading'
data.headingClass = message('main-div-heading-class')
end
-- Data for the [view][edit][history][purge] or [create] links.
if links then
-- 'mw-editsection-like plainlinks'
data.linksClass = message('start-box-link-classes')
data.links = links
end
return data
end
function p.renderStartBox(data)
-- Renders the start box html.
-- @data - a table of data generated by p.makeStartBoxData.
local sbox = mw.html.create('div')
sbox
-- 'documentation-startbox'
:addClass(message('start-box-class'))
:newline()
:tag('span')
:addClass(data.headingClass)
:attr('id', 'documentation-heading')
:cssText(data.headingStyleText)
:wikitext(data.heading)
local links = data.links
if links then
sbox:tag('span')
:addClass(data.linksClass)
:attr('id', data.linksId)
:wikitext(links)
end
return tostring(sbox)
end
----------------------------------------------------------------------------
-- Documentation content
----------------------------------------------------------------------------
p.content = makeInvokeFunc('_content')
function p._content(args, env)
-- Displays the documentation contents
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
local content = args.content
if not content and docTitle and docTitle.exists then
content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText}
end
-- The line breaks below are necessary so that "=== Headings ===" at the start and end
-- of docs are interpreted correctly.
return '\n' .. (content or '') .. '\n'
end
p.contentTitle = makeInvokeFunc('_contentTitle')
function p._contentTitle(args, env)
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
if not args.content and docTitle and docTitle.exists then
return docTitle.prefixedText
else
return ''
end
end
----------------------------------------------------------------------------
-- End box
----------------------------------------------------------------------------
p.endBox = makeInvokeFunc('_endBox')
function p._endBox(args, env)
--[=[
-- This function generates the end box (also known as the link box).
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
--]=]
-- Get environment data.
env = env or p.getEnvironment(args)
local subjectSpace = env.subjectSpace
local docTitle = env.docTitle
if not subjectSpace or not docTitle then
return nil
end
-- Check whether we should output the end box at all. Add the end
-- box by default if the documentation exists or if we are in the
-- user, module or template namespaces.
local linkBox = args['link box']
if linkBox == 'off'
or not (
docTitle.exists
or subjectSpace == 2
or subjectSpace == 828
or subjectSpace == 10
)
then
return nil
end
-- Assemble the link box.
local text = ''
if linkBox then
text = text .. linkBox
else
text = text .. (p.makeDocPageBlurb(args, env) or '') -- "This documentation is transcluded from [[Foo]]."
if subjectSpace == 2 or subjectSpace == 10 or subjectSpace == 828 then
-- We are in the user, template or module namespaces.
-- Add sandbox and testcases links.
-- "Editors can experiment in this template's sandbox and testcases pages."
text = text .. (p.makeExperimentBlurb(args, env) or '') .. '<br />'
if not args.content and not args[1] then
-- "Please add categories to the /doc subpage."
-- Don't show this message with inline docs or with an explicitly specified doc page,
-- as then it is unclear where to add the categories.
text = text .. (p.makeCategoriesBlurb(args, env) or '')
end
text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or '') --"Subpages of this template"
end
end
local box = mw.html.create('div')
-- 'documentation-metadata'
box:attr('role', 'note')
:addClass(message('end-box-class'))
-- 'plainlinks'
:addClass(message('end-box-plainlinks'))
:wikitext(text)
:done()
return '\n' .. tostring(box)
end
function p.makeDocPageBlurb(args, env)
--[=[
-- Makes the blurb "This documentation is transcluded from [[Template:Foo]] (edit, history)".
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'edit-link-display' --> 'edit'
-- 'history-link-display' --> 'history'
-- 'transcluded-from-blurb' -->
-- 'The above [[Wikipedia:Template documentation|documentation]]
-- is [[Help:Transclusion|transcluded]] from $1.'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'create-link-display' --> 'create'
-- 'create-module-doc-blurb' -->
-- 'You might want to $1 a documentation page for this [[Wikipedia:Lua|Scribunto module]].'
--]=]
local docTitle = env.docTitle
if not docTitle then
return nil
end
local ret
if docTitle.exists then
-- /doc exists; link to it.
local docLink = makeWikilink(docTitle.prefixedText)
local editDisplay = message('edit-link-display')
local editLink = makeWikilink("Special:EditPage/" .. docTitle.prefixedText, editDisplay)
local historyDisplay = message('history-link-display')
local historyLink = makeWikilink("Special:PageHistory/" .. docTitle.prefixedText, historyDisplay)
ret = message('transcluded-from-blurb', {docLink})
.. ' '
.. makeToolbar(editLink, historyLink)
.. '<br />'
elseif env.subjectSpace == 828 then
-- /doc does not exist; ask to create it.
local createUrl = docTitle:canonicalUrl{action = 'edit', preload = message('module-preload')}
local createDisplay = message('create-link-display')
local createLink = makeUrlLink(createUrl, createDisplay)
ret = message('create-module-doc-blurb', {createLink})
.. '<br />'
end
return ret
end
function p.makeExperimentBlurb(args, env)
--[[
-- Renders the text "Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages."
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'sandbox-link-display' --> 'sandbox'
-- 'sandbox-edit-link-display' --> 'edit'
-- 'compare-link-display' --> 'diff'
-- 'module-sandbox-preload' --> 'Template:Documentation/preload-module-sandbox'
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'
-- 'sandbox-create-link-display' --> 'create'
-- 'mirror-edit-summary' --> 'Create sandbox version of $1'
-- 'mirror-link-display' --> 'mirror'
-- 'mirror-link-preload' --> 'Template:Documentation/mirror'
-- 'sandbox-link-display' --> 'sandbox'
-- 'testcases-link-display' --> 'testcases'
-- 'testcases-edit-link-display'--> 'edit'
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'
-- 'testcases-create-link-display' --> 'create'
-- 'testcases-link-display' --> 'testcases'
-- 'testcases-edit-link-display' --> 'edit'
-- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases'
-- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases'
-- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.'
-- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.'
--]]
local subjectSpace = env.subjectSpace
local templateTitle = env.templateTitle
local sandboxTitle = env.sandboxTitle
local testcasesTitle = env.testcasesTitle
local templatePage = templateTitle.prefixedText
if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then
return nil
end
-- Make links.
local sandboxLinks, testcasesLinks
if sandboxTitle.exists then
local sandboxPage = sandboxTitle.prefixedText
local sandboxDisplay = message('sandbox-link-display')
local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay)
local sandboxEditDisplay = message('sandbox-edit-link-display')
local sandboxEditLink = makeWikilink("Special:EditPage/" .. sandboxPage, sandboxEditDisplay)
local compareUrl = env.compareUrl
local compareLink
if compareUrl then
local compareDisplay = message('compare-link-display')
compareLink = makeUrlLink(compareUrl, compareDisplay)
end
sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink)
else
local sandboxPreload
if subjectSpace == 828 then
sandboxPreload = message('module-sandbox-preload')
else
sandboxPreload = message('template-sandbox-preload')
end
local sandboxCreateUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = sandboxPreload}
local sandboxCreateDisplay = message('sandbox-create-link-display')
local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay)
local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)})
local mirrorPreload = message('mirror-link-preload')
local mirrorUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary}
if subjectSpace == 828 then
mirrorUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary}
end
local mirrorDisplay = message('mirror-link-display')
local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay)
sandboxLinks = message('sandbox-link-display') .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink)
end
if testcasesTitle.exists then
local testcasesPage = testcasesTitle.prefixedText
local testcasesDisplay = message('testcases-link-display')
local testcasesLink = makeWikilink(testcasesPage, testcasesDisplay)
local testcasesEditUrl = testcasesTitle:canonicalUrl{action = 'edit'}
local testcasesEditDisplay = message('testcases-edit-link-display')
local testcasesEditLink = makeWikilink("Special:EditPage/" .. testcasesPage, testcasesEditDisplay)
-- for Modules, add testcases run link if exists
if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then
local testcasesRunLinkDisplay = message('testcases-run-link-display')
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink)
else
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink)
end
else
local testcasesPreload
if subjectSpace == 828 then
testcasesPreload = message('module-testcases-preload')
else
testcasesPreload = message('template-testcases-preload')
end
local testcasesCreateUrl = testcasesTitle:canonicalUrl{action = 'edit', preload = testcasesPreload}
local testcasesCreateDisplay = message('testcases-create-link-display')
local testcasesCreateLink = makeUrlLink(testcasesCreateUrl, testcasesCreateDisplay)
testcasesLinks = message('testcases-link-display') .. ' ' .. makeToolbar(testcasesCreateLink)
end
local messageName
if subjectSpace == 828 then
messageName = 'experiment-blurb-module'
else
messageName = 'experiment-blurb-template'
end
return message(messageName, {sandboxLinks, testcasesLinks})
end
function p.makeCategoriesBlurb(args, env)
--[[
-- Generates the text "Please add categories to the /doc subpage."
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'doc-link-display' --> '/doc'
-- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.'
--]]
local docTitle = env.docTitle
if not docTitle then
return nil
end
local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display'))
return message('add-categories-blurb', {docPathLink})
end
function p.makeSubpagesBlurb(args, env)
--[[
-- Generates the "Subpages of this template" link.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'template-pagetype' --> 'template'
-- 'module-pagetype' --> 'module'
-- 'default-pagetype' --> 'page'
-- 'subpages-link-display' --> 'Subpages of this $1'
--]]
local subjectSpace = env.subjectSpace
local templateTitle = env.templateTitle
if not subjectSpace or not templateTitle then
return nil
end
local pagetype
if subjectSpace == 10 then
pagetype = message('template-pagetype')
elseif subjectSpace == 828 then
pagetype = message('module-pagetype')
else
pagetype = message('default-pagetype')
end
local subpagesLink = makeWikilink(
'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/',
message('subpages-link-display', {pagetype})
)
return message('subpages-blurb', {subpagesLink})
end
----------------------------------------------------------------------------
-- Tracking categories
----------------------------------------------------------------------------
function p.addTrackingCategories(env)
--[[
-- Check if {{documentation}} is transcluded on a /doc or /testcases page.
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'display-strange-usage-category' --> true
-- 'doc-subpage' --> 'doc'
-- 'testcases-subpage' --> 'testcases'
-- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage'
--
-- /testcases pages in the module namespace are not categorised, as they may have
-- {{documentation}} transcluded automatically.
--]]
local title = env.title
local subjectSpace = env.subjectSpace
if not title or not subjectSpace then
return nil
end
local subpage = title.subpageText
local ret = ''
if message('display-strange-usage-category', nil, 'boolean')
and (
subpage == message('doc-subpage')
or subjectSpace ~= 828 and subpage == message('testcases-subpage')
)
then
ret = ret .. makeCategoryLink(message('strange-usage-category'))
end
return ret
end
return p
0f0f558e631e573a8b022c2a20bfc47c4137d640
Template:Country data United States
10
216
424
2023-10-28T19:22:57Z
wikipedia>Paine Ellsworth
0
per edit request on talk page - include military armed forces link alias
wikitext
text/x-wiki
{{safesubst<noinclude />: {{{1<noinclude>|country showdata</noinclude>}}}
| alias = United States
| flag alias = Flag of the United States.svg
| flag alias-1776 = Flag of the United States (1776–1777).svg
| flag alias-1777 = Flag of the United States (1777–1795).svg
| flag alias-1777-Ross = Betsy Ross flag.svg
| flag alias-1795 = Flag of the United States (1795-1818).svg
| flag alias-1795FM = Flag of the United States (1795–1818).svg
| flag alias-1818 = Flag of the United States (1818-1819).svg
| flag alias-1819 = Flag of the United States (1819-1820).svg
| flag alias-1820 = Flag of the United States (1820-1822).svg
| flag alias-1822 = Flag of the United States (1822-1836).svg
| flag alias-1836 = Flag of the United States (1836-1837).svg
| flag alias-1837 = Flag of the United States (1837-1845).svg
| flag alias-1845 = Flag of the United States (1845-1846).svg
| flag alias-1846 = Flag of the United States (1846-1847).svg
| flag alias-1847 = Flag of the United States (1847-1848).svg
| flag alias-1848 = Flag of the United States (1848-1851).svg
| flag alias-1851 = Flag of the United States (1851-1858).svg
| flag alias-1858 = Flag of the United States (1858-1859).svg
| flag alias-1859 = Flag of the United States (1859-1861).svg
| flag alias-1861 = Flag of the United States (1861-1863).svg
| flag alias-1863 = Flag of the United States (1863-1865).svg
| flag alias-1865 = Flag of the United States (1865-1867).svg
| flag alias-1867 = Flag of the United States (1867-1877).svg
| flag alias-1877 = Flag of the United States (1877-1890).svg
| flag alias-1890 = Flag of the United States (1890-1891).svg
| flag alias-1891 = Flag of the United States (1891-1896).svg
| flag alias-1896 = Flag of the United States (1896-1908).svg
| flag alias-1908 = Flag of the United States (1908-1912).svg
| flag alias-1912 = Flag of the United States (1912-1959).svg
| flag alias-1959 = Flag of the United States (1959-1960).svg
| flag alias-1960 = Flag of the United States (Pantone).svg
| flag alias-yacht = United States yacht flag.svg
| flag alias-air force = Flag of the United States Air Force.svg
| flag alias-coast guard-1799 = Ensign of the United States Revenue-Marine (1799).png
| flag alias-coast guard-1815 = Ensign of the United States Revenue-Marine (1815).png
| flag alias-coast guard-1836 = Ensign of the United States Revenue-Marine (1836).png
| flag alias-coast guard-1841 = Ensign of the United States Revenue-Marine (1841).png
| flag alias-coast guard-1867 = Ensign of the United States Revenue-Marine (1867).png
| flag alias-coast guard-1868 = Ensign of the United States Revenue-Marine (1868).png
| flag alias-coast guard-1915 = Ensign of the United States Coast Guard (1915-1953).png
| flag alias-coast guard-1953 = Ensign of the United States Coast Guard.svg
| flag alias-coast guard = Flag of the United States Coast Guard.svg
| link alias-coast guard = {{#switch:{{{variant|}}}|coast guard|coast guard-1915=United States Coast Guard|coast guard-1894=United States Revenue Cutter Service|coast guard-1799|coast guard-1815|coast guard-1836|coast guard-1841|coast guard-1867|coast guard-1868=United States Revenue-Marine|United States Coast Guard}}
| flag alias-army = Flag of the United States Army.svg
| link alias-naval = {{#switch:{{{variant|}}}|navy|coast guard-1915=United States Coast Guard|United States Coast Guard|United States Navy}}
| flag alias-navy-1864 = Flag of the United States Navy (1864-1959).svg
| flag alias-navy = Flag of the United States Navy (official).svg
| link alias-navy = United States Navy
| link alias-marines = {{#switch:{{{variant|}}}|marines|marines-1914=United States Marine Corps|United States Marine Corps}}
| flag alias-marines-1914 = Flag of the United States Marine Corps (1914-1939).png
| flag alias-marines = Flag of the United States Marine Corps.svg
| link alias-merchant marine = United States Merchant Marine
| flag alias-merchant marine = Flag of the United States Merchant Marine Higher Resolution.jpg
| flag alias-space force = Flag of the United States Space Force.svg
| link alias-military = United States Armed Forces
| link alias-football = United States {{{mw|men's}}} national {{{age|}}} soccer team
| link alias-Australian rules football = United States {{{mw|men's}}} national Australian rules football team
| {{#ifeq:{{{altlink}}}|A national rugby union team|link alias-rugby union|empty}} = USA Selects
| size = {{{size|}}}
| name = {{{name|}}}
| altlink = {{{altlink|}}}
| altvar = {{{altvar|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = 1776
| var2 = 1777
| var3 = 1777-Ross
| var4 = 1795
| var5 = 1795FM
| var6 = 1818
| var7 = 1819
| var8 = 1820
| var9 = 1822
| var10 = 1836
| var11 = 1837
| var12 = 1845
| var13 = 1846
| var14 = 1847
| var15 = 1848
| var16 = 1851
| var17 = 1858
| var18 = 1859
| var19 = 1861
| var20 = 1863
| var21 = 1865
| var22 = 1867
| var23 = 1877
| var24 = 1890
| var25 = 1891
| var26 = 1896
| var27 = 1908
| var28 = 1912
| var29 = 1959
| var30 = 1960
| var31 = yacht
| var32 = coast guard-1915
| var33 = coast guard-1953
| var34 = marines-1914
| redir1 = USA
| redir2 = US
| redir3 = United States of America
| redir4 = U.S.
</noinclude>
}}
14b1f0dfe034ac279f6c3e9c246fa120c6431cda
Template:Infobox election/doc
10
245
482
2023-11-07T17:29:37Z
wikipedia>CommonsDelinker
0
Removing [[:c:File:Scotlandliam.png|Scotlandliam.png]]; it has been deleted from Commons by [[:c:User:Infrogmation|Infrogmation]] because: per [[:c:Commons:Deletion requests/File:Scotlandliam.png|]].
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{High-use}}
{{ombox|type=style|text=This is not for [[referendums]]; use '''{{Tlg|Infobox referendum}}''' instead.}}
{{Lua|Module:Infobox|Module:InfoboxImage|Module:String|Module:Check for unknown parameters}}
This infobox describes a presidential, primary, legislative or parliamentary election.
For legislative elections with many parties, consider using {{tl|Infobox legislative election}} instead.
== Usage ==
Remove fields for different types of elections.
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox election
| election_name =
| country =
| flag_year =
| flag_image =
| type = <!-- presidential, parliamentary, legislative, primary, or by-election --><!-- MANDATORY, and limited to the preceding five types -->
| vote_type = Popular <!-- default -->
| ongoing =
| party_colour =
| party_name =
| alliance_name =
| previous_election =
| previous_year =
| outgoing_members =
| election_date = <!-- {{Start date|YYYY|MM|DD}} -->
| elected_members =
| next_election = <!--page title, will be linked if it exists-->
| next_year =
| votes_for_election=
| needed_votes =
| seats_for_election=
| majority_seats =
| opinion_polls =
| registered =
| turnout =
| votes_counted = <!-- Use ONE out of votes_counted, reporting or declared, do not include percentage (%) sign-->
| reporting = <!-- Use ONE out of votes_counted, reporting or declared, do not include percentage (%) sign-->
| declared = <!-- Use ONE out of votes_counted, reporting or declared, do not include percentage (%) sign-->
| last_update =
| time_zone =
| image_upright =
| filler = <!-- (fills whitespace to the left of image1 with filler text, such as "Political selections")-->
<!-- person 1 -->
| image1 =
| image1_size =
| image1_upright =
| colour1 =
| nominee1 = <!-- when appropriate, candidate1 can be used instead -->
| candidate1 = <!-- any type of election -->
| leader1 = <!-- legislative or parliamentary only-->
| party1 =
| alliance1 =
<!-- presidential -->
| home_state1 =
| running_mate1 =
| electoral_vote1 =
| delegate_count1 =
| states_carried1 =
| districts_won1 =
<!-- legislative or parliamentary -->
| leader_since1 =
| leaders_seat1 =
| last_election1 =
| seats_before1 =
| seats_needed1 =
| seats1 =
| seats_after1 =
| seat_change1 =
<!-- any -->
| popular_vote1 =
| percentage1 =
| swing1 = <!-- legislative or parliamentary only-->
<!-- person 2 -->
| image2 =
| image2_size =
| image2_upright =
| colour2 =
| nominee2 = <!-- presidential only, when appropriate, candidate2 can be used instead -->
| candidate2 = <!-- any type of election -->
| leader2 = <!-- legislative or parliamentary only-->
| party2 =
| alliance2 =
<!-- presidential -->
| home_state2 =
| running_mate2 =
| electoral_vote2 =
| delegate_count2 =
| states_carried2 =
| districts_won2 =
<!-- legislative or parliamentary -->
| leader_since2 =
| leaders_seat2 =
| last_election2 =
| seats_before2 =
| seats_needed2 =
| seats2 =
| seats_after2 =
| seat_change2 =
<!-- any -->
| popular_vote2 =
| percentage2 =
| swing2 = <!-- legislative or parliamentary only-->
<!-- polls -->
| poll1_date =
| poll1_source =
| poll1_nominee1 = <!-- presidential only, when appropriate, poll1_candidate1 can be used instead -->
| poll1_party1 = <!-- legislative or parliamentary only-->
| poll1_nominee2 = <!-- presidential only, when appropriate, poll1_candidate2 can be used instead -->
| poll1_party2 = <!-- legislative or parliamentary only-->
| poll2_date =
| poll2_source =
| poll2_nominee1 = <!-- presidential only, when appropriate, poll2_candidate1 can be used instead -->
| poll2_party1 = <!-- legislative or parliamentary only-->
| poll2_nominee2 = <!-- presidential only, when appropriate, poll2_candidate2 can be used instead -->
| poll2_party2 = <!-- legislative or parliamentary only-->
<!-- auxiliary rows -->
| 1blank =
| 1data1 =
| 1data2 =
| 2blank =
| 2data1 =
| 2data2 =
<!-- map -->
| map_image =
| map_size =
| map_alt =
| map =
| map_caption =
<!-- bottom -->
| title =
| before_election =
| before_party =
| posttitle =
| after_election =
| after_party =
}}
</syntaxhighlight>
: *Non-optional fields.
: † only displayed if the election is yet to take place.
: ‡ only displayed if the election has finished.
{| class="wikitable"
! Field !! Type !! Description
|-
| '''election_name'''
|*
| Name given to the election. If this field is left empty the page name is displayed
|-
| '''country'''
|
| Country where the election took place.
|-
| '''flag_year'''
|
| For historical elections when an older flag design was in effect, enter the year the flag came into effect (not the election year). Default is to use the current flag.
|-
| '''flag_image'''
|
| For non-country elections, specify the full name of the flag, coat-of-arms, or seal image to display.
|-
| '''type'''
|*
| The type of election. Must be one of five: presidential, legislative, parliamentary, primary, or by-election. Legislative after the election will display majority and minority party, rather than first and second party.
|-
| '''vote_type'''
|
| The type of votes recorded at popular_vote''n''. Defaults to "Popular".
|-
| '''ongoing'''
|*
| Must be either yes or no, whether the election is yet to take place, or completed. Fields marked with a † are only displayed if the election is yet to take place. Fields marked with a ‡ are only displayed if the election has finished. (Default no.)
|-
| '''party_colour'''
|
| Also spelled '''party_color'''. To turn off the party colours enter 'no'.
|-
| '''party_name'''
|
| To turn off linking to the parties enter 'no'.
|-
| '''alliance_name'''
|
| To turn off linking to the alliances enter 'no'.
|-
| '''previous_election'''
|
| The page name of the last election of this type.
|-
| '''previous_year'''
|
| The year the last election of this type took place.
|-
| '''previous_mps''' (DEPRECATED)
| ''legislative''<br/>''parliamentary''
| Also spelled '''previous_MPs''' or '''previous_members''', page name for the members elected in the last election.
|-
| '''outgoing_members'''
| ''legislative''<br/>''parliamentary''
| The page name of the legislative term (typically including a list of members) serving between the previous election and this election.<br />(Can either be a page title or a wiki link.)
|-
| '''election_date'''
|
| Date of election - use {{tl|Start date}}
|-
| '''elected_mps''' (DEPRECATED)
| ''legislative''<br/>''parliamentary''
| Wikilink to the MPs elected in this election.
|-
| '''elected_members'''
| ''legislative''<br/>''parliamentary''
| The page name of the legislative term (typically including a list of members) serving between this election and the next election.<br />(Can either be a page title or a wiki link.)
|-
| '''next_election'''
|
| The page name of the next election of this type. If red link (it doesn't exist), then it will appear unlinked.
|-
| '''next_year'''
|
| The year the next election of this type took place.
|-
| '''<del>next_mps</del>''' (DEPRECATED, REMOVED)
| <del>''legislative''<br/>''parliamentary''</del>
| <del>Also spelled '''next_MPs''' or '''next_members''', page name for the members elected in the next election.</del>
|-
| '''votes_for_election'''
| ''presidential''
| The number of votes for election and the system of voting (e.g. Electoral College).
|-
| '''needed_votes'''
| ''presidential''
| The number of votes required to win. If there is an even number of votes, use the number that is said by the media.
|-
| '''seats_for_election'''
| ''legislative''<br/>''parliamentary''<br/>''by-election''
| The number of seats for election and the house or chamber the seats are for.
|-
| '''majority_seats'''
| ''legislative''<br/>''parliamentary''
| The number of seats required for a [[majority government]]. If there is an even number of seats in the house or chamber, use the number that is said by the media.
|-
| '''opinion_polls'''
|
| Pagename or section anchor of [[opinion poll]]s.
|-
| '''registered'''
|
| Number of [[Voter registration|registered voters]] for this election.
|-
| '''turnout'''
|
| [[Voter turnout]] for this election.
|-
| '''votes_counted'''
| rowspan="3"|
| rowspan="3"|The number of votes or the number of constituencies, in %, that have been counted after polls have closed. '''Do not include''' the percentage sign (%) after number. It is advisable to remove this information soon after the counting process has finished and all the results have been declared. Use '''votes_counted''', '''reporting''' or '''declared''' according to whichever term best suits the specific election and counting procedure
|-
| '''reporting'''
|-
| '''declared'''
|-
| '''last_update'''
|
| The time at which the latest update on results and the number of votes were updated on the infobox
|-
| '''time_zone'''
|
| Time zone of the time given in the ''last_update'' field. Must be linked as normal similar to an article (e.g. <nowiki>[[Greenwich mean time|GMT]])</nowiki>
|-
| '''image_upright'''
|
| Upright for all {{para|image<var>n</var>}}. See [[WP:UPRIGHT]]. Can be overridden by the corresponding {{para|image<var>n</var>_upright}}.
|-
| '''filler'''
|
| Set filler = (text) to include optional filler text, such as "Political selections", to the left of image1.
|-
| '''image1'''
|
| Image of Nominee, head of Party list or Party Leader. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time. In order to work, colour1 or party1 must be entered.
|-
| '''image1_upright'''
|
| Upright for {{para|image1}}. See [[WP:UPRIGHT]]. Overrides {{para|image_upright}}.
|-
| '''colour1'''
|
| Also spelt '''color1'''. Enter a hex colour code (without the <nowiki>#</nowiki>) to override the border colour of image1. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time.
|-
| '''nominee1'''
| ''presidential''<br/>''by-election''
| Name of Nominee. When appropriate, candidate1 can be used instead. The number can be changed up to nine to display different Nominees or Candidates at the same time.
|-
| '''candidate1'''
|
| Name of Candidate. The number can be changed up to nine to display different Candidates at the same time.
|-
| '''leader1'''
| ''legislative''<br/>''parliamentary''
| Name of head of Party list or Party Leader. The number can be changed up to nine to display different Parties at the same time.
|-
| '''party1'''
|
| Political Party using [[:Category:Political party shortname templates|Political party shortname templates]]. The number can be changed up to nine to display different Parties at the same time.
|-
| '''alliance1'''
|
| Political alliance in elections where coalition politics is common.
|-
| '''home_state1'''
| ''presidential''
| The state the Nominee or Candidate represents. The number can be changed up to nine to display different Nominees at the same time.
|-
| '''running_mate1'''
| ''presidential''
| The Nominee's [[Running mate]]. The number can be changed up to nine to display different Nominees at the same time.
|-
| '''electoral_vote1'''
| ''presidential''<br/>‡
| The [[electoral vote]]s obtained by the Nominee. The number can be changed up to nine to display different Nominees at the same time.
|-
| '''projected_vote1'''
| ''presidential''<br/>‡
| The [[electoral vote]]s projected for the Nominee.
|-
| '''delegate_count1'''
| ''presidential''
| The aggregate number of [[Delegate (American politics)|delegate]]s obtained by the candidate. The number can be changed up to nine to display different candidates at the same time. Intended for use in pre-election processes such as selection of delegates to [[United States presidential nominating convention]]s. Intended to be used instead of electoral_vote1 for these cases.
|-
| '''states_carried1'''
| ''presidential''<br/>‡
| The states carried or won by the Nominee. The number can be changed up to nine to display different Nominees at the same time.
|-
| '''districts_won1'''
| ''presidential''<br/>‡
| The number of districts won by the Nominee. The number can be changed up to nine to display different Nominees at the same time.
|-
| '''leader_since1'''
| ''legislative''<br/>''parliamentary''
| The date the Leader took office. The number can be changed up to nine to display different Parties at the same time. Only to be used when the information is in the article body.
|-
| '''leaders_seat1'''
| ''legislative''<br/>''parliamentary''
| The seat the Leader represents. The number can be changed up to nine to display different Parties at the same time. Only to be used when the information is in the article body.
|-
| '''last_election1'''
| ''legislative''<br/>''parliamentary''
| The seat count and percentage of the vote received at the previous election. The number can be changed up to nine to display different Parties at the same time.
|-
| '''seats_before1'''
| ''legislative''<br/>''parliamentary''
| The seat count before the election, labeled 'current seats' if the election is yet to take place. The number can be changed up to nine to display different Parties at the same time.
|-
| '''seats_needed1'''
| ''legislative''<br/>''parliamentary''<br/>†
| The seats required to gain an overall majority. The number can be changed up to nine to display different Parties at the same time.
|-
| '''seats1'''
| ''legislative''<br/>''parliamentary''<br/>‡
| The seats won at the election. The number can be changed up to nine to display different Parties at the same time.
|-
| '''seats_after1'''
| ''legislative''<br/>''parliamentary''<br/>‡
| The seat count after the election. The number can be changed up to nine to display different Parties at the same time.
|-
| '''seat_change1'''
| ''legislative''<br/>''parliamentary''<br/>‡
| The change in the number of seats won at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.
|-
| '''popular_vote1'''
| ‡
| The number of votes obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.
|-
| '''percentage1'''
| ‡
| The percentage of the popular vote obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.
|-
| '''swing1'''
| ''legislative''<br/>''parliamentary''<br/>‡
| The [[Swing (politics)|swing]] or change in popular vote at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.
|-
| '''poll1_date'''
| †
| The date of an opinion poll. The number can be changed up to five to display different polls at the same time.
|-
| '''poll1_source'''
| †
| The source or URL of the opinion poll. The number can be changed up to five to display different polls at the same time.
poll1_nominee1
|-
| '''poll1_nominee1'''
| ''presidential''<br/>†
| The percentage poll 1 gave to nominee 1. When appropriate, '''poll1_candidate1''' can be used instead. The poll number can be changed up to five to display different polls at the same time. The nominee or candidate number can be changed up to nine to display different Nominees or Candidates at the same time.
|-
| '''poll1_party1'''
| ''legislative''<br/>''parliamentary''<br/>†
| The percentage poll 1 gave to party 1. The poll number can be changed up to five to display different polls at the same time. The party number can be changed up to nine to display different Nominees at the same time.
|-
| '''1blank'''
|
| Title of an auxiliary row. The number can be changed up to six to display six extra rows.
|-
| '''1data1'''
|
| Data 1 for nominee or party 1. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.
|-
| '''map_image'''
|
| Page name for the election map file.
|-
| '''map_size'''
|
| Size of image of the election map to be displayed. (Default 300px).
|-
| '''map_alt'''
|
| [[WP:Alternative text for images|Alt text]] for the election map.
|-
| '''map'''
|
| A freeform replacement for the above, which can be used to insert [[mw:extension:ImageMap|extension:ImageMap]]s or templates instead of images.
|-
| '''map_caption'''
|
| Caption on image of the election map to be displayed.
|-
| '''title'''
|
| Title of the leader before the election. (President, Speaker, Government, Prime Minister...)
|-
| '''before_election'''
|
| The leader in power before the election, labeled [[incumbent]] if the election is yet to take place.
|-
| '''before_party'''
|
| The party in power before the election. This can be set to "Acting (law)" (which will display as "[[Acting (law)|Acting]]") if necessary.
|-
| '''posttitle'''
| ‡
| Title of the victor of the election (President-elect, Prime Minister-designate...), only if different than before.
|-
| '''after_election'''
| ‡
| The leader in power as a result of the election. In case of an ongoing primary, this field may contain the name of the presumptive nominee. If an election is decided by a country's Constitutional/Supreme Court, the leader and the party in power are both listed in this field and a link to the court decision is listed one line below the leader in power. If an election is annulled, the term "Election results annulled" or similar is listed here and a note is listed one line below that.
|-
| '''after_party'''
| ‡
| The party in power as a result of the election.
|}
== Notes ==
The template can display up to nine parties or nominees at the same time, three per row. If exactly four are needed, use the first two on the top and bottom lines. This is done by only using the numbers 1, 2, 4 and 5 on the fields that require a number.
All the fields that work for Legislative will also work for Parliamentary. The only difference between the two is the titles above the images.
The template uses the party fields to display the party colour in the background of the images and some text. To turn this function off, input:
| party_colour = no
To override the calling of the party short name templates, input:
| party_name = no
To override the calling of the alliance short name templates, input:
| alliance_name = no
To override the colour for party1 or nominee1, input:
| colour1 = [HEX OF COLOUR, MINUS #]
The hex number must be entered without the hash for the field to work. The number (colour'''1''') can be changed up to nine for different parties or Nominees. The fields work with both spellings of the word 'color'.
In 2013, the Request for Comment (RFC) process established a consensus that third party candidates must poll over 5% to be included in an infobox, at least for elections in the United States. This was re-affirmed in 2017. RFCs on whether the 5% threshold is necessary for second-place finishers to be included in the infobox have been mixed. (See [[Wikipedia:Five percent rule]])
=== Which leader to use ===
The parties are shown in the infobox in the order they came in the election. The "leader" of each party is the person leading the party through that election.
== Examples ==
=== Presidential ===
{{Infobox election
| election_name = 2004 United States presidential election
| country = United States
| type = presidential
| previous_election = 2000 United States presidential election
| previous_year = 2000
| election_date = {{Start date|2004|11|02}}
| next_election = 2008 United States presidential election
| next_year = 2008
| votes_for_election= All [[List of United States presidential electors, 2004|538 electoral votes]] of the [[Electoral College (United States)|Electoral College]]
| needed_votes = 270 electoral
| image_size = 160x180px
| filler = Political selections
<!-- George W. Bush -->
| image1 = George-W-Bush.jpeg
| nominee1 = [[George W. Bush]]
| party1 = Republican Party (US)
| home_state1 = [[Texas]]
| running_mate1 = [[Dick Cheney|Richard B. Cheney]]
| electoral_vote1 = 286
| states_carried1 = 31
| popular_vote1 = 62,040,610
| percentage1 = 50.7%
<!-- John Kerry -->
| image2 = John Kerry headshot with US flag.jpg
| nominee2 = [[John Kerry]]
| party2 = Democratic Party (US)
| home_state2 = [[Massachusetts]]
| running_mate2 = [[John Edwards]]
| electoral_vote2 = 251
| states_carried2 = 19 + [[Washington, D.C.|DC]]
| popular_vote2 = 59,028,444
| percentage2 = 48.3%
<!-- map -->
| map_image = ElectoralCollege2004.svg
| map_size = 270px
| map_caption = Presidential election results map
<!-- bottom -->
| title = President
| before_election = [[George W. Bush]]
| before_party = Republican Party (US)
| after_election = [[George W. Bush]]
| after_party = Republican Party (US)
}}
<syntaxhighlight lang="wikitext" style="overflow: auto">
{{Infobox election
| election_name = 2004 United States presidential election
| country = United States
| type = presidential
| previous_election = 2000 United States presidential election
| previous_year = 2000
| election_date = {{Start date|2004|11|02}}
| next_election = 2008 United States presidential election
| next_year = 2008
| votes_for_election= All [[List of United States presidential electors, 2004|538 electoral votes]] of the [[Electoral College (United States)|Electoral College]]
| needed_votes = 270 electoral
| image_size = 160x180px
| filler = Political selections
<!-- George W. Bush -->
| image1 = George-W-Bush.jpeg
| nominee1 = [[George W. Bush]]
| party1 = Republican Party (US)
| home_state1 = [[Texas]]
| running_mate1 = [[Dick Cheney|Richard B. Cheney]]
| electoral_vote1 = 286
| states_carried1 = 31
| popular_vote1 = 62,040,610
| percentage1 = 50.7%
<!-- John Kerry -->
| image2 = John Kerry headshot with US flag.jpg
| nominee2 = [[John Kerry]]
| party2 = Democratic Party (US)
| home_state2 = [[Massachusetts]]
| running_mate2 = [[John Edwards]]
| electoral_vote2 = 251
| states_carried2 = 19 + [[Washington, D.C.|DC]]
| popular_vote2 = 59,028,444
| percentage2 = 48.3%
<!-- map -->
| map_image = ElectoralCollege2004.svg
| map_size = 270px
| map_caption = Presidential election results map
<!-- bottom -->
| title = President
| before_election = [[George W. Bush]]
| before_party = Republican Party (US)
| after_election = [[George W. Bush]]
| after_party = Republican Party (US)
}}</syntaxhighlight>
{{-}}
=== Presidential primary ===
{{Infobox election
| election_name = [[Republican Party presidential primaries, 2016]]
| country = United States
| type = primary
| ongoing = yes
| previous_election = 2012 Republican Party presidential primaries
| previous_year = 2012
| next_election = 2020 Republican Party presidential primaries
| next_year = ''2020''
| election_date = February 1 – June 7, 2016
| votes_for_election = 2,472 delegates to the [[2016 Republican National Convention|Republican National Convention]]
| needed_votes = 1,237 delegate
| party_name = no
| image_size = 160x180px
<!-- Donald Trump -->
| image1 = Donald August 19 (cropped).jpg
| candidate1 = '''[[Donald Trump]]'''
| color1 = 283681
| home_state1 = [[New York (state)|New York]]
| states_carried1 = '''28'''
| popular_vote1 = '''10,713,526'''
| percentage1 = '''40.2%'''
| delegate_count1 = '''1,014'''
<!-- Ted Cruz-->
| image2 = Ted Cruz, official portrait, 113th Congress (cropped 2).jpg
| candidate2 = [[Ted Cruz]]
| color2 = DAA520
| home_state2 = [[Texas]]
| states_carried2 = 11
| popular_vote2 = 7,321,878
| percentage2 = 27.5%
| delegate_count2 = 546
<!-- Marco Rubio -->
| image4 = Marco Rubio, Official Portrait, 112th Congress.jpg
| candidate4 = [[Marco Rubio]]
| color4 = C60E3B
| home_state4 = [[Florida]]
| states_carried4 = 3
| popular_vote4 = 3,497,828
| percentage4 = 13.1%
| delegate_count4 = 173
<!-- John Kasich -->
| image5 = Governor John Kasich (cropped2).jpg
| candidate5 = [[John Kasich]]
| color5 = 29AB87
| home_state5 = [[Ohio]]
| states_carried5 = 1
| popular_vote5 = 3,762,367
| percentage5 = 14.1%
| delegate_count5 = 154
| map_image = Republican Party presidential primaries results, 2016.svg
| map_size = 308px
| map_caption = '''First place by first-instance vote'''
{{{!}} style="font-size:110%; margin:0 auto;"
{{!}} {{Legend0|#283681|Donald Trump}} {{!}}{{!}} {{Legend0|#DAA520|Ted Cruz}}
{{!}}-
{{!}} {{Legend0|#C60E3B|Marco Rubio}} {{!}}{{!}} {{Legend0|#29AB87|John Kasich}}
{{!}}-
{{!}} {{Legend0|#000000|Uncommitted}} {{!}}{{!}}
{{!}}}
| title = Republican nominee
| before_election = [[Mitt Romney]]
| after_election = [[Donald Trump]]
| template_name = 2016 Republican Party presidential primaries
}}
<syntaxhighlight lang="wikitext" style="overflow: auto">
{{Infobox election
| election_name = [[Republican Party presidential primaries, 2016]]
| country = United States
| type = primary
| ongoing = yes
| previous_election = 2012 Republican Party presidential primaries
| previous_year = 2012
| next_election = 2020 Republican Party presidential primaries
| next_year = ''2020''
| election_date = February 1 – June 7, 2016
| votes_for_election = 2,472 delegates to the [[2016 Republican National Convention|Republican National Convention]]
| needed_votes = 1,237 delegate
| party_name = no
| image_size = 160x180px
<!-- Donald Trump -->
| image1 = Donald August 19 (cropped).jpg
| candidate1 = '''[[Donald Trump]]'''
| color1 = 283681
| home_state1 = [[New York (state)|New York]]
| states_carried1 = '''28'''
| popular_vote1 = '''10,713,526'''
| percentage1 = '''30.2%'''
| delegate_count1 = '''1,014'''
<!-- Ted Cruz-->
| image2 = Ted Cruz, official portrait, 113th Congress (cropped 2).jpg
| candidate2 = [[Ted Cruz]]
| color2 = DAA520
| home_state2 = [[Texas]]
| states_carried2 = 11
| popular_vote2 = 7,321,878
| percentage2 = 37.5%
| delegate_count2 = 546
<!-- Marco Rubio -->
| image4 = Marco Rubio, Official Portrait, 112th Congress.jpg
| candidate4 = [[Marco Rubio]]
| color4 = C60E3B
| home_state4 = [[Florida]]
| states_carried4 = 3
| popular_vote4 = 3,497,828
| percentage4 = 13.1%
| delegate_count4 = 173
<!-- John Kasich -->
| image5 = Governor John Kasich (cropped2).jpg
| candidate5 = [[John Kasich]]
| color5 = 29AB87
| home_state5 = [[Ohio]]
| states_carried5 = 1
| popular_vote5 = 3,762,367
| percentage5 = 14.1%
| delegate_count5 = 154
| map_image = Republican Party presidential primaries results, 2016.svg
| map_size = 308px
| map_caption = '''First place by first-instance vote'''
{{{!}} style="font-size:110%; margin:0 auto;"
{{!}} {{Legend0|#283681|Donald Trump}} {{!}}{{!}} {{Legend0|#DAA520|Ted Cruz}}
{{!}}-
{{!}} {{Legend0|#C60E3B|Marco Rubio}} {{!}}{{!}} {{Legend0|#29AB87|John Kasich}}
{{!}}-
{{!}} {{Legend0|#000000|Uncommitted}} {{!}}{{!}}
{{!}}}
| title = Republican nominee
| before_election = [[Mitt Romney]]
| after_election = [[Donald Trump]]
| template_name = 2016 Republican Party presidential primaries
}}
</syntaxhighlight>
{{-}}
=== Legislative or parliamentary ===
{{Infobox election
| election_name = 2005 United Kingdom general election
| country = United Kingdom
| type = parliamentary
| previous_election = 2001 United Kingdom general election
| previous_year = 2001
| outgoing_members = List of MPs elected in the United Kingdom general election, 2001
| election_date = {{Start date|2005|05|05}}
| elected_members = List of MPs elected in the United Kingdom general election, 2005
| next_election = 2010 United Kingdom general election
| next_year = 2010
| seats_for_election= All [[List of United Kingdom Parliament constituencies 2005–2010|646 seats]] to the [[House of Commons of the United Kingdom|House of Commons]]
| majority_seats = 324
| opinion_polls = #Opinion polls
| turnout = 61.4%
| image_size = 160x180px
<!-- Labour -->
| image1 = TonyBlairBasra.JPG
| leader1 = [[Tony Blair]]
| party1 = Labour Party (UK)
| leader_since1 = 21 July 1994
| last_election1 = 413 seats, 40.7%
| seats_before1 = 403
| seats1 = 355
| seat_change1 = −48
| popular_vote1 = 9,552,436
| percentage1 = 35.2%
| swing1 = −5.5%
<!-- Labour -->
| image4 = Official_portrait_of_Jeremy_Corbyn_2020_(cropped).jpg
| leader4 = [[Jeremy Corbyn]]
| party4 = Labour Party (UK)
| leader_since4 = 12 September 2015
| last_election4 = 7 seats, 27.1%
| seats_before4 = 7
| seats4 = 10
| seat_change4 = +3
| popular_vote4 = 511,838
| percentage4 = 18.6%
| swing4 = −8.5%
<!-- Conservative -->
| image2 = Boris_Johnson_election_infobox.jpg
| leader2 = [[Boris Johnson]]
| party2 = Conservative Party (UK)
| leader_since2 = 23 July 2019
| last_election2 = 13, 28.6%
| seats_before2 = 13
| seats2 = 14
| seat_change2 = +1
| popular_vote2 = 692,939
| percentage2 = 25.1%
| swing2 = -3.5%
<!-- Liberal Democrats -->
| image5 =Official_portrait_of_Jo_Swinson_crop_4.jpg
| leader5 = [[Jo Swinson]]
| party5 = Liberal Democrats (UK)
| leader_since5 = 22 July 2019
| last_election5 = 4 seats, 6.8%
| seats_before5 = 4
| seats5 = 5
| seat_change5 = +1
| popular_vote5 = 263,417
| percentage5 = 9.5%
| swing5 = +2.7%
<!-- map -->
| map_image =
| map_size = 250px
| map_caption = Map of United Kingdom showing constituencies won
}}
<syntaxhighlight lang="wikitext" style="overflow: auto">
{{Infobox election
| election_name = 2005 United Kingdom general election
| country = United Kingdom
| type = parliamentary
| previous_election = 2001 United Kingdom general election
| previous_year = 2001
| outgoing_members = List of MPs elected in the United Kingdom general election, 2001
| election_date = {{Start date|2005|05|05}}
| elected_members = List of MPs elected in the United Kingdom general election, 2005
| next_election = 2010 United Kingdom general election
| next_year = 2010
| seats_for_election= All [[List of United Kingdom Parliament constituencies 2005–2010|646 seats]] to the [[House of Commons of the United Kingdom|House of Commons]]
| majority_seats = 324
| opinion_polls = #Opinion polls
| turnout = 61.4%
| image_size = 160x180px
<!-- Labour -->
| image1 = TonyBlairBasra.JPG
| leader1 = [[Tony Blair]]
| party1 = Labour Party (UK)
| leader_since1 = 21 July 1994
| leaders_seat1 = [[Sedgefield (UK Parliament constituency)|Sedgefield]]
| last_election1 = 40.7%, 413 seats
| seats_before1 = 403
| seats1 = 355
| seat_change1 = −58
| popular_vote1 = 9,552,436
| percentage1 = 35.2%
| swing1 = −5.5%
<!-- Conservative -->
| image2 = Michael Howard 1099 cropped.jpg
| leader2 = [[Michael Howard]]
| party2 = Conservative Party (UK)
| leader_since2 = 6 November 2003
| leaders_seat2 = [[Folkestone and Hythe (UK Parliament constituency)|Folkestone & Hythe]]
| last_election2 = 31.7%, 166 seats
| seats_before2 = 165
| seats2 = 198
| seat_change2 = +32
| popular_vote2 = 8,784,915
| percentage2 = 32.4%
| swing2 = +0.7%
<!-- Liberal Democrats -->
| image3 = Charles Kennedy.jpg
| leader3 = [[Charles Kennedy]]
| party3 = Liberal Democrats
| leader_since3 = 9 August 1999
| leaders_seat3 = [[Ross, Skye and Lochaber (UK Parliament constituency)|Ross, Skye, & Lochaber]]
| last_election3 = 18.3%, 52 seats
| seats_before3 = 51
| seats3 = 62
| seat_change3 = +10
| popular_vote3 = 5,985,454
| percentage3 = 22.0%
| swing3 = +3.7%
<!-- map -->
| map_image = 2005UKElectionMap.svg
| map_size = 250px
| map_caption = Map of United Kingdom showing constituencies won
<!-- bottom -->
| title = Prime Minister
| before_election = [[Tony Blair]]
| before_party = Labour Party (UK)
| after_election = [[Tony Blair]]
| after_party = Labour Party (UK)
}}</syntaxhighlight>
{{-}}
=== By-election ===
{{Infobox election
| election_name = 2012 Bradford West by-election
| type = By-election
| country = United Kingdom
| seats_for_election = The [[Bradford West (UK Parliament constituency)|Bradford West]] seat in the [[House of Commons of the United Kingdom|House of Commons]].<br />Election by simple majority using [[first past the post]].<br />Triggered by resignation of incumbent
| votes_for_election =
| ongoing = no
| previous_election = 2010 United Kingdom general election
| previous_year = 2010
| next_election =
| next_year =
| election_date = {{Start date|2012|03|29|df= y}}
| candidate1 = [[George Galloway]]
| image1 = George Galloway 2007-02-24.jpg
| party1 = Respect Party
| last_election1 = 1,245
| popular_vote1 = 18,341
| percentage1 = 55.9
| candidate2 = Imran Hussain
| image2 =
| party2 = Labour Party (UK)
| last_election2 = 18,401
| popular_vote2 = 8,201
| percentage2 = 25.0
| candidate3 = Jackie Whiteley
| image3 =
| party3 = Conservative Party (UK)
| last_election3 = 12,638
| popular_vote3 = 2,746
| percentage3 = 8.4
| candidate4 = Jeanette Sunderland
| image4 =
| party4 = Liberal Democrats (UK)
| last_election4 = 4,732
| popular_vote4 = 1,505
| percentage4 = 4.6
| candidate5 = Sonja McNally
| image5 =
| party5 = UK Independence Party
| last_election5 = 812
| popular_vote5 = 1,085
| percentage5 = 3.3
| candidate6 = Dawud Islam
| image6 =
| party6 = Green Party of England and Wales
| last_election6 = 940
| popular_vote6 = 481
| percentage6 = 1.5
| title = MP
| posttitle = Subsequent MP
| before_election = [[Marsha Singh]]
| before_party = Labour Party (UK)
| after_election = [[George Galloway]]
| after_party = Respect Party
| map_image = BradfordWest2007Constituency.svg
| map_size = 200px
| map_alt = A map of West Yorkshire with black lines dividing the area into irregular shapes
| map =
| map_caption = Boundary of Bradford West in [[West Yorkshire]].
}}
<syntaxhighlight lang="wikitext" style= "overflow: auto">
{{Infobox election
| election_name = 2012 Bradford West by-election
| type = By-election
| country = United Kingdom
| seats_for_election = The [[Bradford West (UK Parliament constituency)|Bradford West]] seat in the [[House of Commons of the United Kingdom|House of Commons]].<br />Elected by simple majority using [[first past the post]].<br />Triggered by resignation of incumbent
| ongoing = no
| previous_election = 2010 United Kingdom general election
| previous_year = 2010
| next_election =
| next_year =
| election_date = {{Start date|2012|03|29|df= y}}
| candidate1 = [[George Galloway]]
| image1 = George Galloway 2007-02-24.jpg
| party1 = Respect Party
| last_election1 = 1,245
| popular_vote1 = 18,341
| percentage1 = 55.9
| candidate2 = Imran Hussain
| image2 =
| party2 = Labour Party (UK)
| last_election2 = 18,401
| popular_vote2 = 8,201
| percentage2 = 25.0
| candidate3 = Jackie Whiteley
| image3 =
| party3 = Conservative Party (UK)
| last_election3 = 12,638
| popular_vote3 = 2,746
| percentage3 = 8.4
| candidate4 = Jeanette Sunderland
| image4 =
| party4 = Liberal Democrats
| last_election4 = 4,732
| popular_vote4 = 1,505
| percentage4 = 4.6
| candidate5 = Sonja McNally
| image5 =
| party5 = UK Independence Party
| last_election5 = 812
| popular_vote5 = 1,085
| percentage5 = 3.3
| candidate6 = Dawud Islam
| image6 =
| party6 = Green Party of England and Wales
| last_election6 = 940
| popular_vote6 = 481
| percentage6 = 1.5
| title = MP
| posttitle = Subsequent MP
| before_election = [[Marsha Singh]]
| before_party = Labour Party (UK)
| after_election = [[George Galloway]]
| after_party = Respect Party
| map_image = BradfordWest2007Constituency.svg
| map_size = 200px
| map_alt = A map of West Yorkshire with black lines dividing the area into irregular shapes
| map =
| map_caption = Boundary of Bradford West in [[West Yorkshire]].
}}
</syntaxhighlight>
{{-}}
===Annulled election===
{{Infobox election
| election_name = 2019 Bolivian general election
| country = Bolivia
| type = presidential
| previous_election = 2014 Bolivian general election
| previous_year = 2014
| next_election = 2020 Bolivian general election
| next_year = 2020
| election_date = 20 October 2019
| ongoing = no
| turnout = 88.31% ({{increase}} 0.41[[Percentage point|pp]])
<!-- Evo Morales -->| image1 = Evo Morales 2017.jpg
| image1_size = 150x150px
| nominee1 = [[Evo Morales]]
| party1 = Movement for Socialism (Bolivia)
| running_mate1 = [[Álvaro García Linera]]
| popular_vote1 = '''2,889,359'''
| percentage1 = '''47.08%'''
<!-- Carlos Mesa -->| image2 = Carlos Mesa, ex-President of Bolivia (cropped 2).jpg
| image2_size = 150x150px
| nominee2 = [[Carlos Mesa]]
| party2 = [[Civic Community]]
| colour2 = F26524
| running_mate2 = Gustavo Pedraza
| popular_vote2 = 2,240,920
| percentage2 = 36.51%
<!-- Chi Hyun Chung -->| image3 = Chi Hyun Ching (cropped).png
| image3_size = 150x150px
| nominee3 = [[Chi Hyun Chung]]
| party3 = Christian Democratic Party (Bolivia)
| running_mate3 = Paola Barriga
| popular_vote3 = 539,081
| percentage3 = 8.78%
<!-- map -->| map_image = 2019 Bolivian elections map.png
| map_size = 300px
| map_caption =
| title = President
| before_election = [[Evo Morales]]
| before_party = Movement for Socialism (Bolivia)
| after_election = [[2019 Bolivian political crisis|Election results annulled]] <br>[[Jeanine Áñez]] ([[Democrat Social Movement]]) becomes acting president
| after_party =
}}
<syntaxhighlight lang="wikitext" style= "overflow: auto">
{{Infobox election
| election_name = 2019 Bolivian general election
| country = Bolivia
| type = presidential
| previous_election = 2014 Bolivian general election
| previous_year = 2014
| next_election = 2020 Bolivian general election
| next_year = 2020
| election_date = 20 October 2019
| ongoing = no
| turnout = 88.31% ({{increase}} 0.41[[Percentage point|pp]])
<!-- Evo Morales -->| image1 = Evo Morales 2017.jpg
| image1_size = 150x150px
| nominee1 = [[Evo Morales]]
| party1 = Movement for Socialism (Bolivia)
| running_mate1 = [[Álvaro García Linera]]
| popular_vote1 = '''2,889,359'''
| percentage1 = '''47.08%'''
<!-- Carlos Mesa -->| image2 = Carlos Mesa, ex-President of Bolivia (cropped 2).jpg
| image2_size = 150x150px
| nominee2 = [[Carlos Mesa]]
| party2 = [[Civic Community]]
| colour2 = F26524
| running_mate2 = Gustavo Pedraza
| popular_vote2 = 2,240,920
| percentage2 = 36.51%
<!-- Chi Hyun Chung -->| image3 = Chi Hyun Ching (cropped).png
| image3_size = 150x150px
| nominee3 = [[Chi Hyun Chung]]
| party3 = Christian Democratic Party (Bolivia)
| running_mate3 = Paola Barriga
| popular_vote3 = 539,081
| percentage3 = 8.78%
<!-- map -->| map_image = 2019 Bolivian elections map.png
| map_size = 300px
| map_caption =
| title = President
| before_election = [[Evo Morales]]
| before_party = Movement for Socialism (Bolivia)
| after_election = [[2019 Bolivian political crisis|Election results annulled]] <br>[[Jeanine Áñez]] ([[Democrat Social Movement]]) becomes acting president
| after_party =
}}
</syntaxhighlight>
{{-}}
== Microformat ==
{{UF-hcal}}
Note: If no date is entered, then the microformat is not emitted.
== Tracking category ==
* {{clc|Pages using infobox election with unknown parameters}}
== TemplateData ==
{{TemplateData header}}
<templatedata>
{
"description": "An infobox for elections.",
"format": "block",
"params": {
"election_name": {
"label": "Name",
"description": "Name given to the election.",
"type": "string",
"required": false,
"example": "2012 United States Senate election in Nevada",
"autovalue": "{{subst:PAGENAME}}"
},
"country": {
"label": "Country",
"description": "Country where the election took place.",
"type": "string",
"required": false
},
"flag_year": {
"label": "Flag year",
"description": "For historical elections when an older flag design was in effect, enter the year the flag came into effect (not the election year).",
"type": "string",
"default": "current flag",
"required": false
},
"flag_image": {
"label": "Flag image",
"description": "For non-country elections, specify the full name of the flag, coat-of-arms, or seal image to display.",
"type": "string",
"required": false
},
"type": {
"label": "Type",
"description": "The type of election. Must be one of five: presidential, primary, legislative, parliamentary or by-election. The type \"Presidential\" lists nominee's names; legislative will not. Legislative after the election will display majority and minority party, rather than first and second party.",
"type": "string",
"required": false,
"example": "'presidential', 'primary', 'legislative', 'parliamentary', 'by-election'",
"autovalue": "presidential"
},
"vote_type": {
"label": "Vote type",
"description": "The type of votes recorded at popular_voten",
"type": "string",
"default": "popular",
"required": false
},
"ongoing": {
"label": "Ongoing?",
"description": "Must be either 'yes' or 'no', whether the election is yet to take place, or completed. 'no' means the election has concluded and results have been declared; 'yes' means the election has yet to occur and be called.",
"type": "string",
"default": "no",
"example": "'no', 'yes'",
"required": false
},
"party_colour": {
"label": "Show party colours?",
"description": "To turn off the party colours enter 'no'.",
"type": "string",
"required": false,
"aliases": [
"party_color"
],
"example": "no"
},
"party_name": {
"label": "Link to parties?",
"description": "To turn off linking to the parties, enter 'no'.",
"type": "string",
"required": false,
"example": "no"
},
"alliance_name": {
"label": "Link to alliances?",
"description": "To turn off linking to the alliances, enter 'no'.",
"type": "string",
"required": false,
"example": "no"
},
"previous_election": {
"label": "Previous election",
"description": "The page name of the last election of this type.",
"type": "wiki-page-name",
"required": false,
"example": "2000 United States presidential election"
},
"previous_year": {
"label": "Previous year",
"description": "The year the last election of this type took place.",
"type": "number",
"required": false,
"example": "2000"
},
"outgoing_members": {
"label": "Outgoing members",
"description": "The page name of the legislative term (typically including a list of members) serving between the previous election and this election. Can either be a page title or a wiki link.",
"type": "string",
"required": false
},
"election_date": {
"label": "Election date",
"description": "Date of election - use {{Start date|YYYY|mm|dd}}.",
"type": "wiki-template-name",
"example": "{{Start date|2020|11|03}}",
"required": false,
"suggested": true
},
"elected_members": {
"label": "Elected members",
"description": "The page name of the legislative term (typically including a list of members) serving between this election and the next election. Can either be a page title or a wiki link.",
"type": "string",
"required": false
},
"next_election": {
"label": "Next election",
"description": "The page name of the next election of this type. If red link (it doesn't exist), then it will appear unlinked.",
"type": "wiki-page-name",
"required": false,
"example": "2008 United States presidential election"
},
"next_year": {
"label": "Next year",
"description": "The year the next election of this type took place.",
"type": "number",
"required": false,
"example": "2008"
},
"votes_for_election": {
"label": "Votes for election",
"description": "The number of votes for election and the system of voting (eg. Electoral College).",
"type": "content",
"required": false,
"example": "All [[List of United States presidential electors, 2004|538 electoral votes]] of the [[Electoral College (United States)|Electoral College]]"
},
"needed_votes": {
"label": "Needed votes",
"description": "The number of votes required to win. If there is an even number of votes, use the number that is said by the media.",
"type": "string",
"required": false,
"example": "270 electoral"
},
"seats_for_election": {
"label": "Seats for election",
"description": "The number of seats for election and the house or chamber the seats are for.",
"type": "number",
"required": false
},
"majority_seats": {
"label": "Majority seats",
"description": "The number of seats required for a majority government. If there is an even number of seats in the house or chamber, use the number that is said by the media.",
"type": "number",
"required": false
},
"opinion_polls": {
"label": "Opinion polls",
"description": "Pagename or section anchor of opinion polls.",
"type": "string",
"required": false
},
"registered": {},
"turnout": {
"label": "Turnout",
"description": "Voter turnout for this election.",
"type": "string",
"required": false
},
"votes_counted": {
"label": "Percent of votes counted",
"type": "line",
"description": "Use ONE out of votes_counted, reporting, or declared. Do not include percentage (%) sign."
},
"reporting": {
"label": "Percent reporting",
"type": "line",
"description": "Use ONE out of votes_counted, reporting, or declared. Do not include percentage (%) sign."
},
"declared": {
"label": "Percent votes declared",
"type": "line",
"description": "Use ONE out of votes_counted, reporting, or declared. Do not include percentage (%) sign."
},
"college_voted": {},
"last_update": {
"label": "Last update",
"type": "date"
},
"time_zone": {
"label": "Time zone",
"type": "line",
"description": "Time zone of the time given in the ''last_update'' field. Must be linked as normal similar to an article [[Greenwich mean time|GMT]](e.g. )",
"example": "[[Greenwich mean time|GMT]]"
},
"image_size": {
"label": "Image size",
"type": "line",
"example": "x200px",
"description": "Size for images. Can be overridden by image(n)_size",
"required": false
},
"image_upright": {
"label": "Image upright",
"description": "Upright for imagen. See WP:UPRIGHT. Can be overridden by imagen_upright",
"type": "string",
"required": false
},
"previous_mps": {
"type": "string",
"deprecated": true
},
"elected_mps": {
"type": "string",
"deprecated": true
},
"image1": {
"label": "Image 1",
"description": "Image of Nominee, head of Party list or Party Leader. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time. In order to work, colour1 or party1 must be entered.",
"type": "wiki-page-name",
"required": false
},
"image1_size": {
"label": "Image 1 size",
"type": "line",
"example": "x200px",
"description": "Size for image 1. Overrides image_size",
"required": false
},
"image1_upright": {
"label": "Image 1 upright",
"description": "Upright for image1. See WP:UPRIGHT. Overrides image_upright",
"type": "string",
"required": false
},
"colour1": {
"label": "Colour 1",
"description": "Enter a hex colour code (without the #) to override the border colour of image1. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time.",
"type": "string",
"required": false,
"aliases": [
"color1"
]
},
"nominee1": {
"label": "Nominee 1",
"description": "Name of Nominee. When appropriate, candidate1 can be used instead. The number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string",
"required": false
},
"candidate1": {
"label": "Candidate 1",
"description": "Name of Candidate. The number can be changed up to nine to display different Candidates at the same time.",
"type": "string",
"required": false
},
"leader1": {
"label": "Leader 1",
"description": "Name of head of Party list or Party Leader. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"party1": {
"label": "Party 1",
"description": "Political Party using Political party shortname templates. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"alliance1": {
"label": "Alliance 1",
"description": "Political alliance in elections where coalition politics is common.",
"type": "string",
"required": false
},
"home_state1": {
"label": "Home state 1",
"description": "The state the Nominee or Candidate represents. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Texas]]"
},
"running_mate1": {
"label": "Running mate 1",
"description": "The Nominee's Running mate. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Dick Cheney|Richard B. Cheney]]"
},
"electoral_vote1": {
"label": "Electoral vote 1",
"description": "The electoral votes obtained by the Nominee. The number can be changed up to nine to display different Nominees at the same time.",
"type": "string",
"required": false
},
"projected_vote1": {
"label": "Projected electoral vote 1",
"description": "The electoral votes projected for the Nominee.",
"type": "string",
"required": false
},
"delegate_count1": {
"label": "Delegate count 1",
"description": "The aggregate number of delegates obtained by the candidate. The number can be changed up to nine to display different candidates at the same time. Intended for use in pre-election processes such as selection of delegates to United States presidential nominating conventions. Intended to be used instead of electoral_vote1 for these cases.",
"type": "string",
"required": false
},
"states_carried1": {
"label": "States carried 1",
"description": "The states carried or won by the Nominee. The number can be changed up to nine to display different Nominees at the same time.",
"type": "string",
"required": false
},
"districts_won1": {
"label": "Districts won 1",
"description": "The number of districts won by the Nominee. The number can be changed up to nine to display different Nominees at the same time.",
"type": "string",
"required": false
},
"counties_threshold1": {},
"counties_won1": {},
"leader_since1": {
"label": "Leader since 1",
"description": "The date the Leader took office. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"leaders_seat1": {
"label": "Leaders seat 1",
"description": "The seat the Leader represents. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"last_election1": {
"label": "Last election 1",
"description": "The seat count and percentage of the vote received at the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_before1": {
"label": "Seats before 1",
"description": "The seat count before the election, labeled 'current seats' if the election is yet to take place. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_needed1": {
"label": "Seats needed 1",
"description": "The seats required to gain an overall majority. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats1": {
"label": "Seats 1",
"description": "The seats won at the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_after1": {
"label": "Seats after 1",
"description": "The seat count after the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seat_change1": {
"label": "Seat change 1",
"description": "The change in the number of seats won at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"swing1": {
"label": "Swing 1",
"description": "The swing or change in popular vote at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"popular_vote1": {
"label": "Popular vote 1",
"description": "The number of votes obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"percentage1": {
"label": "Percentage 1",
"description": "The percentage of the popular vote obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "line",
"required": false,
"example": "50.7%"
},
"image2": {
"label": "Image 2",
"description": "Image of Nominee, head of Party list or Party Leader. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time. In order to work, colour1 or party1 must be entered.",
"type": "wiki-page-name",
"required": false
},
"image2_size": {
"label": "Image 2 size",
"type": "line",
"example": "x200px",
"description": "Size for image 2. Overrides image_size",
"required": false
},
"image2_upright": {
"label": "Image 2 upright",
"description": "Upright for image2. See WP:UPRIGHT. Overrides image_upright",
"type": "string",
"required": false
},
"colour2": {
"label": "Colour 2",
"description": "Enter a hex colour code (without the #) to override the border colour of image2. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time.",
"type": "string",
"required": false,
"aliases": [
"color2"
]
},
"nominee2": {
"label": "Nominee 2",
"description": "Name of Nominee. When appropriate, candidate1 can be used instead. The number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string",
"required": false
},
"candidate2": {
"label": "Candidate 2",
"description": "Name of Candidate. The number can be changed up to nine to display different Candidates at the same time.",
"type": "string",
"required": false
},
"leader2": {
"label": "Leader 2",
"description": "Name of head of Party list or Party Leader. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"party2": {
"label": "Party 2",
"description": "Political Party using Political party shortname templates. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"alliance2": {
"label": "Alliance 2",
"description": "Political alliance in elections where coalition politics is common.",
"type": "string",
"required": false
},
"home_state2": {
"label": "Home state 2",
"description": "The state the Nominee or Candidate represents. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Massachusetts]]"
},
"running_mate2": {
"label": "Running mate 2",
"description": "The Nominee's Running mate. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[John Edwards]]"
},
"electoral_vote2": {
"label": "Electoral vote 2",
"description": "The electoral votes obtained by the Nominee. The number can be changed up to nine to display different Nominees at the same time.",
"type": "string",
"required": false
},
"projected_vote2": {
"label": "Projected electoral vote 2",
"description": "The electoral votes projected for the Nominee.",
"type": "string",
"required": false
},
"delegate_count2": {
"label": "Delegate count 2",
"description": "The aggregate number of delegates obtained by the candidate. The number can be changed up to nine to display different candidates at the same time. Intended for use in pre-election processes such as selection of delegates to United States presidential nominating conventions. Intended to be used instead of electoral_vote1 for these cases.",
"type": "string",
"required": false
},
"states_carried2": {
"label": "States carried 2",
"description": "The states carried or won by the Nominee. The number can be changed up to nine to display different Nominees at the same time.",
"type": "string",
"required": false
},
"districts_won2": {
"label": "Districts won 2",
"description": "The number of districts won by the Nominee. The number can be changed up to nine to display different Nominees at the same time.",
"type": "string",
"required": false
},
"counties_threshold2": {},
"counties_won2": {},
"leader_since2": {
"label": "Leader since 2",
"description": "The date the Leader took office. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"leaders_seat2": {
"label": "Leaders seat 2",
"description": "The seat the Leader represents. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"last_election2": {
"label": "Last election 2",
"description": "The seat count and percentage of the vote received at the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_before2": {
"label": "Seats before 2",
"description": "The seat count before the election, labeled 'current seats' if the election is yet to take place. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_needed2": {
"label": "Seats needed 2",
"description": "The seats required to gain an overall majority. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats2": {
"label": "Seats 2",
"description": "The seats won at the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_after2": {
"label": "Seats after 2",
"description": "The seat count after the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seat_change2": {
"label": "Seat change 2",
"description": "The change in the number of seats won at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"popular_vote2": {
"label": "Popular vote 2",
"description": "The number of votes obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"percentage2": {
"label": "Percentage 2",
"description": "The percentage of the popular vote obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "line",
"required": false,
"example": "48.3%"
},
"swing2": {
"label": "Swing 2",
"description": "The swing or change in popular vote at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"poll1_date": {
"label": "Poll 1 date",
"description": "The date of an opinion poll. The number can be changed up to five to display different polls at the same time.",
"type": "string",
"required": false
},
"poll1_source": {
"label": "Poll 1 source",
"description": "The source or URL of the opinion poll. The number can be changed up to five to display different polls at the same time.",
"type": "string",
"required": false
},
"poll1_nominee1": {
"label": "Poll 1 nominee 1",
"description": "The percentage poll 1 gave to nominee 1. When appropriate, poll1_candidate1 can be used instead. The poll number can be changed up to five to display different polls at the same time. The nominee or candidate number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string",
"required": false
},
"poll1_nominee2": {
"label": "Poll 1 nominee 2",
"description": "The percentage poll 1 gave to nominee 2. When appropriate, poll1_candidate2 can be used instead. The poll number can be changed up to five to display different polls at the same time. The nominee or candidate number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string"
},
"poll1_party1": {
"label": "Poll 1 party 1",
"description": "The percentage poll 1 gave to party 1. The poll number can be changed up to five to display different polls at the same time. The party number can be changed up to nine to display different Nominees at the same time.",
"type": "string",
"required": false
},
"poll1_party2": {
"label": "Poll 1 party 2",
"description": "The percentage poll 1 gave to party 2. The poll number can be changed up to five to display different polls at the same time. The party number can be changed up to nine to display different Nominees at the same time.",
"type": "string"
},
"1blank": {
"label": "1 blank",
"description": "Title of an auxiliary row. The number can be changed up to six to display six extra rows.",
"type": "string",
"required": false
},
"1data1": {
"label": "1 data 1",
"description": "Data 1 for nominee or party 1. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"1data2": {
"label": "1 data 2",
"description": "Data 1 for nominee or party 2. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"2blank": {
"label": "2 blank",
"description": "Title of an auxiliary row. The number can be changed up to six to display six extra rows.",
"type": "string",
"required": false
},
"2data1": {
"label": "2 data 1",
"description": "Data 2 for nominee or party 1. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"2data2": {
"label": "2 data 2",
"description": "Data 2 for nominee or party 2. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"3blank": {
"label": "3 blank",
"description": "Title of an auxiliary row. The number can be changed up to six to display six extra rows.",
"type": "string",
"required": false
},
"3data1": {
"label": "3 data 1",
"description": "Data 3 for nominee or party 1. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"3data2": {
"label": "3 data 2",
"description": "Data 3 for nominee or party 2. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"map_image": {
"label": "Map image",
"description": "Page name for the election map file.",
"type": "wiki-page-name",
"required": false
},
"map_size": {
"label": "Map size",
"description": "Size of image of the election map to be displayed.",
"type": "line",
"default": "300px",
"required": false
},
"map_alt": {
"label": "Map alt",
"description": "Alt text for the election map.",
"type": "string",
"required": false
},
"map": {
"label": "Map",
"description": "A freeform replacement for the above, which can be used to insert extension:ImageMaps or templates instead of images.",
"type": "content",
"required": false
},
"map_caption": {
"label": "Map caption",
"description": "Caption on image of the election map to be displayed.",
"type": "string",
"required": false
},
"map2_image": {
"label": "Map 2 image",
"description": "Page name for the election map 2 file.",
"type": "wiki-page-name",
"required": false
},
"map2_size": {
"label": "Map 2 size",
"description": "Size of image of the election map 2 to be displayed.",
"type": "line",
"default": "300px",
"required": false
},
"map2_alt": {
"label": "Map 2 alt",
"description": "Alt text for the election map.",
"type": "string",
"required": false
},
"map2": {
"label": "Map 2",
"description": "A freeform replacement for the above, which can be used to insert extension:ImageMaps or templates instead of images.",
"type": "content",
"required": false
},
"map2_caption": {
"label": "Map 2 caption",
"description": "Caption on image of the election map 2 to be displayed.",
"type": "string",
"required": false
},
"map3_image": {
"label": "Map 3 image",
"description": "Page name for the election map 3 file.",
"type": "wiki-page-name",
"required": false
},
"map3_size": {
"label": "Map 3 size",
"description": "Size of image of the election map 3 to be displayed.",
"type": "line",
"default": "300px",
"required": false
},
"map3_alt": {
"label": "Map 3 alt",
"description": "Alt text for the election map.",
"type": "string",
"required": false
},
"map3": {
"label": "Map 3",
"description": "A freeform replacement for the above, which can be used to insert extension:ImageMaps or templates instead of images.",
"type": "content",
"required": false
},
"map3_caption": {
"label": "Map 3 caption",
"description": "Caption on image of the election map 3 to be displayed.",
"type": "string",
"required": false
},
"map4_image": {
"label": "Map 4 image",
"description": "Page name for the election map 4 file.",
"type": "wiki-page-name",
"required": false
},
"map4_size": {
"label": "Map 4 size",
"description": "Size of image of the election map 4 to be displayed.",
"type": "line",
"default": "300px",
"required": false
},
"map4_alt": {
"label": "Map 4 alt",
"description": "Alt text for the election map.",
"type": "string",
"required": false
},
"map4": {
"label": "Map 4",
"description": "A freeform replacement for the above, which can be used to insert extension:ImageMaps or templates instead of images.",
"type": "content",
"required": false
},
"map4_caption": {
"label": "Map 4 caption",
"description": "Caption on image of the election map 4 to be displayed.",
"type": "string",
"required": false
},
"title": {
"label": "Title",
"description": "Title of the leader before the election. (President, Speaker, Government, Prime Minister).",
"type": "string",
"required": false
},
"before_election": {
"label": "Before election",
"description": "The leader in power before the election, labeled incumbent if the election is yet to take place.",
"type": "string",
"required": false
},
"before_party": {
"label": "Before party",
"description": "The party in power before the election. This can be set to 'Acting (law)' (which will display as 'Acting') if necessary.",
"type": "string",
"required": false
},
"posttitle": {
"label": "Post-title",
"description": "Title of the victor of the election (President-elect, Prime Minister-designate), only if different than before.",
"type": "string",
"required": false
},
"after_election": {
"label": "After election",
"description": "The leader in power as a result of the election. If an election is annulled, it should be noted Election results annulled or other equivalent and the acting office holder should be denoted in small text on the line below it.",
"type": "string",
"required": false
},
"after_party": {
"label": "After party",
"description": "The party in power as a result of the election.",
"type": "string",
"required": false
},
"image3": {
"label": "Image 3",
"description": "Image of Nominee, head of Party list or Party Leader. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time. In order to work, colour3 or party3 must be entered.",
"type": "wiki-page-name",
"required": false
},
"image3_size": {
"label": "Image 3 size",
"type": "line",
"example": "x200px",
"description": "Size for image 3. Overrides image_size",
"required": false
},
"image3_upright": {
"label": "Image 3 upright",
"description": "Upright for image3. See WP:UPRIGHT. Overrides image_upright",
"type": "string",
"required": false
},
"colour3": {
"label": "Colour 3",
"description": "Enter a hex colour code (without the #) to override the border colour of image3. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time.",
"type": "string",
"required": false,
"aliases": [
"color3"
]
},
"nominee3": {
"label": "Nominee 3",
"description": "Name of Nominee. When appropriate, candidate3 can be used instead. The number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string",
"required": false
},
"candidate3": {
"label": "Candidate 3",
"description": "Name of Candidate. The number can be changed up to nine to display different Candidates at the same time.",
"type": "string",
"required": false
},
"leader3": {
"label": "Leader 3",
"description": "Name of head of Party list or Party Leader. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"party3": {
"label": "Party 3",
"description": "Political Party using Political party shortname templates. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"alliance3": {
"label": "Alliance 3",
"description": "Political alliance in elections where coalition politics is common.",
"type": "string",
"required": false
},
"home_state3": {
"label": "Home state 3",
"description": "The state the Nominee or Candidate represents. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Texas]]"
},
"running_mate3": {
"label": "Running mate 3",
"description": "The Nominee's Running mate. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Dick Cheney|Richard B. Cheney]]"
},
"last_election3": {
"label": "Last election 3",
"description": "The seat count and percentage of the vote received at the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_before3": {
"label": "Seats before 3",
"description": "The seat count before the election, labeled 'current seats' if the election is yet to take place. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_needed3": {
"label": "Seats needed 3",
"description": "The seats required to gain an overall majority. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats3": {
"label": "Seats 3",
"description": "The seats won at the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_after3": {
"label": "Seats after 3",
"description": "The seat count after the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seat_change3": {
"label": "Seat change 3",
"description": "The change in the number of seats won at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"popular_vote3": {
"label": "Popular vote 3",
"description": "The number of votes obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"percentage3": {
"label": "Percentage 3",
"description": "The percentage of the popular vote obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "line",
"required": false,
"example": "48.3%"
},
"swing3": {
"label": "Swing 3",
"description": "The swing or change in popular vote at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"image4_size": {
"label": "Image 4 size",
"type": "line",
"example": "x200px",
"description": "Size for image 4. Overrides image_size",
"required": false
},
"image4": {
"label": "Image 4",
"description": "Image of Nominee, head of Party list or Party Leader. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time. In order to work, colour4 or party4 must be entered.",
"type": "wiki-page-name",
"required": false
},
"image4_upright": {
"label": "Image 4 upright",
"description": "Upright for image4. See WP:UPRIGHT. Overrides image_upright",
"type": "string",
"required": false
},
"colour4": {
"label": "Colour 4",
"description": "Enter a hex colour code (without the #) to override the border colour of image4. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time.",
"type": "string",
"required": false,
"aliases": [
"color4"
]
},
"nominee4": {
"label": "Nominee 4",
"description": "Name of Nominee. When appropriate, candidate4 can be used instead. The number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string",
"required": false
},
"candidate4": {
"label": "Candidate 4",
"description": "Name of Candidate. The number can be changed up to nine to display different Candidates at the same time.",
"type": "string",
"required": false
},
"leader4": {
"label": "Leader 4",
"description": "Name of head of Party list or Party Leader. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"party4": {
"label": "Party 4",
"description": "Political Party using Political party shortname templates. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"alliance4": {
"label": "Alliance 4",
"description": "Political alliance in elections where coalition politics is common.",
"type": "string",
"required": false
},
"home_state4": {
"label": "Home state 4",
"description": "The state the Nominee or Candidate represents. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Texas]]"
},
"running_mate4": {
"label": "Running mate 4",
"description": "The Nominee's Running mate. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Dick Cheney|Richard B. Cheney]]"
},
"last_election4": {
"label": "Last election 4",
"description": "The seat count and percentage of the vote received at the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_before4": {
"label": "Seats before 4",
"description": "The seat count before the election, labeled 'current seats' if the election is yet to take place. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_needed4": {
"label": "Seats needed 4",
"description": "The seats required to gain an overall majority. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats4": {
"label": "Seats 4",
"description": "The seats won at the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_after4": {
"label": "Seats after 4",
"description": "The seat count after the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seat_change4": {
"label": "Seat change 4",
"description": "The change in the number of seats won at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"popular_vote4": {
"label": "Popular vote 4",
"description": "The number of votes obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"percentage4": {
"label": "Percentage 4",
"description": "The percentage of the popular vote obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "line",
"required": false,
"example": "48.3%"
},
"swing4": {
"label": "Swing 4",
"description": "The swing or change in popular vote at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"image5": {
"label": "Image 5",
"description": "Image of Nominee, head of Party list or Party Leader. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time. In order to work, colour5 or party5 must be entered.",
"type": "wiki-page-name",
"required": false
},
"image5_size": {
"label": "Image 5 size",
"type": "line",
"example": "x200px",
"description": "Size for image 5. Overrides image_size",
"required": false
},
"image5_upright": {
"label": "Image 5 upright",
"description": "Upright for image5. See WP:UPRIGHT. Overrides image_upright",
"type": "string",
"required": false
},
"colour5": {
"label": "Colour 5",
"description": "Enter a hex colour code (without the #) to override the border colour of image5. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time.",
"type": "string",
"required": false,
"aliases": [
"color5"
]
},
"nominee5": {
"label": "Nominee 5",
"description": "Name of Nominee. When appropriate, candidate5 can be used instead. The number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string",
"required": false
},
"candidate5": {
"label": "Candidate 5",
"description": "Name of Candidate. The number can be changed up to nine to display different Candidates at the same time.",
"type": "string",
"required": false
},
"leader5": {
"label": "Leader 5",
"description": "Name of head of Party list or Party Leader. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"party5": {
"label": "Party 5",
"description": "Political Party using Political party shortname templates. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"alliance5": {
"label": "Alliance 5",
"description": "Political alliance in elections where coalition politics is common.",
"type": "string",
"required": false
},
"home_state5": {
"label": "Home state 5",
"description": "The state the Nominee or Candidate represents. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Texas]]"
},
"running_mate5": {
"label": "Running mate 5",
"description": "The Nominee's Running mate. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Dick Cheney|Richard B. Cheney]]"
},
"last_election5": {
"label": "Last election 5",
"description": "The seat count and percentage of the vote received at the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_before5": {
"label": "Seats before 5",
"description": "The seat count before the election, labeled 'current seats' if the election is yet to take place. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_needed5": {
"label": "Seats needed 5",
"description": "The seats required to gain an overall majority. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats5": {
"label": "Seats 5",
"description": "The seats won at the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_after5": {
"label": "Seats after 5",
"description": "The seat count after the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seat_change5": {
"label": "Seat change 5",
"description": "The change in the number of seats won at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"popular_vote5": {
"label": "Popular vote 5",
"description": "The number of votes obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"percentage5": {
"label": "Percentage 5",
"description": "The percentage of the popular vote obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "line",
"required": false,
"example": "48.3%"
},
"swing5": {
"label": "Swing 5",
"description": "The swing or change in popular vote at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"image6": {
"label": "Image 6",
"description": "Image of Nominee, head of Party list or Party Leader. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time. In order to work, colour6 or party6 must be entered.",
"type": "wiki-page-name",
"required": false
},
"image6_size": {
"label": "Image 6 size",
"type": "line",
"example": "x200px",
"description": "Size for image 6. Overrides image_size",
"required": false
},
"image6_upright": {
"label": "Image 6 upright",
"description": "Upright for image6. See WP:UPRIGHT. Overrides image_upright",
"type": "string",
"required": false
},
"colour6": {
"label": "Colour 6",
"description": "Enter a hex colour code (without the #) to override the border colour of image6. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time.",
"type": "string",
"required": false,
"aliases": [
"color6"
]
},
"nominee6": {
"label": "Nominee 6",
"description": "Name of Nominee. When appropriate, candidate6 can be used instead. The number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string",
"required": false
},
"candidate6": {
"label": "Candidate 6",
"description": "Name of Candidate. The number can be changed up to nine to display different Candidates at the same time.",
"type": "string",
"required": false
},
"leader6": {
"label": "Leader 6",
"description": "Name of head of Party list or Party Leader. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"party6": {
"label": "Party 6",
"description": "Political Party using Political party shortname templates. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"alliance6": {
"label": "Alliance 6",
"description": "Political alliance in elections where coalition politics is common.",
"type": "string",
"required": false
},
"home_state6": {
"label": "Home state 6",
"description": "The state the Nominee or Candidate represents. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Texas]]"
},
"running_mate6": {
"label": "Running mate 6",
"description": "The Nominee's Running mate. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Dick Cheney|Richard B. Cheney]]"
},
"last_election6": {
"label": "Last election 6",
"description": "The seat count and percentage of the vote received at the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_before6": {
"label": "Seats before 6",
"description": "The seat count before the election, labeled 'current seats' if the election is yet to take place. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_needed6": {
"label": "Seats needed 6",
"description": "The seats required to gain an overall majority. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats6": {
"label": "Seats 6",
"description": "The seats won at the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_after6": {
"label": "Seats after 6",
"description": "The seat count after the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seat_change6": {
"label": "Seat change 6",
"description": "The change in the number of seats won at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"popular_vote6": {
"label": "Popular vote 6",
"description": "The number of votes obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"percentage6": {
"label": "Percentage 6",
"description": "The percentage of the popular vote obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "line",
"required": false,
"example": "48.3%"
},
"swing6": {
"label": "Swing 6",
"description": "The swing or change in popular vote at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"image7": {
"label": "Image 7",
"description": "Image of Nominee, head of Party list or Party Leader. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time. In order to work, colour7 or party7 must be entered.",
"type": "wiki-page-name",
"required": false
},
"image7_size": {
"label": "Image 7 size",
"type": "line",
"example": "x200px",
"description": "Size for image 7. Overrides image_size",
"required": false
},
"image7_upright": {
"label": "Image 7 upright",
"description": "Upright for image7. See WP:UPRIGHT. Overrides image_upright",
"type": "string",
"required": false
},
"colour7": {
"label": "Colour 7",
"description": "Enter a hex colour code (without the #) to override the border colour of image7. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time.",
"type": "string",
"required": false,
"aliases": [
"color7"
]
},
"nominee7": {
"label": "Nominee 7",
"description": "Name of Nominee. When appropriate, candidate7 can be used instead. The number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string",
"required": false
},
"candidate7": {
"label": "Candidate 7",
"description": "Name of Candidate. The number can be changed up to nine to display different Candidates at the same time.",
"type": "string",
"required": false
},
"leader7": {
"label": "Leader 7",
"description": "Name of head of Party list or Party Leader. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"party7": {
"label": "Party 7",
"description": "Political Party using Political party shortname templates. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"alliance7": {
"label": "Alliance 7",
"description": "Political alliance in elections where coalition politics is common.",
"type": "string",
"required": false
},
"home_state7": {
"label": "Home state 7",
"description": "The state the Nominee or Candidate represents. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Texas]]"
},
"running_mate7": {
"label": "Running mate 7",
"description": "The Nominee's Running mate. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Dick Cheney|Richard B. Cheney]]"
},
"last_election7": {
"label": "Last election 7",
"description": "The seat count and percentage of the vote received at the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_before7": {
"label": "Seats before 7",
"description": "The seat count before the election, labeled 'current seats' if the election is yet to take place. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_needed7": {
"label": "Seats needed 7",
"description": "The seats required to gain an overall majority. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats7": {
"label": "Seats 7",
"description": "The seats won at the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_after7": {
"label": "Seats after 7",
"description": "The seat count after the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seat_change7": {
"label": "Seat change 7",
"description": "The change in the number of seats won at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"popular_vote7": {
"label": "Popular vote 7",
"description": "The number of votes obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"percentage7": {
"label": "Percentage 7",
"description": "The percentage of the popular vote obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "line",
"required": false,
"example": "48.3%"
},
"swing7": {
"label": "Swing 7",
"description": "The swing or change in popular vote at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"image8": {
"label": "Image 8",
"description": "Image of Nominee, head of Party list or Party Leader. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time. In order to work, colour8 or party8 must be entered.",
"type": "wiki-page-name",
"required": false
},
"image8_size": {
"label": "Image 8 size",
"type": "line",
"example": "x200px",
"description": "Size for image 8. Overrides image_size",
"required": false
},
"image8_upright": {
"label": "Image 8 upright",
"description": "Upright for image8. See WP:UPRIGHT. Overrides image_upright",
"type": "string",
"required": false
},
"colour8": {
"label": "Colour 8",
"description": "Enter a hex colour code (without the #) to override the border colour of image8. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time.",
"type": "string",
"required": false,
"aliases": [
"color8"
]
},
"nominee8": {
"label": "Nominee 8",
"description": "Name of Nominee. When appropriate, candidate8 can be used instead. The number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string",
"required": false
},
"candidate8": {
"label": "Candidate 8",
"description": "Name of Candidate. The number can be changed up to nine to display different Candidates at the same time.",
"type": "string",
"required": false
},
"leader8": {
"label": "Leader 8",
"description": "Name of head of Party list or Party Leader. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"party8": {
"label": "Party 8",
"description": "Political Party using Political party shortname templates. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"alliance8": {
"label": "Alliance 8",
"description": "Political alliance in elections where coalition politics is common.",
"type": "string",
"required": false
},
"home_state8": {
"label": "Home state 8",
"description": "The state the Nominee or Candidate represents. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Texas]]"
},
"running_mate8": {
"label": "Running mate 8",
"description": "The Nominee's Running mate. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Dick Cheney|Richard B. Cheney]]"
},
"last_election8": {
"label": "Last election 8",
"description": "The seat count and percentage of the vote received at the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_before8": {
"label": "Seats before 8",
"description": "The seat count before the election, labeled 'current seats' if the election is yet to take place. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_needed8": {
"label": "Seats needed 8",
"description": "The seats required to gain an overall majority. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats8": {
"label": "Seats 8",
"description": "The seats won at the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_after8": {
"label": "Seats after 8",
"description": "The seat count after the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seat_change8": {
"label": "Seat change 8",
"description": "The change in the number of seats won at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"popular_vote8": {
"label": "Popular vote 8",
"description": "The number of votes obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"percentage8": {
"label": "Percentage 8",
"description": "The percentage of the popular vote obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "line",
"required": false,
"example": "48.3%"
},
"swing8": {
"label": "Swing 8",
"description": "The swing or change in popular vote at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"image9": {
"label": "Image 9",
"description": "Image of Nominee, head of Party list or Party Leader. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time. In order to work, colour9 or party9 must be entered.",
"type": "wiki-page-name",
"required": false
},
"image9_size": {
"label": "Image 9 size",
"type": "line",
"example": "x200px",
"description": "Size for image 9. Overrides image_size",
"required": false
},
"image9_upright": {
"label": "Image 9 upright",
"description": "Upright for image9. See WP:UPRIGHT. Overrides image_upright",
"type": "string",
"required": false
},
"colour9": {
"label": "Colour 9",
"description": "Enter a hex colour code (without the #) to override the border colour of image9. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time.",
"type": "string",
"required": false,
"aliases": [
"color9"
]
},
"nominee9": {
"label": "Nominee 9",
"description": "Name of Nominee. When appropriate, candidate9 can be used instead. The number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string",
"required": false
},
"candidate9": {
"label": "Candidate 9",
"description": "Name of Candidate. The number can be changed up to nine to display different Candidates at the same time.",
"type": "string",
"required": false
},
"leader9": {
"label": "Leader 9",
"description": "Name of head of Party list or Party Leader. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"party9": {
"label": "Party 9",
"description": "Political Party using Political party shortname templates. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"alliance9": {
"label": "Alliance 9",
"description": "Political alliance in elections where coalition politics is common.",
"type": "string",
"required": false
},
"home_state9": {
"label": "Home state 9",
"description": "The state the Nominee or Candidate represents. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Texas]]"
},
"running_mate9": {
"label": "Running mate 9",
"description": "The Nominee's Running mate. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Dick Cheney|Richard B. Cheney]]"
},
"last_election9": {
"label": "Last election 9",
"description": "The seat count and percentage of the vote received at the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_before9": {
"label": "Seats before 9",
"description": "The seat count before the election, labeled 'current seats' if the election is yet to take place. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_needed9": {
"label": "Seats needed 9",
"description": "The seats required to gain an overall majority. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats9": {
"label": "Seats 9",
"description": "The seats won at the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_after9": {
"label": "Seats after 9",
"description": "The seat count after the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seat_change9": {
"label": "Seat change 9",
"description": "The change in the number of seats won at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"popular_vote9": {
"label": "Popular vote 9",
"description": "The number of votes obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"percentage9": {
"label": "Percentage 9",
"description": "The percentage of the popular vote obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "line",
"required": false,
"example": "48.3%"
},
"swing9": {
"label": "Swing 9",
"description": "The swing or change in popular vote at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"4blank": {
"label": "4 blank",
"description": "Title of an auxiliary row. The number can be changed up to six to display six extra rows.",
"type": "string",
"required": false
},
"4data1": {
"label": "4 data 1",
"description": "Data 4 for nominee or party 1. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"4data2": {
"label": "4 data 2",
"description": "Data 4 for nominee or party 2. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"5blank": {
"label": "5 blank",
"description": "Title of an auxiliary row. The number can be changed up to six to display six extra rows.",
"type": "string",
"required": false
},
"5data1": {
"label": "5 data 1",
"description": "Data 5 for nominee or party 1. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"5data2": {
"label": "5 data 2",
"description": "Data 5 for nominee or party 2. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"6blank": {
"label": "6 blank",
"description": "Title of an auxiliary row. The number can be changed up to six to display six extra rows.",
"type": "string",
"required": false
},
"6data1": {
"label": "6 data 1",
"description": "Data 6 for nominee or party 1. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"6data2": {
"label": "6 data 2",
"description": "Data 6 for nominee or party 2. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"1data3": {
"label": "1 data 3",
"description": "Data 1 for nominee or party 3. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"1data4": {
"label": "1 data 4",
"description": "Data 4 for nominee or party 4. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"1data5": {
"label": "1 data 5",
"description": "Data 1 for nominee or party 5. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"1data6": {
"label": "1 data 6",
"description": "Data 6 for nominee or party 6. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"1data7": {
"label": "1 data 7",
"description": "Data 1 for nominee or party 7. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"1data8": {
"label": "1 data 8",
"description": "Data 1 for nominee or party 8. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"1data9": {
"label": "1 data 9",
"description": "Data 1 for nominee or party 9. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"2data3": {
"label": "2 data 3",
"description": "Data 2 for nominee or party 3. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"2data4": {
"label": "2 data 4",
"description": "Data 4 for nominee or party 4. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"2data5": {
"label": "2 data 5",
"description": "Data 2 for nominee or party 5. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"2data6": {
"label": "2 data 6",
"description": "Data 6 for nominee or party 6. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"2data7": {
"label": "2 data 7",
"description": "Data 2 for nominee or party 7. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"2data8": {
"label": "2 data 8",
"description": "Data 2 for nominee or party 8. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"2data9": {
"label": "2 data 9",
"description": "Data 2 for nominee or party 9. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"3data3": {
"label": "3 data 3",
"description": "Data 3 for nominee or party 3. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"3data4": {
"label": "3 data 4",
"description": "Data 4 for nominee or party 4. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"3data5": {
"label": "3 data 5",
"description": "Data 3 for nominee or party 5. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"3data6": {
"label": "3 data 6",
"description": "Data 6 for nominee or party 6. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"3data7": {
"label": "3 data 7",
"description": "Data 3 for nominee or party 7. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"3data8": {
"label": "3 data 8",
"description": "Data 3 for nominee or party 8. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"3data9": {
"label": "3 data 9",
"description": "Data 3 for nominee or party 9. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"4data3": {
"label": "4 data 3",
"description": "Data 4 for nominee or party 3. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"4data4": {
"label": "4 data 4",
"description": "Data 4 for nominee or party 4. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"4data5": {
"label": "4 data 5",
"description": "Data 4 for nominee or party 5. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"4data6": {
"label": "4 data 6",
"description": "Data 6 for nominee or party 6. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"4data7": {
"label": "4 data 7",
"description": "Data 4 for nominee or party 7. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"4data8": {
"label": "4 data 8",
"description": "Data 4 for nominee or party 8. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"4data9": {
"label": "4 data 9",
"description": "Data 4 for nominee or party 9. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"5data3": {
"label": "5 data 3",
"description": "Data 5 for nominee or party 3. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"5data4": {
"label": "5 data 4",
"description": "Data 4 for nominee or party 4. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"5data5": {
"label": "5 data 5",
"description": "Data 5 for nominee or party 5. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"5data6": {
"label": "5 data 6",
"description": "Data 6 for nominee or party 6. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"5data7": {
"label": "5 data 7",
"description": "Data 5 for nominee or party 7. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"5data8": {
"label": "5 data 8",
"description": "Data 5 for nominee or party 8. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"5data9": {
"label": "5 data 9",
"description": "Data 5 for nominee or party 9. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"6data3": {
"label": "6 data 3",
"description": "Data 6 for nominee or party 3. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"6data4": {
"label": "6 data 4",
"description": "Data 4 for nominee or party 4. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"6data5": {
"label": "6 data 5",
"description": "Data 6 for nominee or party 5. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"6data6": {
"label": "6 data 6",
"description": "Data 6 for nominee or party 6. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"6data7": {
"label": "6 data 7",
"description": "Data 6 for nominee or party 7. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"6data8": {
"label": "6 data 8",
"description": "Data 6 for nominee or party 8. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"6data9": {
"label": "6 data 9",
"description": "Data 6 for nominee or party 9. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"7data3": {
"label": "7 data 3",
"description": "Data 7 for nominee or party 3. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"7data4": {
"label": "7 data 4",
"description": "Data 4 for nominee or party 4. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"7data5": {
"label": "7 data 5",
"description": "Data 7 for nominee or party 5. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"7data6": {
"label": "7 data 6",
"description": "Data 6 for nominee or party 6. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"7data7": {
"label": "7 data 7",
"description": "Data 7 for nominee or party 7. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"7data8": {
"label": "7 data 8",
"description": "Data 7 for nominee or party 8. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"7data9": {
"label": "7 data 9",
"description": "Data 7 for nominee or party 9. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"8data3": {
"label": "8 data 3",
"description": "Data 8 for nominee or party 3. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"8data4": {
"label": "8 data 4",
"description": "Data 4 for nominee or party 4. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"8data5": {
"label": "8 data 5",
"description": "Data 8 for nominee or party 5. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"8data6": {
"label": "8 data 6",
"description": "Data 6 for nominee or party 6. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"8data7": {
"label": "8 data 7",
"description": "Data 8 for nominee or party 7. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"8data8": {
"label": "8 data 8",
"description": "Data 8 for nominee or party 8. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"8data9": {
"label": "8 data 9",
"description": "Data 8 for nominee or party 9. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"9data3": {
"label": "9 data 3",
"description": "Data 9 for nominee or party 3. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"9data4": {
"label": "9 data 4",
"description": "Data 4 for nominee or party 4. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"9data5": {
"label": "9 data 5",
"description": "Data 9 for nominee or party 5. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"9data6": {
"label": "9 data 6",
"description": "Data 6 for nominee or party 6. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"9data7": {
"label": "9 data 7",
"description": "Data 9 for nominee or party 7. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"9data8": {
"label": "9 data 8",
"description": "Data 9 for nominee or party 8. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"9data9": {
"label": "9 data 9",
"description": "Data 9 for nominee or party 9. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"counties_threshold3": {},
"counties_threshold4": {},
"counties_threshold5": {},
"counties_threshold6": {},
"counties_threshold7": {},
"counties_threshold8": {},
"counties_threshold9": {},
"counties_won3": {},
"counties_won4": {},
"counties_won5": {},
"counties_won6": {},
"counties_won7": {},
"counties_won8": {},
"counties_won9": {},
"states_carried3": {},
"states_carried4": {},
"states_carried5": {},
"states_carried6": {},
"states_carried7": {},
"states_carried8": {},
"states_carried9": {},
"delegate_count3": {},
"delegate_count4": {},
"delegate_count5": {},
"delegate_count6": {},
"delegate_count7": {},
"delegate_count8": {},
"delegate_count9": {},
"electoral_vote3": {},
"electoral_vote4": {},
"electoral_vote5": {},
"electoral_vote6": {},
"electoral_vote7": {},
"electoral_vote8": {},
"electoral_vote9": {},
"leader_since3": {},
"leader_since4": {},
"leader_since5": {},
"leader_since6": {},
"leader_since7": {},
"leader_since8": {},
"leader_since9": {},
"leaders_seat3": {},
"leaders_seat4": {},
"leaders_seat5": {},
"leaders_seat6": {},
"leaders_seat7": {},
"leaders_seat8": {},
"leaders_seat9": {},
"poll1_candidate1": {},
"poll1_candidate2": {},
"poll1_candidate3": {},
"poll1_candidate4": {},
"poll1_candidate5": {},
"poll1_candidate6": {},
"poll1_candidate7": {},
"poll1_candidate8": {},
"poll1_candidate9": {},
"poll1_date1": {},
"poll1_date2": {},
"poll1_date3": {},
"poll1_nominee3": {},
"poll1_nominee4": {},
"poll1_nominee5": {},
"poll1_nominee6": {},
"poll1_nominee7": {},
"poll1_nominee8": {},
"poll1_nominee9": {},
"poll1_party3": {},
"poll1_party4": {},
"poll1_party5": {},
"poll1_party6": {},
"poll1_party7": {},
"poll1_party8": {},
"poll1_party9": {},
"poll1_source1": {},
"poll1_source2": {},
"poll1_source3": {},
"poll2_candidate1": {},
"poll2_candidate2": {},
"poll2_candidate3": {},
"poll2_candidate4": {},
"poll2_candidate5": {},
"poll2_candidate6": {},
"poll2_candidate7": {},
"poll2_candidate8": {},
"poll2_candidate9": {},
"poll2_date": {},
"poll2_date1": {},
"poll2_date2": {},
"poll2_date3": {},
"poll2_nominee1": {},
"poll2_nominee2": {},
"poll2_nominee3": {},
"poll2_nominee4": {},
"poll2_nominee5": {},
"poll2_nominee6": {},
"poll2_nominee7": {},
"poll2_nominee8": {},
"poll2_nominee9": {},
"poll2_party1": {},
"poll2_party2": {},
"poll2_party3": {},
"poll2_party4": {},
"poll2_party5": {},
"poll2_party6": {},
"poll2_party7": {},
"poll2_party8": {},
"poll2_party9": {},
"poll2_source": {},
"poll2_source1": {},
"poll2_source2": {},
"poll2_source3": {},
"poll3_candidate1": {},
"poll3_candidate2": {},
"poll3_candidate3": {},
"poll3_candidate4": {},
"poll3_candidate5": {},
"poll3_candidate6": {},
"poll3_candidate7": {},
"poll3_candidate8": {},
"poll3_candidate9": {},
"poll3_date": {},
"poll3_date1": {},
"poll3_date2": {},
"poll3_date3": {},
"poll3_nominee1": {},
"poll3_nominee2": {},
"poll3_nominee3": {},
"poll3_nominee4": {},
"poll3_nominee5": {},
"poll3_nominee6": {},
"poll3_nominee7": {},
"poll3_nominee8": {},
"poll3_nominee9": {},
"poll3_party1": {},
"poll3_party2": {},
"poll3_party3": {},
"poll3_party4": {},
"poll3_party5": {},
"poll3_party6": {},
"poll3_party7": {},
"poll3_party8": {},
"poll3_party9": {},
"poll3_source": {},
"poll3_source1": {},
"poll3_source2": {},
"poll3_source3": {},
"poll4_candidate1": {},
"poll4_candidate2": {},
"poll4_candidate3": {},
"poll4_candidate4": {},
"poll4_candidate5": {},
"poll4_candidate6": {},
"poll4_candidate7": {},
"poll4_candidate8": {},
"poll4_candidate9": {},
"poll4_date": {},
"poll4_date1": {},
"poll4_date2": {},
"poll4_date3": {},
"poll4_nominee1": {},
"poll4_nominee2": {},
"poll4_nominee3": {},
"poll4_nominee4": {},
"poll4_nominee5": {},
"poll4_nominee6": {},
"poll4_nominee7": {},
"poll4_nominee8": {},
"poll4_nominee9": {},
"poll4_party1": {},
"poll4_party2": {},
"poll4_party3": {},
"poll4_party4": {},
"poll4_party5": {},
"poll4_party6": {},
"poll4_party7": {},
"poll4_party8": {},
"poll4_party9": {},
"poll4_source": {},
"poll4_source1": {},
"poll4_source2": {},
"poll4_source3": {},
"poll5_candidate1": {},
"poll5_candidate2": {},
"poll5_candidate3": {},
"poll5_candidate4": {},
"poll5_candidate5": {},
"poll5_candidate6": {},
"poll5_candidate7": {},
"poll5_candidate8": {},
"poll5_candidate9": {},
"poll5_date": {},
"poll5_date1": {},
"poll5_date2": {},
"poll5_date3": {},
"poll5_nominee1": {},
"poll5_nominee2": {},
"poll5_nominee3": {},
"poll5_nominee4": {},
"poll5_nominee5": {},
"poll5_nominee6": {},
"poll5_nominee7": {},
"poll5_nominee8": {},
"poll5_nominee9": {},
"poll5_party1": {},
"poll5_party2": {},
"poll5_party3": {},
"poll5_party4": {},
"poll5_party5": {},
"poll5_party6": {},
"poll5_party7": {},
"poll5_party8": {},
"poll5_party9": {},
"poll5_source": {},
"poll5_source1": {},
"poll5_source2": {},
"poll5_source3": {}
}
}
</templatedata>
<includeonly>{{Sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Politics and government infobox templates|Election]]
[[Category:Infobox templates with module parameter|Election]]
[[Category:Embeddable templates]]
[[Category:Election and referendum infobox templates]]
[[Category:Templates that add a tracking category]]
}}</includeonly>
de40db6d60687d06bd532bca2d4dd9e1dd831acb
Template:Div col/styles.css
10
112
215
2023-11-07T21:54:12Z
wikipedia>Izno
0
revert per talk page
sanitized-css
text/css
/* {{pp|small=yes}} */
.div-col {
margin-top: 0.3em;
column-width: 30em;
}
.div-col-small {
font-size: 90%;
}
.div-col-rules {
column-rule: 1px solid #aaa;
}
/* Reset top margin for lists in div col */
.div-col dl,
.div-col ol,
.div-col ul {
margin-top: 0;
}
/* Avoid elements breaking between columns
See also Template:No col break */
.div-col li,
.div-col dd {
page-break-inside: avoid; /* Removed from CSS in favor of break-inside c. 2020 */
break-inside: avoid-column;
}
c6c2dc0cb2bab7a5f7b4eb938eebc5c67df087bc
Infobox
0
11
17
2023-11-11T06:51:44Z
wikipedia>MtPenguinMonster
0
/* Metadata */ Moved image to above text
wikitext
text/x-wiki
{{short description|Template used to collect and present a subset of information about a subject}}
{{Self-reference|For information about infoboxes on Wikipedia, see [[Help:Infobox]].}}
[[File:43185 infobox.jpg|thumb|right|A real-life infobox from [[British Rail Class 43 (HST)|British Rail Class 43]] car 43185 operated by [[First Great Western]]]]
An '''infobox''' is a digital or physical [[Table (information)|table]] used to collect and present a subset of information about its subject, such as a [[document]]. It is a [[structured document]] containing a set of [[attribute–value pair]]s,{{sfn|Baeza-Yates|King|2009|p=31}} and in [[Wikipedia]] represents a summary of information about the subject of an [[Article (publishing)|article]].{{sfn|Liyang|2011|p=385}} In this way, they are comparable to data [[table (information)|tables]] in some aspects. When presented within the larger document it summarizes, an infobox is often presented in a [[sidebar (publishing)|sidebar]] format.
An infobox may be implemented in another document by [[transclusion|transcluding]] it into that document and specifying some or all of the attribute–value pairs associated with that infobox, known as [[parameterization]]{{dn|date=October 2023}}.
==Wikipedia==
{{See also|Template:Infobox}}
An infobox may be used to summarize the information of an article on [[Wikipedia]].{{sfn|Broughton|2008|p=357}} They are used on similar articles to ensure consistency of presentation by using a common format.{{sfn|Broughton|2008|p=17}}{{sfn|Liyang|2011|p=385}} Originally, infoboxes (and templates in general) were used for [[page layout]] purposes.{{sfn|Liyang|2011|p=385}} An infobox may be transcluded into an article by specifying the [[Value (computer science)|value]] for some or all of its [[Parameter (computer programming)|parameters]].{{sfn|Broughton|2008|p=18}} The parameter name used must be the same as that specified in the infobox template, but any value may be associated to it.{{sfn|Broughton|2008|p=18}} The name is [[delimiter|delimited]] from the value by an [[equals sign]].{{sfn|Broughton|2008|p=18}} The parameter name may be regarded as an attribute of the article's subject.{{sfn|Baeza-Yates|King|2009|p=30}}
<!-- this table is used for examples in the text; please update the text when changing contents in the table -->
{|class="wikitable"
|-
| style="vertical-align: top; width:250px" |
<syntaxhighlight lang="wikitext">
{{Infobox prepared food
| name =
| image =
| image_size =
| caption =
| alternate_name =
| country =
| region =
| creator =
| course =
| type =
| served =
| main_ingredient =
| variations =
| calories =
| other =
}}
</syntaxhighlight>
| style="vertical-align: top;" |
<syntaxhighlight lang="wikitext">
{{Infobox prepared food
| name = Crostata
| image = Crostata limone e zenzero 3.jpg
| image_size =
| caption = Crostata with lemon ginger filling
| alternate_name =
| country = [[Italy]]
| region = [[Lombardia]]
| creator =
| course = [[Dessert]]
| type = [[Tart]]
| served =
| main_ingredient = Pastry crust, [[jam]] or [[ricotta]], fruit
| variations = ''Crostata di frutta'', ''crostata di ricotta'', many other sweet or savoury variations
| calories =
| other =
}}
</syntaxhighlight>
|-
| style="vertical-align: top;" |The infobox ''[[Template:Infobox prepared food|Infobox prepared food]]'' used on Wikipedia food-related articles, with no [[Value (computer science)|values]] specified for its [[Parameter (computer programming)|parameters]] (attributes).
| style="vertical-align: top;" |The same infobox as implemented in the article ''[[crostata]]''. Values are to the right of the [[equals sign]] (=), and that the parameter names are the same as those in the specification for the infobox template. The values are in [[wiki markup]]: entries enclosed in square brackets (e.g. <nowiki>[[Tart]]</nowiki>) will be rendered as a link to the respective Wikipedia article (e.g. [[Tart]]), and the linked file will be transcluded into the article in place of its markup.
|}
[[File:Crostata infobox, February 2018.png|thumb|right|The infobox for the Wikipedia article ''[[Crostata]]'' rendered by a [[web browser engine]] on a [[desktop computer]]]]
[[File:Xuanhanosaurus taxobox, June 2020.png|thumb|200px|left|The taxobox (short for [[Taxonomy (biology)|taxonomy]] infobox) for the Wikipedia article ''[[Xuanhanosaurus]]'' rendered by a [[web browser engine]] (on [[Safari (web browser)|Safari]]) on a [[desktop computer]] ([[iMac]]). A taxobox is a type of infobox which details the taxonomy of a specific [[life form]] or [[animal]]]]
On Wikipedia, an infobox is transcluded into an article by enclosing its name and attribute–value pairs within a double set of [[Curly bracket|braces]]. The [[MediaWiki]] software on which Wikipedia operates then [[Parsing|parses]] the document, for which the infobox and other templates are processed by a [[template processor]]. This is a [[Web template system|template engine]] which produces a [[web document]] and a [[Style sheet (web development)|style sheet]] used for presentation of the document. This enables the design of the infobox to be separated from the content it manipulates;{{sfn|Liyang|2011|p=385}} that is, the design of the template may be updated without affecting the information within it, and the new design will automatically propagate to all articles that transclude the infobox.{{sfn|Broughton|2008|p=17}} Usually, infoboxes are [[Typesetting|formatted]] to appear in the top-right corner of a Wikipedia article in the desktop view,{{sfn|Broughton|2008|p=357}} or at the top in the mobile view.
Placement of an infobox within the [[Wiki markup|wikitext]] of an article is important for [[Web accessibility|accessibility]].{{sfn|Broughton|2008|p=234}} A [[best practice]] is to place them following ''disambiguation'' templates (those that direct readers to articles about topics with similar names) and maintenance templates (such as that marking an article as unreferenced), but before all other [[Content (media)|content]].{{sfn|Broughton|2008|p=235}}<ref>The [[English Wikipedia]] policy about accessibility is specified in the [[Wikipedia:Manual of Style/Accessibility]]. The policy about [[Wiki markup|wikitext]] layout is specified at [[Wikipedia:Manual of Style/Layout]] and [[Wikipedia:Manual of Style/Layout|Wikipedia:Manual of Style/Lead section]].</ref>
[[Ricardo Baeza-Yates|Baeza-Yates]] and King say that some editors find templates such as infoboxes complicated,{{sfn|Baeza-Yates|King|2009|p=345}} as the template may hide text about a property or resource that the editor wishes to change; this is exacerbated by chained templates, that is templates transcluded within other templates.{{sfn|Baeza-Yates|King|2009|p=345}}
As of August 2009, English Wikipedia used about {{formatnum:3000}} infobox templates that collectively used more than {{formatnum:20000}} attributes.{{sfn|Lange|Böhm|Naumann|2010|page=7}} Since then, many have been merged, to reduce redundancy. As of June 2013, there were at least {{formatnum:1345446}} transclusions of the parent [[Template:Infobox|Infobox template]],<ref name="Jarry">{{cite web|url=http://toolserver.org/~jarry/templatecount/index.php?lang=en&name=Infobox&namespace=10|title=Jarry1250's Toolserver Tools - Template transclusion count|date=7 June 2013|work=[[List of Wikimedia projects]]|access-date=7 June 2013}}</ref> used by some, but not all, infoboxes, on {{formatnum:4251127}} articles.
The name of an Infobox is typically "Infobox [genre]"; however, widely used infoboxes may be assigned shorter names, such as "taxobox" for taxonomy.{{sfn|Broughton|2008|p=235}}
===Machine learning===
About 44.2% of Wikipedia articles contained an infobox in 2008,{{sfn|Baeza-Yates|King|2009|p=28}} and about 33% in 2010.{{sfn|Lange|Böhm|Naumann|2010|page=5}} Automated [[Semantic data model|semantic knowledge extraction]] using [[machine learning]] algorithms is used to "extract machine-processable information at a relatively low complexity cost".{{sfn|Baeza-Yates|King|2009|p=31}} However, the low coverage makes it more difficult, though this can be partially overcome by complementing article data with that in [[Categorization|categories]] in which the article is included.{{sfn|Baeza-Yates|King|2009|p=28}} The [[French Wikipedia]] initiated the project ''Infobox Version 2'' in May 2011.{{sfn|Geertman|Reinhardt|Toppen|2011|p=493}}<ref>The project is hosted on the [[French Wikipedia]] page [[:fr:Projet:Infobox/V2|Infobox/V2]].</ref>
Knowledge obtained by machine learning can be used to improve an article, such as by using automated software suggestions to editors for adding infobox data.{{sfn|Baeza-Yates|King|2009|p=28}} The iPopulator project created a system to add a value to an article's infobox parameter via an automated parsing of the text of that article.{{sfn|Lange|Böhm|Naumann|2010|page=7}}
[[DBpedia]] uses [[structured content]] extracted from infoboxes{{sfn|Liyang|2011|p=385}} by machine learning algorithms to create a resource of [[linked data]] in the [[Semantic Web]]; it has been described by [[Tim Berners-Lee]] as "one of the more famous" components of the linked data project.{{sfn|Miller|2008}}
Machine extraction creates a triple consisting of a subject, predicate or relation, and object.{{sfn|Baeza-Yates|King|2009|p=31}} Each attribute-value pair of the infobox is used to create an [[Resource Description Framework|RDF]] statement using an [[Ontology (information science)|ontology]].{{sfn|Liyang|2011|p=387}} This is facilated by the narrower gap between Wikipedia and an ontology than exists between unstructured or free text and an ontology.
{{sfn|Virvou|Matsuura|2012|p=315}}
The [[Ontology components|semantic relationship]] between the subject and object is established by the predicate.{{sfn|Baeza-Yates|King|2009|p=31}} In the example infobox, the triple ("crostata", type, "tart") indicates that a [[crostata]] is a type of [[tart]]. The article's topic is used as the subject, the parameter name is used as the predicate, and the parameter's value as the object.{{sfn|Liyang|2011|p=387}}{{sfn|Baeza-Yates|King|2009|p=31}} Each type of infobox is mapped to an ontology class, and each property (parameter) within an infobox is mapped to an ontology property.{{sfn|Liyang|2011|p=395}} These mappings are used when parsing a Wikipedia article to extract data.
==Metadata==
[[File:Link to infobox article posted into teams.png|alt=Screenshot of a Link to this article posting into Microsoft's application teams|thumb|Link to this article posting into Microsoft Teams and the application using the metadata from the infobox to make the link fuller by adding an image and summary text]]
By presenting the basic facts of an article within an infobox, also allows the facts to be presented in a machine-friendly way allowing extra functionality such as when a link to a wikipedia is pasted into a compatible program, instead of just the link itself being posted other information such as the articles image is posted too.
== Citations ==
{{Reflist|30em}}
== Works cited ==
{{refbegin|2}}
* {{cite book|title=Weaving services and people on the World Wide Web|editor1-last=Baeza-Yates|editor1-first=Ricardo|editor2-last=King|editor-first2=Irwin|publisher=Springer|year=2009|isbn=9783642005695|lccn=2009926100}}
* {{cite book|title=[[Wikipedia – The Missing Manual]]|last=Broughton|first=John|editor1-last=Barber|editor1-first=Nan|editor2-last=Meyers|editor2-first=Peter|publisher=[[O'Reilly Media]]|date=2008-07-14|isbn=9780596553777}}
* {{cite book|title=Advancing geoinformation science for a changing world|series=Lecture Notes in Geoinformation and Cartography|volume=1|editor1-last=Geertman|editor1-first=Stan|editor2-last=Reinhardt|editor2-first=Wolfgang|editor3-last=Toppen|editor3-first=Fred|publisher=Springer|year=2011|isbn=9783642197888|issn=1863-2246|doi=10.1007/978-3-642-19789-5|lccn=2011925152}}
* {{cite book|url=http://opus.kobv.de/ubp/volltexte/2010/4571/|title=Extracting Structured Information from Wikipedia Articles to Populate Infoboxes|work=Technische Berichte des Hasso-Plattner-Instituts für Softwaresystemtechnik an der Universität Potsdam, Hasso-Plattner-Institut für Softwaresystemtechnik Potsdam|last1=Lange|first1=Dustin|last2=Böhm|first2=Christoph|last3=Naumann|first3=Felix|issue=38|publisher=Universitätsverlag Potsdam|year=2010|isbn=9783869560816|access-date=2013-06-02|archive-date=2014-06-06|archive-url=https://web.archive.org/web/20140606211144/http://opus.kobv.de/ubp/volltexte/2010/4571/|url-status=live}}
* {{cite book|title=A Developer's Guide to the Semantic Web|last=Yu|first=Liyang|publisher=Springer|year=2011|isbn=9783642159695|doi=10.1007/978-3-642-15970-1|bibcode=2011adgt.book.....Y|ref={{sfnRef|Liyang|2011}}}}
* {{cite web |url=http://talis-podcasts.s3.amazonaws.com/twt20080207_TimBL.html |title=Sir Tim Berners-Lee Talks with Talis about the Semantic Web |last=Miller |first=Paul |others=Transcription by CastingWords |publisher=Talis Group |date=2008-02-07 |access-date=2013-06-02 |url-status=dead |archive-url=https://web.archive.org/web/20130510134842/http://talis-podcasts.s3.amazonaws.com/twt20080207_TimBL.html |archive-date=2013-05-10 }}
* {{cite book|title=Knowledge-based Software Engineering: Proceedings of the Tenth Joint Conference on Knowledge-Based Software Engineering|work=Frontiers and Artificial Intelligence and Applications|editor1-last=Virvou|editor1-first=Maria|editor2-last=Matsuura|editor2-first=Saeko|volume=240|publisher=IOS Press|year=2012|isbn=9781614990932|lccn=2012943674}}
{{refend}}
==Further reading==
* {{cite book|last1=Kiran|first1=Kumar N.|last2=Santosh|first2=G.S.K.|last3=Varma|first3=Vasudeva|title=Multidisciplinary Information Retrieval |volume=6653|publisher=Springer Berlin Heidelberg|date=June 2011|doi=10.1007/978-3-642-21353-3|isbn=9783642213533|issn=0302-9743|series=Lecture Notes in Computer Science|s2cid=9901886|url-access=registration|url=https://archive.org/details/multidisciplinar0000info}}
* {{cite book|title=The Semantic Web: 3rd Asian Semantic Web Conference, ASWC 2008, Bangkok, Thailand, December 8-11, 2008. Proceedings|series=Lecture Notes in Computer Science|editor1-last=Chutiporn|editor1-first=Anutariya|editor2-last=Domingue|editor2-first=John|volume=5367|publisher=Springer|year=2008|isbn=9783540897033|issn=0302-9743}}
* {{cite book|last1=Wu|first1=Fei|last2=Hoffmann|first2=Ralph|last3=Weld|first3=Daniel s.|title=Proceedings of the 14th ACM SIGKDD international conference on Knowledge discovery and data mining |chapter=Information extraction from Wikipedia |publisher=[[Association for Computing Machinery]]|year=2008|pages=731–739|isbn=9781605581934|doi=10.1145/1401890.1401978|s2cid=7781746}}
[[Category:Semantic Web]]
[[Category:Wikipedia]]
e5e29fe9ed21e3b7c22d5d35fabd9b5b1a79b5fe
Module:Hatnote list
828
64
121
2023-11-13T21:00:31Z
wikipedia>Nihiltres
0
Updated from sandbox: added support for punctuation collapse when text is italicized. The update's content includes changes by users Johnuniq, Dexxor, and Nihiltres.
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Module:Hatnote list --
-- --
-- This module produces and formats lists for use in hatnotes. In particular, --
-- it implements the for-see list, i.e. lists of "For X, see Y" statements, --
-- as used in {{about}}, {{redirect}}, and their variants. Also introduced --
-- are andList & orList helpers for formatting lists with those conjunctions. --
--------------------------------------------------------------------------------
local mArguments --initialize lazily
local mFormatLink = require('Module:Format link')
local mHatnote = require('Module:Hatnote')
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local p = {}
--------------------------------------------------------------------------------
-- List stringification helper functions
--
-- These functions are used for stringifying lists, usually page lists inside
-- the "Y" portion of "For X, see Y" for-see items.
--------------------------------------------------------------------------------
--default options table used across the list stringification functions
local stringifyListDefaultOptions = {
conjunction = "and",
separator = ",",
altSeparator = ";",
space = " ",
formatted = false
}
--Searches display text only
local function searchDisp(haystack, needle)
return string.find(
string.sub(haystack, (string.find(haystack, '|') or 0) + 1), needle
)
end
-- Stringifies a list generically; probably shouldn't be used directly
local function stringifyList(list, options)
-- Type-checks, defaults, and a shortcut
checkType("stringifyList", 1, list, "table")
if #list == 0 then return nil end
checkType("stringifyList", 2, options, "table", true)
options = options or {}
for k, v in pairs(stringifyListDefaultOptions) do
if options[k] == nil then options[k] = v end
end
local s = options.space
-- Format the list if requested
if options.formatted then
list = mFormatLink.formatPages(
{categorizeMissing = mHatnote.missingTargetCat}, list
)
end
-- Set the separator; if any item contains it, use the alternate separator
local separator = options.separator
for k, v in pairs(list) do
if searchDisp(v, separator) then
separator = options.altSeparator
break
end
end
-- Set the conjunction, apply Oxford comma, and force a comma if #1 has "§"
local conjunction = s .. options.conjunction .. s
if #list == 2 and searchDisp(list[1], "§") or #list > 2 then
conjunction = separator .. conjunction
end
-- Return the formatted string
return mw.text.listToText(list, separator .. s, conjunction)
end
--DRY function
function p.conjList (conj, list, fmt)
return stringifyList(list, {conjunction = conj, formatted = fmt})
end
-- Stringifies lists with "and" or "or"
function p.andList (...) return p.conjList("and", ...) end
function p.orList (...) return p.conjList("or", ...) end
--------------------------------------------------------------------------------
-- For see
--
-- Makes a "For X, see [[Y]]." list from raw parameters. Intended for the
-- {{about}} and {{redirect}} templates and their variants.
--------------------------------------------------------------------------------
--default options table used across the forSee family of functions
local forSeeDefaultOptions = {
andKeyword = 'and',
title = mw.title.getCurrentTitle().text,
otherText = 'other uses',
forSeeForm = 'For %s, see %s.',
}
--Collapses duplicate punctuation at end of string, ignoring italics and links
local function punctuationCollapse (text)
return text:match("[.?!]('?)%1(%]?)%2%.$") and text:sub(1, -2) or text
end
-- Structures arguments into a table for stringification, & options
function p.forSeeArgsToTable (args, from, options)
-- Type-checks and defaults
checkType("forSeeArgsToTable", 1, args, 'table')
checkType("forSeeArgsToTable", 2, from, 'number', true)
from = from or 1
checkType("forSeeArgsToTable", 3, options, 'table', true)
options = options or {}
for k, v in pairs(forSeeDefaultOptions) do
if options[k] == nil then options[k] = v end
end
-- maxArg's gotten manually because getArgs() and table.maxn aren't friends
local maxArg = 0
for k, v in pairs(args) do
if type(k) == 'number' and k > maxArg then maxArg = k end
end
-- Structure the data out from the parameter list:
-- * forTable is the wrapper table, with forRow rows
-- * Rows are tables of a "use" string & a "pages" table of pagename strings
-- * Blanks are left empty for defaulting elsewhere, but can terminate list
local forTable = {}
local i = from
local terminated = false
-- If there is extra text, and no arguments are given, give nil value
-- to not produce default of "For other uses, see foo (disambiguation)"
if options.extratext and i > maxArg then return nil end
-- Loop to generate rows
repeat
-- New empty row
local forRow = {}
-- On blank use, assume list's ended & break at end of this loop
forRow.use = args[i]
if not args[i] then terminated = true end
-- New empty list of pages
forRow.pages = {}
-- Insert first pages item if present
table.insert(forRow.pages, args[i + 1])
-- If the param after next is "and", do inner loop to collect params
-- until the "and"'s stop. Blanks are ignored: "1|and||and|3" → {1, 3}
while args[i + 2] == options.andKeyword do
if args[i + 3] then
table.insert(forRow.pages, args[i + 3])
end
-- Increment to next "and"
i = i + 2
end
-- Increment to next use
i = i + 2
-- Append the row
table.insert(forTable, forRow)
until terminated or i > maxArg
return forTable
end
-- Stringifies a table as formatted by forSeeArgsToTable
function p.forSeeTableToString (forSeeTable, options)
-- Type-checks and defaults
checkType("forSeeTableToString", 1, forSeeTable, "table", true)
checkType("forSeeTableToString", 2, options, "table", true)
options = options or {}
for k, v in pairs(forSeeDefaultOptions) do
if options[k] == nil then options[k] = v end
end
-- Stringify each for-see item into a list
local strList = {}
if forSeeTable then
for k, v in pairs(forSeeTable) do
local useStr = v.use or options.otherText
local pagesStr =
p.andList(v.pages, true) or
mFormatLink._formatLink{
categorizeMissing = mHatnote.missingTargetCat,
link = mHatnote.disambiguate(options.title)
}
local forSeeStr = string.format(options.forSeeForm, useStr, pagesStr)
forSeeStr = punctuationCollapse(forSeeStr)
table.insert(strList, forSeeStr)
end
end
if options.extratext then table.insert(strList, punctuationCollapse(options.extratext..'.')) end
-- Return the concatenated list
return table.concat(strList, ' ')
end
-- Produces a "For X, see [[Y]]" string from arguments. Expects index gaps
-- but not blank/whitespace values. Ignores named args and args < "from".
function p._forSee (args, from, options)
local forSeeTable = p.forSeeArgsToTable(args, from, options)
return p.forSeeTableToString(forSeeTable, options)
end
-- As _forSee, but uses the frame.
function p.forSee (frame, from, options)
mArguments = require('Module:Arguments')
return p._forSee(mArguments.getArgs(frame), from, options)
end
return p
1c8e6212115f76ecc3db8d05137011cd18207988
Module:InfoboxImage
828
148
287
2023-11-21T13:26:24Z
wikipedia>WOSlinker
0
update strip maker detection as per request on talk page
Scribunto
text/plain
-- Inputs:
-- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link
-- page - page to display for multipage images (DjVu)
-- size - size to display the image
-- maxsize - maximum size for image
-- sizedefault - default size to display the image if size param is blank
-- alt - alt text for image
-- title - title text for image
-- border - set to yes if border
-- center - set to yes, if the image has to be centered
-- upright - upright image param
-- suppressplaceholder - if yes then checks to see if image is a placeholder and suppresses it
-- link - page to visit when clicking on image
-- class - HTML classes to add to the image
-- Outputs:
-- Formatted image.
-- More details available at the "Module:InfoboxImage/doc" page
local i = {};
local placeholder_image = {
"Blue - Replace this image female.svg",
"Blue - Replace this image male.svg",
"Female no free image yet.png",
"Flag of None (square).svg",
"Flag of None.svg",
"Flag of.svg",
"Green - Replace this image female.svg",
"Green - Replace this image male.svg",
"Image is needed female.svg",
"Image is needed male.svg",
"Location map of None.svg",
"Male no free image yet.png",
"Missing flag.png",
"No flag.svg",
"No free portrait.svg",
"No portrait (female).svg",
"No portrait (male).svg",
"Red - Replace this image female.svg",
"Red - Replace this image male.svg",
"Replace this image female (blue).svg",
"Replace this image female.svg",
"Replace this image male (blue).svg",
"Replace this image male.svg",
"Silver - Replace this image female.svg",
"Silver - Replace this image male.svg",
"Replace this image.svg",
"Cricket no pic.png",
"CarersLogo.gif",
"Diagram Needed.svg",
"Example.jpg",
"Image placeholder.png",
"No male portrait.svg",
"Nocover-upload.png",
"NoDVDcover copy.png",
"Noribbon.svg",
"No portrait-BFD-test.svg",
"Placeholder barnstar ribbon.png",
"Project Trains no image.png",
"Image-request.png",
"Sin bandera.svg",
"Sin escudo.svg",
"Replace this image - temple.png",
"Replace this image butterfly.png",
"Replace this image.svg",
"Replace this image1.svg",
"Resolution angle.png",
"Image-No portrait-text-BFD-test.svg",
"Insert image here.svg",
"No image available.png",
"NO IMAGE YET square.png",
"NO IMAGE YET.png",
"No Photo Available.svg",
"No Screenshot.svg",
"No-image-available.jpg",
"Null.png",
"PictureNeeded.gif",
"Place holder.jpg",
"Unbenannt.JPG",
"UploadACopyrightFreeImage.svg",
"UploadAnImage.gif",
"UploadAnImage.svg",
"UploadAnImageShort.svg",
"CarersLogo.gif",
"Diagram Needed.svg",
"No male portrait.svg",
"NoDVDcover copy.png",
"Placeholder barnstar ribbon.png",
"Project Trains no image.png",
"Image-request.png",
"Noimage.gif",
}
function i.IsPlaceholder(image)
-- change underscores to spaces
image = mw.ustring.gsub(image, "_", " ");
assert(image ~= nil, 'mw.ustring.gsub(image, "_", " ") must not return nil')
-- if image starts with [[ then remove that and anything after |
if mw.ustring.sub(image,1,2) == "[[" then
image = mw.ustring.sub(image,3);
image = mw.ustring.gsub(image, "([^|]*)|.*", "%1");
assert(image ~= nil, 'mw.ustring.gsub(image, "([^|]*)|.*", "%1") must not return nil')
end
-- Trim spaces
image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1');
assert(image ~= nil, "mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1') must not return nil")
-- remove prefix if exists
local allNames = mw.site.namespaces[6].aliases
allNames[#allNames + 1] = mw.site.namespaces[6].name
allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName
for i, name in ipairs(allNames) do
if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then
image = mw.ustring.sub(image, mw.ustring.len(name) + 2);
break
end
end
-- Trim spaces
image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1');
-- capitalise first letter
image = mw.ustring.upper(mw.ustring.sub(image,1,1)) .. mw.ustring.sub(image,2);
for i,j in pairs(placeholder_image) do
if image == j then
return true
end
end
return false
end
function i.InfoboxImage(frame)
local image = frame.args["image"];
if image == "" or image == nil then
return "";
end
if image == " " then
return image;
end
if frame.args["suppressplaceholder"] ~= "no" then
if i.IsPlaceholder(image) == true then
return "";
end
end
if mw.ustring.lower(mw.ustring.sub(image,1,5)) == "http:" then
return "";
end
if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "[http:" then
return "";
end
if mw.ustring.lower(mw.ustring.sub(image,1,7)) == "[[http:" then
return "";
end
if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "https:" then
return "";
end
if mw.ustring.lower(mw.ustring.sub(image,1,7)) == "[https:" then
return "";
end
if mw.ustring.lower(mw.ustring.sub(image,1,8)) == "[[https:" then
return "";
end
if mw.ustring.sub(image,1,2) == "[[" then
-- search for thumbnail images and add to tracking cat if found
local cat = "";
if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]")) then
cat = "[[Category:Pages using infoboxes with thumbnail images]]";
end
return image .. cat;
elseif mw.ustring.sub(image,1,2) == "{{" and mw.ustring.sub(image,1,3) ~= "{{{" then
return image;
elseif mw.ustring.sub(image,1,1) == "<" then
return image;
elseif mw.ustring.sub(image,1,8) == mw.ustring.char(127).."'\"`UNIQ" then
-- Found strip marker at begining, so pass don't process at all
return image;
else
local result = "";
local page = frame.args["page"];
local size = frame.args["size"];
local maxsize = frame.args["maxsize"];
local sizedefault = frame.args["sizedefault"];
local alt = frame.args["alt"];
local link = frame.args["link"];
local title = frame.args["title"];
local border = frame.args["border"];
local upright = frame.args["upright"] or "";
local thumbtime = frame.args["thumbtime"] or "";
local center = frame.args["center"];
local class = frame.args["class"];
-- remove prefix if exists
local allNames = mw.site.namespaces[6].aliases
allNames[#allNames + 1] = mw.site.namespaces[6].name
allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName
for i, name in ipairs(allNames) do
if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then
image = mw.ustring.sub(image, mw.ustring.len(name) + 2);
break
end
end
if maxsize ~= "" and maxsize ~= nil then
-- if no sizedefault then set to maxsize
if sizedefault == "" or sizedefault == nil then
sizedefault = maxsize
end
-- check to see if size bigger than maxsize
if size ~= "" and size ~= nil then
local sizenumber = tonumber(mw.ustring.match(size,"%d*")) or 0;
local maxsizenumber = tonumber(mw.ustring.match(maxsize,"%d*")) or 0;
if sizenumber>maxsizenumber and maxsizenumber>0 then
size = maxsize;
end
end
end
-- add px to size if just a number
if (tonumber(size) or 0) > 0 then
size = size .. "px";
end
-- add px to sizedefault if just a number
if (tonumber(sizedefault) or 0) > 0 then
sizedefault = sizedefault .. "px";
end
result = "[[File:" .. image;
if page ~= "" and page ~= nil then
result = result .. "|page=" .. page;
end
if size ~= "" and size ~= nil then
result = result .. "|" .. size;
elseif sizedefault ~= "" and sizedefault ~= nil then
result = result .. "|" .. sizedefault;
else
result = result .. "|frameless";
end
if center == "yes" then
result = result .. "|center"
end
if alt ~= "" and alt ~= nil then
result = result .. "|alt=" .. alt;
end
if link ~= "" and link ~= nil then
result = result .. "|link=" .. link;
end
if border == "yes" then
result = result .. "|border";
end
if upright == "yes" then
result = result .. "|upright";
elseif upright ~= "" then
result = result .. "|upright=" .. upright;
end
if thumbtime ~= "" then
result = result .. "|thumbtime=" .. thumbtime;
end
if class ~= nil and class ~= "" then
result = result .. "|class=" .. class;
end
-- if alt value is a keyword then do not use as a description
if alt == "thumbnail" or alt == "thumb" or alt == "frameless" or alt == "left" or alt == "center" or alt == "right" or alt == "upright" or alt == "border" or mw.ustring.match(alt or "", '^[0-9]*px$', 1) ~= nil then
alt = nil;
end
if title ~= "" and title ~= nil then
-- does title param contain any templatestyles? If yes then set to blank.
if mw.ustring.match(frame:preprocess(title), 'UNIQ%-%-templatestyles', 1) ~= nil then
title = nil;
end
end
if title ~= "" and title ~= nil then
result = result .. "|" .. title;
end
result = result .. "]]";
return result;
end
end
return i;
35066ee19938554ca6eeb18d6e22d2063336b7e1
Template:Infobox/doc
10
137
265
2023-11-23T16:59:57Z
wikipedia>DB1729
0
Reverted 1 edit by [[Special:Contributions/176.18.48.9|176.18.48.9]] ([[User talk:176.18.48.9|talk]]) to last revision by Tjmj
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{distinguish|Template:Userbox}}
{{#ifeq:{{SUBPAGENAME}}|sandbox||{{High-use}}}}
{{Lua|Module:Infobox}}
{{Parameter names example
|name={{PAGENAME}} <!--|child |subbox |decat--> |title |above |subheader |subheader1 |subheader2={{{subheader2}}}<br/>......
|image|caption |image1|caption1 |image2|caption2={{{caption2}}}<br/>......
|header1=<div style="border-top:1px dashed #ccc;">{{{header1}}}<br/>{{nobold|( ''or'' )}}</div>
|label2={{{label1}}} |data2={{{data1}}}
|data3=( ''or'' ) |data4=<div style="padding-bottom:0.25em;border-bottom:1px dashed #ccc;">{{{data1}}}</div>
|header5={{{header2}}}<br/><div style="padding:0.75em 0 0.5em;">{{nobold|( ''or'' )}}</div>
|label6={{{label2}}} |data6={{{data2}}}
|data7=( ''or'' ) |data8=<div style="padding-bottom:0.25em;border-bottom:1px dashed #ccc;">{{{data2}}}</div>
|data9=<div style="padding:0.75em 0 0.5em;">( ''etc'' )</div>
|below
}}
This template is intended as a meta template: a template used for constructing other templates. '''Note''': In general, it is not meant for use directly in an article, but can be used on a one-off basis if required. [[Help:Infobox]] contains an introduction about the recommended content and design of infoboxes; [[Wikipedia:Manual of Style/Infoboxes]] contains additional style guidelines. See [[WP:List of infoboxes]] and [[:Category:Infobox templates]] for lists of prepared topic-specific infoboxes.
== Usage ==
{{tlf|Infobox}} is a meta-template: used to organise an actual <nowiki>{{Infobox sometopic}}</nowiki> template (like {{tl|Infobox building}}).
For <code><nowiki>[[Template:Infobox sometopic]]</nowiki></code>, template code then looks like this, simplified:
<syntaxhighlight lang="wikitext">
{{Infobox
| name = {{{name|{{PAGENAME}}}}}
| image = {{{image|}}}
| caption1 = {{{caption|}}}
| label1 = Former names
| data1 = {{{former_names|}}}
| header2 = General information
| label3 = Status
| data3 = {{{status|}}}
... <!-- etc. -->
}}
</syntaxhighlight>
== Optional control parameters ==
; name : If this parameter is present, "view/talk/edit" links will be added to the bottom of the infobox pointing to the named page, prefixed by <code>Template:</code> if no namespace is specified. You may use the value <nowiki>{{subst:PAGENAME}}</nowiki>; however, this is rarely what you want because it will send users clicking these links in an infobox to the template code rather than the data in the infobox they probably want to change.
; child : See the [[#Embedding|Embedding]] section for details. If this is set to "yes", this child infobox should be titled but have no name parameter. This parameter is empty by default, set it to "yes" to activate it.
; subbox : See the [[#Subboxes|Subboxes]] section for details. If this is set to "yes", this subbox should be titled but have no name parameter. This parameter is empty by default, set to "yes" to activate it. It has no effect if the '''child''' parameter is also set to "yes".
; decat : If this is set to "yes", the current page will not be autocategorized in a maintenance category when the generated infobox has some problems or no visible data section. Leave empty by default or set to "yes" to activate it.
; autoheaders: If this is set to any non-blank value, headers which are not followed by data fields are suppressed. See the "[[#Hiding headers when all its data fields are empty|hiding headers when all its data fields are empty]]" section for more details.
== Content parameters ==
=== Title ===
There are two different ways to put a title on an infobox. One contains the title inside the infobox's border in the uppermost cell of the table, the other puts it as a caption on top of the table. You can use them both together, or just one or the other, or neither (though this is not recommended):
; title : Text to put in the caption over the top of the table (or as section header before the whole content of this table, if this is a child infobox). For [[Wikipedia:Manual of Style/Accessibility#Tables|accessibility reasons]], this is the most recommended alternative.
; above : Text to put within the uppermost cell of the table.
; subheader(n) : additional title fields which fit below {{{title}}} and {{{above}}}, but before images.
Examples:
{{Infobox
| name = Infobox/doc
| title = Text in caption over infobox
| subheader = Subheader of the infobox
| header = (the rest of the infobox goes here)
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox
| name = {{subst:PAGENAME}}
| title = Text in caption over infobox
| subheader = Subheader of the infobox
| header = (the rest of the infobox goes here)
}}
</syntaxhighlight>{{clear}}
{{Infobox
| name = Infobox/doc
| above = Text in uppermost cell of infobox
| subheader = Subheader of the infobox
| subheader2 = Second subheader of the infobox
| header = (the rest of the infobox goes here)
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox
| name = {{subst:PAGENAME}}
| above = Text in uppermost cell of infobox
| subheader = Subheader of the infobox
| subheader2 = Second subheader of the infobox
| header = (the rest of the infobox goes here)
}}
</syntaxhighlight>{{clear}}
=== Illustration images ===
; image(n) : images to display at the top of the template. Use full image syntax, for example <nowiki>[[File:example.png|200px|alt=Example alt text]]</nowiki>. Image is centered by default. See [[WP:ALT]] for more on alt text.
; caption(n) : Text to put underneath the images.
=== Main data ===
; header(n) : Text to use as a header in row n.
; label(n) : Text to use as a label in row n.
; data(n) : Text to display as data in row n.
Note: for any given value for (n), not all combinations of parameters are permitted. The presence of a {{para|header''(n)''}} will cause the corresponding {{para|data''(n)''}} (and {{para|rowclass''(n)''}} {{para|label''(n)''}}, see below) to be ignored; the absence of a {{para|data''(n)''}} will cause the corresponding {{para|label''(n)''}} to be ignored. Valid combinations for any single row are:
* {{para|class''(n)''}} {{para|header''(n)''}}
* {{para|rowclass''(n)''}} {{para|class''(n)''}} {{para|data''(n)''}}
* {{para|rowclass''(n)''}} {{para|label''(n)''}} {{para|class''(n)''}} {{para|data''(n)''}}
See the rendering of header4, label4, and data4 in the [[#Examples|Examples]] section below.
==== Number ranges ====
To allow flexibility when the layout of an infobox is changed, it may be helpful when developing an infobox to use non-contiguous numbers for header and label/data rows. Parameters for new rows can then be inserted in future without having to renumber existing parameters. For example:
<syntaxhighlight lang="wikitext" style="overflow:auto">
| header3 = Section 1
| label5 = Label A
| data5 = Data A
| label7 = Label C
| data7 = Data C
| header10 = Section 2
| label12 = Label D
| data12 = Data D
</syntaxhighlight>{{clear}}
It is also possible to automatically renumber parameter names by using [[User:Frietjes/infoboxgap.js]] or [[Module:IncrementParams]].
There is no upper limit on numbers but there must be at most 50 between each used number.
==== Making data fields optional ====
A row with a label but no data is not displayed. This allows for the easy creation of optional infobox content rows. To make a row optional use a parameter that defaults to an empty string, like so:
<syntaxhighlight lang="wikitext" style="overflow:auto">
| label5 = Population
| data5 = {{{population|}}}
</syntaxhighlight>{{clear}}
This way if an article doesn't define the population parameter in its infobox the row won't be displayed.
For more complex fields with pre-formatted contents that would still be present even if the parameter wasn't set, you can wrap it all in an "#if" statement to make the whole thing vanish when the parameter is not used. For instance, the "#if" statement in the following example reads "#if:the parameter ''mass'' has been supplied |then display it, followed by 'kg'":
<syntaxhighlight lang="wikitext" style="overflow:auto">
| label6 = Mass
| data6 = {{ #if: {{{mass|}}} | {{{mass}}} kg }}
</syntaxhighlight>{{clear}}
For more on #if, see [[meta:ParserFunctions##if:|here]].
==== Hiding headers when all its data fields are empty ====
You can also make headers automatically hide when their section is empty (has no data-row showing).
Consider this situation:
{{Infobox
| title = Example: header with & without data
| headerstyle = background:lightgrey
| header1 = Header1 with empty section
| label2 = label2 text | data2 =
| label3 = label3 text | data3 =
| label4 = label4 text | data4 =
| header5 = Header5 with data below
| label6 = label6 text | data6 = Some value
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox
| title = Example: header with & without data
| headerstyle = background:lightgrey
| header1 = Header1 with empty section
| label2 = label2 text | data2 =
| label3 = label3 text | data3 =
| label4 = label4 text | data4 =
| header5 = Header5 with data below
| label6 = label6 text | data6 = Some value
}}
</syntaxhighlight>{{clear}}
If you want hide the header when no {{para|data''N''}} values are present, use '''{{para|autoheaders|y}}''':
{{Infobox
| title = Example: header with & without data
| autoheaders = y
| headerstyle = background:lightgrey
| header1 = Header1 with empty section
| label2 = label2 text | data2 =
| label3 = label3 text | data3 =
| label4 = label4 text | data4 =
| header5 = Header5 with data below
| label6 = label6 text | data6 = Some value
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox
| title = Example: header with & without data
| autoheaders = y
| headerstyle = background:lightgrey
| header1 = Header1 with empty section
| label2 = label2 text | data2 =
| label3 = label3 text | data3 =
| label4 = label4 text | data4 =
| header5 = Header5 with data below
| label6 = label6 text | data6 = Some value
}}
</syntaxhighlight>{{clear}}
So, header1 will be shown if any of item1, item2, or item3 is defined. If none of the three parameters are defined the header won't be shown and no empty row appears before the next visible content.
Note: if the data has empty css elements, like {{para|data|2=<span style="background:yellow;"></span>}}, this will be treated as non-empty (having data).
If {{para|autoheaders|y}} but there are items that you ''do not'' want to trigger a header, place {{para|headerX|_BLANK_}}. This will serve as an empty header and separate it from the subsequent items.
{{Infobox
| title = Example: blank header with & without data
| autoheaders = y
| headerstyle = background:lightgrey
| header1 = Header1 with empty section
| label2 = label2 text | data2 =
| label3 = label3 text | data3 =
| label4 = label4 text | data4 =
| header5 = _BLANK_
| label6 = label6 text | data6 = Some value, but does not trigger header1 or show header5
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox
| title = Example: header with & without data
| autoheaders = y
| headerstyle = background:lightgrey
| header1 = Header1 with empty section
| label2 = label2 text | data2 =
| label3 = label3 text | data3 =
| label4 = label4 text | data4 =
| header5 = _BLANK_
| label6 = label6 text | data6 = Some value, but does not trigger header1 or show header5
}}
</syntaxhighlight>{{clear}}
=== Footer ===
; below : Text to put in the bottom cell. The bottom cell is intended for footnotes, see-also, and other such information.
== Presentation parameters ==
=== Italic titles ===
Titles of articles with infoboxes may be made italic, in line with [[WP:ITALICTITLE]], by passing the <code>italic title</code> parameter.
* Turn on italic titles by passing {{para|italic title|<nowiki>{{{italic title|}}}</nowiki>}} from the infobox.
* Turn off by default (notably because only Latin script may be safely rendered in this style and italic may be needed to distinguish foreign language from local English language only in that script, but would be difficult to read for other scripts) but allow some instances to be made italic by passing {{para|italic title|<nowiki>{{{italic title|no}}}</nowiki>}}
* Do not make any titles italic by not passing the parameter at all.
=== CSS styling ===
{{div col}}
; bodystyle : Applies to the infobox table as a whole
; titlestyle : Applies only to the title caption. Adding a background color is usually inadvisable since the text is rendered "outside" the infobox.
; abovestyle : Applies only to the "above" cell at the top. The default style has font-size:125%; since this cell is usually used for a title, if you want to use the above cell for regular-sized text include "font-size:100%;" in the abovestyle.
; imagestyle : Applies to the cell the image is in. This includes the text of the image caption, but you should set text properties with captionstyle instead of imagestyle in case the caption is moved out of this cell in the future.
; captionstyle : Applies to the text of the image caption.
; rowstyle(n) : This parameter is inserted into the <code>style</code> attribute for the specified row.
; headerstyle : Applies to all header cells
; subheaderstyle : Applies to all subheader cells
; labelstyle : Applies to all label cells
; datastyle : Applies to all data cells
; belowstyle : Applies only to the below cell
{{div col end}}
=== HTML classes and microformats ===
{{div col}}
; bodyclass : This parameter is inserted into the <code>class</code> attribute for the infobox as a whole.
; titleclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''title''' caption.
<!-- currently not implemented in Lua module
; aboverowclass : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''above''' cell is on.
-->
; aboveclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''above''' cell.
; subheaderrowclass(n) : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''subheader''' is on.
; subheaderclass(n) : This parameter is inserted into the <code>class</code> attribute for the infobox's '''subheader'''.
; imagerowclass(n) : These parameters are inserted into the <code>class</code> attribute for the complete table row their respective '''image''' is on.
; imageclass : This parameter is inserted into the <code>class</code> attribute for the '''image'''.
; rowclass(n) : This parameter is inserted into the <code>class</code> attribute for the specified row including the '''label''' and '''data''' cells.
; class(n) : This parameter is inserted into the <code>class</code> attribute for the '''data''' cell of the specified row. If there's no '''data''' cell it has no effect.
<!-- currently not implemented in Lua module
; belowrowclass : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''below''' cell is on.
-->
; belowclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''below''' cell.
{{div col end}}
This template supports the addition of microformat information. This is done by adding "class" attributes to various data cells, indicating what kind of information is contained within. Multiple class names may be specified, separated by spaces, some of them being used as selectors for custom styling according to a project policy or to the skin selected in user preferences, others being used for microformats.
To flag an infobox as containing [[hCard]] information, for example, add the following parameter:
<syntaxhighlight lang="wikitext" style="overflow:auto">
| bodyclass = vcard
</syntaxhighlight>{{clear}}
And for each row containing a data cell that's part of the vcard, add a corresponding class parameter:
<syntaxhighlight lang="wikitext" style="overflow:auto">
| class1 = fn
| class2 = org
| class3 = tel
</syntaxhighlight>{{clear}}
...and so forth. "above" and "title" can also be given classes, since these are usually used to display the name of the subject of the infobox.
See [[Wikipedia:WikiProject Microformats]] for more information on adding microformat information to Wikipedia, and [[microformat]] for more information on microformats in general.
== Examples ==
Notice how the row doesn't appear in the displayed infobox when a '''label''' is defined without an accompanying '''data''' cell, and how all of them are displayed when a '''header''' is defined on the same row as a '''data''' cell. Also notice that '''subheaders''' are not bold by default like the '''headers''' used to split the main data section, because this role is meant to be for the '''above''' cell :
{{Suppress categories|
{{Infobox
|name = Infobox/doc
|bodystyle =
|titlestyle =
|abovestyle = background:#cfc;
|subheaderstyle =
|title = Test Infobox
|above = Above text
|subheader = Subheader above image
|subheader2 = Second subheader
|imagestyle =
|captionstyle =
|image = [[File:Example-serious.jpg|200px|alt=Example alt text]]
|caption = Caption displayed below File:Example-serious.jpg
|headerstyle = background:#ccf;
|labelstyle = background:#ddf;
|datastyle =
|header1 = Header defined alone
| label1 =
| data1 =
|header2 =
| label2 = Label defined alone does not display (needs data, or is suppressed)
| data2 =
|header3 =
| label3 =
| data3 = Data defined alone
|header4 = All three defined (header, label, data, all with same number)
| label4 = does not display (same number as a header)
| data4 = does not display (same number as a header)
|header5 =
| label5 = Label and data defined (label)
| data5 = Label and data defined (data)
|belowstyle = background:#ddf;
|below = Below text
}}
}}
<syntaxhighlight lang="wikitext">
{{Infobox
|name = Infobox/doc
|bodystyle =
|titlestyle =
|abovestyle = background:#cfc;
|subheaderstyle =
|title = Test Infobox
|above = Above text
|subheader = Subheader above image
|subheader2 = Second subheader
|imagestyle =
|captionstyle =
|image = [[File:Example-serious.jpg|200px|alt=Example alt text]]
|caption = Caption displayed below File:Example-serious.jpg
|headerstyle = background:#ccf;
|labelstyle = background:#ddf;
|datastyle =
|header1 = Header defined alone
| label1 =
| data1 =
|header2 =
| label2 = Label defined alone does not display (needs data, or is suppressed)
| data2 =
|header3 =
| label3 =
| data3 = Data defined alone
|header4 = All three defined (header, label, data, all with same number)
| label4 = does not display (same number as a header)
| data4 = does not display (same number as a header)
|header5 =
| label5 = Label and data defined (label)
| data5 = Label and data defined (data)
|belowstyle = background:#ddf;
|below = Below text
}}
</syntaxhighlight>
For this example, the {{para|bodystyle}} and {{para|labelstyle}} parameters are used to adjust the infobox width and define a default width for the column of labels:
{{Infobox
|name = Infobox/doc
|bodystyle = width:20em
|titlestyle =
|title = Test Infobox
|headerstyle =
|labelstyle = width:33%
|datastyle =
|header1 =
| label1 = Label 1
| data1 = Data 1
|header2 =
| label2 = Label 2
| data2 = Data 2
|header3 =
| label3 = Label 3
| data3 = Data 3
|header4 = Header 4
| label4 =
| data4 =
|header5 =
| label5 = Label 5
| data5 = Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|belowstyle =
|below = Below text
}}
<syntaxhighlight lang="wikitext">
{{Infobox
|name = Infobox/doc
|bodystyle = width:20em
|titlestyle =
|title = Test Infobox
|headerstyle =
|labelstyle = width:33%
|datastyle =
|header1 =
| label1 = Label 1
| data1 = Data 1
|header2 =
| label2 = Label 2
| data2 = Data 2
|header3 =
| label3 = Label 3
| data3 = Data 3
|header4 = Header 4
| label4 =
| data4 =
|header5 =
| label5 = Label 5
| data5 = Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|belowstyle =
|below = Below text
}}
</syntaxhighlight>
== Embedding ==
<!--Linked from [[Template:Subinfobox bodystyle/doc]]-->
One infobox template can be embedded into another using the {{para|child}} parameter. This feature can be used to create a modular infobox, or to create better-defined logical sections. Long ago, it was necessary to use embedding in order to create infoboxes with more than 99 rows; but nowadays there's no limit to the number of rows that can be defined in a single instance of <code><nowiki>{{infobox}}</nowiki></code>.
{{Infobox
| title = Top level title
| data1 = {{Infobox | decat = yes | child = yes
| title = First subsection
| label1= Label 1.1
| data1 = Data 1.1
}}
| data2 = {{Infobox | decat = yes | child = yes
|title = Second subsection
| label1= Label 2.1
| data1 = Data 2.1
}}
| belowstyle =
| below = Below text
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox
| title = Top level title
| data1 = {{Infobox | decat = yes | child = yes
| title = First subsection
| label1= Label 1.1
| data1 = Data 1.1
}}
| data2 = {{Infobox | decat = yes | child = yes
|title = Second subsection
| label1= Label 2.1
| data1 = Data 2.1
}}
| belowstyle =
| below = Below text
}}
</syntaxhighlight>{{clear}}
Note, in the examples above, the child infobox is placed in a <code>data</code> field, not a <code>header</code> field. Notice that the section subheadings are not in bold font if bolding is not explicitly specified. To obtain bold section headings, place the child infobox in a '''header''' field (but not in a '''label''' field because it would not be displayed!), either using
{{Infobox
| title = Top level title
| header1 = {{Infobox | decat = yes | child = yes
| title = First subsection
| label1= Label 1.1
| data1 = Data 1.1
}}
| header2 = {{Infobox | decat = yes | child = yes
| title = Second subsection
| label1= Label 2.1
| data1 = Data 2.1
}}
| belowstyle =
| below = Below text
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox
| title = Top level title
| header1 = {{Infobox | decat = yes | child = yes
| title = First subsection
| label1= Label 1.1
| data1 = Data 1.1
}}
| header2 = {{Infobox | decat = yes | child = yes
| title = Second subsection
| label1= Label 2.1
| data1 = Data 2.1
}}
| belowstyle =
| below = Below text
}}
</syntaxhighlight>{{clear}}
or,
{{Infobox
| title = Top level title
| header1 = First subsection
{{Infobox | decat = yes | child = yes
| label1 = Label 1.1
| data1 = Data 1.1
}}
| header2 = Second subsection
{{Infobox | decat = yes | child = yes
| label1 = Label 2.1
| data1 = Data 2.1
}}
| belowstyle =
| below = Below text
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox
| title = Top level title
| header1 = First subsection
{{Infobox | decat = yes | child = yes
| label1 = Label 1.1
| data1 = Data 1.1
}}
| header2 = Second subsection
{{Infobox | decat = yes | child = yes
| label1 = Label 2.1
| data1 = Data 2.1
}}
| belowstyle =
| below = Below text
}}
</syntaxhighlight>{{clear}}
Note that omitting the {{para|title}} parameter, and not including any text preceding the embedded infobox, may result in spurious blank table rows, creating gaps in the visual presentation. The garbage output can be suppressed using {{para|rowstyleN|display: none}}, replacing N with the data/header number.
[[Wikipedia:WikiProject Infoboxes/embed]] includes some links to Wikipedia articles which include infoboxes embedded within other infoboxes.
== Subboxes ==
An alternative method for embedding is to use {{para|subbox|yes}}, which removes the outer border from the infobox, but preserves the interior structure. One feature of this approach is that the parent and child boxes need not have the same structure, and the label and data fields are not aligned between the parent and child boxes because they are not in the same parent table.
{{Infobox
| headerstyle = background-color:#eee;
| labelstyle = background-color:#eee;
| header1 = Main 1
| header2 = Main 2
| data3 = {{Infobox | subbox = yes
| headerstyle = background-color:#ccc;
| labelstyle = background-color:#ddd;
| header1 = Sub 3-1
| header2 = Sub 3-2
| label3 = Label 3-3 | data3 = Data 3-3
}}
| data4 = {{Infobox | subbox = yes
| labelstyle = background-color:#ccc;
| label1 = Label 4-1 | data1 = Data 4-1
}}
| label5 = Label 5 | data5 = Data 5
| header6 = Main 6
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox
| headerstyle = background-color:#eee;
| labelstyle = background-color:#eee;
| header1 = Main 1
| header2 = Main 2
| data3 = {{Infobox | subbox = yes
| headerstyle = background-color:#ccc;
| labelstyle = background-color:#ddd;
| header1 = Sub 3-1
| header2 = Sub 3-2
| label3 = Label 3-3 | data3 = Data 3-3
}}
| data4 = {{Infobox | subbox = yes
| labelstyle = background-color:#ccc;
| label1 = Label 4-1 | data1 = Data 4-1
}}
| label5 = Label 5 | data5 = Data 5
| header6 = Main 6
}}
</syntaxhighlight>{{clear}}
Similar embedding techniques may be used within content parameters of some other templates generating tables (such as [[:Template:Sidebar|Sidebar]]) :
{{Sidebar
| navbar = off
| headingstyle = background-color:#eee;
| heading1 = Heading 1
| heading2 = Heading 2
| content3 = {{Infobox | subbox = yes
| headerstyle = background-color:#ccc;
| labelstyle = background-color:#ddd;
| header1 = Sub 3-1
| header2 = Sub 3-2
| label3 = Label 3-3 | data3 = Data 3-3
}}
| content4 = {{Infobox | subbox = yes
| labelstyle = background-color:#ccc;
| label1 = Label 4-1 | data1 = Data 4-1
}}
| heading5 = Heading 5
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Sidebar
| navbar = off
| headingstyle = background-color:#eee;
| heading1 = Heading 1
| heading2 = Heading 2
| content3 = {{Infobox | subbox = yes
| headerstyle = background-color:#ccc;
| labelstyle = background-color:#ddd;
| header1 = Sub 3-1
| header2 = Sub 3-2
| label3 = Label 3-3 | data3 = Data 3-3
}}
| content4 = {{Infobox | subbox = yes
| labelstyle = background-color:#ccc;
| label1 = Label 4-1 | data1 = Data 4-1
}}
| heading5 = Heading 5
}}
</syntaxhighlight>{{clear}}
Note that the default padding of the parent data cell containing each subbox is still visible, so the subboxes are slightly narrower than the parent box and there's a higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.
== Controlling line-breaking in embedded bulletless lists ==
Template {{tlx|nbsp}} may be used with {{tlx|wbr}} and {{tlx|nowrap}} to control line-breaking in bulletless lists embedded in infoboxes (e.g. cast list in {{tlx|Infobox film}}), to prevent wrapped long entries from being confused with multiple entries. See [[Template:Wbr/doc#Controlling line-breaking in infoboxes]] for details.
== Full blank syntax ==
(Note: there is no limit to the number of possible rows; only 20 are given below since infoboxes larger than that will be relatively rare. Just extend the numbering as needed. The microformat "class" parameters are also omitted as they are not commonly used.)
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox
| name = {{subst:PAGENAME}}
| child = {{{child|}}}
| subbox = {{{subbox|}}}
| italic title = {{{italic title|no}}}
| templatestyles =
| child templatestyles =
| grandchild templatestyles =
| bodystyle =
| titlestyle =
| abovestyle =
| subheaderstyle =
| title =
| above =
| subheader =
| imagestyle =
| captionstyle =
| image =
| caption =
| image2 =
| caption2 =
| headerstyle =
| labelstyle =
| datastyle =
| header1 =
| label1 =
| data1 =
| header2 =
| label2 =
| data2 =
| header3 =
| label3 =
| data3 =
| header4 =
| label4 =
| data4 =
| header5 =
| label5 =
| data5 =
| header6 =
| label6 =
| data6 =
| header7 =
| label7 =
| data7 =
| header8 =
| label8 =
| data8 =
| header9 =
| label9 =
| data9 =
| header10 =
| label10 =
| data10 =
| header11 =
| label11 =
| data11 =
| header12 =
| label12 =
| data12 =
| header13 =
| label13 =
| data13 =
| header14 =
| label14 =
| data14 =
| header15 =
| label15 =
| data15 =
| header16 =
| label16 =
| data16 =
| header17 =
| label17 =
| data17 =
| header18 =
| label18 =
| data18 =
| header19 =
| label19 =
| data19 =
| header20 =
| label20 =
| data20 =
| belowstyle =
| below =
}}
</syntaxhighlight>{{clear}}
{{Help:Infobox/user style}}
== Porting to other MediaWikis ==
The infobox template requires the [[:mw:Extension:Scribunto|Scribunto]] and [[:mw:Extension:TemplateStyles|TemplateStyles]] extensions. [[Wikipedia:WikiProject Transwiki|WikiProject Transwiki]] has a version of this template that has been modified to work on other MediaWikis.
== TemplateData ==
{{TemplateData header}}
<templatedata>
{
"description": "This template is intended as a meta template, a template used for constructing other templates. In general, it is not meant for use directly in an article but can be used on a one-off basis if required.",
"format": "{{_\n| ________________ = _\n}}\n",
"params": {
"title": {
"label": "Title",
"description": "Title displayed above the infobox",
"type": "string",
"suggested": true
},
"image": {
"label": "Image",
"description": "Image illustrating the topic. Use full image syntax.",
"type": "content",
"suggested": true,
"example": "[[File:example.png|200px|alt=Example alt text]]"
},
"caption": {
"label": "Caption",
"description": "caption for the image",
"type": "content",
"suggested": true
}
},
"paramOrder": [
"title",
"image",
"caption"
]
}
</templatedata>
==Tracking categories==
* {{Category link with count|Articles with missing Wikidata information}}
* {{Category link with count|Articles using infobox templates with no data rows}}
* {{Category link with count|Pages using embedded infobox templates with the title parameter}}
==See also==
* [[Module:Infobox]], the [[WP:LUA|Lua]] module on which this template is based
* [[Module:Check for unknown parameters]]
* {{tl|Infobox3cols}}
* {{tl|Navbox}} and {{tl|Sidebar}}
* [[Wikipedia:List of infoboxes|List of infoboxes]]
* [[:Module:InfoboxImage]]
<includeonly>{{Sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Infobox templates| ]]
[[Category:Wikipedia metatemplates|Infobox]]
[[Category:Templates generating microformats]]
[[Category:Templates that add a tracking category]]
[[Category:Templates based on the Infobox Lua module]]
}}</includeonly>
b7ba187ea76ee960bbe295ad01c44c646eaedadb
Module:Message box/configuration
828
75
141
2023-11-24T02:41:46Z
wikipedia>Pppery
0
Per edit request
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Message box configuration --
-- --
-- This module contains configuration data for [[Module:Message box]]. --
--------------------------------------------------------------------------------
return {
ambox = {
types = {
speedy = {
class = 'ambox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'ambox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'ambox-content',
image = 'Ambox important.svg'
},
style = {
class = 'ambox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'ambox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'ambox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'ambox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst', 'hidden'},
allowSmall = true,
smallParam = 'left',
smallClass = 'mbox-small-left',
substCheck = true,
classes = {'metadata', 'ambox'},
imageEmptyCell = true,
imageCheckBlank = true,
imageSmallSize = '20x20px',
imageCellDiv = true,
useCollapsibleTextFields = true,
imageRightNone = true,
sectionDefault = 'article',
allowMainspaceCategories = true,
templateCategory = 'Article message templates',
templateCategoryRequireName = true,
templateErrorCategory = 'Article message templates with missing parameters',
templateErrorParamsToCheck = {'issue', 'fix', 'subst'},
removalNotice = '<small>[[Help:Maintenance template removal|Learn how and when to remove this template message]]</small>',
templatestyles = 'Module:Message box/ambox.css'
},
cmbox = {
types = {
speedy = {
class = 'cmbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'cmbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'cmbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'cmbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'cmbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'cmbox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'cmbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'cmbox'},
imageEmptyCell = true,
templatestyles = 'Module:Message box/cmbox.css'
},
fmbox = {
types = {
warning = {
class = 'fmbox-warning',
image = 'Ambox warning pn.svg'
},
editnotice = {
class = 'fmbox-editnotice',
image = 'Information icon4.svg'
},
system = {
class = 'fmbox-system',
image = 'Information icon4.svg'
}
},
default = 'system',
showInvalidTypeError = true,
classes = {'fmbox'},
imageEmptyCell = false,
imageRightNone = false,
templatestyles = 'Module:Message box/fmbox.css'
},
imbox = {
types = {
speedy = {
class = 'imbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'imbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'imbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'imbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'imbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'imbox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
license = {
class = 'imbox-license licensetpl',
image = 'Imbox-license.svg'
},
["license-related"] = {
class = 'imbox-license',
image = 'Imbox-license.svg'
},
featured = {
class = 'imbox-featured',
image = 'Cscr-featured.svg',
imageNeedsLink = true
},
notice = {
class = 'imbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'imbox'},
imageEmptyCell = true,
below = true,
templateCategory = 'File message boxes',
templatestyles = 'Module:Message box/imbox.css'
},
ombox = {
types = {
speedy = {
class = 'ombox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'ombox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'ombox-content',
image = 'Ambox important.svg'
},
style = {
class = 'ombox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'ombox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'ombox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'ombox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'ombox'},
allowSmall = true,
imageEmptyCell = true,
imageRightNone = true,
templatestyles = 'Module:Message box/ombox.css'
},
tmbox = {
types = {
speedy = {
class = 'tmbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'tmbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'tmbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'tmbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'tmbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'tmbox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'tmbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'tmbox'},
allowSmall = true,
imageRightNone = true,
imageEmptyCell = true,
templateCategory = 'Talk message boxes',
templatestyles = 'Module:Message box/tmbox.css'
}
}
ccb6bdf2868087b6833d203307f2f6a92b3b0a01
Module:Citation/CS1/Identifiers
828
22
37
2023-11-25T16:42:08Z
wikipedia>Trappist the monk
0
sync from sandbox;
Scribunto
text/plain
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
]]
local has_accept_as_written, is_set, in_array, set_message, select_one, -- functions in Module:Citation/CS1/Utilities
substitute, make_wikilink;
local z; -- table of tables defined in Module:Citation/CS1/Utilities
local cfg; -- table of configuration tables that are defined in Module:Citation/CS1/Configuration
--[[--------------------------< P A G E S C O P E V A R I A B L E S >--------------------------------------
declare variables here that have page-wide scope that are not brought in from other modules; that are created here and used here
]]
local auto_link_urls = {}; -- holds identifier URLs for those identifiers that can auto-link |title=
--============================<< H E L P E R F U N C T I O N S >>============================================
--[[--------------------------< W I K I D A T A _ A R T I C L E _ N A M E _ G E T >----------------------------
as an aid to internationalizing identifier-label wikilinks, gets identifier article names from Wikidata.
returns :<lang code>:<article title> when <q> has an <article title> for <lang code>; nil else
for identifiers that do not have q, returns nil
for wikis that do not have mw.wikibase installed, returns nil
]]
local function wikidata_article_name_get (q)
if not is_set (q) or (q and not mw.wikibase) then -- when no q number or when a q number but mw.wikibase not installed on this wiki
return nil; -- abandon
end
local wd_article;
local this_wiki_code = cfg.this_wiki_code; -- Wikipedia subdomain; 'en' for en.wikipedia.org
wd_article = mw.wikibase.getSitelink (q, this_wiki_code .. 'wiki'); -- fetch article title from WD; nil when no title available at this wiki
if wd_article then
wd_article = table.concat ({':', this_wiki_code, ':', wd_article}); -- interwiki-style link without brackets if taken from WD; leading colon required
end
return wd_article; -- article title from WD; nil else
end
--[[--------------------------< L I N K _ L A B E L _ M A K E >------------------------------------------------
common function to create identifier link label from handler table or from Wikidata
returns the first available of
1. redirect from local wiki's handler table (if enabled)
2. Wikidata (if there is a Wikidata entry for this identifier in the local wiki's language)
3. label specified in the local wiki's handler table
]]
local function link_label_make (handler)
local wd_article;
if not (cfg.use_identifier_redirects and is_set (handler.redirect)) then -- redirect has priority so if enabled and available don't fetch from Wikidata because expensive
wd_article = wikidata_article_name_get (handler.q); -- if Wikidata has an article title for this wiki, get it;
end
return (cfg.use_identifier_redirects and is_set (handler.redirect) and handler.redirect) or wd_article or handler.link;
end
--[[--------------------------< E X T E R N A L _ L I N K _ I D >----------------------------------------------
Formats a wiki-style external link
]]
local function external_link_id (options)
local url_string = options.id;
local ext_link;
local this_wiki_code = cfg.this_wiki_code; -- Wikipedia subdomain; 'en' for en.wikipedia.org
local wd_article; -- article title from Wikidata
if options.encode == true or options.encode == nil then
url_string = mw.uri.encode (url_string, 'PATH');
end
if options.auto_link and is_set (options.access) then
auto_link_urls[options.auto_link] = table.concat ({options.prefix, url_string, options.suffix});
end
ext_link = mw.ustring.format ('[%s%s%s %s]', options.prefix, url_string, options.suffix or "", mw.text.nowiki (options.id));
if is_set (options.access) then
ext_link = substitute (cfg.presentation['ext-link-access-signal'], {cfg.presentation[options.access].class, cfg.presentation[options.access].title, ext_link}); -- add the free-to-read / paywall lock
end
return table.concat ({
make_wikilink (link_label_make (options), options.label), -- redirect, Wikidata link, or locally specified link (in that order)
options.separator or ' ',
ext_link
});
end
--[[--------------------------< I N T E R N A L _ L I N K _ I D >----------------------------------------------
Formats a wiki-style internal link
TODO: Does not currently need to support options.access, options.encode, auto-linking and COinS (as in external_link_id),
but may be needed in the future for :m:Interwiki_map custom-prefixes like :arxiv:, :bibcode:, :DOI:, :hdl:, :ISSN:,
:JSTOR:, :Openlibrary:, :PMID:, :RFC:.
]]
local function internal_link_id (options)
local id = mw.ustring.gsub (options.id, '%d', cfg.date_names.local_digits); -- translate 'local' digits to Western 0-9
return table.concat (
{
make_wikilink (link_label_make (options), options.label), -- wiki-link the identifier label
options.separator or ' ', -- add the separator
make_wikilink (
table.concat (
{
options.prefix,
id, -- translated to Western digits
options.suffix or ''
}),
substitute (cfg.presentation['bdi'], {'', mw.text.nowiki (options.id)}) -- bdi tags to prevent Latin script identifiers from being reversed at RTL language wikis
); -- nowiki because MediaWiki still has magic links for ISBN and the like; TODO: is it really required?
});
end
--[[--------------------------< I S _ E M B A R G O E D >------------------------------------------------------
Determines if a PMC identifier's online version is embargoed. Compares the date in |pmc-embargo-date= against
today's date. If embargo date is in the future, returns the content of |pmc-embargo-date=; otherwise, returns
an empty string because the embargo has expired or because |pmc-embargo-date= was not set in this cite.
]]
local function is_embargoed (embargo)
if is_set (embargo) then
local lang = mw.getContentLanguage();
local good1, embargo_date, todays_date;
good1, embargo_date = pcall (lang.formatDate, lang, 'U', embargo);
todays_date = lang:formatDate ('U');
if good1 then -- if embargo date is a good date
if tonumber (embargo_date) >= tonumber (todays_date) then -- is embargo date is in the future?
return embargo; -- still embargoed
else
set_message ('maint_pmc_embargo'); -- embargo has expired; add main cat
return ''; -- unset because embargo has expired
end
end
end
return ''; -- |pmc-embargo-date= not set return empty string
end
--[=[-------------------------< I S _ V A L I D _ R X I V _ D A T E >------------------------------------------
for biorxiv, returns true if:
2019-12-11T00:00Z <= biorxiv_date < today + 2 days
for medrxiv, returns true if:
2020-01-01T00:00Z <= medrxiv_date < today + 2 days
The dated form of biorxiv identifier has a start date of 2019-12-11. The Unix timestamp for that date is {{#time:U|2019-12-11}} = 1576022400
The medrxiv identifier has a start date of 2020-01-01. The Unix timestamp for that date is {{#time:U|2020-01-01}} = 1577836800
<rxiv_date> is the date provided in those |biorxiv= parameter values that are dated and in |medrxiv= parameter values at time 00:00:00 UTC
<today> is the current date at time 00:00:00 UTC plus 48 hours
if today's date is 2023-01-01T00:00:00 then
adding 24 hours gives 2023-01-02T00:00:00 – one second more than today
adding 24 hours gives 2023-01-03T00:00:00 – one second more than tomorrow
inputs:
<y>, <m>, <d> – year, month, day parts of the date from the birxiv or medrxiv identifier
<select> 'b' for biorxiv, 'm' for medrxiv; defaults to 'b'
]=]
local function is_valid_rxiv_date (y, m, d, select)
if 0 == tonumber (m) and 12 < tonumber (m) then -- <m> must be a number 1–12
return false;
end
if 0 == tonumber (d) and 31 < tonumber (d) then -- <d> must be a number 1–31; TODO: account for month length and leap yer?
return false;
end
local rxiv_date = table.concat ({y, m, d}, '-'); -- make ymd date string
local good1, good2;
local rxiv_ts, tomorrow_ts; -- to hold Unix timestamps representing the dates
local lang_object = mw.getContentLanguage();
good1, rxiv_ts = pcall (lang_object.formatDate, lang_object, 'U', rxiv_date); -- convert rxiv_date value to Unix timestamp
good2, tomorrow_ts = pcall (lang_object.formatDate, lang_object, 'U', 'today + 2 days' ); -- today midnight + 2 days is one second more than all day tomorrow
if good1 and good2 then -- lang.formatDate() returns a timestamp in the local script which tonumber() may not understand
rxiv_ts = tonumber (rxiv_ts) or lang_object:parseFormattedNumber (rxiv_ts); -- convert to numbers for the comparison;
tomorrow_ts = tonumber (tomorrow_ts) or lang_object:parseFormattedNumber (tomorrow_ts);
else
return false; -- one or both failed to convert to Unix timestamp
end
local limit_ts = ((select and ('m' == select)) and 1577836800) or 1576022400; -- choose the appropriate limit timesatmp
return ((limit_ts <= rxiv_ts) and (rxiv_ts < tomorrow_ts)) -- limit_ts <= rxiv_date < tomorrow's date
end
--[[--------------------------< IS _ V A L I D _ I S X N >-----------------------------------------------------
ISBN-10 and ISSN validator code calculates checksum across all ISBN/ISSN digits including the check digit.
ISBN-13 is checked in isbn().
If the number is valid the result will be 0. Before calling this function, ISBN/ISSN must be checked for length
and stripped of dashes, spaces and other non-ISxN characters.
]]
local function is_valid_isxn (isxn_str, len)
local temp = 0;
isxn_str = { isxn_str:byte(1, len) }; -- make a table of byte values '0' → 0x30 .. '9' → 0x39, 'X' → 0x58
len = len + 1; -- adjust to be a loop counter
for i, v in ipairs (isxn_str) do -- loop through all of the bytes and calculate the checksum
if v == string.byte ("X" ) then -- if checkdigit is X (compares the byte value of 'X' which is 0x58)
temp = temp + 10 * (len - i); -- it represents 10 decimal
else
temp = temp + tonumber (string.char (v) )*(len-i);
end
end
return temp % 11 == 0; -- returns true if calculation result is zero
end
--[[--------------------------< IS _ V A L I D _ I S X N _ 1 3 >-----------------------------------------------
ISBN-13 and ISMN validator code calculates checksum across all 13 ISBN/ISMN digits including the check digit.
If the number is valid, the result will be 0. Before calling this function, ISBN-13/ISMN must be checked for length
and stripped of dashes, spaces and other non-ISxN-13 characters.
]]
local function is_valid_isxn_13 (isxn_str)
local temp=0;
isxn_str = { isxn_str:byte(1, 13) }; -- make a table of byte values '0' → 0x30 .. '9' → 0x39
for i, v in ipairs (isxn_str) do
temp = temp + (3 - 2*(i % 2)) * tonumber (string.char (v) ); -- multiply odd index digits by 1, even index digits by 3 and sum; includes check digit
end
return temp % 10 == 0; -- sum modulo 10 is zero when ISBN-13/ISMN is correct
end
--[[--------------------------< N O R M A L I Z E _ L C C N >--------------------------------------------------
LCCN normalization (https://www.loc.gov/marc/lccn-namespace.html#normalization)
1. Remove all blanks.
2. If there is a forward slash (/) in the string, remove it, and remove all characters to the right of the forward slash.
3. If there is a hyphen in the string:
a. Remove it.
b. Inspect the substring following (to the right of) the (removed) hyphen. Then (and assuming that steps 1 and 2 have been carried out):
1. All these characters should be digits, and there should be six or less. (not done in this function)
2. If the length of the substring is less than 6, left-fill the substring with zeroes until the length is six.
Returns a normalized LCCN for lccn() to validate. There is no error checking (step 3.b.1) performed in this function.
]]
local function normalize_lccn (lccn)
lccn = lccn:gsub ("%s", ""); -- 1. strip whitespace
if nil ~= string.find (lccn, '/') then
lccn = lccn:match ("(.-)/"); -- 2. remove forward slash and all character to the right of it
end
local prefix
local suffix
prefix, suffix = lccn:match ("(.+)%-(.+)"); -- 3.a remove hyphen by splitting the string into prefix and suffix
if nil ~= suffix then -- if there was a hyphen
suffix = string.rep("0", 6-string.len (suffix)) .. suffix; -- 3.b.2 left fill the suffix with 0s if suffix length less than 6
lccn = prefix..suffix; -- reassemble the LCCN
end
return lccn;
end
--============================<< I D E N T I F I E R F U N C T I O N S >>====================================
--[[--------------------------< A R X I V >--------------------------------------------------------------------
See: https://arxiv.org/help/arxiv_identifier
format and error check arXiv identifier. There are three valid forms of the identifier:
the first form, valid only between date codes 9107 and 0703, is:
arXiv:<archive>.<class>/<date code><number><version>
where:
<archive> is a string of alpha characters - may be hyphenated; no other punctuation
<class> is a string of alpha characters - may be hyphenated; no other punctuation; not the same as |class= parameter which is not supported in this form
<date code> is four digits in the form YYMM where YY is the last two digits of the four-digit year and MM is the month number January = 01
first digit of YY for this form can only 9 and 0
<number> is a three-digit number
<version> is a 1 or more digit number preceded with a lowercase v; no spaces (undocumented)
the second form, valid from April 2007 through December 2014 is:
arXiv:<date code>.<number><version>
where:
<date code> is four digits in the form YYMM where YY is the last two digits of the four-digit year and MM is the month number January = 01
<number> is a four-digit number
<version> is a 1 or more digit number preceded with a lowercase v; no spaces
the third form, valid from January 2015 is:
arXiv:<date code>.<number><version>
where:
<date code> and <version> are as defined for 0704-1412
<number> is a five-digit number
]]
local function arxiv (options)
local id = options.id;
local class = options.Class; -- TODO: lowercase?
local handler = options.handler;
local year, month, version;
local err_msg = false; -- assume no error message
local text; -- output text
if id:match("^%a[%a%.%-]+/[90]%d[01]%d%d%d%d$") or id:match("^%a[%a%.%-]+/[90]%d[01]%d%d%d%dv%d+$") then -- test for the 9107-0703 format with or without version
year, month = id:match("^%a[%a%.%-]+/([90]%d)([01]%d)%d%d%d[v%d]*$");
year = tonumber (year);
month = tonumber (month);
if ((not (90 < year or 8 > year)) or (1 > month or 12 < month)) or -- if invalid year or invalid month
((91 == year and 7 > month) or (7 == year and 3 < month)) then -- if years ok, are starting and ending months ok?
err_msg = true; -- flag for error message
end
elseif id:match("^%d%d[01]%d%.%d%d%d%d$") or id:match("^%d%d[01]%d%.%d%d%d%dv%d+$") then -- test for the 0704-1412 with or without version
year, month = id:match("^(%d%d)([01]%d)%.%d%d%d%d[v%d]*$");
year = tonumber (year);
month = tonumber (month);
if ((7 > year) or (14 < year) or (1 > month or 12 < month)) or -- is year invalid or is month invalid? (doesn't test for future years)
((7 == year) and (4 > month)) then -- when year is 07, is month invalid (before April)?
err_msg = true; -- flag for error message
end
elseif id:match("^%d%d[01]%d%.%d%d%d%d%d$") or id:match("^%d%d[01]%d%.%d%d%d%d%dv%d+$") then -- test for the 1501- format with or without version
year, month = id:match("^(%d%d)([01]%d)%.%d%d%d%d%d[v%d]*$");
year = tonumber (year);
month = tonumber (month);
if ((15 > year) or (1 > month or 12 < month)) then -- is year invalid or is month invalid? (doesn't test for future years)
err_msg = true; -- flag for error message
end
else
err_msg = true; -- not a recognized format; flag for error message
end
if err_msg then
options.coins_list_t['ARXIV'] = nil; -- when error, unset so not included in COinS
end
local err_msg_t = {};
if err_msg then
set_message ('err_bad_arxiv');
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access});
if is_set (class) then
if id:match ('^%d+') then
text = table.concat ({text, ' [[https://arxiv.org/archive/', class, ' ', class, ']]'}); -- external link within square brackets, not wikilink
else
set_message ('err_class_ignored');
end
end
return text;
end
--[[--------------------------< B I B C O D E >--------------------------------------------------------------------
Validates (sort of) and formats a bibcode ID.
Format for bibcodes is specified here: https://adsabs.harvard.edu/abs_doc/help_pages/data.html#bibcodes
But, this: 2015arXiv151206696F is apparently valid so apparently, the only things that really matter are length, 19 characters
and first four digits must be a year. This function makes these tests:
length must be 19 characters
characters in position
1–4 must be digits and must represent a year in the range of 1000 – next year
5 must be a letter
6–8 must be letter, digit, ampersand, or dot (ampersand cannot directly precede a dot; &. )
9–18 must be letter, digit, or dot
19 must be a letter or dot
]]
local function bibcode (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
local ignore_invalid = options.accept;
local err_type;
local err_msg = '';
local year;
local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode,
access = access});
if 19 ~= id:len() then
err_type = cfg.err_msg_supl.length;
else
year = id:match ("^(%d%d%d%d)[%a][%w&%.][%w&%.][%w&%.][%w.]+[%a%.]$");
if not year then -- if nil then no pattern match
err_type = cfg.err_msg_supl.value; -- so value error
else
local next_year = tonumber (os.date ('%Y')) + 1; -- get the current year as a number and add one for next year
year = tonumber (year); -- convert year portion of bibcode to a number
if (1000 > year) or (year > next_year) then
err_type = cfg.err_msg_supl.year; -- year out of bounds
end
if id:find('&%.') then
err_type = cfg.err_msg_supl.journal; -- journal abbreviation must not have '&.' (if it does it's missing a letter)
end
if id:match ('.........%.tmp%.') then -- temporary bibcodes when positions 10–14 are '.tmp.'
set_message ('maint_bibcode');
end
end
end
if is_set (err_type) and not ignore_invalid then -- if there was an error detected and accept-as-written markup not used
set_message ('err_bad_bibcode', {err_type});
options.coins_list_t['BIBCODE'] = nil; -- when error, unset so not included in COinS
end
return text;
end
--[[--------------------------< B I O R X I V >-----------------------------------------------------------------
Format bioRxiv ID and do simple error checking. Before 2019-12-11, biorXiv IDs were 10.1101/ followed by exactly
6 digits. After 2019-12-11, biorXiv IDs retained the six-digit identifier but prefixed that with a yyyy.mm.dd.
date and suffixed with an optional version identifier.
The bioRxiv ID is the string of characters:
https://doi.org/10.1101/078733 -> 10.1101/078733
or a date followed by a six-digit number followed by an optional version indicator 'v' and one or more digits:
https://www.biorxiv.org/content/10.1101/2019.12.11.123456v2 -> 10.1101/2019.12.11.123456v2
see https://www.biorxiv.org/about-biorxiv
]]
local function biorxiv (options)
local id = options.id;
local handler = options.handler;
local err_msg = true; -- flag; assume that there will be an error
local patterns = {
'^10%.1101/%d%d%d%d%d%d$', -- simple 6-digit identifier (before 2019-12-11)
'^10%.1101/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%dv%d+$', -- y.m.d. date + 6-digit identifier + version (after 2019-12-11)
'^10%.1101/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d$', -- y.m.d. date + 6-digit identifier (after 2019-12-11)
}
for _, pattern in ipairs (patterns) do -- spin through the patterns looking for a match
if id:match (pattern) then
local y, m, d = id:match (pattern); -- found a match, attempt to get year, month and date from the identifier
if m then -- m is nil when id is the six-digit form
if not is_valid_rxiv_date (y, m, d, 'b') then -- validate the encoded date; 'b' for biorxiv limit
break; -- date fail; break out early so we don't unset the error message
end
end
err_msg = nil; -- we found a match so unset the error message
break; -- and done
end
end -- err_cat remains set here when no match
if err_msg then
options.coins_list_t['BIORXIV'] = nil; -- when error, unset so not included in COinS
set_message ('err_bad_biorxiv'); -- and set the error message
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator,
encode = handler.encode, access = handler.access});
end
--[[--------------------------< C I T E S E E R X >------------------------------------------------------------
CiteSeerX use their own notion of "doi" (not to be confused with the identifiers resolved via doi.org).
The description of the structure of this identifier can be found at Help_talk:Citation_Style_1/Archive_26#CiteSeerX_id_structure
]]
local function citeseerx (options)
local id = options.id;
local handler = options.handler;
local matched;
local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode,
access = handler.access});
matched = id:match ("^10%.1%.1%.[1-9]%d?%d?%d?%.[1-9]%d?%d?%d?$");
if not matched then
set_message ('err_bad_citeseerx' );
options.coins_list_t['CITESEERX'] = nil; -- when error, unset so not included in COinS
end
return text;
end
--[[--------------------------< D O I >------------------------------------------------------------------------
Formats a DOI and checks for DOI errors.
DOI names contain two parts: prefix and suffix separated by a forward slash.
Prefix: directory indicator '10.' followed by a registrant code
Suffix: character string of any length chosen by the registrant
This function checks a DOI name for: prefix/suffix. If the DOI name contains spaces or endashes, or, if it ends
with a period or a comma, this function will emit a bad_doi error message.
DOI names are case-insensitive and can incorporate any printable Unicode characters so the test for spaces, endash,
and terminal punctuation may not be technically correct but it appears, that in practice these characters are rarely
if ever used in DOI names.
https://www.doi.org/doi_handbook/2_Numbering.html -- 2.2 Syntax of a DOI name
https://www.doi.org/doi_handbook/2_Numbering.html#2.2.2 -- 2.2.2 DOI prefix
]]
local function doi (options)
local id = options.id;
local inactive = options.DoiBroken
local access = options.access;
local ignore_invalid = options.accept;
local handler = options.handler;
local err_flag;
local text;
if is_set (inactive) then
local inactive_year = inactive:match("%d%d%d%d"); -- try to get the year portion from the inactive date
local inactive_month, good;
if is_set (inactive_year) then
if 4 < inactive:len() then -- inactive date has more than just a year (could be anything)
local lang_obj = mw.getContentLanguage(); -- get a language object for this wiki
good, inactive_month = pcall (lang_obj.formatDate, lang_obj, 'F', inactive); -- try to get the month name from the inactive date
if not good then
inactive_month = nil; -- something went wrong so make sure this is unset
end
end
end -- otherwise, |doi-broken-date= has something but it isn't a date
if is_set (inactive_year) and is_set (inactive_month) then
set_message ('maint_doi_inactive_dated', {inactive_year, inactive_month, ' '});
elseif is_set (inactive_year) then
set_message ('maint_doi_inactive_dated', {inactive_year, '', ''});
else
set_message ('maint_doi_inactive');
end
inactive = " (" .. cfg.messages['inactive'] .. ' ' .. inactive .. ')';
end
local registrant = mw.ustring.match (id, '^10%.([^/]+)/[^%s–]-[^%.,]$'); -- registrant set when DOI has the proper basic form
local registrant_err_patterns = { -- these patterns are for code ranges that are not supported
'^[^1-3]%d%d%d%d%.%d+$', -- 5 digits with subcode (0xxxx, 40000+); accepts: 10000–39999
'^[^1-6]%d%d%d%d$', -- 5 digits without subcode (0xxxx, 60000+); accepts: 10000–69999
'^[^1-9]%d%d%d%.%d+$', -- 4 digits with subcode (0xxx); accepts: 1000–9999
'^[^1-9]%d%d%d$', -- 4 digits without subcode (0xxx); accepts: 1000–9999
'^%d%d%d%d%d%d+', -- 6 or more digits
'^%d%d?%d?$', -- less than 4 digits without subcode (3 digits with subcode is legitimate)
'^%d%d?%.[%d%.]+', -- 1 or 2 digits with subcode
'^5555$', -- test registrant will never resolve
'[^%d%.]', -- any character that isn't a digit or a dot
}
if not ignore_invalid then
if registrant then -- when DOI has proper form
for i, pattern in ipairs (registrant_err_patterns) do -- spin through error patterns
if registrant:match (pattern) then -- to validate registrant codes
err_flag = set_message ('err_bad_doi'); -- when found, mark this DOI as bad
break; -- and done
end
end
else
err_flag = set_message ('err_bad_doi'); -- invalid directory or malformed
end
else
set_message ('maint_doi_ignore');
end
if err_flag then
options.coins_list_t['DOI'] = nil; -- when error, unset so not included in COinS
else
if not access and cfg.known_free_doi_registrants_t[registrant] then -- |doi-access=free not set and <registrant> is known to be free
set_message ('maint_doi_unflagged_free'); -- set a maint cat
end
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access,
auto_link = not (err_flag or is_set (inactive) or ignore_invalid) and 'doi' or nil -- do not auto-link when |doi-broken-date= has a value or when there is a DOI error or (to play it safe, after all, auto-linking is not essential) when invalid DOIs are ignored
}) .. (inactive or '');
return text;
end
--[[--------------------------< H D L >------------------------------------------------------------------------
Formats an HDL with minor error checking.
HDL names contain two parts: prefix and suffix separated by a forward slash.
Prefix: character string using any character in the UCS-2 character set except '/'
Suffix: character string of any length using any character in the UCS-2 character set chosen by the registrant
This function checks a HDL name for: prefix/suffix. If the HDL name contains spaces, endashes, or, if it ends
with a period or a comma, this function will emit a bad_hdl error message.
HDL names are case-insensitive and can incorporate any printable Unicode characters so the test for endashes and
terminal punctuation may not be technically correct but it appears, that in practice these characters are rarely
if ever used in HDLs.
Query string parameters are named here: https://www.handle.net/proxy_servlet.html. query strings are not displayed
but since '?' is an allowed character in an HDL, '?' followed by one of the query parameters is the only way we
have to detect the query string so that it isn't URL-encoded with the rest of the identifier.
]]
local function hdl (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
local query_params = { -- list of known query parameters from https://www.handle.net/proxy_servlet.html
'noredirect',
'ignore_aliases',
'auth',
'cert',
'index',
'type',
'urlappend',
'locatt',
'action',
}
local hdl, suffix, param = id:match ('(.-)(%?(%a+).+)$'); -- look for query string
local found;
if hdl then -- when there are query strings, this is the handle identifier portion
for _, q in ipairs (query_params) do -- spin through the list of query parameters
if param:match ('^' .. q) then -- if the query string begins with one of the parameters
found = true; -- announce a find
break; -- and stop looking
end
end
end
if found then
id = hdl; -- found so replace id with the handle portion; this will be URL-encoded, suffix will not
else
suffix = ''; -- make sure suffix is empty string for concatenation else
end
local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, suffix = suffix, separator = handler.separator, encode = handler.encode, access = access})
if nil == id:match("^[^%s–]-/[^%s–]-[^%.,]$") then -- HDL must contain a forward slash, must not contain spaces, endashes, and must not end with period or comma
set_message ('err_bad_hdl' );
options.coins_list_t['HDL'] = nil; -- when error, unset so not included in COinS
end
return text;
end
--[[--------------------------< I S B N >----------------------------------------------------------------------
Determines whether an ISBN string is valid
]]
local function isbn (options)
local isbn_str = options.id;
local ignore_invalid = options.accept;
local handler = options.handler;
local function return_result (check, err_type) -- local function to handle the various returns
local ISBN = internal_link_id ({link = handler.link, label = handler.label, redirect = handler.redirect,
prefix = handler.prefix, id = isbn_str, separator = handler.separator});
if ignore_invalid then -- if ignoring ISBN errors
set_message ('maint_isbn_ignore'); -- add a maint category even when there is no error
else -- here when not ignoring
if not check then -- and there is an error
options.coins_list_t['ISBN'] = nil; -- when error, unset so not included in COinS
set_message ('err_bad_isbn', err_type); -- set an error message
return ISBN; -- return id text
end
end
return ISBN; -- return id text
end
if nil ~= isbn_str:match ('[^%s-0-9X]') then
return return_result (false, cfg.err_msg_supl.char); -- fail if isbn_str contains anything but digits, hyphens, or the uppercase X
end
local id = isbn_str:gsub ('[%s-]', ''); -- remove hyphens and whitespace
local len = id:len();
if len ~= 10 and len ~= 13 then
return return_result (false, cfg.err_msg_supl.length); -- fail if incorrect length
end
if len == 10 then
if id:match ('^%d*X?$') == nil then -- fail if isbn_str has 'X' anywhere but last position
return return_result (false, cfg.err_msg_supl.form);
end
if not is_valid_isxn (id, 10) then -- test isbn-10 for numerical validity
return return_result (false, cfg.err_msg_supl.check); -- fail if isbn-10 is not numerically valid
end
if id:find ('^63[01]') then -- 630xxxxxxx and 631xxxxxxx are (apparently) not valid isbn group ids but are used by amazon as numeric identifiers (asin)
return return_result (false, cfg.err_msg_supl.group); -- fail if isbn-10 begins with 630/1
end
return return_result (true, cfg.err_msg_supl.check); -- pass if isbn-10 is numerically valid
else
if id:match ('^%d+$') == nil then
return return_result (false, cfg.err_msg_supl.char); -- fail if ISBN-13 is not all digits
end
if id:match ('^97[89]%d*$') == nil then
return return_result (false, cfg.err_msg_supl.prefix); -- fail when ISBN-13 does not begin with 978 or 979
end
if id:match ('^9790') then
return return_result (false, cfg.err_msg_supl.group); -- group identifier '0' is reserved to ISMN
end
return return_result (is_valid_isxn_13 (id), cfg.err_msg_supl.check);
end
end
--[[--------------------------< A S I N >----------------------------------------------------------------------
Formats a link to Amazon. Do simple error checking: ASIN must be mix of 10 numeric or uppercase alpha
characters. If a mix, first character must be uppercase alpha; if all numeric, ASINs must be 10-digit
ISBN. If 10-digit ISBN, add a maintenance category so a bot or AWB script can replace |asin= with |isbn=.
Error message if not 10 characters, if not ISBN-10, if mixed and first character is a digit.
|asin=630....... and |asin=631....... are (apparently) not a legitimate ISBN though it checksums as one; these
do not cause this function to emit the maint_asin message
This function is positioned here because it calls isbn()
]]
local function asin (options)
local id = options.id;
local domain = options.ASINTLD;
local err_flag;
if not id:match("^[%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u]$") then
err_flag = set_message ('err_bad_asin'); -- ASIN is not a mix of 10 uppercase alpha and numeric characters
else
if id:match("^%d%d%d%d%d%d%d%d%d[%dX]$") then -- if 10-digit numeric (or 9 digits with terminal X)
if is_valid_isxn (id, 10) then -- see if ASIN value is or validates as ISBN-10
if not id:find ('^63[01]') then -- 630xxxxxxx and 631xxxxxxx are (apparently) not a valid isbn prefixes but are used by amazon as a numeric identifier
err_flag = set_message ('err_bad_asin'); -- ASIN has ISBN-10 form but begins with something other than 630/1 so probably an isbn
end
elseif not is_set (err_flag) then
err_flag = set_message ('err_bad_asin'); -- ASIN is not ISBN-10
end
elseif not id:match("^%u[%d%u]+$") then
err_flag = set_message ('err_bad_asin'); -- asin doesn't begin with uppercase alpha
end
end
if (not is_set (domain)) or in_array (domain, {'us'}) then -- default: United States
domain = "com";
elseif in_array (domain, {'jp', 'uk'}) then -- Japan, United Kingdom
domain = "co." .. domain;
elseif in_array (domain, {'z.cn'}) then -- China
domain = "cn";
elseif in_array (domain, {'au', 'br', 'mx', 'sg', 'tr'}) then -- Australia, Brazil, Mexico, Singapore, Turkey
domain = "com." .. domain;
elseif not in_array (domain, {'ae', 'ca', 'cn', 'de', 'es', 'fr', 'in', 'it', 'nl', 'pl', 'sa', 'se', 'co.jp', 'co.uk', 'com', 'com.au', 'com.br', 'com.mx', 'com.sg', 'com.tr'}) then -- Arabic Emirates, Canada, China, Germany, Spain, France, Indonesia, Italy, Netherlands, Poland, Saudi Arabia, Sweden (as of 2021-03 Austria (.at), Liechtenstein (.li) and Switzerland (.ch) still redirect to the German site (.de) with special settings, so don't maintain local ASINs for them)
err_flag = set_message ('err_bad_asin_tld'); -- unsupported asin-tld value
end
local handler = options.handler;
if not is_set (err_flag) then
options.coins_list_t['ASIN'] = handler.prefix .. domain .. "/dp/" .. id; -- asin for coins
else
options.coins_list_t['ASIN'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix .. domain .. "/dp/",
id = id, encode = handler.encode, separator = handler.separator})
end
--[[--------------------------< I S M N >----------------------------------------------------------------------
Determines whether an ISMN string is valid. Similar to ISBN-13, ISMN is 13 digits beginning 979-0-... and uses the
same check digit calculations. See https://www.ismn-international.org/download/Web_ISMN_Users_Manual_2008-6.pdf
section 2, pages 9–12.
ismn value not made part of COinS metadata because we don't have a url or isn't a COinS-defined identifier (rft.xxx)
or an identifier registered at info-uri.info (info:)
]]
local function ismn (options)
local id = options.id;
local handler = options.handler;
local text;
local valid_ismn = true;
local id_copy;
id_copy = id; -- save a copy because this testing is destructive
id = id:gsub ('[%s-]', ''); -- remove hyphens and white space
if 13 ~= id:len() or id:match ("^9790%d*$" ) == nil then -- ISMN must be 13 digits and begin with 9790
valid_ismn = false;
else
valid_ismn=is_valid_isxn_13 (id); -- validate ISMN
end
-- text = internal_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect, -- use this (or external version) when there is some place to link to
-- prefix = handler.prefix, id = id_copy, separator = handler.separator, encode = handler.encode})
text = table.concat ( -- because no place to link to yet
{
make_wikilink (link_label_make (handler), handler.label),
handler.separator,
id_copy
});
if false == valid_ismn then
options.coins_list_t['ISMN'] = nil; -- when error, unset so not included in COinS; not really necessary here because ismn not made part of COinS
set_message ('err_bad_ismn'); -- create an error message if the ISMN is invalid
end
return text;
end
--[[--------------------------< I S S N >----------------------------------------------------------------------
Validate and format an ISSN. This code fixes the case where an editor has included an ISSN in the citation but
has separated the two groups of four digits with a space. When that condition occurred, the resulting link looked
like this:
|issn=0819 4327 gives: [https://www.worldcat.org/issn/0819 4327 0819 4327] -- can't have spaces in an external link
This code now prevents that by inserting a hyphen at the ISSN midpoint. It also validates the ISSN for length
and makes sure that the checkdigit agrees with the calculated value. Incorrect length (8 digits), characters
other than 0-9 and X, or checkdigit / calculated value mismatch will all cause a check ISSN error message. The
ISSN is always displayed with a hyphen, even if the ISSN was given as a single group of 8 digits.
]]
local function issn (options)
local id = options.id;
local handler = options.handler;
local ignore_invalid = options.accept;
local issn_copy = id; -- save a copy of unadulterated ISSN; use this version for display if ISSN does not validate
local text;
local valid_issn = true;
id = id:gsub ('[%s-]', ''); -- remove hyphens and whitespace
if 8 ~= id:len() or nil == id:match ("^%d*X?$" ) then -- validate the ISSN: 8 digits long, containing only 0-9 or X in the last position
valid_issn = false; -- wrong length or improper character
else
valid_issn = is_valid_isxn (id, 8); -- validate ISSN
end
if true == valid_issn then
id = string.sub (id, 1, 4 ) .. "-" .. string.sub (id, 5 ); -- if valid, display correctly formatted version
else
id = issn_copy; -- if not valid, show the invalid ISSN with error message
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode})
if ignore_invalid then
set_message ('maint_issn_ignore');
else
if false == valid_issn then
options.coins_list_t['ISSN'] = nil; -- when error, unset so not included in COinS
set_message ('err_bad_issn', (options.hkey == 'EISSN') and 'e' or ''); -- create an error message if the ISSN is invalid
end
end
return text;
end
--[[--------------------------< J F M >-----------------------------------------------------------------------
A numerical identifier in the form nn.nnnn.nn
]]
local function jfm (options)
local id = options.id;
local handler = options.handler;
local id_num;
id_num = id:match ('^[Jj][Ff][Mm](.*)$'); -- identifier with jfm prefix; extract identifier
if is_set (id_num) then
set_message ('maint_jfm_format');
else -- plain number without JFM prefix
id_num = id; -- if here id does not have prefix
end
if id_num and id_num:match('^%d%d%.%d%d%d%d%.%d%d$') then
id = id_num; -- jfm matches pattern
else
set_message ('err_bad_jfm' ); -- set an error message
options.coins_list_t['JFM'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});
end
--[[--------------------------< J S T O R >--------------------------------------------------------------------
Format a JSTOR with some error checking
]]
local function jstor (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
if id:find ('[Jj][Ss][Tt][Oo][Rr]') or id:find ('^https?://') or id:find ('%s') then
set_message ('err_bad_jstor'); -- set an error message
options.coins_list_t['JSTOR'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});
end
--[[--------------------------< L C C N >----------------------------------------------------------------------
Format LCCN link and do simple error checking. LCCN is a character string 8-12 characters long. The length of
the LCCN dictates the character type of the first 1-3 characters; the rightmost eight are always digits.
https://oclc-research.github.io/infoURI-Frozen/info-uri.info/info:lccn/reg.html
length = 8 then all digits
length = 9 then lccn[1] is lowercase alpha
length = 10 then lccn[1] and lccn[2] are both lowercase alpha or both digits
length = 11 then lccn[1] is lower case alpha, lccn[2] and lccn[3] are both lowercase alpha or both digits
length = 12 then lccn[1] and lccn[2] are both lowercase alpha
]]
local function lccn (options)
local lccn = options.id;
local handler = options.handler;
local err_flag; -- presume that LCCN is valid
local id = lccn; -- local copy of the LCCN
id = normalize_lccn (id); -- get canonical form (no whitespace, hyphens, forward slashes)
local len = id:len(); -- get the length of the LCCN
if 8 == len then
if id:match("[^%d]") then -- if LCCN has anything but digits (nil if only digits)
err_flag = set_message ('err_bad_lccn'); -- set an error message
end
elseif 9 == len then -- LCCN should be adddddddd
if nil == id:match("%l%d%d%d%d%d%d%d%d") then -- does it match our pattern?
err_flag = set_message ('err_bad_lccn'); -- set an error message
end
elseif 10 == len then -- LCCN should be aadddddddd or dddddddddd
if id:match("[^%d]") then -- if LCCN has anything but digits (nil if only digits) ...
if nil == id:match("^%l%l%d%d%d%d%d%d%d%d") then -- ... see if it matches our pattern
err_flag = set_message ('err_bad_lccn'); -- no match, set an error message
end
end
elseif 11 == len then -- LCCN should be aaadddddddd or adddddddddd
if not (id:match("^%l%l%l%d%d%d%d%d%d%d%d") or id:match("^%l%d%d%d%d%d%d%d%d%d%d")) then -- see if it matches one of our patterns
err_flag = set_message ('err_bad_lccn'); -- no match, set an error message
end
elseif 12 == len then -- LCCN should be aadddddddddd
if not id:match("^%l%l%d%d%d%d%d%d%d%d%d%d") then -- see if it matches our pattern
err_flag = set_message ('err_bad_lccn'); -- no match, set an error message
end
else
err_flag = set_message ('err_bad_lccn'); -- wrong length, set an error message
end
if not is_set (err_flag) and nil ~= lccn:find ('%s') then
err_flag = set_message ('err_bad_lccn'); -- lccn contains a space, set an error message
end
if is_set (err_flag) then
options.coins_list_t['LCCN'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = lccn, separator = handler.separator, encode = handler.encode});
end
--[[--------------------------< M E D R X I V >-----------------------------------------------------------------
Format medRxiv ID and do simple error checking. Similar to later bioRxiv IDs, medRxiv IDs are prefixed with a
yyyy.mm.dd. date and suffixed with an optional version identifier. Ealiest date accepted is 2020.01.01
The medRxiv ID is a date followed by an eight-digit number followed by an optional version indicator 'v' and one or more digits:
https://www.medrxiv.org/content/10.1101/2020.11.16.20232009v2 -> 10.1101/2020.11.16.20232009v2
]]
local function medrxiv (options)
local id = options.id;
local handler = options.handler;
local err_msg_flag = true; -- flag; assume that there will be an error
local patterns = {
'%d%d%d%d%d%d%d%d$', -- simple 8-digit identifier; these should be relatively rare
'^10%.1101/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d%d%dv%d+$', -- y.m.d. date + 8-digit identifier + version (2020-01-01 and later)
'^10%.1101/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d%d%d$', -- y.m.d. date + 8-digit identifier (2020-01-01 and later)
}
for _, pattern in ipairs (patterns) do -- spin through the patterns looking for a match
if id:match (pattern) then
local y, m, d = id:match (pattern); -- found a match, attempt to get year, month and date from the identifier
if m then -- m is nil when id is the 8-digit form
if not is_valid_rxiv_date (y, m, d, 'b') then -- validate the encoded date; 'b' for medrxiv limit
break; -- date fail; break out early so we don't unset the error message
end
end
err_msg_flag = nil; -- we found a match so unset the error message
break; -- and done
end
end -- <err_msg_flag> remains set here when no match
if err_msg_flag then
options.coins_list_t['MEDRXIV'] = nil; -- when error, unset so not included in COinS
set_message ('err_bad_medrxiv'); -- and set the error message
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator,
encode = handler.encode, access = handler.access});
end
--[[--------------------------< M R >--------------------------------------------------------------------------
A seven digit number; if not seven digits, zero-fill leading digits to make seven digits.
]]
local function mr (options)
local id = options.id;
local handler = options.handler;
local id_num;
local id_len;
id_num = id:match ('^[Mm][Rr](%d+)$'); -- identifier with mr prefix
if is_set (id_num) then
set_message ('maint_mr_format'); -- add maint cat
else -- plain number without mr prefix
id_num = id:match ('^%d+$'); -- if here id is all digits
end
id_len = id_num and id_num:len() or 0;
if (7 >= id_len) and (0 ~= id_len) then
id = string.rep ('0', 7-id_len) .. id_num; -- zero-fill leading digits
else
set_message ('err_bad_mr'); -- set an error message
options.coins_list_t['MR'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});
end
--[[--------------------------< O C L C >----------------------------------------------------------------------
Validate and format an OCLC ID. https://www.oclc.org/batchload/controlnumber.en.html {{dead link}}
archived at: https://web.archive.org/web/20161228233804/https://www.oclc.org/batchload/controlnumber.en.html
]]
local function oclc (options)
local id = options.id;
local handler = options.handler;
local number;
if id:match('^ocm%d%d%d%d%d%d%d%d$') then -- ocm prefix and 8 digits; 001 field (12 characters)
number = id:match('ocm(%d+)'); -- get the number
elseif id:match('^ocn%d%d%d%d%d%d%d%d%d$') then -- ocn prefix and 9 digits; 001 field (12 characters)
number = id:match('ocn(%d+)'); -- get the number
elseif id:match('^on%d%d%d%d%d%d%d%d%d%d+$') then -- on prefix and 10 or more digits; 001 field (12 characters)
number = id:match('^on(%d%d%d%d%d%d%d%d%d%d+)$'); -- get the number
elseif id:match('^%(OCoLC%)[1-9]%d*$') then -- (OCoLC) prefix and variable number digits; no leading zeros; 035 field
number = id:match('%(OCoLC%)([1-9]%d*)'); -- get the number
if 9 < number:len() then
number = nil; -- constrain to 1 to 9 digits; change this when OCLC issues 10-digit numbers
end
elseif id:match('^%d+$') then -- no prefix
number = id; -- get the number
if tonumber (id) > handler.id_limit then
number = nil; -- unset when id value exceeds the limit
end
end
if number then -- proper format
id = number; -- exclude prefix, if any, from external link
else
set_message ('err_bad_oclc') -- add an error message if the id is malformed
options.coins_list_t['OCLC'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});
end
--[[--------------------------< O P E N L I B R A R Y >--------------------------------------------------------
Formats an OpenLibrary link, and checks for associated errors.
]]
local function openlibrary (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
local ident, code = id:gsub('^OL', ''):match("^(%d+([AMW]))$"); -- strip optional OL prefix followed immediately by digits followed by 'A', 'M', or 'W';
local err_flag;
local prefix = { -- these are appended to the handler.prefix according to code
['A']='authors/OL',
['M']='books/OL',
['W']='works/OL',
['X']='OL' -- not a code; spoof when 'code' in id is invalid
};
if not ident then
code = 'X'; -- no code or id completely invalid
ident = id; -- copy id to ident so that we display the flawed identifier
err_flag = set_message ('err_bad_ol');
end
if not is_set (err_flag) then
options.coins_list_t['OL'] = handler.prefix .. prefix[code] .. ident; -- experiment for ol coins
else
options.coins_list_t['OL'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix .. prefix[code],
id = ident, separator = handler.separator, encode = handler.encode,
access = access});
end
--[[--------------------------< O S T I >----------------------------------------------------------------------
Format OSTI and do simple error checking. OSTIs are sequential numbers beginning at 1 and counting up. This
code checks the OSTI to see that it contains only digits and is less than test_limit specified in the configuration;
the value in test_limit will need to be updated periodically as more OSTIs are issued.
NB. 1018 is the lowest OSTI number found in the wild (so far) and resolving OK on the OSTI site
]]
local function osti (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
if id:match("[^%d]") then -- if OSTI has anything but digits
set_message ('err_bad_osti'); -- set an error message
options.coins_list_t['OSTI'] = nil; -- when error, unset so not included in COinS
else -- OSTI is only digits
local id_num = tonumber (id); -- convert id to a number for range testing
if 1018 > id_num or handler.id_limit < id_num then -- if OSTI is outside test limit boundaries
set_message ('err_bad_osti'); -- set an error message
options.coins_list_t['OSTI'] = nil; -- when error, unset so not included in COinS
end
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});
end
--[[--------------------------< P M C >------------------------------------------------------------------------
Format a PMC, do simple error checking, and check for embargoed articles.
The embargo parameter takes a date for a value. If the embargo date is in the future the PMC identifier will not
be linked to the article. If the embargo date is today or in the past, or if it is empty or omitted, then the
PMC identifier is linked to the article through the link at cfg.id_handlers['PMC'].prefix.
PMC embargo date testing is done in function is_embargoed () which is called earlier because when the citation
has |pmc=<value> but does not have a |url= then |title= is linked with the PMC link. Function is_embargoed ()
returns the embargo date if the PMC article is still embargoed, otherwise it returns an empty string.
PMCs are sequential numbers beginning at 1 and counting up. This code checks the PMC to see that it contains only digits and is less
than test_limit; the value in local variable test_limit will need to be updated periodically as more PMCs are issued.
]]
local function pmc (options)
local id = options.id;
local embargo = options.Embargo; -- TODO: lowercase?
local handler = options.handler;
local err_flag;
local id_num;
local text;
id_num = id:match ('^[Pp][Mm][Cc](%d+)$'); -- identifier with PMC prefix
if is_set (id_num) then
set_message ('maint_pmc_format');
else -- plain number without PMC prefix
id_num = id:match ('^%d+$'); -- if here id is all digits
end
if is_set (id_num) then -- id_num has a value so test it
id_num = tonumber (id_num); -- convert id_num to a number for range testing
if 1 > id_num or handler.id_limit < id_num then -- if PMC is outside test limit boundaries
err_flag = set_message ('err_bad_pmc'); -- set an error message
else
id = tostring (id_num); -- make sure id is a string
end
else -- when id format incorrect
err_flag = set_message ('err_bad_pmc'); -- set an error message
end
if is_set (embargo) and is_set (is_embargoed (embargo)) then -- is PMC is still embargoed?
text = table.concat ( -- still embargoed so no external link
{
make_wikilink (link_label_make (handler), handler.label),
handler.separator,
id,
});
else
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect, -- no embargo date or embargo has expired, ok to link to article
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access,
auto_link = not err_flag and 'pmc' or nil -- do not auto-link when PMC has error
});
end
if err_flag then
options.coins_list_t['PMC'] = nil; -- when error, unset so not included in COinS
end
return text;
end
--[[--------------------------< P M I D >----------------------------------------------------------------------
Format PMID and do simple error checking. PMIDs are sequential numbers beginning at 1 and counting up. This
code checks the PMID to see that it contains only digits and is less than test_limit; the value in local variable
test_limit will need to be updated periodically as more PMIDs are issued.
]]
local function pmid (options)
local id = options.id;
local handler = options.handler;
if id:match("[^%d]") then -- if PMID has anything but digits
set_message ('err_bad_pmid'); -- set an error message
options.coins_list_t['PMID'] = nil; -- when error, unset so not included in COinS
else -- PMID is only digits
local id_num = tonumber (id); -- convert id to a number for range testing
if 1 > id_num or handler.id_limit < id_num then -- if PMID is outside test limit boundaries
set_message ('err_bad_pmid'); -- set an error message
options.coins_list_t['PMID'] = nil; -- when error, unset so not included in COinS
end
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});
end
--[[--------------------------< R F C >------------------------------------------------------------------------
Format RFC and do simple error checking. RFCs are sequential numbers beginning at 1 and counting up. This
code checks the RFC to see that it contains only digits and is less than test_limit specified in the configuration;
the value in test_limit will need to be updated periodically as more RFCs are issued.
An index of all RFCs is here: https://tools.ietf.org/rfc/
]]
local function rfc (options)
local id = options.id;
local handler = options.handler;
if id:match("[^%d]") then -- if RFC has anything but digits
set_message ('err_bad_rfc'); -- set an error message
options.coins_list_t['RFC'] = nil; -- when error, unset so not included in COinS
else -- RFC is only digits
local id_num = tonumber (id); -- convert id to a number for range testing
if 1 > id_num or handler.id_limit < id_num then -- if RFC is outside test limit boundaries
set_message ('err_bad_rfc'); -- set an error message
options.coins_list_t['RFC'] = nil; -- when error, unset so not included in COinS
end
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access});
end
--[[--------------------------< S 2 C I D >--------------------------------------------------------------------
Format an S2CID, do simple error checking
S2CIDs are sequential numbers beginning at 1 and counting up. This code checks the S2CID to see that it is only
digits and is less than test_limit; the value in local variable test_limit will need to be updated periodically
as more S2CIDs are issued.
]]
local function s2cid (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
local id_num;
local text;
id_num = id:match ('^[1-9]%d*$'); -- id must be all digits; must not begin with 0; no open access flag
if is_set (id_num) then -- id_num has a value so test it
id_num = tonumber (id_num); -- convert id_num to a number for range testing
if handler.id_limit < id_num then -- if S2CID is outside test limit boundaries
set_message ('err_bad_s2cid'); -- set an error message
options.coins_list_t['S2CID'] = nil; -- when error, unset so not included in COinS
end
else -- when id format incorrect
set_message ('err_bad_s2cid'); -- set an error message
options.coins_list_t['S2CID'] = nil; -- when error, unset so not included in COinS
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});
return text;
end
--[[--------------------------< S B N >------------------------------------------------------------------------
9-digit form of ISBN-10; uses same check-digit validation when SBN is prefixed with an additional '0' to make 10 digits
sbn value not made part of COinS metadata because we don't have a url or isn't a COinS-defined identifier (rft.xxx)
or an identifier registered at info-uri.info (info:)
]]
local function sbn (options)
local id = options.id;
local ignore_invalid = options.accept;
local handler = options.handler;
local function return_result (check, err_type) -- local function to handle the various returns
local SBN = internal_link_id ({link = handler.link, label = handler.label, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator});
if not ignore_invalid then -- if not ignoring SBN errors
if not check then
options.coins_list_t['SBN'] = nil; -- when error, unset so not included in COinS; not really necessary here because sbn not made part of COinS
set_message ('err_bad_sbn', {err_type}); -- display an error message
return SBN;
end
else
set_message ('maint_isbn_ignore'); -- add a maint category even when there is no error (ToDo: Possibly switch to separate message for SBNs only)
end
return SBN;
end
if id:match ('[^%s-0-9X]') then
return return_result (false, cfg.err_msg_supl.char); -- fail if SBN contains anything but digits, hyphens, or the uppercase X
end
local ident = id:gsub ('[%s-]', ''); -- remove hyphens and whitespace; they interfere with the rest of the tests
if 9 ~= ident:len() then
return return_result (false, cfg.err_msg_supl.length); -- fail if incorrect length
end
if ident:match ('^%d*X?$') == nil then
return return_result (false, cfg.err_msg_supl.form); -- fail if SBN has 'X' anywhere but last position
end
return return_result (is_valid_isxn ('0' .. ident, 10), cfg.err_msg_supl.check);
end
--[[--------------------------< S S R N >----------------------------------------------------------------------
Format an SSRN, do simple error checking
SSRNs are sequential numbers beginning at 100? and counting up. This code checks the SSRN to see that it is
only digits and is greater than 99 and less than test_limit; the value in local variable test_limit will need
to be updated periodically as more SSRNs are issued.
]]
local function ssrn (options)
local id = options.id;
local handler = options.handler;
local id_num;
local text;
id_num = id:match ('^%d+$'); -- id must be all digits
if is_set (id_num) then -- id_num has a value so test it
id_num = tonumber (id_num); -- convert id_num to a number for range testing
if 100 > id_num or handler.id_limit < id_num then -- if SSRN is outside test limit boundaries
set_message ('err_bad_ssrn'); -- set an error message
options.coins_list_t['SSRN'] = nil; -- when error, unset so not included in COinS
end
else -- when id format incorrect
set_message ('err_bad_ssrn'); -- set an error message
options.coins_list_t['SSRN'] = nil; -- when error, unset so not included in COinS
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = options.access});
return text;
end
--[[--------------------------< U S E N E T _ I D >------------------------------------------------------------
Validate and format a usenet message id. Simple error checking, looks for 'id-left@id-right' not enclosed in
'<' and/or '>' angle brackets.
]]
local function usenet_id (options)
local id = options.id;
local handler = options.handler;
local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode})
if not id:match('^.+@.+$') or not id:match('^[^<].*[^>]$') then -- doesn't have '@' or has one or first or last character is '< or '>'
set_message ('err_bad_usenet_id') -- add an error message if the message id is invalid
options.coins_list_t['USENETID'] = nil; -- when error, unset so not included in COinS
end
return text;
end
--[[--------------------------< Z B L >-----------------------------------------------------------------------
A numerical identifier in the form nnnn.nnnnn - leading zeros in the first quartet optional
format described here: http://emis.mi.sanu.ac.rs/ZMATH/zmath/en/help/search/
temporary format is apparently eight digits. Anything else is an error
]]
local function zbl (options)
local id = options.id;
local handler = options.handler;
if id:match('^%d%d%d%d%d%d%d%d$') then -- is this identifier using temporary format?
set_message ('maint_zbl'); -- yes, add maint cat
elseif not id:match('^%d?%d?%d?%d%.%d%d%d%d%d$') then -- not temporary, is it normal format?
set_message ('err_bad_zbl'); -- no, set an error message
options.coins_list_t['ZBL'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});
end
--============================<< I N T E R F A C E F U N C T I O N S >>==========================================
--[[--------------------------< E X T R A C T _ I D S >------------------------------------------------------------
Populates ID table from arguments using configuration settings. Loops through cfg.id_handlers and searches args for
any of the parameters listed in each cfg.id_handlers['...'].parameters. If found, adds the parameter and value to
the identifier list. Emits redundant error message if more than one alias exists in args
]]
local function extract_ids (args)
local id_list = {}; -- list of identifiers found in args
for k, v in pairs (cfg.id_handlers) do -- k is uppercase identifier name as index to cfg.id_handlers; e.g. cfg.id_handlers['ISBN'], v is a table
v = select_one (args, v.parameters, 'err_redundant_parameters' ); -- v.parameters is a table of aliases for k; here we pick one from args if present
if is_set (v) then id_list[k] = v; end -- if found in args, add identifier to our list
end
return id_list;
end
--[[--------------------------< E X T R A C T _ I D _ A C C E S S _ L E V E L S >--------------------------------------
Fetches custom id access levels from arguments using configuration settings. Parameters which have a predefined access
level (e.g. arxiv) do not use this function as they are directly rendered as free without using an additional parameter.
returns a table of k/v pairs where k is same as the identifier's key in cfg.id_handlers and v is the assigned (valid) keyword
access-level values must match the case used in cfg.keywords_lists['id-access'] (lowercase unless there is some special reason for something else)
]]
local function extract_id_access_levels (args, id_list)
local id_accesses_list = {};
for k, v in pairs (cfg.id_handlers) do
local access_param = v.custom_access; -- name of identifier's access-level parameter
if is_set (access_param) then
local access_level = args[access_param]; -- get the assigned value if there is one
if is_set (access_level) then
if not in_array (access_level, cfg.keywords_lists['id-access']) then -- exact match required
set_message ('err_invalid_param_val', {access_param, access_level});
access_level = nil; -- invalid so unset
end
if not is_set (id_list[k]) then -- identifier access-level must have a matching identifier
set_message ('err_param_access_requires_param', {k:lower()}); -- parameter name is uppercase in cfg.id_handlers (k); lowercase for error message
end
id_accesses_list[k] = cfg.keywords_xlate[access_level]; -- get translated keyword
end
end
end
return id_accesses_list;
end
--[[--------------------------< B U I L D _ I D _ L I S T >----------------------------------------------------
render the identifiers into a sorted sequence table
<ID_list_coins_t> is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value
<options_t> is a table of various k/v option pairs provided in the call to new_build_id_list();
modified by this function and passed to all identifier rendering functions
<access_levels_t> is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value (if valid)
returns a sequence table of sorted (by hkey - 'handler' key) rendered identifier strings
]]
local function build_id_list (ID_list_coins_t, options_t, access_levels_t)
local ID_list_t = {};
local accept;
local func_map = { --function map points to functions associated with hkey identifier
['ARXIV'] = arxiv,
['ASIN'] = asin,
['BIBCODE'] = bibcode,
['BIORXIV'] = biorxiv,
['CITESEERX'] = citeseerx,
['DOI'] = doi,
['EISSN'] = issn,
['HDL'] = hdl,
['ISBN'] = isbn,
['ISMN'] = ismn,
['ISSN'] = issn,
['JFM'] = jfm,
['JSTOR'] = jstor,
['LCCN'] = lccn,
['MEDRXIV'] = medrxiv,
['MR'] = mr,
['OCLC'] = oclc,
['OL'] = openlibrary,
['OSTI'] = osti,
['PMC'] = pmc,
['PMID'] = pmid,
['RFC'] = rfc,
['S2CID'] = s2cid,
['SBN'] = sbn,
['SSRN'] = ssrn,
['USENETID'] = usenet_id,
['ZBL'] = zbl,
}
for hkey, v in pairs (ID_list_coins_t) do
v, accept = has_accept_as_written (v); -- remove accept-as-written markup if present; accept is boolean true when markup removed; false else
-- every function gets the options table with value v and accept boolean
options_t.hkey = hkey; -- ~/Configuration handler key
options_t.id = v; -- add that identifier value to the options table
options_t.accept = accept; -- add the accept boolean flag
options_t.access = access_levels_t[hkey]; -- add the access level for those that have an |<identifier-access= parameter
options_t.handler = cfg.id_handlers[hkey];
options_t.coins_list_t = ID_list_coins_t; -- pointer to ID_list_coins_t; for |asin= and |ol=; also to keep erroneous values out of the citation's metadata
options_t.coins_list_t[hkey] = v; -- id value without accept-as-written markup for metadata
if options_t.handler.access and not in_array (options_t.handler.access, cfg.keywords_lists['id-access']) then
error (cfg.messages['unknown_ID_access'] .. options_t.handler.access); -- here when handler access key set to a value not listed in list of allowed id access keywords
end
if func_map[hkey] then
local id_text = func_map[hkey] (options_t); -- call the function to get identifier text and any error message
table.insert (ID_list_t, {hkey, id_text}); -- add identifier text to the output sequence table
else
error (cfg.messages['unknown_ID_key'] .. hkey); -- here when func_map doesn't have a function for hkey
end
end
local function comp (a, b) -- used by following table.sort()
return a[1]:lower() < b[1]:lower(); -- sort by hkey
end
table.sort (ID_list_t, comp); -- sequence table of tables sort
for k, v in ipairs (ID_list_t) do -- convert sequence table of tables to simple sequence table of strings
ID_list_t[k] = v[2]; -- v[2] is the identifier rendering from the call to the various functions in func_map{}
end
return ID_list_t;
end
--[[--------------------------< O P T I O N S _ C H E C K >----------------------------------------------------
check that certain option parameters have their associated identifier parameters with values
<ID_list_coins_t> is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value
<ID_support_t> is a sequence table of tables created in citation0() where each subtable has four elements:
[1] is the support parameter's assigned value; empty string if not set
[2] is a text string same as key in cfg.id_handlers
[3] is cfg.error_conditions key used to create error message
[4] is original ID support parameter name used to create error message
returns nothing; on error emits an appropriate error message
]]
local function options_check (ID_list_coins_t, ID_support_t)
for _, v in ipairs (ID_support_t) do
if is_set (v[1]) and not ID_list_coins_t[v[2]] then -- when support parameter has a value but matching identifier parameter is missing or empty
set_message (v[3], (v[4])); -- emit the appropriate error message
end
end
end
--[[--------------------------< I D E N T I F I E R _ L I S T S _ G E T >--------------------------------------
Creates two identifier lists: a k/v table of identifiers and their values to be used locally and for use in the
COinS metadata, and a sequence table of the rendered identifier strings that will be included in the rendered
citation.
]]
local function identifier_lists_get (args_t, options_t, ID_support_t)
local ID_list_coins_t = extract_ids (args_t); -- get a table of identifiers and their values for use locally and for use in COinS
options_check (ID_list_coins_t, ID_support_t); -- ID support parameters must have matching identifier parameters
local ID_access_levels_t = extract_id_access_levels (args_t, ID_list_coins_t); -- get a table of identifier access levels
local ID_list_t = build_id_list (ID_list_coins_t, options_t, ID_access_levels_t); -- get a sequence table of rendered identifier strings
return ID_list_t, ID_list_coins_t; -- return the tables
end
--[[--------------------------< S E T _ S E L E C T E D _ M O D U L E S >--------------------------------------
Sets local cfg table and imported functions table to same (live or sandbox) as that used by the other modules.
]]
local function set_selected_modules (cfg_table_ptr, utilities_page_ptr)
cfg = cfg_table_ptr;
has_accept_as_written = utilities_page_ptr.has_accept_as_written; -- import functions from select Module:Citation/CS1/Utilities module
is_set = utilities_page_ptr.is_set;
in_array = utilities_page_ptr.in_array;
set_message = utilities_page_ptr.set_message;
select_one = utilities_page_ptr.select_one;
substitute = utilities_page_ptr.substitute;
make_wikilink = utilities_page_ptr.make_wikilink;
z = utilities_page_ptr.z; -- table of tables in Module:Citation/CS1/Utilities
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {
auto_link_urls = auto_link_urls, -- table of identifier URLs to be used when auto-linking |title=
identifier_lists_get = identifier_lists_get, -- experiment to replace individual calls to build_id_list(), extract_ids, extract_id_access_levels
is_embargoed = is_embargoed;
set_selected_modules = set_selected_modules;
}
3abc2deceb5ede29ebd4cded31822d8bda63ab7d
Module:Citation/CS1/Date validation
828
20
35
2023-11-25T16:42:10Z
wikipedia>Trappist the monk
0
sync from sandbox;
Scribunto
text/plain
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
]]
local add_prop_cat, is_set, in_array, set_message, substitute, wrap_style; -- imported functions from selected Module:Citation/CS1/Utilities
local cfg; -- table of tables imported from selected Module:Citation/CS1/Configuration
--[[--------------------------< F I L E - S C O P E D E C L A R A T I O N S >--------------------------------
File-scope variables are declared here
]]
local lang_object = mw.getContentLanguage(); -- used by is_valid_accessdate(), is_valid_year(), date_name_xlate(); TODO: move to ~/Configuration?
local year_limit; -- used by is_valid_year()
--[=[-------------------------< I S _ V A L I D _ A C C E S S D A T E >----------------------------------------
returns true if:
Wikipedia start date <= accessdate < today + 2 days
Wikipedia start date is 2001-01-15T00:00:00 UTC which is 979516800 seconds after 1970-01-01T00:00:00 UTC (the start of Unix time)
accessdate is the date provided in |access-date= at time 00:00:00 UTC
today is the current date at time 00:00:00 UTC plus 48 hours
if today is 2015-01-01T00:00:00 then
adding 24 hours gives 2015-01-02T00:00:00 – one second more than today
adding 24 hours gives 2015-01-03T00:00:00 – one second more than tomorrow
This function does not work if it is fed month names for languages other than English. Wikimedia #time: parser
apparently doesn't understand non-English date month names. This function will always return false when the date
contains a non-English month name because good1 is false after the call to lang.formatDate(). To get around that
call this function with YYYY-MM-DD format dates.
]=]
local function is_valid_accessdate (accessdate)
local good1, good2;
local access_ts, tomorrow_ts; -- to hold Unix time stamps representing the dates
good1, access_ts = pcall (lang_object.formatDate, lang_object, 'U', accessdate ); -- convert accessdate value to Unix timestamp
good2, tomorrow_ts = pcall (lang_object.formatDate, lang_object, 'U', 'today + 2 days' ); -- today midnight + 2 days is one second more than all day tomorrow
if good1 and good2 then -- lang.formatDate() returns a timestamp in the local script which which tonumber() may not understand
access_ts = tonumber (access_ts) or lang_object:parseFormattedNumber (access_ts); -- convert to numbers for the comparison;
tomorrow_ts = tonumber (tomorrow_ts) or lang_object:parseFormattedNumber (tomorrow_ts);
else
return false; -- one or both failed to convert to Unix time stamp
end
if 979516800 <= access_ts and access_ts < tomorrow_ts then -- Wikipedia start date <= accessdate < tomorrow's date
return true;
else
return false; -- accessdate out of range
end
end
--[[--------------------------< G E T _ M O N T H _ N U M B E R >----------------------------------------------
returns a number according to the month in a date: 1 for January, etc. Capitalization and spelling must be correct.
If not a valid month, returns 0
]]
local function get_month_number (month)
return cfg.date_names['local'].long[month] or cfg.date_names['local'].short[month] or -- look for local names first
cfg.date_names['en'].long[month] or cfg.date_names['en'].short[month] or -- failing that, look for English names
0; -- not a recognized month name
end
--[[--------------------------< G E T _ S E A S O N _ N U M B E R >--------------------------------------------
returns a number according to the sequence of seasons in a year: 21 for Spring, etc. Capitalization and spelling
must be correct. If not a valid season, returns 0.
21-24 = Spring, Summer, Autumn, Winter, independent of “Hemisphere”
returns 0 when <param> is not |date=
Season numbering is defined by Extended Date/Time Format (EDTF) specification (https://www.loc.gov/standards/datetime/)
which became part of ISO 8601 in 2019. See '§Sub-year groupings'. The standard defines various divisions using
numbers 21-41. cs1|2 only supports generic seasons. EDTF does support the distinction between north and south
hemisphere seasons but cs1|2 has no way to make that distinction.
These additional divisions not currently supported:
25-28 = Spring - Northern Hemisphere, Summer- Northern Hemisphere, Autumn - Northern Hemisphere, Winter - Northern Hemisphere
29-32 = Spring – Southern Hemisphere, Summer– Southern Hemisphere, Autumn – Southern Hemisphere, Winter - Southern Hemisphere
33-36 = Quarter 1, Quarter 2, Quarter 3, Quarter 4 (3 months each)
37-39 = Quadrimester 1, Quadrimester 2, Quadrimester 3 (4 months each)
40-41 = Semestral 1, Semestral-2 (6 months each)
]]
local function get_season_number (season, param)
if 'date' ~= param then
return 0; -- season dates only supported by |date=
end
return cfg.date_names['local'].season[season] or -- look for local names first
cfg.date_names['en'].season[season] or -- failing that, look for English names
0; -- not a recognized season name
end
--[[--------------------------< G E T _ Q U A R T E R _ N U M B E R >------------------------------------------
returns a number according to the sequence of quarters in a year: 33 for first quarter, etc. Capitalization and spelling
must be correct. If not a valid quarter, returns 0.
33-36 = Quarter 1, Quarter 2, Quarter 3, Quarter 4 (3 months each)
returns 0 when <param> is not |date=
Quarter numbering is defined by Extended Date/Time Format (EDTF) specification (https://www.loc.gov/standards/datetime/)
which became part of ISO 8601 in 2019. See '§Sub-year groupings'. The standard defines various divisions using
numbers 21-41. cs1|2 only supports generic seasons and quarters.
These additional divisions not currently supported:
37-39 = Quadrimester 1, Quadrimester 2, Quadrimester 3 (4 months each)
40-41 = Semestral 1, Semestral-2 (6 months each)
]]
local function get_quarter_number (quarter, param)
if 'date' ~= param then
return 0; -- quarter dates only supported by |date=
end
quarter = mw.ustring.gsub (quarter, ' +', ' '); -- special case replace multiple space chars with a single space char
return cfg.date_names['local'].quarter[quarter] or -- look for local names first
cfg.date_names['en'].quarter[quarter] or -- failing that, look for English names
0; -- not a recognized quarter name
end
--[[--------------------------< G E T _ P R O P E R _ N A M E _ N U M B E R >----------------------------------
returns a non-zero number if date contains a recognized proper-name. Capitalization and spelling must be correct.
returns 0 when <param> is not |date=
]]
local function get_proper_name_number (name, param)
if 'date' ~= param then
return 0; -- proper-name dates only supported by |date=
end
return cfg.date_names['local'].named[name] or -- look for local names dates first
cfg.date_names['en'].named[name] or -- failing that, look for English names
0; -- not a recognized named date
end
--[[--------------------------< G E T _ E L E M E N T _ N U M B E R <------------------------------------------
returns true if month or season or quarter or proper name is valid (properly spelled, capitalized, abbreviated)
]]
local function get_element_number (element, param)
local num;
local funcs = {get_month_number, get_season_number, get_quarter_number, get_proper_name_number}; -- list of functions to execute in order
for _, func in ipairs (funcs) do -- spin through the function list
num = func (element, param); -- call the function and get the returned number
if 0 ~= num then -- non-zero when valid month season quarter
return num; -- return that number
end
end
return nil; -- not valid
end
--[[--------------------------< I S _ V A L I D _ Y E A R >----------------------------------------------------
Function gets current year from the server and compares it to year from a citation parameter. Years more than one
year in the future are not acceptable.
Special case for |pmc-embargo-date=: years more than two years in the future are not acceptable
]]
local function is_valid_year (year, param)
if not is_set (year_limit) then
year_limit = tonumber(os.date("%Y"))+1; -- global variable so we only have to fetch it once
end
year = tonumber (year) or lang_object:parseFormattedNumber (year); -- convert to number for the comparison
if year and (100 > year) then -- years less than 100 not supported
return false;
end
if 'pmc-embargo-date' == param then -- special case for |pmc-embargo-date=
return year and (year <= tonumber(os.date("%Y"))+2) or false; -- years more than two years in the future are not accepted
end
return year and (year <= year_limit) or false;
end
--[[--------------------------< I S _ V A L I D _ D A T E >----------------------------------------------------
Returns true if day is less than or equal to the number of days in month and year is no farther into the future
than next year; else returns false.
Assumes Julian calendar prior to year 1582 and Gregorian calendar thereafter. Accounts for Julian calendar leap
years before 1582 and Gregorian leap years after 1582. Where the two calendars overlap (1582 to approximately
1923) dates are assumed to be Gregorian.
]]
local function is_valid_date (year, month, day, param)
local days_in_month = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
local month_length;
if not is_valid_year (year, param) then -- no farther into the future than next year except |pmc-embargo-date= no more than two years in the future
return false;
end
month = tonumber (month); -- required for YYYY-MM-DD dates
if (2 == month) then -- if February
month_length = 28; -- then 28 days unless
if 1582 > tonumber(year) then -- Julian calendar
if 0 == (year%4) then -- is a leap year?
month_length = 29; -- if leap year then 29 days in February
end
else -- Gregorian calendar
if (0 == (year%4) and (0 ~= (year%100) or 0 == (year%400))) then -- is a leap year?
month_length = 29; -- if leap year then 29 days in February
end
end
else
month_length = days_in_month[month];
end
if tonumber (day) > month_length then
return false;
end
return true;
end
--[[--------------------------< I S _ V A L I D _ M O N T H _ R A N G E _ S T Y L E >--------------------------
Months in a range are expected to have the same style: Jan–Mar or October–December but not February–Mar or Jul–August.
This function looks in cfg.date_names{} to see if both month names are listed in the long subtable or both are
listed in the short subtable. When both have the same style (both are listed in the same table), returns true; false else
]]
local function is_valid_month_range_style (month1, month2)
if (cfg.date_names.en.long[month1] and cfg.date_names.en.long[month2]) or -- are both English names listed in the long subtable?
(cfg.date_names.en.short[month1] and cfg.date_names.en.short[month2]) or -- are both English names listed in the short subtable?
(cfg.date_names['local'].long[month1] and cfg.date_names['local'].long[month2]) or -- are both local names listed in the long subtable?
(cfg.date_names['local'].short[month1] and cfg.date_names['local'].short[month2]) then -- are both local names listed in the short subtable?
return true;
end
return false; -- names are mixed
end
--[[--------------------------< I S _ V A L I D _ M O N T H _ S E A S O N _ R A N G E >------------------------
Check a pair of months or seasons to see if both are valid members of a month or season pair.
Month pairs are expected to be left to right, earliest to latest in time.
All season ranges are accepted as valid because there are publishers out there who have published a Summer–Spring YYYY issue, hence treat as ok
]]
local function is_valid_month_season_range(range_start, range_end, param)
local range_start_number = get_month_number (range_start);
local range_end_number;
if 0 == range_start_number then -- is this a month range?
range_start_number = get_season_number (range_start, param); -- not a month; is it a season? get start season number
range_end_number = get_season_number (range_end, param); -- get end season number
if (0 ~= range_start_number) and (0 ~= range_end_number) and (range_start_number ~= range_end_number) then
return true; -- any season pairing is accepted except when both are the same
end
return false; -- range_start and/or range_end is not a season
end
-- here when range_start is a month
range_end_number = get_month_number (range_end); -- get end month number
if range_start_number < range_end_number and -- range_start is a month; does range_start precede range_end?
is_valid_month_range_style (range_start, range_end) then -- do months have the same style?
return true; -- proper order and same style
end
return false; -- range_start month number is greater than or equal to range end number; or range end isn't a month
end
--[[--------------------------< M A K E _ C O I N S _ D A T E >------------------------------------------------
This function receives a table of date parts for one or two dates and an empty table reference declared in
Module:Citation/CS1. The function is called only for |date= parameters and only if the |date=<value> is
determined to be a valid date format. The question of what to do with invalid date formats is not answered here.
The date parts in the input table are converted to an ISO 8601 conforming date string:
single whole dates: yyyy-mm-dd
month and year dates: yyyy-mm
year dates: yyyy
ranges: yyyy-mm-dd/yyyy-mm-dd
yyyy-mm/yyyy-mm
yyyy/yyyy
Dates in the Julian calendar are reduced to year or year/year so that we don't have to do calendar conversion from
Julian to Proleptic Gregorian.
The input table has:
year, year2 – always present; if before 1582, ignore months and days if present
month, month2 – 0 if not provided, 1-12 for months, 21-24 for seasons; 99 Christmas
day, day2 – 0 if not provided, 1-31 for days
the output table receives:
rftdate: an ISO 8601 formatted date
rftchron: a free-form version of the date, usually without year which is in rftdate (season ranges and proper-name dates)
rftssn: one of four season keywords: winter, spring, summer, fall (lowercase)
rftquarter: one of four values: 1, 2, 3, 4
]]
local function make_COinS_date (input, tCOinS_date)
local date; -- one date or first date in a range
local date2 = ''; -- end of range date
input.year = tonumber (input.year) or lang_object:parseFormattedNumber (input.year); -- language-aware tonumber()
input.year2 = tonumber (input.year2) or lang_object:parseFormattedNumber (input.year2); -- COinS dates are pseudo-ISO 8601 so convert to Arabic numerals
-- start temporary Julian / Gregorian calendar uncertainty detection
local year = input.year; -- this temporary code to determine the extent of sources dated to the Julian/Gregorian
local month = tonumber(input.month); -- interstice 1 October 1582 – 1 January 1926
local day = tonumber (input.day);
if (0 ~= day) and -- day must have a value for this to be a whole date
(((1582 == year) and (10 <= month) and (12 >= month)) or -- any whole 1582 date from 1 October to 31 December or
((1926 == year) and (1 == month) and (1 == input.day)) or -- 1 January 1926 or
((1582 < year) and (1925 >= year))) then -- any date 1 January 1583 – 31 December 1925
tCOinS_date.inter_cal_cat = true; -- set category flag true
end
-- end temporary Julian / Gregorian calendar uncertainty detection
if ((1582 == year) and (10 > month)) or (1582 > year) then -- if a Julian calendar date
tCOinS_date.rftdate = tostring (input.year); -- &rft.date gets year only
return; -- done
end
-- here for all forms of Gregorian dates
if 20 < tonumber (input.month) then -- if season, quarter, or proper-name date
date = input.year; -- &rft.date gets year only
if 0 ~= input.year2 and input.year ~= input.year2 then -- if a range, only the second year portion when not the same as range start year
date = string.format ('%.4d/%.4d', input.year, input.year2) -- assemble the date range
end
local season = {[24] = 'winter', [21] = 'spring', [22] = 'summer', [23] = 'fall', [33] = '1', [34] = '2', [35] = '3', [36] = '4', [98] = 'Easter', [99] = 'Christmas'}; -- seasons lowercase, no autumn; proper-names use title case
if 0 == input.month2 then -- single season, quarter, or proper-name date
if 40 < tonumber(input.month) then
tCOinS_date.rftchron = season[input.month]; -- proper-name date; used in journal metadata only
elseif 30 < tonumber(input.month) then
tCOinS_date.rftquarter = season[input.month]; -- quarter date; used in journal metadata only
else
tCOinS_date.rftssn = season[input.month]; -- season date; used in journal metadata only
end
else -- season ranges are lumped into &rft.chron; &rft.ssn and &rft.quarter are left blank
if input.year ~= input.year2 then -- season year – season year range or season year–year
if 0 ~= input.month2 then
tCOinS_date.rftchron = string.format ('%s %s – %s %s', season[input.month], input.year, season[input.month2], input.year2); -- used in journal metadata only
end
else -- season–season year range
tCOinS_date.rftchron = season[input.month] .. '–' .. season[input.month2]; -- season–season year range; used in journal metadata only
end
end
tCOinS_date.rftdate = tostring (date);
return; -- done
end
-- here for gregorian calendar dates
if 0 ~= input.day then
date = string.format ('%s-%.2d-%.2d', input.year, tonumber(input.month), tonumber(input.day)); -- whole date
elseif 0 ~= input.month then
date = string.format ('%s-%.2d', input.year, tonumber(input.month)); -- year and month
else
date = string.format ('%s', input.year); -- just year
end
if 0 ~= input.year2 then
if 0 ~= input.day2 then
date2 = string.format ('/%s-%.2d-%.2d', input.year2, tonumber(input.month2), tonumber(input.day2)); -- whole date
elseif 0 ~= input.month2 then
date2 = string.format ('/%s-%.2d', input.year2, tonumber(input.month2)); -- year and month
else
date2 = string.format ('/%s', input.year2); -- just year
end
end
tCOinS_date.rftdate = date .. date2; -- date2 has the '/' separator
return;
end
--[[--------------------------< P A T T E R N S >--------------------------------------------------------------
this is the list of patterns for date formats that this module recognizes. Approximately the first half of these
patterns represent formats that might be reformatted into another format. Those that might be reformatted have
'indicator' letters that identify the content of the matching capture: 'd' (day), 'm' (month), 'a' (anchor year),
'y' (year); second day, month, year have a '2' suffix.
These patterns are used for both date validation and for reformatting. This table should not be moved to ~/Configuration
because changes to this table require changes to check_date() and to reformatter() and reformat_date()
]]
local patterns = {
-- year-initial numerical year-month-day
['ymd'] = {'^(%d%d%d%d)%-(%d%d)%-(%d%d)$', 'y', 'm', 'd'},
-- month-initial: month day, year
['Mdy'] = {'^(%D-) +([1-9]%d?), +((%d%d%d%d?)%a?)$', 'm', 'd', 'a', 'y'},
-- month-initial day range: month day–day, year; days are separated by endash
['Md-dy'] = {'^(%D-) +([1-9]%d?)[%-–]([1-9]%d?), +((%d%d%d%d)%a?)$', 'm', 'd', 'd2', 'a', 'y'},
-- day-initial: day month year
['dMy'] = {'^([1-9]%d?) +(%D-) +((%d%d%d%d?)%a?)$', 'd', 'm', 'a', 'y'},
-- year-initial: year month day; day: 1 or 2 two digits, leading zero allowed; not supported at en.wiki
-- ['yMd'] = {'^((%d%d%d%d?)%a?) +(%D-) +(%d%d?)$', 'a', 'y', 'm', 'd'},
-- day-range-initial: day–day month year; days are separated by endash
['d-dMy'] = {'^([1-9]%d?)[%-–]([1-9]%d?) +(%D-) +((%d%d%d%d)%a?)$', 'd', 'd2', 'm', 'a', 'y'},
-- day initial month-day-range: day month - day month year; uses spaced endash
['dM-dMy'] = {'^([1-9]%d?) +(%D-) +[%-–] +([1-9]%d?) +(%D-) +((%d%d%d%d)%a?)$', 'd', 'm', 'd2', 'm2', 'a', 'y'},
-- month initial month-day-range: month day – month day, year; uses spaced endash
['Md-Mdy'] = {'^(%D-) +([1-9]%d?) +[%-–] +(%D-) +([1-9]%d?), +((%d%d%d%d)%a?)$','m', 'd', 'm2', 'd2', 'a', 'y'},
-- day initial month-day-year-range: day month year - day month year; uses spaced endash
['dMy-dMy'] = {'^([1-9]%d?) +(%D-) +(%d%d%d%d) +[%-–] +([1-9]%d?) +(%D-) +((%d%d%d%d)%a?)$', 'd', 'm', 'y', 'd2', 'm2', 'a', 'y2'},
-- month initial month-day-year-range: month day, year – month day, year; uses spaced endash
['Mdy-Mdy'] = {'^(%D-) +([1-9]%d?), +(%d%d%d%d) +[%-–] +(%D-) +([1-9]%d?), +((%d%d%d%d)%a?)$', 'm', 'd', 'y', 'm2', 'd2', 'a', 'y2'},
-- these date formats cannot be converted, per se, but month name can be rendered short or long
-- month/season year - month/season year; separated by spaced endash
['My-My'] = {'^(%D-) +(%d%d%d%d) +[%-–] +(%D-) +((%d%d%d%d)%a?)$', 'm', 'y', 'm2', 'a', 'y2'},
-- month/season range year; months separated by endash
['M-My'] = {'^(%D-)[%-–](%D-) +((%d%d%d%d)%a?)$', 'm', 'm2', 'a', 'y'},
-- month/season year or proper-name year; quarter year when First Quarter YYYY etc.
['My'] = {'^([^%d–]-) +((%d%d%d%d)%a?)$', 'm', 'a', 'y'}, -- this way because endash is a member of %D; %D- will match January–March 2019 when it shouldn't
-- these date formats cannot be converted
['Sy4-y2'] = {'^(%D-) +((%d%d)%d%d)[%-–]((%d%d)%a?)$'}, -- special case Winter/Summer year-year (YYYY-YY); year separated with unspaced endash
['Sy-y'] = {'^(%D-) +(%d%d%d%d)[%-–]((%d%d%d%d)%a?)$'}, -- special case Winter/Summer year-year; year separated with unspaced endash
['y-y'] = {'^(%d%d%d%d?)[%-–]((%d%d%d%d?)%a?)$'}, -- year range: YYY-YYY or YYY-YYYY or YYYY–YYYY; separated by unspaced endash; 100-9999
['y4-y2'] = {'^((%d%d)%d%d)[%-–]((%d%d)%a?)$'}, -- year range: YYYY–YY; separated by unspaced endash
['y'] = {'^((%d%d%d%d?)%a?)$'}, -- year; here accept either YYY or YYYY
}
--[[--------------------------< I S _ V A L I D _ E M B A R G O _ D A T E >------------------------------------
returns true and date value if that value has proper dmy, mdy, ymd format.
returns false and 9999 (embargoed forever) when date value is not proper format; assumes that when |pmc-embargo-date= is
set, the editor intended to embargo a PMC but |pmc-embargo-date= does not hold a single date.
]]
local function is_valid_embargo_date (v)
if v:match (patterns['ymd'][1]) or -- ymd
v:match (patterns['Mdy'][1]) or -- dmy
v:match (patterns['dMy'][1]) then -- mdy
return true, v;
end
return false, '9999'; -- if here not good date so return false and set embargo date to long time in future
end
--[[--------------------------< C H E C K _ D A T E >----------------------------------------------------------
Check date format to see that it is one of the formats approved by WP:DATESNO or WP:DATERANGE. Exception: only
allowed range separator is endash. Additionally, check the date to see that it is a real date: no 31 in 30-day
months; no 29 February when not a leap year. Months, both long-form and three character abbreviations, and seasons
must be spelled correctly. Future years beyond next year are not allowed.
If the date fails the format tests, this function returns false and does not return values for anchor_year and
COinS_date. When this happens, the date parameter is (DEBUG: not?) used in the COinS metadata and the CITEREF identifier gets
its year from the year parameter if present otherwise CITEREF does not get a date value.
Inputs:
date_string - date string from date-holding parameters (date, year, publication-date, access-date, pmc-embargo-date, archive-date, lay-date)
Returns:
false if date string is not a real date; else
true, anchor_year, COinS_date
anchor_year can be used in CITEREF anchors
COinS_date is ISO 8601 format date; see make_COInS_date()
]]
local function check_date (date_string, param, tCOinS_date)
local year; -- assume that year2, months, and days are not used;
local year2 = 0; -- second year in a year range
local month = 0;
local month2 = 0; -- second month in a month range
local day = 0;
local day2 = 0; -- second day in a day range
local anchor_year;
local coins_date;
if date_string:match (patterns['ymd'][1]) then -- year-initial numerical year month day format
year, month, day = date_string:match (patterns['ymd'][1]);
if 12 < tonumber(month) or 1 > tonumber(month) or 1582 > tonumber(year) or 0 == tonumber(day) then return false; end -- month or day number not valid or not Gregorian calendar
anchor_year = year;
elseif mw.ustring.match(date_string, patterns['Mdy'][1]) then -- month-initial: month day, year
month, day, anchor_year, year = mw.ustring.match(date_string, patterns['Mdy'][1]);
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
elseif mw.ustring.match(date_string, patterns['Md-dy'][1]) then -- month-initial day range: month day–day, year; days are separated by endash
month, day, day2, anchor_year, year = mw.ustring.match(date_string, patterns['Md-dy'][1]);
if tonumber(day) >= tonumber(day2) then return false; end -- date range order is left to right: earlier to later; dates may not be the same;
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
month2=month; -- for metadata
year2 = year;
elseif mw.ustring.match(date_string, patterns['dMy'][1]) then -- day-initial: day month year
day, month, anchor_year, year = mw.ustring.match(date_string, patterns['dMy'][1]);
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
--[[ NOT supported at en.wiki
elseif mw.ustring.match(date_string, patterns['yMd'][1]) then -- year-initial: year month day; day: 1 or 2 two digits, leading zero allowed
anchor_year, year, month, day = mw.ustring.match(date_string, patterns['yMd'][1]);
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
-- end NOT supported at en.wiki ]]
elseif mw.ustring.match(date_string, patterns['d-dMy'][1]) then -- day-range-initial: day–day month year; days are separated by endash
day, day2, month, anchor_year, year = mw.ustring.match(date_string, patterns['d-dMy'][1]);
if tonumber(day) >= tonumber(day2) then return false; end -- date range order is left to right: earlier to later; dates may not be the same;
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
month2 = month; -- for metadata
year2 = year;
elseif mw.ustring.match(date_string, patterns['dM-dMy'][1]) then -- day initial month-day-range: day month - day month year; uses spaced endash
day, month, day2, month2, anchor_year, year = mw.ustring.match(date_string, patterns['dM-dMy'][1]);
if (not is_valid_month_season_range(month, month2)) or not is_valid_year(year) then return false; end -- date range order is left to right: earlier to later;
month = get_month_number (month); -- for metadata
month2 = get_month_number (month2);
year2 = year;
elseif mw.ustring.match(date_string, patterns['Md-Mdy'][1]) then -- month initial month-day-range: month day – month day, year; uses spaced endash
month, day, month2, day2, anchor_year, year = mw.ustring.match(date_string, patterns['Md-Mdy'][1]);
if (not is_valid_month_season_range(month, month2, param)) or not is_valid_year(year) then return false; end
month = get_month_number (month); -- for metadata
month2 = get_month_number (month2);
year2 = year;
elseif mw.ustring.match(date_string, patterns['dMy-dMy'][1]) then -- day initial month-day-year-range: day month year - day month year; uses spaced endash
day, month, year, day2, month2, anchor_year, year2 = mw.ustring.match(date_string, patterns['dMy-dMy'][1]);
if tonumber(year2) <= tonumber(year) then return false; end -- must be sequential years, left to right, earlier to later
if not is_valid_year(year2) or not is_valid_month_range_style(month, month2) then return false; end -- year2 no more than one year in the future; months same style
month = get_month_number (month); -- for metadata
month2 = get_month_number (month2);
if 0 == month or 0 == month2 then return false; end -- both must be valid
elseif mw.ustring.match(date_string, patterns['Mdy-Mdy'][1]) then -- month initial month-day-year-range: month day, year – month day, year; uses spaced endash
month, day, year, month2, day2, anchor_year, year2 = mw.ustring.match(date_string, patterns['Mdy-Mdy'][1]);
if tonumber(year2) <= tonumber(year) then return false; end -- must be sequential years, left to right, earlier to later
if not is_valid_year(year2) or not is_valid_month_range_style(month, month2) then return false; end -- year2 no more than one year in the future; months same style
month = get_month_number (month); -- for metadata
month2 = get_month_number(month2);
if 0 == month or 0 == month2 then return false; end -- both must be valid
elseif mw.ustring.match(date_string, patterns['Sy4-y2'][1]) then -- special case Winter/Summer year-year (YYYY-YY); year separated with unspaced endash
local century;
month, year, century, anchor_year, year2 = mw.ustring.match(date_string, patterns['Sy4-y2'][1]);
if 'Winter' ~= month and 'Summer' ~= month then return false end; -- 'month' can only be Winter or Summer
anchor_year = year .. '–' .. anchor_year; -- assemble anchor_year from both years
year2 = century..year2; -- add the century to year2 for comparisons
if 1 ~= tonumber(year2) - tonumber(year) then return false; end -- must be sequential years, left to right, earlier to later
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
month = get_season_number(month, param);
elseif mw.ustring.match(date_string, patterns['Sy-y'][1]) then -- special case Winter/Summer year-year; year separated with unspaced endash
month, year, anchor_year, year2 = mw.ustring.match(date_string, patterns['Sy-y'][1]);
month = get_season_number (month, param); -- <month> can only be winter or summer; also for metadata
if (month ~= cfg.date_names['en'].season['Winter']) and (month ~= cfg.date_names['en'].season['Summer']) then
return false; -- not Summer or Winter; abandon
end
anchor_year = year .. '–' .. anchor_year; -- assemble anchor_year from both years
if 1 ~= tonumber(year2) - tonumber(year) then return false; end -- must be sequential years, left to right, earlier to later
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
elseif mw.ustring.match(date_string, patterns['My-My'][1]) then -- month/season year - month/season year; separated by spaced endash
month, year, month2, anchor_year, year2 = mw.ustring.match(date_string, patterns['My-My'][1]);
anchor_year = year .. '–' .. anchor_year; -- assemble anchor_year from both years
if tonumber(year) >= tonumber(year2) then return false; end -- left to right, earlier to later, not the same
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
if 0 ~= get_month_number(month) and 0 ~= get_month_number(month2) and is_valid_month_range_style(month, month2) then -- both must be month year, same month style
month = get_month_number(month);
month2 = get_month_number(month2);
elseif 0 ~= get_season_number(month, param) and 0 ~= get_season_number(month2, param) then -- both must be season year, not mixed
month = get_season_number(month, param);
month2 = get_season_number(month2, param);
else
return false;
end
elseif mw.ustring.match(date_string, patterns['M-My'][1]) then -- month/season range year; months separated by endash
month, month2, anchor_year, year = mw.ustring.match(date_string, patterns['M-My'][1]);
if (not is_valid_month_season_range(month, month2, param)) or (not is_valid_year(year)) then return false; end
if 0 ~= get_month_number(month) then -- determined to be a valid range so just check this one to know if month or season
month = get_month_number(month);
month2 = get_month_number(month2);
if 0 == month or 0 == month2 then return false; end
else
month = get_season_number(month, param);
month2 = get_season_number(month2, param);
end
year2 = year;
elseif mw.ustring.match(date_string, patterns['My'][1]) then -- month/season/quarter/proper-name year
month, anchor_year, year = mw.ustring.match(date_string, patterns['My'][1]);
if not is_valid_year(year) then return false; end
month = get_element_number(month, param); -- get month season quarter proper-name number or nil
if not month then return false; end -- not valid whatever it is
elseif mw.ustring.match(date_string, patterns['y-y'][1]) then -- Year range: YYY-YYY or YYY-YYYY or YYYY–YYYY; separated by unspaced endash; 100-9999
year, anchor_year, year2 = mw.ustring.match(date_string, patterns['y-y'][1]);
anchor_year = year .. '–' .. anchor_year; -- assemble anchor year from both years
if tonumber(year) >= tonumber(year2) then return false; end -- left to right, earlier to later, not the same
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
elseif mw.ustring.match(date_string, patterns['y4-y2'][1]) then -- Year range: YYYY–YY; separated by unspaced endash
local century;
year, century, anchor_year, year2 = mw.ustring.match(date_string, patterns['y4-y2'][1]);
anchor_year = year .. '–' .. anchor_year; -- assemble anchor year from both years
if 13 > tonumber(year2) then return false; end -- don't allow 2003-05 which might be May 2003
year2 = century .. year2; -- add the century to year2 for comparisons
if tonumber(year) >= tonumber(year2) then return false; end -- left to right, earlier to later, not the same
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
if in_array (param, {'date', 'publication-date', 'year'}) then -- here when 'valid' abbreviated year range; if one of these parameters
add_prop_cat ('year-range-abbreviated'); -- add properties cat
end
elseif mw.ustring.match(date_string, patterns['y'][1]) then -- year; here accept either YYY or YYYY
anchor_year, year = mw.ustring.match(date_string, patterns['y'][1]);
if false == is_valid_year(year) then
return false;
end
else
return false; -- date format not one of the MOS:DATE approved formats
end
if param ~= 'date' then -- CITEREF disambiguation only allowed in |date=; |year= & |publication-date= promote to date
if anchor_year:match ('%l$') then
return false;
end
end
if 'access-date' == param then -- test access-date here because we have numerical date parts
if 0 ~= year and 0 ~= month and 0 ~= day and -- all parts of a single date required
0 == year2 and 0 == month2 and 0 == day2 then -- none of these; access-date must not be a range
if not is_valid_accessdate(year .. '-' .. month .. '-' .. day) then
return false; -- return false when access-date out of bounds
end
else
return false; -- return false when access-date is a range of two dates
end
end
if 'archive-date' == param then -- test archive-date here because we have numerical date parts
if not (0 ~= year and 0 ~= month and 0 ~= day and -- all parts of a single date required
0 == year2 and 0 == month2 and 0 == day2) then -- none of these; archive-date must not be a range
return false; -- return false when archive-date is a range of two dates
end
end
local result=true; -- check whole dates for validity; assume true because not all dates will go through this test
if 0 ~= year and 0 ~= month and 0 ~= day and 0 == year2 and 0 == month2 and 0 == day2 then -- YMD (simple whole date)
result = is_valid_date (year, month, day, param); -- <param> for |pmc-embargo-date=
elseif 0 ~= year and 0 ~= month and 0 ~= day and 0 == year2 and 0 == month2 and 0 ~= day2 then -- YMD-d (day range)
result = is_valid_date (year, month, day);
result = result and is_valid_date (year, month, day2);
elseif 0 ~= year and 0 ~= month and 0 ~= day and 0 == year2 and 0 ~= month2 and 0 ~= day2 then -- YMD-md (day month range)
result = is_valid_date (year, month, day);
result = result and is_valid_date (year, month2, day2);
elseif 0 ~= year and 0 ~= month and 0 ~= day and 0 ~= year2 and 0 ~= month2 and 0 ~= day2 then -- YMD-ymd (day month year range)
result = is_valid_date(year, month, day);
result = result and is_valid_date(year2, month2, day2);
end
if false == result then return false; end
if nil ~= tCOinS_date then -- this table only passed into this function when testing |date= parameter values
make_COinS_date ({year = year, month = month, day = day, year2 = year2, month2 = month2, day2 = day2}, tCOinS_date); -- make an ISO 8601 date string for COinS
end
return true, anchor_year; -- format is good and date string represents a real date
end
--[[--------------------------< D A T E S >--------------------------------------------------------------------
Cycle the date-holding parameters in passed table date_parameters_list through check_date() to check compliance with MOS:DATE. For all valid dates, check_date() returns
true. The |date= parameter test is unique, it is the only date holding parameter from which values for anchor_year (used in CITEREF identifiers) and COinS_date (used in
the COinS metadata) are derived. The |date= parameter is the only date-holding parameter that is allowed to contain the no-date keywords "n.d." or "nd" (without quotes).
Unlike most error messages created in this module, only one error message is created by this function. Because all of the date holding parameters are processed serially,
parameters with errors are added to the <error_list> sequence table as the dates are tested.
]]
local function dates(date_parameters_list, tCOinS_date, error_list)
local anchor_year; -- will return as nil if the date being tested is not |date=
local COinS_date; -- will return as nil if the date being tested is not |date=
local embargo_date; -- if embargo date is a good dmy, mdy, ymd date then holds original value else reset to 9999
local good_date = false;
for k, v in pairs(date_parameters_list) do -- for each date-holding parameter in the list
if is_set(v.val) then -- if the parameter has a value
v.val = mw.ustring.gsub(v.val, '%d', cfg.date_names.local_digits); -- translate 'local' digits to Western 0-9
if v.val:match("^c%. [1-9]%d%d%d?%a?$") then -- special case for c. year or with or without CITEREF disambiguator - only |date= and |year=
local year = v.val:match("c%. ([1-9]%d%d%d?)%a?"); -- get the year portion so it can be tested
if 'date' == k then
anchor_year, COinS_date = v.val:match("((c%. [1-9]%d%d%d?)%a?)"); -- anchor year and COinS_date only from |date= parameter
good_date = is_valid_year(year);
elseif 'year' == k then
good_date = is_valid_year(year);
end
elseif 'date' == k then -- if the parameter is |date=
if v.val:match("^n%.d%.%a?$") then -- ToDo: I18N -- if |date=n.d. with or without a CITEREF disambiguator
good_date, anchor_year, COinS_date = true, v.val:match("((n%.d%.)%a?)"); -- ToDo: I18N -- "n.d."; no error when date parameter is set to no date
elseif v.val:match("^nd%a?$") then -- ToDo: I18N -- if |date=nd with or without a CITEREF disambiguator
good_date, anchor_year, COinS_date = true, v.val:match("((nd)%a?)"); -- ToDo: I18N -- "nd"; no error when date parameter is set to no date
else
good_date, anchor_year, COinS_date = check_date (v.val, k, tCOinS_date); -- go test the date
end
elseif 'year' == k then -- if the parameter is |year= it should hold only a year value
if v.val:match("^[1-9]%d%d%d?%a?$") then -- if |year = 3 or 4 digits only with or without a CITEREF disambiguator
good_date, anchor_year, COinS_date = true, v.val:match("((%d+)%a?)");
end
elseif 'pmc-embargo-date' == k then -- if the parameter is |pmc-embargo-date=
good_date = check_date (v.val, k); -- go test the date
if true == good_date then -- if the date is a valid date
good_date, embargo_date = is_valid_embargo_date (v.val); -- is |pmc-embargo-date= date a single dmy, mdy, or ymd formatted date? yes: returns embargo date; no: returns 9999
end
else -- any other date-holding parameter
good_date = check_date (v.val, k); -- go test the date
end
if false == good_date then -- assemble one error message so we don't add the tracking category multiple times
table.insert (error_list, wrap_style ('parameter', v.name)); -- make parameter name suitable for error message list
end
end
end
return anchor_year, embargo_date; -- and done
end
--[[--------------------------< Y E A R _ D A T E _ C H E C K >------------------------------------------------
Compare the value provided in |year= with the year value(s) provided in |date=. This function sets a local numeric value:
0 - year value does not match the year value in date
1 - (default) year value matches the year value in date or one of the year values when date contains two years
2 - year value matches the year value in date when date is in the form YYYY-MM-DD and year is disambiguated (|year=YYYYx)
the numeric value in <result> determines the 'output' if any from this function:
0 – adds error message to error_list sequence table
1 – adds maint cat
2 – does nothing
]]
local function year_date_check (year_string, year_origin, date_string, date_origin, error_list)
local year;
local date1;
local date2;
local result = 1; -- result of the test; assume that the test passes
year = year_string:match ('(%d%d%d%d?)');
if date_string:match ('%d%d%d%d%-%d%d%-%d%d') and year_string:match ('%d%d%d%d%a') then --special case where both date and year are required YYYY-MM-DD and YYYYx
date1 = date_string:match ('(%d%d%d%d)');
year = year_string:match ('(%d%d%d%d)');
if year ~= date1 then
result = 0; -- years don't match
else
result = 2; -- years match; but because disambiguated, don't add to maint cat
end
elseif date_string:match ("%d%d%d%d?.-%d%d%d%d?") then -- any of the standard range formats of date with two three- or four-digit years
date1, date2 = date_string:match ("(%d%d%d%d?).-(%d%d%d%d?)");
if year ~= date1 and year ~= date2 then
result = 0;
end
elseif mw.ustring.match(date_string, "%d%d%d%d[%-–]%d%d") then -- YYYY-YY date ranges
local century;
date1, century, date2 = mw.ustring.match(date_string, "((%d%d)%d%d)[%-–]+(%d%d)");
date2 = century..date2; -- convert YY to YYYY
if year ~= date1 and year ~= date2 then
result = 0;
end
elseif date_string:match ("%d%d%d%d?") then -- any of the standard formats of date with one year
date1 = date_string:match ("(%d%d%d%d?)");
if year ~= date1 then
result = 0;
end
else -- should never get here; this function called only when no other date errors
result = 0; -- no recognizable year in date
end
if 0 == result then -- year / date mismatch
table.insert (error_list, substitute (cfg.messages['mismatch'], {year_origin, date_origin})); -- add error message to error_list sequence table
elseif 1 == result then -- redundant year / date
set_message ('maint_date_year'); -- add a maint cat
end
end
--[[--------------------------< R E F O R M A T T E R >--------------------------------------------------------
reformat 'date' into new format specified by format_param if pattern_idx (the current format of 'date') can be
reformatted. Does the grunt work for reformat_dates().
The table re_formats maps pattern_idx (current format) and format_param (desired format) to a table that holds:
format string used by string.format()
identifier letters ('d', 'm', 'y', 'd2', 'm2', 'y2') that serve as indexes into a table t{} that holds captures
from mw.ustring.match() for the various date parts specified by patterns[pattern_idx][1]
Items in patterns{} have the general form:
['ymd'] = {'^(%d%d%d%d)%-(%d%d)%-(%d%d)$', 'y', 'm', 'd'}, where:
['ymd'] is pattern_idx
patterns['ymd'][1] is the match pattern with captures for mw.ustring.match()
patterns['ymd'][2] is an indicator letter identifying the content of the first capture
patterns['ymd'][3] ... the second capture etc.
when a pattern matches a date, the captures are loaded into table t{} in capture order using the idemtifier
characters as indexes into t{} For the above, a ymd date is in t{} as:
t.y = first capture (year), t.m = second capture (month), t.d = third capture (day)
To reformat, this function is called with the pattern_idx that matches the current format of the date and with
format_param set to the desired format. This function loads table t{} as described and then calls string.format()
with the format string specified by re_format[pattern_idx][format_param][1] using values taken from t{} according
to the capture identifier letters specified by patterns[pattern_idx][format_param][n] where n is 2..
]]
local re_formats = {
['ymd'] = { -- date format is ymd; reformat to:
['mdy'] = {'%s %s, %s', 'm', 'd', 'y'}, -- |df=mdy
['dmy'] = {'%s %s %s', 'd', 'm', 'y'}, -- |df=dmy
-- ['yMd'] = {'%s %s %s', 'y', 'm', 'd'}, -- |df=yMd; not supported at en.wiki
},
['Mdy'] = { -- date format is Mdy; reformat to:
['mdy'] = {'%s %s, %s', 'm', 'd', 'y'}, -- for long/short reformatting
['dmy'] = {'%s %s %s', 'd', 'm', 'y'}, -- |df=dmy
['ymd'] = {'%s-%s-%s', 'y', 'm', 'd'}, -- |df=ymd
-- ['yMd'] = {'%s %s %s', 'y', 'm', 'd'}, -- |df=yMd; not supported at en.wiki
},
['dMy'] = { -- date format is dMy; reformat to:
['dmy'] = {'%s %s %s', 'd', 'm', 'y'}, -- for long/short reformatting
['mdy'] = {'%s %s, %s', 'm', 'd', 'y'}, -- |df=mdy
['ymd'] = {'%s-%s-%s', 'y', 'm', 'd'}, -- |df=ymd
-- ['yMd'] = {'%s %s %s', 'y', 'm', 'd'}, -- |df=yMd; not supported at en.wiki
},
['Md-dy'] = { -- date format is Md-dy; reformat to:
['mdy'] = {'%s %s–%s, %s', 'm', 'd', 'd2', 'y'}, -- for long/short reformatting
['dmy'] = {'%s–%s %s %s', 'd', 'd2', 'm', 'y'}, -- |df=dmy -> d-dMy
},
['d-dMy'] = { -- date format is d-d>y; reformat to:
['dmy'] = {'%s–%s %s %s', 'd', 'd2', 'm', 'y'}, -- for long/short reformatting
['mdy'] = {'%s %s–%s, %s', 'm', 'd', 'd2', 'y'}, -- |df=mdy -> Md-dy
},
['dM-dMy'] = { -- date format is dM-dMy; reformat to:
['dmy'] = {'%s %s – %s %s %s', 'd', 'm', 'd2', 'm2', 'y'}, -- for long/short reformatting
['mdy'] = {'%s %s – %s %s, %s', 'm', 'd', 'm2', 'd2', 'y'}, -- |df=mdy -> Md-Mdy
},
['Md-Mdy'] = { -- date format is Md-Mdy; reformat to:
['mdy'] = {'%s %s – %s %s, %s', 'm', 'd', 'm2', 'd2', 'y'}, -- for long/short reformatting
['dmy'] = {'%s %s – %s %s %s', 'd', 'm', 'd2', 'm2', 'y'}, -- |df=dmy -> dM-dMy
},
['dMy-dMy'] = { -- date format is dMy-dMy; reformat to:
['dmy'] = {'%s %s %s – %s %s %s', 'd', 'm', 'y', 'd2', 'm2', 'y2'}, -- for long/short reformatting
['mdy'] = {'%s %s, %s – %s %s, %s', 'm', 'd', 'y', 'm2', 'd2', 'y2'}, -- |df=mdy -> Mdy-Mdy
},
['Mdy-Mdy'] = { -- date format is Mdy-Mdy; reformat to:
['mdy'] = {'%s %s, %s – %s %s, %s', 'm', 'd', 'y', 'm2', 'd2', 'y2'}, -- for long/short reformatting
['dmy'] = {'%s %s %s – %s %s %s', 'd', 'm', 'y', 'd2', 'm2', 'y2'}, -- |df=dmy -> dMy-dMy
},
['My-My'] = { -- these for long/short reformatting
['any'] = {'%s %s – %s %s', 'm', 'y', 'm2', 'y2'}, -- dmy/mdy agnostic
},
['M-My'] = { -- these for long/short reformatting
['any'] = {'%s–%s %s', 'm', 'm2', 'y'}, -- dmy/mdy agnostic
},
['My'] = { -- these for long/short reformatting
['any'] = {'%s %s', 'm', 'y'}, -- dmy/mdy agnostic
},
-- ['yMd'] = { -- not supported at en.wiki
-- ['mdy'] = {'%s %s, %s', 'm', 'd', 'y'}, -- |df=mdy
-- ['dmy'] = {'%s %s %s', 'd', 'm', 'y'}, -- |df=dmy
-- ['ymd'] = {'%s-%s-%s', 'y', 'm', 'd'}, -- |df=ymd
-- },
}
local function reformatter (date, pattern_idx, format_param, mon_len)
if not in_array (pattern_idx, {'ymd', 'Mdy', 'Md-dy', 'dMy', 'yMd', 'd-dMy', 'dM-dMy', 'Md-Mdy', 'dMy-dMy', 'Mdy-Mdy', 'My-My', 'M-My', 'My'}) then
return; -- not in this set of date format patterns then not a reformattable date
end
if 'ymd' == format_param and in_array (pattern_idx, {'ymd', 'Md-dy', 'd-dMy', 'dM-dMy', 'Md-Mdy', 'dMy-dMy', 'Mdy-Mdy', 'My-My', 'M-My', 'My'}) then
return; -- ymd date ranges not supported at en.wiki; no point in reformatting ymd to ymd
end
if in_array (pattern_idx, {'My', 'M-My', 'My-My'}) then -- these are not dmy/mdy so can't be 'reformatted' into either
format_param = 'any'; -- so format-agnostic
end
-- yMd is not supported at en.wiki; when yMd is supported at your wiki, uncomment the next line
-- if 'yMd' == format_param and in_array (pattern_idx, {'yMd', 'Md-dy', 'd-dMy', 'dM-dMy', 'Md-Mdy', 'dMy-dMy', 'Mdy-Mdy'}) then -- these formats not convertable; yMd not supported at en.wiki
if 'yMd' == format_param then -- yMd not supported at en.wiki; when yMd is supported at your wiki, remove or comment-out this line
return; -- not a reformattable date
end
local c1, c2, c3, c4, c5, c6, c7; -- these hold the captures specified in patterns[pattern_idx][1]
c1, c2, c3, c4, c5, c6, c7 = mw.ustring.match (date, patterns[pattern_idx][1]); -- get the captures
local t = { -- table that holds k/v pairs of date parts from the captures and patterns[pattern_idx][2..]
[patterns[pattern_idx][2]] = c1; -- at minimum there is always one capture with a matching indicator letter
[patterns[pattern_idx][3] or 'x'] = c2; -- patterns can have a variable number of captures; each capture requires an indicator letter;
[patterns[pattern_idx][4] or 'x'] = c3; -- where there is no capture, there is no indicator letter so n in patterns[pattern_idx][n] will be nil;
[patterns[pattern_idx][5] or 'x'] = c4; -- the 'x' here spoofs an indicator letter to prevent 'table index is nil' error
[patterns[pattern_idx][6] or 'x'] = c5;
[patterns[pattern_idx][7] or 'x'] = c6;
[patterns[pattern_idx][8] or 'x'] = c7;
};
if t.a then -- if this date has an anchor year capture (all convertable date formats except ymd)
if t.y2 then -- for year range date formats
t.y2 = t.a; -- use the anchor year capture when reassembling the date
else -- here for single date formats (except ymd)
t.y = t.a; -- use the anchor year capture when reassembling the date
end
end
if tonumber(t.m) then -- if raw month is a number (converting from ymd)
if 's' == mon_len then -- if we are to use abbreviated month names
t.m = cfg.date_names['inv_local_short'][tonumber(t.m)]; -- convert it to a month name
else
t.m = cfg.date_names['inv_local_long'][tonumber(t.m)]; -- convert it to a month name
end
t.d = t.d:gsub ('0(%d)', '%1'); -- strip leading '0' from day if present
elseif 'ymd' == format_param then -- when converting to ymd
t.y = t.y:gsub ('%a', ''); -- strip CITREF disambiguator if present; anchor year already known so process can proceed; TODO: maint message?
if 1582 > tonumber (t.y) then -- ymd format dates not allowed before 1582
return;
end
t.m = string.format ('%02d', get_month_number (t.m)); -- make sure that month and day are two digits
t.d = string.format ('%02d', t.d);
elseif mon_len then -- if mon_len is set to either 'short' or 'long'
for _, mon in ipairs ({'m', 'm2'}) do -- because there can be two month names, check both
if t[mon] then
t[mon] = get_month_number (t[mon]); -- get the month number for this month (is length agnostic)
if 0 == t[mon] then return; end -- seasons and named dates can't be converted
t[mon] = (('s' == mon_len) and cfg.date_names['inv_local_short'][t[mon]]) or cfg.date_names['inv_local_long'][t[mon]]; -- fetch month name according to length
end
end
end
local new_date = string.format (re_formats[pattern_idx][format_param][1], -- format string
t[re_formats[pattern_idx][format_param][2]], -- named captures from t{}
t[re_formats[pattern_idx][format_param][3]],
t[re_formats[pattern_idx][format_param][4]],
t[re_formats[pattern_idx][format_param][5]],
t[re_formats[pattern_idx][format_param][6]],
t[re_formats[pattern_idx][format_param][7]],
t[re_formats[pattern_idx][format_param][8]]
);
return new_date;
end
--[[-------------------------< R E F O R M A T _ D A T E S >--------------------------------------------------
Reformats existing dates into the format specified by format.
format is one of several manual keywords: dmy, dmy-all, mdy, mdy-all, ymd, ymd-all. The -all version includes
access- and archive-dates; otherwise these dates are not reformatted.
This function allows automatic date formatting. In ~/Configuration, the article source is searched for one of
the {{use xxx dates}} templates. If found, xxx becomes the global date format as xxx-all. If |cs1-dates= in
{{use xxx dates}} has legitimate value then that value determines how cs1|2 dates will be rendered. Legitimate
values for |cs1-dates= are:
l - all dates are rendered with long month names
ls - publication dates use long month names; access-/archive-dates use abbreviated month names
ly - publication dates use long month names; access-/archive-dates rendered in ymd format
s - all dates are rendered with abbreviated (short) month names
sy - publication dates use abbreviated month names; access-/archive-dates rendered in ymd format
y - all dates are rendered in ymd format
the format argument for automatic date formatting will be the format specified by {{use xxx dates}} with the
value supplied by |cs1-dates so one of: xxx-l, xxx-ls, xxx-ly, xxx-s, xxx-sy, xxx-y, or simply xxx (|cs1-dates=
empty, omitted, or invalid) where xxx shall be either of dmy or mdy.
dates are extracted from date_parameters_list, reformatted (if appropriate), and then written back into the
list in the new format. Dates in date_parameters_list are presumed here to be valid (no errors). This function
returns true when a date has been reformatted, false else. Actual reformatting is done by reformatter().
]]
local function reformat_dates (date_parameters_list, format)
local all = false; -- set to false to skip access- and archive-dates
local len_p = 'l'; -- default publication date length shall be long
local len_a = 'l'; -- default access-/archive-date length shall be long
local result = false;
local new_date;
if format:match('%a+%-all') then -- manual df keyword; auto df keyword when length not specified in {{use xxx dates}};
format = format:match('(%a+)%-all'); -- extract the format
all = true; -- all dates are long format dates because this keyword doesn't specify length
elseif format:match('%a+%-[lsy][sy]?') then -- auto df keywords; internal only
all = true; -- auto df applies to all dates; use length specified by capture len_p for all dates
format, len_p, len_a = format:match('(%a+)%-([lsy])([sy]?)'); -- extract the format and length keywords
if 'y' == len_p then -- because allowed by MOS:DATEUNIFY (sort of) range dates and My dates not reformatted
format = 'ymd'; -- override {{use xxx dates}}
elseif (not is_set(len_a)) or (len_p == len_a) then -- no access-/archive-date length specified or same length as publication dates then
len_a = len_p; -- in case len_a not set
end
end -- else only publication dates and they are long
for param_name, param_val in pairs (date_parameters_list) do -- for each date-holding parameter in the list
if is_set (param_val.val) then -- if the parameter has a value
if not (not all and in_array (param_name, {'access-date', 'archive-date'})) then -- skip access- or archive-date unless format is xxx-all; yeah, ugly; TODO: find a better way
for pattern_idx, pattern in pairs (patterns) do
if mw.ustring.match (param_val.val, pattern[1]) then
if all and in_array (param_name, {'access-date', 'archive-date'}) then -- if this date is an access- or archive-date
new_date = reformatter (param_val.val, pattern_idx, (('y' == len_a) and 'ymd') or format, len_a); -- choose ymd or dmy/mdy according to len_a setting
else -- all other dates
new_date = reformatter (param_val.val, pattern_idx, format, len_p);
end
if new_date then -- set when date was reformatted
date_parameters_list[param_name].val = new_date; -- update date in date list
result = true; -- and announce that changes have been made
break;
end
end -- if
end -- for
end -- if
end -- if
end -- for
return result; -- declare boolean result and done
end
--[[--------------------------< D A T E _ H Y P H E N _ T O _ D A S H >----------------------------------------
Loops through the list of date-holding parameters and converts any hyphen to an ndash. Not called if the cs1|2
template has any date errors.
Modifies the date_parameters_list and returns true if hyphens are replaced, else returns false.
]]
local function date_hyphen_to_dash (date_parameters_list)
local result = false;
local n;
for param_name, param_val in pairs(date_parameters_list) do -- for each date-holding parameter in the list
if is_set (param_val.val) and
not mw.ustring.match (param_val.val, patterns.ymd[1]) then -- for those that are not ymd dates (ustring because here digits may not be Western)
param_val.val, n = param_val.val:gsub ('%-', '–'); -- replace any hyphen with ndash
if 0 ~= n then
date_parameters_list[param_name].val = param_val.val; -- update the list
result = true;
end
end
end
return result; -- so we know if any hyphens were replaced
end
--[[-------------------------< D A T E _ N A M E _ X L A T E >------------------------------------------------
Attempts to translate English date names to local-language date names using names supplied by MediaWiki's
date parser function. This is simple name-for-name replacement and may not work for all languages.
if xlat_dig is true, this function will also translate Western (English) digits to the local language's digits.
This will also translate ymd dates.
]]
local function date_name_xlate (date_parameters_list, xlt_dig)
local xlate;
local mode; -- long or short month names
local modified = false;
local date;
local sources_t = {
{cfg.date_names.en.long, cfg.date_names.inv_local_long}, -- for translating long English month names to long local month names
{cfg.date_names.en.short, cfg.date_names.inv_local_short}, -- short month names
{cfg.date_names.en.quarter, cfg.date_names.inv_local_quarter}, -- quarter date names
{cfg.date_names.en.season, cfg.date_names.inv_local_season}, -- season date nam
{cfg.date_names.en.named, cfg.date_names.inv_local_named}, -- named dates
}
local function is_xlateable (month) -- local function to get local date name that replaces existing English-language date name
for _, date_names_t in ipairs (sources_t) do -- for each sequence table in date_names_t
if date_names_t[1][month] then -- if date name is English month (long or short), quarter, season or named and
if date_names_t[2][date_names_t[1][month]] then -- if there is a matching local date name
return date_names_t[2][date_names_t[1][month]]; -- return the local date name
end
end
end
end
for param_name, param_val in pairs(date_parameters_list) do -- for each date-holding parameter in the list
if is_set(param_val.val) then -- if the parameter has a value
date = param_val.val;
for month in mw.ustring.gmatch (date, '[%a ]+') do -- iterate through all date names in the date (single date or date range)
month = mw.text.trim (month); -- this because quarterly dates contain whitespace
xlate = is_xlateable (month); -- get translate <month>; returns translation or nil
if xlate then
date = mw.ustring.gsub (date, month, xlate); -- replace the English with the translation
date_parameters_list[param_name].val = date; -- save the translated date
modified = true;
end
end
if xlt_dig then -- shall we also translate digits?
date = date:gsub ('%d', cfg.date_names.xlate_digits); -- translate digits from Western to 'local digits'
date_parameters_list[param_name].val = date; -- save the translated date
modified = true;
end
end
end
return modified;
end
--[[--------------------------< S E T _ S E L E C T E D _ M O D U L E S >--------------------------------------
Sets local imported functions table to same (live or sandbox) as that used by the other modules.
]]
local function set_selected_modules (cfg_table_ptr, utilities_page_ptr)
add_prop_cat = utilities_page_ptr.add_prop_cat ; -- import functions from selected Module:Citation/CS1/Utilities module
is_set = utilities_page_ptr.is_set;
in_array = utilities_page_ptr.in_array;
set_message = utilities_page_ptr.set_message;
substitute = utilities_page_ptr.substitute;
wrap_style = utilities_page_ptr.wrap_style;
cfg = cfg_table_ptr; -- import tables from selected Module:Citation/CS1/Configuration
end
--[[--------------------------< A R C H I V E _ D A T E _ C H E C K >------------------------------------------
Compare value in |archive-date= with the timestamp in Wayback machine urls. Emits an error message with suggested
date from the |archive-url= timestamp in an appropriate format when the value in |archive-date= does not match
the timestamp.
this function never called when any date in a cs1|2 template has errors
error message suggests new |archive-date= value in an appropriate format specified by <df>. <df> is either
|df= or cfg.global_df in that order. If <df> is nil, suggested date has format from |archive-date=. There is
a caveat: when |df=dmy or |df=mdy, the reformatter leaves |access-date= and |archive-date= formats as they are.
The error message suggested date is passed to the formatter as YYYY-MM-DD so when |df=dmy or |df=mdy, the format
is not changed.
]]
local function archive_date_check (archive_date, archive_url_timestamp, df)
local archive_date_format = 'dmy-y'; -- holds the date format of date in |archive-date; default to ymd; 'dmy' used here to spoof reformat_dates()
for _, v_t in ipairs ({{'dMy', 'dmy-all'}, {'Mdy', 'mdy-all'}}) do -- is |archive-date= format dmy or mdy?
if archive_date:match (patterns[v_t[1]][1]) then -- does the pattern match?
archive_date_format = cfg.keywords_xlate[v_t[2]]; -- get appropriate |df= supported keyword from the i18n translator table
break;
end
end
local dates_t = {};
dates_t['archive-date'] = {val=archive_date, name=''}; -- setup to call reformat_dates(); never called when errors so <name> unset as not needed
reformat_dates (dates_t, 'dmy-y'); -- reformat |archive-date= to ymd; 'dmy' used here to spoof reformat_dates()
local archive_url_date = archive_url_timestamp:gsub ('(%d%d%d%d)(%d%d)(%d%d)%d*', '%1-%2-%3'); -- make ymd format date from timestamp
if dates_t['archive-date'].val == archive_url_date then -- are the two dates the same
return; -- yes, done
else
dates_t['archive-date'] = {val=archive_url_date, name=''}; -- setup to call reformat_dates() with the timestamp date
reformat_dates (dates_t, df or archive_date_format); -- reformat timestamp to format specified by <df> or format used in |archive-date=
archive_url_date = dates_t['archive-date'].val;
set_message ('err_archive_date_url_ts_mismatch', archive_url_date); -- emit an error message
end
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return { -- return exported functions
archive_date_check = archive_date_check,
date_hyphen_to_dash = date_hyphen_to_dash,
date_name_xlate = date_name_xlate,
dates = dates,
reformat_dates = reformat_dates,
set_selected_modules = set_selected_modules,
year_date_check = year_date_check,
}
718d35019893cf90ddadc83b1951cc1c7ad97de5
Module:Citation/CS1/Whitelist
828
18
31
2023-11-25T16:42:12Z
wikipedia>Trappist the monk
0
sync from sandbox;
Scribunto
text/plain
--[[--------------------------< S U P P O R T E D P A R A M E T E R S >--------------------------------------
Because a steady-state signal conveys no useful information, whitelist.basic_arguments[] list items can have three values:
true - these parameters are valid and supported parameters
false - these parameters are deprecated but still supported
tracked - these parameters are valid and supported parameters tracked in an eponymous properties category
nil - these parameters are no longer supported. remove entirely
]]
local basic_arguments_t = {
['accessdate'] = true,
['access-date'] = true,
['agency'] = true,
['archivedate'] = true,
['archive-date'] = true,
['archive-format'] = true,
['archiveurl'] = true,
['archive-url'] = true,
['article'] = true,
['article-format'] = true,
['article-number'] = true, -- {{cite journal}}, {{cite conference}}; {{citation}} when |journal= has a value
['article-url'] = true,
['article-url-access'] = true,
['arxiv'] = true, -- cite arxiv; here because allowed in cite ... as identifier
['asin'] = true,
['ASIN'] = true,
['asin-tld'] = true,
['at'] = true,
['author'] = true,
['author-first'] = true,
['author-given'] = true,
['author-last'] = true,
['author-surname'] = true,
['authorlink'] = true,
['author-link'] = true,
['author-mask'] = true,
['authors'] = false,
['bibcode'] = true,
['bibcode-access'] = true,
['biorxiv'] = true, -- cite biorxiv; here because allowed in cite ... as identifier
['chapter'] = true,
['chapter-format'] = true,
['chapter-url'] = true,
['chapter-url-access'] = true,
['citeseerx'] = true, -- cite citeseerx; here because allowed in cite ... as identifier
['collaboration'] = true,
['contribution'] = true,
['contribution-format'] = true,
['contribution-url'] = true,
['contribution-url-access'] = true,
['contributor'] = true,
['contributor-first'] = true,
['contributor-given'] = true,
['contributor-last'] = true,
['contributor-surname'] = true,
['contributor-link'] = true,
['contributor-mask'] = true,
['date'] = true,
['department'] = true,
['df'] = true,
['dictionary'] = true,
['display-authors'] = true,
['display-contributors'] = true,
['display-editors'] = true,
['display-interviewers'] = true,
['display-subjects'] = true,
['display-translators'] = true,
['doi'] = true,
['DOI'] = true,
['doi-access'] = true,
['doi-broken-date'] = true,
['edition'] = true,
['editor'] = true,
['editor-first'] = true,
['editor-given'] = true,
['editor-last'] = true,
['editor-surname'] = true,
['editor-link'] = true,
['editor-mask'] = true,
['eissn'] = true,
['EISSN'] = true,
['encyclopaedia'] = true,
['encyclopedia'] = true,
['entry'] = true,
['entry-format'] = true,
['entry-url'] = true,
['entry-url-access'] = true,
['eprint'] = true, -- cite arxiv; here because allowed in cite ... as identifier
['first'] = true,
['format'] = true,
['given'] = true,
['hdl'] = true,
['HDL'] = true,
['hdl-access'] = true,
['host'] = true, -- unique to certain templates?
['id'] = true,
['ID'] = true,
['institution'] = true, -- constrain to cite thesis?
['interviewer'] = true,
['interviewer-first'] = true,
['interviewer-given'] = true,
['interviewer-last'] = true,
['interviewer-surname'] = true,
['interviewer-link'] = true,
['interviewer-mask'] = true,
['isbn'] = true,
['ISBN'] = true,
['ismn'] = true,
['ISMN'] = true,
['issn'] = true,
['ISSN'] = true,
['issue'] = true,
['jfm'] = true,
['JFM'] = true,
['journal'] = true,
['jstor'] = true,
['JSTOR'] = true,
['jstor-access'] = true,
['lang'] = true,
['language'] = true,
['last'] = true,
['lccn'] = true,
['LCCN'] = true,
['location'] = true,
['magazine'] = true,
['medium'] = true,
['medrxiv'] = true, -- cite medrxiv; here because allowed in cite ... as identifier
['minutes'] = true, -- constrain to cite AV media and podcast?
['mode'] = true,
['mr'] = true,
['MR'] = true,
['name-list-style'] = true,
['newspaper'] = true,
['no-pp'] = true,
['no-tracking'] = true,
['number'] = true,
['oclc'] = true,
['OCLC'] = true,
['ol'] = true,
['OL'] = true,
['ol-access'] = true,
['orig-date'] = true,
['origyear'] = true,
['orig-year'] = true,
['osti'] = true,
['OSTI'] = true,
['osti-access'] = true,
['others'] = true,
['p'] = true,
['page'] = true,
['pages'] = true,
['people'] = true,
['periodical'] = true,
['place'] = true,
['pmc'] = true,
['PMC'] = true,
['pmc-embargo-date'] = true,
['pmid'] = true,
['PMID'] = true,
['postscript'] = true,
['pp'] = true,
['publication-date'] = true,
['publication-place'] = true,
['publisher'] = true,
['quotation'] = true,
['quote'] = true,
['quote-page'] = true,
['quote-pages'] = true,
['ref'] = true,
['rfc'] = true,
['RFC'] = true,
['sbn'] = true,
['SBN'] = true,
['scale'] = true,
['script-article'] = true,
['script-chapter'] = true,
['script-contribution'] = true,
['script-entry'] = true,
['script-journal'] = true,
['script-magazine'] = true,
['script-newspaper'] = true,
['script-periodical'] = true,
['script-quote'] = true,
['script-section'] = true,
['script-title'] = true,
['script-website'] = true,
['script-work'] = true,
['section'] = true,
['section-format'] = true,
['section-url'] = true,
['section-url-access'] = true,
['series'] = true,
['ssrn'] = true, -- cite ssrn; these three here because allowed in cite ... as identifier
['SSRN'] = true,
['ssrn-access'] = true,
['subject'] = true,
['subject-first'] = true,
['subject-given'] = true,
['subject-last'] = true,
['subject-link'] = true,
['subject-mask'] = true,
['subject-surname'] = true,
['surname'] = true,
['s2cid'] = true,
['S2CID'] = true,
['s2cid-access'] = true,
['template-doc-demo'] = true,
['time'] = true, -- constrain to cite av media and podcast?
['time-caption'] = true, -- constrain to cite av media and podcast?
['title'] = true,
['title-link'] = true,
['title-note'] = true,
['translator'] = true,
['translator-first'] = true,
['translator-given'] = true,
['translator-last'] = true,
['translator-surname'] = true,
['translator-link'] = true,
['translator-mask'] = true,
['trans-article'] = true,
['trans-chapter'] = true,
['trans-contribution'] = true,
['trans-entry'] = true,
['trans-journal'] = true,
['trans-magazine'] = true,
['trans-newspaper'] = true,
['trans-periodical'] = true,
['trans-quote'] = true,
['trans-section'] = true,
['trans-title'] = true,
['trans-website'] = true,
['trans-work'] = true,
['type'] = true,
['url'] = true,
['URL'] = true,
['url-access'] = true,
['url-status'] = true,
['vauthors'] = true,
['veditors'] = true,
['version'] = true,
['via'] = true,
['volume'] = true,
['website'] = true,
['work'] = true,
['year'] = true,
['zbl'] = true,
['ZBL'] = true,
}
local numbered_arguments_t = {
['author#'] = true,
['author-first#'] = true,
['author#-first'] = true,
['author-given#'] = true,
['author#-given'] = true,
['author-last#'] = true,
['author#-last'] = true,
['author-surname#'] = true,
['author#-surname'] = true,
['author-link#'] = true,
['author#-link'] = true,
['authorlink#'] = true,
['author#link'] = true,
['author-mask#'] = true,
['author#-mask'] = true,
['contributor#'] = true,
['contributor-first#'] = true,
['contributor#-first'] = true,
['contributor-given#'] = true,
['contributor#-given'] = true,
['contributor-last#'] = true,
['contributor#-last'] = true,
['contributor-surname#'] = true,
['contributor#-surname'] = true,
['contributor-link#'] = true,
['contributor#-link'] = true,
['contributor-mask#'] = true,
['contributor#-mask'] = true,
['editor#'] = true,
['editor-first#'] = true,
['editor#-first'] = true,
['editor-given#'] = true,
['editor#-given'] = true,
['editor-last#'] = true,
['editor#-last'] = true,
['editor-surname#'] = true,
['editor#-surname'] = true,
['editor-link#'] = true,
['editor#-link'] = true,
['editor-mask#'] = true,
['editor#-mask'] = true,
['first#'] = true,
['given#'] = true,
['host#'] = true,
['interviewer#'] = true,
['interviewer-first#'] = true,
['interviewer#-first'] = true,
['interviewer-given#'] = true,
['interviewer#-given'] = true,
['interviewer-last#'] = true,
['interviewer#-last'] = true,
['interviewer-surname#'] = true,
['interviewer#-surname'] = true,
['interviewer-link#'] = true,
['interviewer#-link'] = true,
['interviewer-mask#'] = true,
['interviewer#-mask'] = true,
['last#'] = true,
['subject#'] = true,
['subject-first#'] = true,
['subject#-first'] = true,
['subject-given#'] = true,
['subject#-given'] = true,
['subject-last#'] = true,
['subject#-last'] = true,
['subject-link#'] = true,
['subject#-link'] = true,
['subject-mask#'] = true,
['subject#-mask'] = true,
['subject-surname#'] = true,
['subject#-surname'] = true,
['surname#'] = true,
['translator#'] = true,
['translator-first#'] = true,
['translator#-first'] = true,
['translator-given#'] = true,
['translator#-given'] = true,
['translator-last#'] = true,
['translator#-last'] = true,
['translator-surname#'] = true,
['translator#-surname'] = true,
['translator-link#'] = true,
['translator#-link'] = true,
['translator-mask#'] = true,
['translator#-mask'] = true,
}
--[[--------------------------< P R E P R I N T S U P P O R T E D P A R A M E T E R S >--------------------
Cite arXiv, cite biorxiv, cite citeseerx, cite medrxiv, and cite ssrn are preprint templates that use the limited
set of parameters defined in the limited_basic_arguments and limited_numbered_arguments tables. Those lists are
supplemented with a template-specific list of parameters that are required by the particular template and may be
exclusive to one of the preprint templates. Some of these parameters may also be available to the general cs1|2
templates.
Same conventions for true/false/tracked/nil as above.
]]
local preprint_arguments_t = {
arxiv = {
['arxiv'] = true, -- cite arxiv and arxiv identifiers
['class'] = true,
['eprint'] = true, -- cite arxiv and arxiv identifiers
},
biorxiv = {
['biorxiv'] = true,
},
citeseerx = {
['citeseerx'] = true,
},
medrxiv = {
['medrxiv'] = true,
},
ssrn = {
['ssrn'] = true,
['SSRN'] = true,
['ssrn-access'] = true,
},
}
--[[--------------------------< L I M I T E D S U P P O R T E D P A R A M E T E R S >----------------------
cite arxiv, cite biorxiv, cite citeseerx, cite medrxiv, and cite ssrn templates are preprint templates so are
allowed only a limited subset of parameters allowed to all other cs1|2 templates. The limited subset is defined
here.
This list of parameters also used by {{cite document}}
Same conventions for true/false/tracked/nil as above.
]]
local limited_basic_arguments_t = {
['at'] = true,
['author'] = true,
['author-first'] = true,
['author-given'] = true,
['author-last'] = true,
['author-surname'] = true,
['author-link'] = true,
['authorlink'] = true,
['author-mask'] = true,
['authors'] = false,
['collaboration'] = true,
['date'] = true,
['df'] = true,
['display-authors'] = true,
['first'] = true,
['given'] = true,
['language'] = true,
['last'] = true,
['mode'] = true,
['name-list-style'] = true,
['no-tracking'] = true,
['p'] = true,
['page'] = true,
['pages'] = true,
['postscript'] = true,
['pp'] = true,
['quotation'] = true,
['quote'] = true,
['ref'] = true,
['surname'] = true,
['template-doc-demo'] = true,
['title'] = true,
['trans-title'] = true,
['vauthors'] = true,
['year'] = true,
}
local limited_numbered_arguments_t = {
['author#'] = true,
['author-first#'] = true,
['author#-first'] = true,
['author-given#'] = true,
['author#-given'] = true,
['author-last#'] = true,
['author#-last'] = true,
['author-surname#'] = true,
['author#-surname'] = true,
['author-link#'] = true,
['author#-link'] = true,
['authorlink#'] = true,
['author#link'] = true,
['author-mask#'] = true,
['author#-mask'] = true,
['first#'] = true,
['given#'] = true,
['last#'] = true,
['surname#'] = true,
}
--[[--------------------------< U N I Q U E _ A R G U M E N T S >----------------------------------------------
Some templates have unique parameters. Those templates and their unique parameters are listed here. Keys in this
table are the template's CitationClass parameter value
Same conventions for true/false/tracked/nil as above.
]]
local unique_arguments_t = {
['audio-visual'] = {
['transcript'] = true,
['transcript-format'] = true,
['transcript-url'] = true,
},
conference = {
['book-title'] = true,
['conference'] = true,
['conference-format'] = true,
['conference-url'] = true,
['event'] = true,
},
episode = {
['airdate'] = true,
['air-date'] = true,
['credits'] = true,
['episode-link'] = true, -- alias of |title-link=
['network'] = true,
['season'] = true,
['series-link'] = true,
['series-no'] = true,
['series-number'] = true,
['station'] = true,
['transcript'] = true,
['transcript-format'] = true,
['transcript-url'] = true,
},
mailinglist = {
['mailing-list'] = true,
},
map = {
['cartography'] = true,
['inset'] = true,
['map'] = true,
['map-format'] = true,
['map-url'] = true,
['map-url-access'] = true,
['script-map'] = true,
['sections'] = true,
['sheet'] = true,
['sheets'] = true,
['trans-map'] = true,
},
newsgroup = {
['message-id'] = true,
['newsgroup'] = true,
},
report = {
['docket'] = true,
},
serial = {
['airdate'] = true,
['air-date'] = true,
['credits'] = true,
['episode'] = true, -- cite serial only TODO: make available to cite episode?
['episode-link'] = true, -- alias of |title-link=
['network'] = true,
['series-link'] = true,
['station'] = true,
},
speech = {
['conference'] = true,
['conference-format'] = true,
['conference-url'] = true,
['event'] = true,
},
thesis = {
['degree'] = true,
['docket'] = true,
},
}
--[[--------------------------< C I T E _ D O C U M E N T >----------------------------------------------------
Special case for cite document. This template takes the limited basic and limited enumerated parameters plus
others that are apply only to standalone published sources that cannot be cited any other way; no url, book,
periodical, etc parameters; limited support for name lists and named identifiers.
when validating parameters in {{cite document}} templates, the basic and
]]
local document_arguments_t = {
['bibcode'] = true,
['bibcode-access'] = true,
['doi'] = true,
['DOI'] = true,
['doi-access'] = true,
['doi-broken-date'] = true,
['hdl'] = true,
['HDL'] = true,
['hdl-access'] = true,
['id'] = true,
['ID'] = true,
['jfm'] = true,
['JFM'] = true,
['lang'] = true,
['location'] = true,
['mr'] = true,
['MR'] = true,
['no-pp'] = true,
['orig-date'] = true,
['origyear'] = true,
['orig-year'] = true,
['osti'] = true,
['OSTI'] = true,
['osti-access'] = true,
['place'] = true,
['publisher'] = true,
['quote-page'] = true,
['quote-pages'] = true,
['script-quote'] = true,
['script-title'] = true,
['title-link'] = true,
['translator'] = true,
['translator-first'] = true,
['translator-given'] = true,
['translator-last'] = true,
['translator-surname'] = true,
['translator-link'] = true,
['translator-mask'] = true,
['trans-quote'] = true,
['type'] = true,
['zbl'] = true,
['ZBL'] = true,
}
local document_numbered_arguments_t = {
['translator#'] = true,
['translator-first#'] = true,
['translator#-first'] = true,
['translator-given#'] = true,
['translator#-given'] = true,
['translator-last#'] = true,
['translator#-last'] = true,
['translator-surname#'] = true,
['translator#-surname'] = true,
['translator-link#'] = true,
['translator#-link'] = true,
['translator-mask#'] = true,
['translator#-mask'] = true,
}
--[[--------------------------< L I S T _ C O M B I N E >------------------------------------------------------
makes one table from a list of tables. <lists_t> is a sequence of tables to be combined
]]
local function list_combine (lists_t)
local out_t = {};
for _, list_t in ipairs (lists_t) do -- for each list in <lists_t>
for k, v in pairs (list_t) do -- extract each k/v pair
out_t[k] = v; -- add to <out_t>
end
end
return out_t; -- and done
end
--[[--------------------------< T E M P L A T E _ L I S T _ G E T >--------------------------------------------
gets a list of the templates from table t
]]
local function template_list_get (t)
local out_t = {}; -- a table for output
for k, _ in pairs (t) do -- spin through the table and collect the keys
table.insert (out_t, k) -- add each key to the output table
end
return out_t; -- and done
end
--[[--------------------------< E X P O R T E D T A B L E S >------------------------------------------------
]]
return {
preprint_arguments_t = preprint_arguments_t,
preprint_template_list_t = template_list_get (preprint_arguments_t), -- make a template list from preprint_arguments{} table
unique_arguments_t = unique_arguments_t,
unique_param_template_list_t = template_list_get (unique_arguments_t), -- make a template list from unique_arguments{} table
document_parameters_t = list_combine ({limited_basic_arguments_t, limited_numbered_arguments_t, document_arguments_t, document_numbered_arguments_t});
common_parameters_t = list_combine ({basic_arguments_t, numbered_arguments_t});
limited_parameters_t = list_combine ({limited_basic_arguments_t, limited_numbered_arguments_t});
};
e7d75a91b1b2d2d12264796bfc0a7125e370f896
32
31
2023-12-24T02:01:03Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Citation/CS1/Whitelist]]
Scribunto
text/plain
--[[--------------------------< S U P P O R T E D P A R A M E T E R S >--------------------------------------
Because a steady-state signal conveys no useful information, whitelist.basic_arguments[] list items can have three values:
true - these parameters are valid and supported parameters
false - these parameters are deprecated but still supported
tracked - these parameters are valid and supported parameters tracked in an eponymous properties category
nil - these parameters are no longer supported. remove entirely
]]
local basic_arguments_t = {
['accessdate'] = true,
['access-date'] = true,
['agency'] = true,
['archivedate'] = true,
['archive-date'] = true,
['archive-format'] = true,
['archiveurl'] = true,
['archive-url'] = true,
['article'] = true,
['article-format'] = true,
['article-number'] = true, -- {{cite journal}}, {{cite conference}}; {{citation}} when |journal= has a value
['article-url'] = true,
['article-url-access'] = true,
['arxiv'] = true, -- cite arxiv; here because allowed in cite ... as identifier
['asin'] = true,
['ASIN'] = true,
['asin-tld'] = true,
['at'] = true,
['author'] = true,
['author-first'] = true,
['author-given'] = true,
['author-last'] = true,
['author-surname'] = true,
['authorlink'] = true,
['author-link'] = true,
['author-mask'] = true,
['authors'] = false,
['bibcode'] = true,
['bibcode-access'] = true,
['biorxiv'] = true, -- cite biorxiv; here because allowed in cite ... as identifier
['chapter'] = true,
['chapter-format'] = true,
['chapter-url'] = true,
['chapter-url-access'] = true,
['citeseerx'] = true, -- cite citeseerx; here because allowed in cite ... as identifier
['collaboration'] = true,
['contribution'] = true,
['contribution-format'] = true,
['contribution-url'] = true,
['contribution-url-access'] = true,
['contributor'] = true,
['contributor-first'] = true,
['contributor-given'] = true,
['contributor-last'] = true,
['contributor-surname'] = true,
['contributor-link'] = true,
['contributor-mask'] = true,
['date'] = true,
['department'] = true,
['df'] = true,
['dictionary'] = true,
['display-authors'] = true,
['display-contributors'] = true,
['display-editors'] = true,
['display-interviewers'] = true,
['display-subjects'] = true,
['display-translators'] = true,
['doi'] = true,
['DOI'] = true,
['doi-access'] = true,
['doi-broken-date'] = true,
['edition'] = true,
['editor'] = true,
['editor-first'] = true,
['editor-given'] = true,
['editor-last'] = true,
['editor-surname'] = true,
['editor-link'] = true,
['editor-mask'] = true,
['eissn'] = true,
['EISSN'] = true,
['encyclopaedia'] = true,
['encyclopedia'] = true,
['entry'] = true,
['entry-format'] = true,
['entry-url'] = true,
['entry-url-access'] = true,
['eprint'] = true, -- cite arxiv; here because allowed in cite ... as identifier
['first'] = true,
['format'] = true,
['given'] = true,
['hdl'] = true,
['HDL'] = true,
['hdl-access'] = true,
['host'] = true, -- unique to certain templates?
['id'] = true,
['ID'] = true,
['institution'] = true, -- constrain to cite thesis?
['interviewer'] = true,
['interviewer-first'] = true,
['interviewer-given'] = true,
['interviewer-last'] = true,
['interviewer-surname'] = true,
['interviewer-link'] = true,
['interviewer-mask'] = true,
['isbn'] = true,
['ISBN'] = true,
['ismn'] = true,
['ISMN'] = true,
['issn'] = true,
['ISSN'] = true,
['issue'] = true,
['jfm'] = true,
['JFM'] = true,
['journal'] = true,
['jstor'] = true,
['JSTOR'] = true,
['jstor-access'] = true,
['lang'] = true,
['language'] = true,
['last'] = true,
['lccn'] = true,
['LCCN'] = true,
['location'] = true,
['magazine'] = true,
['medium'] = true,
['medrxiv'] = true, -- cite medrxiv; here because allowed in cite ... as identifier
['minutes'] = true, -- constrain to cite AV media and podcast?
['mode'] = true,
['mr'] = true,
['MR'] = true,
['name-list-style'] = true,
['newspaper'] = true,
['no-pp'] = true,
['no-tracking'] = true,
['number'] = true,
['oclc'] = true,
['OCLC'] = true,
['ol'] = true,
['OL'] = true,
['ol-access'] = true,
['orig-date'] = true,
['origyear'] = true,
['orig-year'] = true,
['osti'] = true,
['OSTI'] = true,
['osti-access'] = true,
['others'] = true,
['p'] = true,
['page'] = true,
['pages'] = true,
['people'] = true,
['periodical'] = true,
['place'] = true,
['pmc'] = true,
['PMC'] = true,
['pmc-embargo-date'] = true,
['pmid'] = true,
['PMID'] = true,
['postscript'] = true,
['pp'] = true,
['publication-date'] = true,
['publication-place'] = true,
['publisher'] = true,
['quotation'] = true,
['quote'] = true,
['quote-page'] = true,
['quote-pages'] = true,
['ref'] = true,
['rfc'] = true,
['RFC'] = true,
['sbn'] = true,
['SBN'] = true,
['scale'] = true,
['script-article'] = true,
['script-chapter'] = true,
['script-contribution'] = true,
['script-entry'] = true,
['script-journal'] = true,
['script-magazine'] = true,
['script-newspaper'] = true,
['script-periodical'] = true,
['script-quote'] = true,
['script-section'] = true,
['script-title'] = true,
['script-website'] = true,
['script-work'] = true,
['section'] = true,
['section-format'] = true,
['section-url'] = true,
['section-url-access'] = true,
['series'] = true,
['ssrn'] = true, -- cite ssrn; these three here because allowed in cite ... as identifier
['SSRN'] = true,
['ssrn-access'] = true,
['subject'] = true,
['subject-first'] = true,
['subject-given'] = true,
['subject-last'] = true,
['subject-link'] = true,
['subject-mask'] = true,
['subject-surname'] = true,
['surname'] = true,
['s2cid'] = true,
['S2CID'] = true,
['s2cid-access'] = true,
['template-doc-demo'] = true,
['time'] = true, -- constrain to cite av media and podcast?
['time-caption'] = true, -- constrain to cite av media and podcast?
['title'] = true,
['title-link'] = true,
['title-note'] = true,
['translator'] = true,
['translator-first'] = true,
['translator-given'] = true,
['translator-last'] = true,
['translator-surname'] = true,
['translator-link'] = true,
['translator-mask'] = true,
['trans-article'] = true,
['trans-chapter'] = true,
['trans-contribution'] = true,
['trans-entry'] = true,
['trans-journal'] = true,
['trans-magazine'] = true,
['trans-newspaper'] = true,
['trans-periodical'] = true,
['trans-quote'] = true,
['trans-section'] = true,
['trans-title'] = true,
['trans-website'] = true,
['trans-work'] = true,
['type'] = true,
['url'] = true,
['URL'] = true,
['url-access'] = true,
['url-status'] = true,
['vauthors'] = true,
['veditors'] = true,
['version'] = true,
['via'] = true,
['volume'] = true,
['website'] = true,
['work'] = true,
['year'] = true,
['zbl'] = true,
['ZBL'] = true,
}
local numbered_arguments_t = {
['author#'] = true,
['author-first#'] = true,
['author#-first'] = true,
['author-given#'] = true,
['author#-given'] = true,
['author-last#'] = true,
['author#-last'] = true,
['author-surname#'] = true,
['author#-surname'] = true,
['author-link#'] = true,
['author#-link'] = true,
['authorlink#'] = true,
['author#link'] = true,
['author-mask#'] = true,
['author#-mask'] = true,
['contributor#'] = true,
['contributor-first#'] = true,
['contributor#-first'] = true,
['contributor-given#'] = true,
['contributor#-given'] = true,
['contributor-last#'] = true,
['contributor#-last'] = true,
['contributor-surname#'] = true,
['contributor#-surname'] = true,
['contributor-link#'] = true,
['contributor#-link'] = true,
['contributor-mask#'] = true,
['contributor#-mask'] = true,
['editor#'] = true,
['editor-first#'] = true,
['editor#-first'] = true,
['editor-given#'] = true,
['editor#-given'] = true,
['editor-last#'] = true,
['editor#-last'] = true,
['editor-surname#'] = true,
['editor#-surname'] = true,
['editor-link#'] = true,
['editor#-link'] = true,
['editor-mask#'] = true,
['editor#-mask'] = true,
['first#'] = true,
['given#'] = true,
['host#'] = true,
['interviewer#'] = true,
['interviewer-first#'] = true,
['interviewer#-first'] = true,
['interviewer-given#'] = true,
['interviewer#-given'] = true,
['interviewer-last#'] = true,
['interviewer#-last'] = true,
['interviewer-surname#'] = true,
['interviewer#-surname'] = true,
['interviewer-link#'] = true,
['interviewer#-link'] = true,
['interviewer-mask#'] = true,
['interviewer#-mask'] = true,
['last#'] = true,
['subject#'] = true,
['subject-first#'] = true,
['subject#-first'] = true,
['subject-given#'] = true,
['subject#-given'] = true,
['subject-last#'] = true,
['subject#-last'] = true,
['subject-link#'] = true,
['subject#-link'] = true,
['subject-mask#'] = true,
['subject#-mask'] = true,
['subject-surname#'] = true,
['subject#-surname'] = true,
['surname#'] = true,
['translator#'] = true,
['translator-first#'] = true,
['translator#-first'] = true,
['translator-given#'] = true,
['translator#-given'] = true,
['translator-last#'] = true,
['translator#-last'] = true,
['translator-surname#'] = true,
['translator#-surname'] = true,
['translator-link#'] = true,
['translator#-link'] = true,
['translator-mask#'] = true,
['translator#-mask'] = true,
}
--[[--------------------------< P R E P R I N T S U P P O R T E D P A R A M E T E R S >--------------------
Cite arXiv, cite biorxiv, cite citeseerx, cite medrxiv, and cite ssrn are preprint templates that use the limited
set of parameters defined in the limited_basic_arguments and limited_numbered_arguments tables. Those lists are
supplemented with a template-specific list of parameters that are required by the particular template and may be
exclusive to one of the preprint templates. Some of these parameters may also be available to the general cs1|2
templates.
Same conventions for true/false/tracked/nil as above.
]]
local preprint_arguments_t = {
arxiv = {
['arxiv'] = true, -- cite arxiv and arxiv identifiers
['class'] = true,
['eprint'] = true, -- cite arxiv and arxiv identifiers
},
biorxiv = {
['biorxiv'] = true,
},
citeseerx = {
['citeseerx'] = true,
},
medrxiv = {
['medrxiv'] = true,
},
ssrn = {
['ssrn'] = true,
['SSRN'] = true,
['ssrn-access'] = true,
},
}
--[[--------------------------< L I M I T E D S U P P O R T E D P A R A M E T E R S >----------------------
cite arxiv, cite biorxiv, cite citeseerx, cite medrxiv, and cite ssrn templates are preprint templates so are
allowed only a limited subset of parameters allowed to all other cs1|2 templates. The limited subset is defined
here.
This list of parameters also used by {{cite document}}
Same conventions for true/false/tracked/nil as above.
]]
local limited_basic_arguments_t = {
['at'] = true,
['author'] = true,
['author-first'] = true,
['author-given'] = true,
['author-last'] = true,
['author-surname'] = true,
['author-link'] = true,
['authorlink'] = true,
['author-mask'] = true,
['authors'] = false,
['collaboration'] = true,
['date'] = true,
['df'] = true,
['display-authors'] = true,
['first'] = true,
['given'] = true,
['language'] = true,
['last'] = true,
['mode'] = true,
['name-list-style'] = true,
['no-tracking'] = true,
['p'] = true,
['page'] = true,
['pages'] = true,
['postscript'] = true,
['pp'] = true,
['quotation'] = true,
['quote'] = true,
['ref'] = true,
['surname'] = true,
['template-doc-demo'] = true,
['title'] = true,
['trans-title'] = true,
['vauthors'] = true,
['year'] = true,
}
local limited_numbered_arguments_t = {
['author#'] = true,
['author-first#'] = true,
['author#-first'] = true,
['author-given#'] = true,
['author#-given'] = true,
['author-last#'] = true,
['author#-last'] = true,
['author-surname#'] = true,
['author#-surname'] = true,
['author-link#'] = true,
['author#-link'] = true,
['authorlink#'] = true,
['author#link'] = true,
['author-mask#'] = true,
['author#-mask'] = true,
['first#'] = true,
['given#'] = true,
['last#'] = true,
['surname#'] = true,
}
--[[--------------------------< U N I Q U E _ A R G U M E N T S >----------------------------------------------
Some templates have unique parameters. Those templates and their unique parameters are listed here. Keys in this
table are the template's CitationClass parameter value
Same conventions for true/false/tracked/nil as above.
]]
local unique_arguments_t = {
['audio-visual'] = {
['transcript'] = true,
['transcript-format'] = true,
['transcript-url'] = true,
},
conference = {
['book-title'] = true,
['conference'] = true,
['conference-format'] = true,
['conference-url'] = true,
['event'] = true,
},
episode = {
['airdate'] = true,
['air-date'] = true,
['credits'] = true,
['episode-link'] = true, -- alias of |title-link=
['network'] = true,
['season'] = true,
['series-link'] = true,
['series-no'] = true,
['series-number'] = true,
['station'] = true,
['transcript'] = true,
['transcript-format'] = true,
['transcript-url'] = true,
},
mailinglist = {
['mailing-list'] = true,
},
map = {
['cartography'] = true,
['inset'] = true,
['map'] = true,
['map-format'] = true,
['map-url'] = true,
['map-url-access'] = true,
['script-map'] = true,
['sections'] = true,
['sheet'] = true,
['sheets'] = true,
['trans-map'] = true,
},
newsgroup = {
['message-id'] = true,
['newsgroup'] = true,
},
report = {
['docket'] = true,
},
serial = {
['airdate'] = true,
['air-date'] = true,
['credits'] = true,
['episode'] = true, -- cite serial only TODO: make available to cite episode?
['episode-link'] = true, -- alias of |title-link=
['network'] = true,
['series-link'] = true,
['station'] = true,
},
speech = {
['conference'] = true,
['conference-format'] = true,
['conference-url'] = true,
['event'] = true,
},
thesis = {
['degree'] = true,
['docket'] = true,
},
}
--[[--------------------------< C I T E _ D O C U M E N T >----------------------------------------------------
Special case for cite document. This template takes the limited basic and limited enumerated parameters plus
others that are apply only to standalone published sources that cannot be cited any other way; no url, book,
periodical, etc parameters; limited support for name lists and named identifiers.
when validating parameters in {{cite document}} templates, the basic and
]]
local document_arguments_t = {
['bibcode'] = true,
['bibcode-access'] = true,
['doi'] = true,
['DOI'] = true,
['doi-access'] = true,
['doi-broken-date'] = true,
['hdl'] = true,
['HDL'] = true,
['hdl-access'] = true,
['id'] = true,
['ID'] = true,
['jfm'] = true,
['JFM'] = true,
['lang'] = true,
['location'] = true,
['mr'] = true,
['MR'] = true,
['no-pp'] = true,
['orig-date'] = true,
['origyear'] = true,
['orig-year'] = true,
['osti'] = true,
['OSTI'] = true,
['osti-access'] = true,
['place'] = true,
['publisher'] = true,
['quote-page'] = true,
['quote-pages'] = true,
['script-quote'] = true,
['script-title'] = true,
['title-link'] = true,
['translator'] = true,
['translator-first'] = true,
['translator-given'] = true,
['translator-last'] = true,
['translator-surname'] = true,
['translator-link'] = true,
['translator-mask'] = true,
['trans-quote'] = true,
['type'] = true,
['zbl'] = true,
['ZBL'] = true,
}
local document_numbered_arguments_t = {
['translator#'] = true,
['translator-first#'] = true,
['translator#-first'] = true,
['translator-given#'] = true,
['translator#-given'] = true,
['translator-last#'] = true,
['translator#-last'] = true,
['translator-surname#'] = true,
['translator#-surname'] = true,
['translator-link#'] = true,
['translator#-link'] = true,
['translator-mask#'] = true,
['translator#-mask'] = true,
}
--[[--------------------------< L I S T _ C O M B I N E >------------------------------------------------------
makes one table from a list of tables. <lists_t> is a sequence of tables to be combined
]]
local function list_combine (lists_t)
local out_t = {};
for _, list_t in ipairs (lists_t) do -- for each list in <lists_t>
for k, v in pairs (list_t) do -- extract each k/v pair
out_t[k] = v; -- add to <out_t>
end
end
return out_t; -- and done
end
--[[--------------------------< T E M P L A T E _ L I S T _ G E T >--------------------------------------------
gets a list of the templates from table t
]]
local function template_list_get (t)
local out_t = {}; -- a table for output
for k, _ in pairs (t) do -- spin through the table and collect the keys
table.insert (out_t, k) -- add each key to the output table
end
return out_t; -- and done
end
--[[--------------------------< E X P O R T E D T A B L E S >------------------------------------------------
]]
return {
preprint_arguments_t = preprint_arguments_t,
preprint_template_list_t = template_list_get (preprint_arguments_t), -- make a template list from preprint_arguments{} table
unique_arguments_t = unique_arguments_t,
unique_param_template_list_t = template_list_get (unique_arguments_t), -- make a template list from unique_arguments{} table
document_parameters_t = list_combine ({limited_basic_arguments_t, limited_numbered_arguments_t, document_arguments_t, document_numbered_arguments_t});
common_parameters_t = list_combine ({basic_arguments_t, numbered_arguments_t});
limited_parameters_t = list_combine ({limited_basic_arguments_t, limited_numbered_arguments_t});
};
e7d75a91b1b2d2d12264796bfc0a7125e370f896
Module:Citation/CS1
828
16
27
2023-11-25T16:42:17Z
wikipedia>Trappist the monk
0
sync from sandbox;
Scribunto
text/plain
require ('strict');
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
each of these counts against the Lua upvalue limit
]]
local validation; -- functions in Module:Citation/CS1/Date_validation
local utilities; -- functions in Module:Citation/CS1/Utilities
local z = {}; -- table of tables in Module:Citation/CS1/Utilities
local identifiers; -- functions and tables in Module:Citation/CS1/Identifiers
local metadata; -- functions in Module:Citation/CS1/COinS
local cfg = {}; -- table of configuration tables that are defined in Module:Citation/CS1/Configuration
local whitelist = {}; -- table of tables listing valid template parameter names; defined in Module:Citation/CS1/Whitelist
--[[------------------< P A G E S C O P E V A R I A B L E S >---------------
declare variables here that have page-wide scope that are not brought in from
other modules; that are created here and used here
]]
local added_deprecated_cat; -- Boolean flag so that the category is added only once
local added_vanc_errs; -- Boolean flag so we only emit one Vancouver error / category
local added_generic_name_errs; -- Boolean flag so we only emit one generic name error / category and stop testing names once an error is encountered
local added_numeric_name_errs; -- Boolean flag so we only emit one numeric name error / category and stop testing names once an error is encountered
local added_numeric_name_maint; -- Boolean flag so we only emit one numeric name maint category and stop testing names once a category has been emitted
local Frame; -- holds the module's frame table
local is_preview_mode; -- true when article is in preview mode; false when using 'Preview page with this template' (previewing the module)
local is_sandbox; -- true when using sandbox modules to render citation
--[[--------------------------< F I R S T _ S E T >------------------------------------------------------------
Locates and returns the first set value in a table of values where the order established in the table,
left-to-right (or top-to-bottom), is the order in which the values are evaluated. Returns nil if none are set.
This version replaces the original 'for _, val in pairs do' and a similar version that used ipairs. With the pairs
version the order of evaluation could not be guaranteed. With the ipairs version, a nil value would terminate
the for-loop before it reached the actual end of the list.
]]
local function first_set (list, count)
local i = 1;
while i <= count do -- loop through all items in list
if utilities.is_set( list[i] ) then
return list[i]; -- return the first set list member
end
i = i + 1; -- point to next
end
end
--[[--------------------------< A D D _ V A N C _ E R R O R >----------------------------------------------------
Adds a single Vancouver system error message to the template's output regardless of how many error actually exist.
To prevent duplication, added_vanc_errs is nil until an error message is emitted.
added_vanc_errs is a Boolean declared in page scope variables above
]]
local function add_vanc_error (source, position)
if added_vanc_errs then return end
added_vanc_errs = true; -- note that we've added this category
utilities.set_message ('err_vancouver', {source, position});
end
--[[--------------------------< I S _ S C H E M E >------------------------------------------------------------
does this thing that purports to be a URI scheme seem to be a valid scheme? The scheme is checked to see if it
is in agreement with http://tools.ietf.org/html/std66#section-3.1 which says:
Scheme names consist of a sequence of characters beginning with a
letter and followed by any combination of letters, digits, plus
("+"), period ("."), or hyphen ("-").
returns true if it does, else false
]]
local function is_scheme (scheme)
return scheme and scheme:match ('^%a[%a%d%+%.%-]*:'); -- true if scheme is set and matches the pattern
end
--[=[-------------------------< I S _ D O M A I N _ N A M E >--------------------------------------------------
Does this thing that purports to be a domain name seem to be a valid domain name?
Syntax defined here: http://tools.ietf.org/html/rfc1034#section-3.5
BNF defined here: https://tools.ietf.org/html/rfc4234
Single character names are generally reserved; see https://tools.ietf.org/html/draft-ietf-dnsind-iana-dns-01#page-15;
see also [[Single-letter second-level domain]]
list of TLDs: https://www.iana.org/domains/root/db
RFC 952 (modified by RFC 1123) requires the first and last character of a hostname to be a letter or a digit. Between
the first and last characters the name may use letters, digits, and the hyphen.
Also allowed are IPv4 addresses. IPv6 not supported
domain is expected to be stripped of any path so that the last character in the last character of the TLD. tld
is two or more alpha characters. Any preceding '//' (from splitting a URL with a scheme) will be stripped
here. Perhaps not necessary but retained in case it is necessary for IPv4 dot decimal.
There are several tests:
the first character of the whole domain name including subdomains must be a letter or a digit
internationalized domain name (ASCII characters with .xn-- ASCII Compatible Encoding (ACE) prefix xn-- in the TLD) see https://tools.ietf.org/html/rfc3490
single-letter/digit second-level domains in the .org, .cash, and .today TLDs
q, x, and z SL domains in the .com TLD
i and q SL domains in the .net TLD
single-letter SL domains in the ccTLDs (where the ccTLD is two letters)
two-character SL domains in gTLDs (where the gTLD is two or more letters)
three-plus-character SL domains in gTLDs (where the gTLD is two or more letters)
IPv4 dot-decimal address format; TLD not allowed
returns true if domain appears to be a proper name and TLD or IPv4 address, else false
]=]
local function is_domain_name (domain)
if not domain then
return false; -- if not set, abandon
end
domain = domain:gsub ('^//', ''); -- strip '//' from domain name if present; done here so we only have to do it once
if not domain:match ('^[%w]') then -- first character must be letter or digit
return false;
end
if domain:match ('^%a+:') then -- hack to detect things that look like s:Page:Title where Page: is namespace at Wikisource
return false;
end
local patterns = { -- patterns that look like URLs
'%f[%w][%w][%w%-]+[%w]%.%a%a+$', -- three or more character hostname.hostname or hostname.tld
'%f[%w][%w][%w%-]+[%w]%.xn%-%-[%w]+$', -- internationalized domain name with ACE prefix
'%f[%a][qxz]%.com$', -- assigned one character .com hostname (x.com times out 2015-12-10)
'%f[%a][iq]%.net$', -- assigned one character .net hostname (q.net registered but not active 2015-12-10)
'%f[%w][%w]%.%a%a$', -- one character hostname and ccTLD (2 chars)
'%f[%w][%w][%w]%.%a%a+$', -- two character hostname and TLD
'^%d%d?%d?%.%d%d?%d?%.%d%d?%d?%.%d%d?%d?', -- IPv4 address
}
for _, pattern in ipairs (patterns) do -- loop through the patterns list
if domain:match (pattern) then
return true; -- if a match then we think that this thing that purports to be a URL is a URL
end
end
for _, d in ipairs (cfg.single_letter_2nd_lvl_domains_t) do -- look for single letter second level domain names for these top level domains
if domain:match ('%f[%w][%w]%.' .. d) then
return true
end
end
return false; -- no matches, we don't know what this thing is
end
--[[--------------------------< I S _ U R L >------------------------------------------------------------------
returns true if the scheme and domain parts of a URL appear to be a valid URL; else false.
This function is the last step in the validation process. This function is separate because there are cases that
are not covered by split_url(), for example is_parameter_ext_wikilink() which is looking for bracketted external
wikilinks.
]]
local function is_url (scheme, domain)
if utilities.is_set (scheme) then -- if scheme is set check it and domain
return is_scheme (scheme) and is_domain_name (domain);
else
return is_domain_name (domain); -- scheme not set when URL is protocol-relative
end
end
--[[--------------------------< S P L I T _ U R L >------------------------------------------------------------
Split a URL into a scheme, authority indicator, and domain.
First remove Fully Qualified Domain Name terminator (a dot following TLD) (if any) and any path(/), query(?) or fragment(#).
If protocol-relative URL, return nil scheme and domain else return nil for both scheme and domain.
When not protocol-relative, get scheme, authority indicator, and domain. If there is an authority indicator (one
or more '/' characters immediately following the scheme's colon), make sure that there are only 2.
Any URL that does not have news: scheme must have authority indicator (//). TODO: are there other common schemes
like news: that don't use authority indicator?
Strip off any port and path;
]]
local function split_url (url_str)
local scheme, authority, domain;
url_str = url_str:gsub ('([%a%d])%.?[/%?#].*$', '%1'); -- strip FQDN terminator and path(/), query(?), fragment (#) (the capture prevents false replacement of '//')
if url_str:match ('^//%S*') then -- if there is what appears to be a protocol-relative URL
domain = url_str:match ('^//(%S*)')
elseif url_str:match ('%S-:/*%S+') then -- if there is what appears to be a scheme, optional authority indicator, and domain name
scheme, authority, domain = url_str:match ('(%S-:)(/*)(%S+)'); -- extract the scheme, authority indicator, and domain portions
if utilities.is_set (authority) then
authority = authority:gsub ('//', '', 1); -- replace place 1 pair of '/' with nothing;
if utilities.is_set(authority) then -- if anything left (1 or 3+ '/' where authority should be) then
return scheme; -- return scheme only making domain nil which will cause an error message
end
else
if not scheme:match ('^news:') then -- except for news:..., MediaWiki won't link URLs that do not have authority indicator; TODO: a better way to do this test?
return scheme; -- return scheme only making domain nil which will cause an error message
end
end
domain = domain:gsub ('(%a):%d+', '%1'); -- strip port number if present
end
return scheme, domain;
end
--[[--------------------------< L I N K _ P A R A M _ O K >---------------------------------------------------
checks the content of |title-link=, |series-link=, |author-link=, etc. for properly formatted content: no wikilinks, no URLs
Link parameters are to hold the title of a Wikipedia article, so none of the WP:TITLESPECIALCHARACTERS are allowed:
# < > [ ] | { } _
except the underscore which is used as a space in wiki URLs and # which is used for section links
returns false when the value contains any of these characters.
When there are no illegal characters, this function returns TRUE if value DOES NOT appear to be a valid URL (the
|<param>-link= parameter is ok); else false when value appears to be a valid URL (the |<param>-link= parameter is NOT ok).
]]
local function link_param_ok (value)
local scheme, domain;
if value:find ('[<>%[%]|{}]') then -- if any prohibited characters
return false;
end
scheme, domain = split_url (value); -- get scheme or nil and domain or nil from URL;
return not is_url (scheme, domain); -- return true if value DOES NOT appear to be a valid URL
end
--[[--------------------------< L I N K _ T I T L E _ O K >---------------------------------------------------
Use link_param_ok() to validate |<param>-link= value and its matching |<title>= value.
|<title>= may be wiki-linked but not when |<param>-link= has a value. This function emits an error message when
that condition exists
check <link> for inter-language interwiki-link prefix. prefix must be a MediaWiki-recognized language
code and must begin with a colon.
]]
local function link_title_ok (link, lorig, title, torig)
local orig;
if utilities.is_set (link) then -- don't bother if <param>-link doesn't have a value
if not link_param_ok (link) then -- check |<param>-link= markup
orig = lorig; -- identify the failing link parameter
elseif title:find ('%[%[') then -- check |title= for wikilink markup
orig = torig; -- identify the failing |title= parameter
elseif link:match ('^%a+:') then -- if the link is what looks like an interwiki
local prefix = link:match ('^(%a+):'):lower(); -- get the interwiki prefix
if cfg.inter_wiki_map[prefix] then -- if prefix is in the map, must have preceding colon
orig = lorig; -- flag as error
end
end
end
if utilities.is_set (orig) then
link = ''; -- unset
utilities.set_message ('err_bad_paramlink', orig); -- URL or wikilink in |title= with |title-link=;
end
return link; -- link if ok, empty string else
end
--[[--------------------------< C H E C K _ U R L >------------------------------------------------------------
Determines whether a URL string appears to be valid.
First we test for space characters. If any are found, return false. Then split the URL into scheme and domain
portions, or for protocol-relative (//example.com) URLs, just the domain. Use is_url() to validate the two
portions of the URL. If both are valid, or for protocol-relative if domain is valid, return true, else false.
Because it is different from a standard URL, and because this module used external_link() to make external links
that work for standard and news: links, we validate newsgroup names here. The specification for a newsgroup name
is at https://tools.ietf.org/html/rfc5536#section-3.1.4
]]
local function check_url( url_str )
if nil == url_str:match ("^%S+$") then -- if there are any spaces in |url=value it can't be a proper URL
return false;
end
local scheme, domain;
scheme, domain = split_url (url_str); -- get scheme or nil and domain or nil from URL;
if 'news:' == scheme then -- special case for newsgroups
return domain:match('^[%a%d%+%-_]+%.[%a%d%+%-_%.]*[%a%d%+%-_]$');
end
return is_url (scheme, domain); -- return true if value appears to be a valid URL
end
--[=[-------------------------< I S _ P A R A M E T E R _ E X T _ W I K I L I N K >----------------------------
Return true if a parameter value has a string that begins and ends with square brackets [ and ] and the first
non-space characters following the opening bracket appear to be a URL. The test will also find external wikilinks
that use protocol-relative URLs. Also finds bare URLs.
The frontier pattern prevents a match on interwiki-links which are similar to scheme:path URLs. The tests that
find bracketed URLs are required because the parameters that call this test (currently |title=, |chapter=, |work=,
and |publisher=) may have wikilinks and there are articles or redirects like '//Hus' so, while uncommon, |title=[[//Hus]]
is possible as might be [[en://Hus]].
]=]
local function is_parameter_ext_wikilink (value)
local scheme, domain;
if value:match ('%f[%[]%[%a%S*:%S+.*%]') then -- if ext. wikilink with scheme and domain: [xxxx://yyyyy.zzz]
scheme, domain = split_url (value:match ('%f[%[]%[(%a%S*:%S+).*%]'));
elseif value:match ('%f[%[]%[//%S+.*%]') then -- if protocol-relative ext. wikilink: [//yyyyy.zzz]
scheme, domain = split_url (value:match ('%f[%[]%[(//%S+).*%]'));
elseif value:match ('%a%S*:%S+') then -- if bare URL with scheme; may have leading or trailing plain text
scheme, domain = split_url (value:match ('(%a%S*:%S+)'));
elseif value:match ('//%S+') then -- if protocol-relative bare URL: //yyyyy.zzz; may have leading or trailing plain text
scheme, domain = split_url (value:match ('(//%S+)')); -- what is left should be the domain
else
return false; -- didn't find anything that is obviously a URL
end
return is_url (scheme, domain); -- return true if value appears to be a valid URL
end
--[[-------------------------< C H E C K _ F O R _ U R L >-----------------------------------------------------
loop through a list of parameters and their values. Look at the value and if it has an external link, emit an error message.
]]
local function check_for_url (parameter_list, error_list)
for k, v in pairs (parameter_list) do -- for each parameter in the list
if is_parameter_ext_wikilink (v) then -- look at the value; if there is a URL add an error message
table.insert (error_list, utilities.wrap_style ('parameter', k));
end
end
end
--[[--------------------------< S A F E _ F O R _ U R L >------------------------------------------------------
Escape sequences for content that will be used for URL descriptions
]]
local function safe_for_url( str )
if str:match( "%[%[.-%]%]" ) ~= nil then
utilities.set_message ('err_wikilink_in_url', {});
end
return str:gsub( '[%[%]\n]', {
['['] = '[',
[']'] = ']',
['\n'] = ' ' } );
end
--[[--------------------------< E X T E R N A L _ L I N K >----------------------------------------------------
Format an external link with error checking
]]
local function external_link (URL, label, source, access)
local err_msg = '';
local domain;
local path;
local base_url;
if not utilities.is_set (label) then
label = URL;
if utilities.is_set (source) then
utilities.set_message ('err_bare_url_missing_title', {utilities.wrap_style ('parameter', source)});
else
error (cfg.messages["bare_url_no_origin"]); -- programmer error; valid parameter name does not have matching meta-parameter
end
end
if not check_url (URL) then
utilities.set_message ('err_bad_url', {utilities.wrap_style ('parameter', source)});
end
domain, path = URL:match ('^([/%.%-%+:%a%d]+)([/%?#].*)$'); -- split the URL into scheme plus domain and path
if path then -- if there is a path portion
path = path:gsub ('[%[%]]', {['['] = '%5b', [']'] = '%5d'}); -- replace '[' and ']' with their percent-encoded values
URL = table.concat ({domain, path}); -- and reassemble
end
base_url = table.concat ({ "[", URL, " ", safe_for_url (label), "]" }); -- assemble a wiki-markup URL
if utilities.is_set (access) then -- access level (subscription, registration, limited)
base_url = utilities.substitute (cfg.presentation['ext-link-access-signal'], {cfg.presentation[access].class, cfg.presentation[access].title, base_url}); -- add the appropriate icon
end
return base_url;
end
--[[--------------------------< D E P R E C A T E D _ P A R A M E T E R >--------------------------------------
Categorize and emit an error message when the citation contains one or more deprecated parameters. The function includes the
offending parameter name to the error message. Only one error message is emitted regardless of the number of deprecated
parameters in the citation.
added_deprecated_cat is a Boolean declared in page scope variables above
]]
local function deprecated_parameter(name)
if not added_deprecated_cat then
added_deprecated_cat = true; -- note that we've added this category
utilities.set_message ('err_deprecated_params', {name}); -- add error message
end
end
--[=[-------------------------< K E R N _ Q U O T E S >--------------------------------------------------------
Apply kerning to open the space between the quote mark provided by the module and a leading or trailing quote
mark contained in a |title= or |chapter= parameter's value.
This function will positive kern either single or double quotes:
"'Unkerned title with leading and trailing single quote marks'"
" 'Kerned title with leading and trailing single quote marks' " (in real life the kerning isn't as wide as this example)
Double single quotes (italic or bold wiki-markup) are not kerned.
Replaces Unicode quote marks in plain text or in the label portion of a [[L|D]] style wikilink with typewriter
quote marks regardless of the need for kerning. Unicode quote marks are not replaced in simple [[D]] wikilinks.
Call this function for chapter titles, for website titles, etc.; not for book titles.
]=]
local function kern_quotes (str)
local cap = '';
local wl_type, label, link;
wl_type, label, link = utilities.is_wikilink (str); -- wl_type is: 0, no wl (text in label variable); 1, [[D]]; 2, [[L|D]]
if 1 == wl_type then -- [[D]] simple wikilink with or without quote marks
if mw.ustring.match (str, '%[%[[\"“”\'‘’].+[\"“”\'‘’]%]%]') then -- leading and trailing quote marks
str = utilities.substitute (cfg.presentation['kern-left'], str);
str = utilities.substitute (cfg.presentation['kern-right'], str);
elseif mw.ustring.match (str, '%[%[[\"“”\'‘’].+%]%]') then -- leading quote marks
str = utilities.substitute (cfg.presentation['kern-left'], str);
elseif mw.ustring.match (str, '%[%[.+[\"“”\'‘’]%]%]') then -- trailing quote marks
str = utilities.substitute (cfg.presentation['kern-right'], str);
end
else -- plain text or [[L|D]]; text in label variable
label = mw.ustring.gsub (label, '[“”]', '\"'); -- replace “” (U+201C & U+201D) with " (typewriter double quote mark)
label = mw.ustring.gsub (label, '[‘’]', '\''); -- replace ‘’ (U+2018 & U+2019) with ' (typewriter single quote mark)
cap = mw.ustring.match (label, "^([\"\'][^\'].+)"); -- match leading double or single quote but not doubled single quotes (italic markup)
if utilities.is_set (cap) then
label = utilities.substitute (cfg.presentation['kern-left'], cap);
end
cap = mw.ustring.match (label, "^(.+[^\'][\"\'])$") -- match trailing double or single quote but not doubled single quotes (italic markup)
if utilities.is_set (cap) then
label = utilities.substitute (cfg.presentation['kern-right'], cap);
end
if 2 == wl_type then
str = utilities.make_wikilink (link, label); -- reassemble the wikilink
else
str = label;
end
end
return str;
end
--[[--------------------------< F O R M A T _ S C R I P T _ V A L U E >----------------------------------------
|script-title= holds title parameters that are not written in Latin-based scripts: Chinese, Japanese, Arabic, Hebrew, etc. These scripts should
not be italicized and may be written right-to-left. The value supplied by |script-title= is concatenated onto Title after Title has been wrapped
in italic markup.
Regardless of language, all values provided by |script-title= are wrapped in <bdi>...</bdi> tags to isolate RTL languages from the English left to right.
|script-title= provides a unique feature. The value in |script-title= may be prefixed with a two-character ISO 639-1 language code and a colon:
|script-title=ja:*** *** (where * represents a Japanese character)
Spaces between the two-character code and the colon and the colon and the first script character are allowed:
|script-title=ja : *** ***
|script-title=ja: *** ***
|script-title=ja :*** ***
Spaces preceding the prefix are allowed: |script-title = ja:*** ***
The prefix is checked for validity. If it is a valid ISO 639-1 language code, the lang attribute (lang="ja") is added to the <bdi> tag so that browsers can
know the language the tag contains. This may help the browser render the script more correctly. If the prefix is invalid, the lang attribute
is not added. At this time there is no error message for this condition.
Supports |script-title=, |script-chapter=, |script-<periodical>=
]]
local function format_script_value (script_value, script_param)
local lang=''; -- initialize to empty string
local name;
if script_value:match('^%l%l%l?%s*:') then -- if first 3 or 4 non-space characters are script language prefix
lang = script_value:match('^(%l%l%l?)%s*:%s*%S.*'); -- get the language prefix or nil if there is no script
if not utilities.is_set (lang) then
utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['missing title part']}); -- prefix without 'title'; add error message
return ''; -- script_value was just the prefix so return empty string
end
-- if we get this far we have prefix and script
name = cfg.lang_tag_remap[lang] or mw.language.fetchLanguageName( lang, cfg.this_wiki_code ); -- get language name so that we can use it to categorize
if utilities.is_set (name) then -- is prefix a proper ISO 639-1 language code?
script_value = script_value:gsub ('^%l+%s*:%s*', ''); -- strip prefix from script
-- is prefix one of these language codes?
if utilities.in_array (lang, cfg.script_lang_codes) then
utilities.add_prop_cat ('script', {name, lang})
else
utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['unknown language code']}); -- unknown script-language; add error message
end
lang = ' lang="' .. lang .. '" '; -- convert prefix into a lang attribute
else
utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['invalid language code']}); -- invalid language code; add error message
lang = ''; -- invalid so set lang to empty string
end
else
utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['missing prefix']}); -- no language code prefix; add error message
end
script_value = utilities.substitute (cfg.presentation['bdi'], {lang, script_value}); -- isolate in case script is RTL
return script_value;
end
--[[--------------------------< S C R I P T _ C O N C A T E N A T E >------------------------------------------
Initially for |title= and |script-title=, this function concatenates those two parameter values after the script
value has been wrapped in <bdi> tags.
]]
local function script_concatenate (title, script, script_param)
if utilities.is_set (script) then
script = format_script_value (script, script_param); -- <bdi> tags, lang attribute, categorization, etc.; returns empty string on error
if utilities.is_set (script) then
title = title .. ' ' .. script; -- concatenate title and script title
end
end
return title;
end
--[[--------------------------< W R A P _ M S G >--------------------------------------------------------------
Applies additional message text to various parameter values. Supplied string is wrapped using a message_list
configuration taking one argument. Supports lower case text for {{citation}} templates. Additional text taken
from citation_config.messages - the reason this function is similar to but separate from wrap_style().
]]
local function wrap_msg (key, str, lower)
if not utilities.is_set ( str ) then
return "";
end
if true == lower then
local msg;
msg = cfg.messages[key]:lower(); -- set the message to lower case before
return utilities.substitute ( msg, str ); -- including template text
else
return utilities.substitute ( cfg.messages[key], str );
end
end
--[[----------------< W I K I S O U R C E _ U R L _ M A K E >-------------------
Makes a Wikisource URL from Wikisource interwiki-link. Returns the URL and appropriate
label; nil else.
str is the value assigned to |chapter= (or aliases) or |title= or |title-link=
]]
local function wikisource_url_make (str)
local wl_type, D, L;
local ws_url, ws_label;
local wikisource_prefix = table.concat ({'https://', cfg.this_wiki_code, '.wikisource.org/wiki/'});
wl_type, D, L = utilities.is_wikilink (str); -- wl_type is 0 (not a wikilink), 1 (simple wikilink), 2 (complex wikilink)
if 0 == wl_type then -- not a wikilink; might be from |title-link=
str = D:match ('^[Ww]ikisource:(.+)') or D:match ('^[Ss]:(.+)'); -- article title from interwiki link with long-form or short-form namespace
if utilities.is_set (str) then
ws_url = table.concat ({ -- build a Wikisource URL
wikisource_prefix, -- prefix
str, -- article title
});
ws_label = str; -- label for the URL
end
elseif 1 == wl_type then -- simple wikilink: [[Wikisource:ws article]]
str = D:match ('^[Ww]ikisource:(.+)') or D:match ('^[Ss]:(.+)'); -- article title from interwiki link with long-form or short-form namespace
if utilities.is_set (str) then
ws_url = table.concat ({ -- build a Wikisource URL
wikisource_prefix, -- prefix
str, -- article title
});
ws_label = str; -- label for the URL
end
elseif 2 == wl_type then -- non-so-simple wikilink: [[Wikisource:ws article|displayed text]] ([[L|D]])
str = L:match ('^[Ww]ikisource:(.+)') or L:match ('^[Ss]:(.+)'); -- article title from interwiki link with long-form or short-form namespace
if utilities.is_set (str) then
ws_label = D; -- get ws article name from display portion of interwiki link
ws_url = table.concat ({ -- build a Wikisource URL
wikisource_prefix, -- prefix
str, -- article title without namespace from link portion of wikilink
});
end
end
if ws_url then
ws_url = mw.uri.encode (ws_url, 'WIKI'); -- make a usable URL
ws_url = ws_url:gsub ('%%23', '#'); -- undo percent-encoding of fragment marker
end
return ws_url, ws_label, L or D; -- return proper URL or nil and a label or nil
end
--[[----------------< F O R M A T _ P E R I O D I C A L >-----------------------
Format the three periodical parameters: |script-<periodical>=, |<periodical>=,
and |trans-<periodical>= into a single Periodical meta-parameter.
]]
local function format_periodical (script_periodical, script_periodical_source, periodical, trans_periodical)
if not utilities.is_set (periodical) then
periodical = ''; -- to be safe for concatenation
else
periodical = utilities.wrap_style ('italic-title', periodical); -- style
end
periodical = script_concatenate (periodical, script_periodical, script_periodical_source); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped
if utilities.is_set (trans_periodical) then
trans_periodical = utilities.wrap_style ('trans-italic-title', trans_periodical);
if utilities.is_set (periodical) then
periodical = periodical .. ' ' .. trans_periodical;
else -- here when trans-periodical without periodical or script-periodical
periodical = trans_periodical;
utilities.set_message ('err_trans_missing_title', {'periodical'});
end
end
return periodical;
end
--[[------------------< F O R M A T _ C H A P T E R _ T I T L E >---------------
Format the four chapter parameters: |script-chapter=, |chapter=, |trans-chapter=,
and |chapter-url= into a single chapter meta- parameter (chapter_url_source used
for error messages).
]]
local function format_chapter_title (script_chapter, script_chapter_source, chapter, chapter_source, trans_chapter, trans_chapter_source, chapter_url, chapter_url_source, no_quotes, access)
local ws_url, ws_label, L = wikisource_url_make (chapter); -- make a wikisource URL and label from a wikisource interwiki link
if ws_url then
ws_label = ws_label:gsub ('_', ' '); -- replace underscore separators with space characters
chapter = ws_label;
end
if not utilities.is_set (chapter) then
chapter = ''; -- to be safe for concatenation
else
if false == no_quotes then
chapter = kern_quotes (chapter); -- if necessary, separate chapter title's leading and trailing quote marks from module provided quote marks
chapter = utilities.wrap_style ('quoted-title', chapter);
end
end
chapter = script_concatenate (chapter, script_chapter, script_chapter_source); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped
if utilities.is_set (chapter_url) then
chapter = external_link (chapter_url, chapter, chapter_url_source, access); -- adds bare_url_missing_title error if appropriate
elseif ws_url then
chapter = external_link (ws_url, chapter .. ' ', 'ws link in chapter'); -- adds bare_url_missing_title error if appropriate; space char to move icon away from chap text; TODO: better way to do this?
chapter = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], L, chapter});
end
if utilities.is_set (trans_chapter) then
trans_chapter = utilities.wrap_style ('trans-quoted-title', trans_chapter);
if utilities.is_set (chapter) then
chapter = chapter .. ' ' .. trans_chapter;
else -- here when trans_chapter without chapter or script-chapter
chapter = trans_chapter;
chapter_source = trans_chapter_source:match ('trans%-?(.+)'); -- when no chapter, get matching name from trans-<param>
utilities.set_message ('err_trans_missing_title', {chapter_source});
end
end
return chapter;
end
--[[----------------< H A S _ I N V I S I B L E _ C H A R S >-------------------
This function searches a parameter's value for non-printable or invisible characters.
The search stops at the first match.
This function will detect the visible replacement character when it is part of the Wikisource.
Detects but ignores nowiki and math stripmarkers. Also detects other named stripmarkers
(gallery, math, pre, ref) and identifies them with a slightly different error message.
See also coins_cleanup().
Output of this function is an error message that identifies the character or the
Unicode group, or the stripmarker that was detected along with its position (or,
for multi-byte characters, the position of its first byte) in the parameter value.
]]
local function has_invisible_chars (param, v)
local position = ''; -- position of invisible char or starting position of stripmarker
local capture; -- used by stripmarker detection to hold name of the stripmarker
local stripmarker; -- boolean set true when a stripmarker is found
capture = string.match (v, '[%w%p ]*'); -- test for values that are simple ASCII text and bypass other tests if true
if capture == v then -- if same there are no Unicode characters
return;
end
for _, invisible_char in ipairs (cfg.invisible_chars) do
local char_name = invisible_char[1]; -- the character or group name
local pattern = invisible_char[2]; -- the pattern used to find it
position, _, capture = mw.ustring.find (v, pattern); -- see if the parameter value contains characters that match the pattern
if position and (cfg.invisible_defs.zwj == capture) then -- if we found a zero-width joiner character
if mw.ustring.find (v, cfg.indic_script) then -- it's ok if one of the Indic scripts
position = nil; -- unset position
elseif cfg.emoji_t[mw.ustring.codepoint (v, position+1)] then -- is zwj followed by a character listed in emoji{}?
position = nil; -- unset position
end
end
if position then
if 'nowiki' == capture or 'math' == capture or -- nowiki and math stripmarkers (not an error condition)
('templatestyles' == capture and utilities.in_array (param, {'id', 'quote'})) then -- templatestyles stripmarker allowed in these parameters
stripmarker = true; -- set a flag
elseif true == stripmarker and cfg.invisible_defs.del == capture then -- because stripmakers begin and end with the delete char, assume that we've found one end of a stripmarker
position = nil; -- unset
else
local err_msg;
if capture and not (cfg.invisible_defs.del == capture or cfg.invisible_defs.zwj == capture) then
err_msg = capture .. ' ' .. char_name;
else
err_msg = char_name .. ' ' .. 'character';
end
utilities.set_message ('err_invisible_char', {err_msg, utilities.wrap_style ('parameter', param), position}); -- add error message
return; -- and done with this parameter
end
end
end
end
--[[-------------------< A R G U M E N T _ W R A P P E R >----------------------
Argument wrapper. This function provides support for argument mapping defined
in the configuration file so that multiple names can be transparently aliased to
single internal variable.
]]
local function argument_wrapper ( args )
local origin = {};
return setmetatable({
ORIGIN = function ( self, k )
local dummy = self[k]; -- force the variable to be loaded.
return origin[k];
end
},
{
__index = function ( tbl, k )
if origin[k] ~= nil then
return nil;
end
local args, list, v = args, cfg.aliases[k];
if type( list ) == 'table' then
v, origin[k] = utilities.select_one ( args, list, 'err_redundant_parameters' );
if origin[k] == nil then
origin[k] = ''; -- Empty string, not nil
end
elseif list ~= nil then
v, origin[k] = args[list], list;
else
-- maybe let through instead of raising an error?
-- v, origin[k] = args[k], k;
error( cfg.messages['unknown_argument_map'] .. ': ' .. k);
end
-- Empty strings, not nil;
if v == nil then
v = '';
origin[k] = '';
end
tbl = rawset( tbl, k, v );
return v;
end,
});
end
--[[--------------------------< N O W R A P _ D A T E >-------------------------
When date is YYYY-MM-DD format wrap in nowrap span: <span ...>YYYY-MM-DD</span>.
When date is DD MMMM YYYY or is MMMM DD, YYYY then wrap in nowrap span:
<span ...>DD MMMM</span> YYYY or <span ...>MMMM DD,</span> YYYY
DOES NOT yet support MMMM YYYY or any of the date ranges.
]]
local function nowrap_date (date)
local cap = '';
local cap2 = '';
if date:match("^%d%d%d%d%-%d%d%-%d%d$") then
date = utilities.substitute (cfg.presentation['nowrap1'], date);
elseif date:match("^%a+%s*%d%d?,%s+%d%d%d%d$") or date:match ("^%d%d?%s*%a+%s+%d%d%d%d$") then
cap, cap2 = string.match (date, "^(.*)%s+(%d%d%d%d)$");
date = utilities.substitute (cfg.presentation['nowrap2'], {cap, cap2});
end
return date;
end
--[[--------------------------< S E T _ T I T L E T Y P E >---------------------
This function sets default title types (equivalent to the citation including
|type=<default value>) for those templates that have defaults. Also handles the
special case where it is desirable to omit the title type from the rendered citation
(|type=none).
]]
local function set_titletype (cite_class, title_type)
if utilities.is_set (title_type) then
if 'none' == cfg.keywords_xlate[title_type] then
title_type = ''; -- if |type=none then type parameter not displayed
end
return title_type; -- if |type= has been set to any other value use that value
end
return cfg.title_types [cite_class] or ''; -- set template's default title type; else empty string for concatenation
end
--[[--------------------------< S A F E _ J O I N >-----------------------------
Joins a sequence of strings together while checking for duplicate separation characters.
]]
local function safe_join( tbl, duplicate_char )
local f = {}; -- create a function table appropriate to type of 'duplicate character'
if 1 == #duplicate_char then -- for single byte ASCII characters use the string library functions
f.gsub = string.gsub
f.match = string.match
f.sub = string.sub
else -- for multi-byte characters use the ustring library functions
f.gsub = mw.ustring.gsub
f.match = mw.ustring.match
f.sub = mw.ustring.sub
end
local str = ''; -- the output string
local comp = ''; -- what does 'comp' mean?
local end_chr = '';
local trim;
for _, value in ipairs( tbl ) do
if value == nil then value = ''; end
if str == '' then -- if output string is empty
str = value; -- assign value to it (first time through the loop)
elseif value ~= '' then
if value:sub(1, 1) == '<' then -- special case of values enclosed in spans and other markup.
comp = value:gsub( "%b<>", "" ); -- remove HTML markup (<span>string</span> -> string)
else
comp = value;
end
-- typically duplicate_char is sepc
if f.sub(comp, 1, 1) == duplicate_char then -- is first character same as duplicate_char? why test first character?
-- Because individual string segments often (always?) begin with terminal punct for the
-- preceding segment: 'First element' .. 'sepc next element' .. etc.?
trim = false;
end_chr = f.sub(str, -1, -1); -- get the last character of the output string
-- str = str .. "<HERE(enchr=" .. end_chr .. ")" -- debug stuff?
if end_chr == duplicate_char then -- if same as separator
str = f.sub(str, 1, -2); -- remove it
elseif end_chr == "'" then -- if it might be wiki-markup
if f.sub(str, -3, -1) == duplicate_char .. "''" then -- if last three chars of str are sepc''
str = f.sub(str, 1, -4) .. "''"; -- remove them and add back ''
elseif f.sub(str, -5, -1) == duplicate_char .. "]]''" then -- if last five chars of str are sepc]]''
trim = true; -- why? why do this and next differently from previous?
elseif f.sub(str, -4, -1) == duplicate_char .. "]''" then -- if last four chars of str are sepc]''
trim = true; -- same question
end
elseif end_chr == "]" then -- if it might be wiki-markup
if f.sub(str, -3, -1) == duplicate_char .. "]]" then -- if last three chars of str are sepc]] wikilink
trim = true;
elseif f.sub(str, -3, -1) == duplicate_char .. '"]' then -- if last three chars of str are sepc"] quoted external link
trim = true;
elseif f.sub(str, -2, -1) == duplicate_char .. "]" then -- if last two chars of str are sepc] external link
trim = true;
elseif f.sub(str, -4, -1) == duplicate_char .. "'']" then -- normal case when |url=something & |title=Title.
trim = true;
end
elseif end_chr == " " then -- if last char of output string is a space
if f.sub(str, -2, -1) == duplicate_char .. " " then -- if last two chars of str are <sepc><space>
str = f.sub(str, 1, -3); -- remove them both
end
end
if trim then
if value ~= comp then -- value does not equal comp when value contains HTML markup
local dup2 = duplicate_char;
if f.match(dup2, "%A" ) then dup2 = "%" .. dup2; end -- if duplicate_char not a letter then escape it
value = f.gsub(value, "(%b<>)" .. dup2, "%1", 1 ) -- remove duplicate_char if it follows HTML markup
else
value = f.sub(value, 2, -1 ); -- remove duplicate_char when it is first character
end
end
end
str = str .. value; -- add it to the output string
end
end
return str;
end
--[[--------------------------< I S _ S U F F I X >-----------------------------
returns true if suffix is properly formed Jr, Sr, or ordinal in the range 1–9.
Puncutation not allowed.
]]
local function is_suffix (suffix)
if utilities.in_array (suffix, {'Jr', 'Sr', 'Jnr', 'Snr', '1st', '2nd', '3rd'}) or suffix:match ('^%dth$') then
return true;
end
return false;
end
--[[--------------------< I S _ G O O D _ V A N C _ N A M E >-------------------
For Vancouver style, author/editor names are supposed to be rendered in Latin
(read ASCII) characters. When a name uses characters that contain diacritical
marks, those characters are to be converted to the corresponding Latin
character. When a name is written using a non-Latin alphabet or logogram, that
name is to be transliterated into Latin characters. The module doesn't do this
so editors may/must.
This test allows |first= and |last= names to contain any of the letters defined
in the four Unicode Latin character sets
[http://www.unicode.org/charts/PDF/U0000.pdf C0 Controls and Basic Latin] 0041–005A, 0061–007A
[http://www.unicode.org/charts/PDF/U0080.pdf C1 Controls and Latin-1 Supplement] 00C0–00D6, 00D8–00F6, 00F8–00FF
[http://www.unicode.org/charts/PDF/U0100.pdf Latin Extended-A] 0100–017F
[http://www.unicode.org/charts/PDF/U0180.pdf Latin Extended-B] 0180–01BF, 01C4–024F
|lastn= also allowed to contain hyphens, spaces, and apostrophes.
(http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35029/)
|firstn= also allowed to contain hyphens, spaces, apostrophes, and periods
This original test:
if nil == mw.ustring.find (last, "^[A-Za-zÀ-ÖØ-öø-ƿDŽ-ɏ%-%s%']*$")
or nil == mw.ustring.find (first, "^[A-Za-zÀ-ÖØ-öø-ƿDŽ-ɏ%-%s%'%.]+[2-6%a]*$") then
was written outside of the code editor and pasted here because the code editor
gets confused between character insertion point and cursor position. The test has
been rewritten to use decimal character escape sequence for the individual bytes
of the Unicode characters so that it is not necessary to use an external editor
to maintain this code.
\195\128-\195\150 – À-Ö (U+00C0–U+00D6 – C0 controls)
\195\152-\195\182 – Ø-ö (U+00D8-U+00F6 – C0 controls)
\195\184-\198\191 – ø-ƿ (U+00F8-U+01BF – C0 controls, Latin extended A & B)
\199\132-\201\143 – DŽ-ɏ (U+01C4-U+024F – Latin extended B)
]]
local function is_good_vanc_name (last, first, suffix, position)
if not suffix then
if first:find ('[,%s]') then -- when there is a space or comma, might be first name/initials + generational suffix
first = first:match ('(.-)[,%s]+'); -- get name/initials
suffix = first:match ('[,%s]+(.+)$'); -- get generational suffix
end
end
if utilities.is_set (suffix) then
if not is_suffix (suffix) then
add_vanc_error (cfg.err_msg_supl.suffix, position);
return false; -- not a name with an appropriate suffix
end
end
if nil == mw.ustring.find (last, "^[A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143%-%s%']*$") or
nil == mw.ustring.find (first, "^[A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143%-%s%'%.]*$") then
add_vanc_error (cfg.err_msg_supl['non-Latin char'], position);
return false; -- not a string of Latin characters; Vancouver requires Romanization
end;
return true;
end
--[[--------------------------< R E D U C E _ T O _ I N I T I A L S >------------------------------------------
Attempts to convert names to initials in support of |name-list-style=vanc.
Names in |firstn= may be separated by spaces or hyphens, or for initials, a period.
See http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35062/.
Vancouver style requires family rank designations (Jr, II, III, etc.) to be rendered
as Jr, 2nd, 3rd, etc. See http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35085/.
This code only accepts and understands generational suffix in the Vancouver format
because Roman numerals look like, and can be mistaken for, initials.
This function uses ustring functions because firstname initials may be any of the
Unicode Latin characters accepted by is_good_vanc_name ().
]]
local function reduce_to_initials(first, position)
local name, suffix = mw.ustring.match(first, "^(%u+) ([%dJS][%drndth]+)$");
if not name then -- if not initials and a suffix
name = mw.ustring.match(first, "^(%u+)$"); -- is it just initials?
end
if name then -- if first is initials with or without suffix
if 3 > mw.ustring.len (name) then -- if one or two initials
if suffix then -- if there is a suffix
if is_suffix (suffix) then -- is it legitimate?
return first; -- one or two initials and a valid suffix so nothing to do
else
add_vanc_error (cfg.err_msg_supl.suffix, position); -- one or two initials with invalid suffix so error message
return first; -- and return first unmolested
end
else
return first; -- one or two initials without suffix; nothing to do
end
end
end -- if here then name has 3 or more uppercase letters so treat them as a word
local initials, names = {}, {}; -- tables to hold name parts and initials
local i = 1; -- counter for number of initials
names = mw.text.split (first, '[%s,]+'); -- split into a table of names and possible suffix
while names[i] do -- loop through the table
if 1 < i and names[i]:match ('[%dJS][%drndth]+%.?$') then -- if not the first name, and looks like a suffix (may have trailing dot)
names[i] = names[i]:gsub ('%.', ''); -- remove terminal dot if present
if is_suffix (names[i]) then -- if a legitimate suffix
table.insert (initials, ' ' .. names[i]); -- add a separator space, insert at end of initials table
break; -- and done because suffix must fall at the end of a name
end -- no error message if not a suffix; possibly because of Romanization
end
if 3 > i then
table.insert (initials, mw.ustring.sub(names[i], 1, 1)); -- insert the initial at end of initials table
end
i = i + 1; -- bump the counter
end
return table.concat(initials) -- Vancouver format does not include spaces.
end
--[[--------------------------< I N T E R W I K I _ P R E F I X E N _ G E T >----------------------------------
extract interwiki prefixen from <value>. Returns two one or two values:
false – no prefixen
nil – prefix exists but not recognized
project prefix, language prefix – when value has either of:
:<project>:<language>:<article>
:<language>:<project>:<article>
project prefix, nil – when <value> has only a known single-letter prefix
nil, language prefix – when <value> has only a known language prefix
accepts single-letter project prefixen: 'd' (wikidata), 's' (wikisource), and 'w' (wikipedia) prefixes; at this
writing, the other single-letter prefixen (b (wikibook), c (commons), m (meta), n (wikinews), q (wikiquote), and
v (wikiversity)) are not supported.
]]
local function interwiki_prefixen_get (value, is_link)
if not value:find (':%l+:') then -- if no prefix
return false; -- abandon; boolean here to distinguish from nil fail returns later
end
local prefix_patterns_linked_t = { -- sequence of valid interwiki and inter project prefixen
'^%[%[:([dsw]):(%l%l+):', -- wikilinked; project and language prefixes
'^%[%[:(%l%l+):([dsw]):', -- wikilinked; language and project prefixes
'^%[%[:([dsw]):', -- wikilinked; project prefix
'^%[%[:(%l%l+):', -- wikilinked; language prefix
}
local prefix_patterns_unlinked_t = { -- sequence of valid interwiki and inter project prefixen
'^:([dsw]):(%l%l+):', -- project and language prefixes
'^:(%l%l+):([dsw]):', -- language and project prefixes
'^:([dsw]):', -- project prefix
'^:(%l%l+):', -- language prefix
}
local cap1, cap2;
for _, pattern in ipairs ((is_link and prefix_patterns_linked_t) or prefix_patterns_unlinked_t) do
cap1, cap2 = value:match (pattern);
if cap1 then
break; -- found a match so stop looking
end
end
if cap1 and cap2 then -- when both then :project:language: or :language:project: (both forms allowed)
if 1 == #cap1 then -- length == 1 then :project:language:
if cfg.inter_wiki_map[cap2] then -- is language prefix in the interwiki map?
return cap1, cap2; -- return interwiki project and interwiki language
end
else -- here when :language:project:
if cfg.inter_wiki_map[cap1] then -- is language prefix in the interwiki map?
return cap2, cap1; -- return interwiki project and interwiki language
end
end
return nil; -- unknown interwiki language
elseif not (cap1 or cap2) then -- both are nil?
return nil; -- we got something that looks like a project prefix but isn't; return fail
elseif 1 == #cap1 then -- here when one capture
return cap1, nil; -- length is 1 so return project, nil language
else -- here when one capture and its length it more than 1
if cfg.inter_wiki_map[cap1] then -- is language prefix in the interwiki map?
return nil, cap1; -- return nil project, language
end
end
end
--[[--------------------------< L I S T _ P E O P L E >--------------------------
Formats a list of people (authors, contributors, editors, interviewers, translators)
names in the list will be linked when
|<name>-link= has a value
|<name>-mask- does NOT have a value; masked names are presumed to have been
rendered previously so should have been linked there
when |<name>-mask=0, the associated name is not rendered
]]
local function list_people (control, people, etal)
local sep;
local namesep;
local format = control.format;
local maximum = control.maximum;
local name_list = {};
if 'vanc' == format then -- Vancouver-like name styling?
sep = cfg.presentation['sep_nl_vanc']; -- name-list separator between names is a comma
namesep = cfg.presentation['sep_name_vanc']; -- last/first separator is a space
else
sep = cfg.presentation['sep_nl']; -- name-list separator between names is a semicolon
namesep = cfg.presentation['sep_name']; -- last/first separator is <comma><space>
end
if sep:sub (-1, -1) ~= " " then sep = sep .. " " end
if utilities.is_set (maximum) and maximum < 1 then return "", 0; end -- returned 0 is for EditorCount; not used for other names
for i, person in ipairs (people) do
if utilities.is_set (person.last) then
local mask = person.mask;
local one;
local sep_one = sep;
if utilities.is_set (maximum) and i > maximum then
etal = true;
break;
end
if mask then
local n = tonumber (mask); -- convert to a number if it can be converted; nil else
if n then
one = 0 ~= n and string.rep("—", n) or nil; -- make a string of (n > 0) mdashes, nil else, to replace name
person.link = nil; -- don't create link to name if name is replaces with mdash string or has been set nil
else
one = mask; -- replace name with mask text (must include name-list separator)
sep_one = " "; -- modify name-list separator
end
else
one = person.last; -- get surname
local first = person.first -- get given name
if utilities.is_set (first) then
if ("vanc" == format) then -- if Vancouver format
one = one:gsub ('%.', ''); -- remove periods from surnames (http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35029/)
if not person.corporate and is_good_vanc_name (one, first, nil, i) then -- and name is all Latin characters; corporate authors not tested
first = reduce_to_initials (first, i); -- attempt to convert first name(s) to initials
end
end
one = one .. namesep .. first;
end
end
if utilities.is_set (person.link) then
one = utilities.make_wikilink (person.link, one); -- link author/editor
end
if one then -- if <one> has a value (name, mdash replacement, or mask text replacement)
local proj, tag = interwiki_prefixen_get (one, true); -- get the interwiki prefixen if present
if 'w' == proj and ('Wikipedia' == mw.site.namespaces.Project['name']) then
proj = nil; -- for stuff like :w:de:<article>, :w is unnecessary TODO: maint cat?
end
if proj then
proj = ({['d'] = 'Wikidata', ['s'] = 'Wikisource', ['w'] = 'Wikipedia'})[proj]; -- :w (wikipedia) for linking from a non-wikipedia project
if proj then
one = one .. utilities.wrap_style ('interproj', proj); -- add resized leading space, brackets, static text, language name
tag = nil; -- unset; don't do both project and language
end
end
if tag == cfg.this_wiki_code then
tag = nil; -- stuff like :en:<article> at en.wiki is pointless TODO: maint cat?
end
if tag then
local lang = cfg.lang_tag_remap[tag] or cfg.mw_languages_by_tag_t[tag];
if lang then -- error messaging done in extract_names() where we know parameter names
one = one .. utilities.wrap_style ('interwiki', lang); -- add resized leading space, brackets, static text, language name
end
end
table.insert (name_list, one); -- add it to the list of names
table.insert (name_list, sep_one); -- add the proper name-list separator
end
end
end
local count = #name_list / 2; -- (number of names + number of separators) divided by 2
if 0 < count then
if 1 < count and not etal then
if 'amp' == format then
name_list[#name_list-2] = " & "; -- replace last separator with ampersand text
elseif 'and' == format then
if 2 == count then
name_list[#name_list-2] = cfg.presentation.sep_nl_and; -- replace last separator with 'and' text
else
name_list[#name_list-2] = cfg.presentation.sep_nl_end; -- replace last separator with '(sep) and' text
end
end
end
name_list[#name_list] = nil; -- erase the last separator
end
local result = table.concat (name_list); -- construct list
if etal and utilities.is_set (result) then -- etal may be set by |display-authors=etal but we might not have a last-first list
result = result .. sep .. cfg.messages['et al']; -- we've got a last-first list and etal so add et al.
end
return result, count; -- return name-list string and count of number of names (count used for editor names only)
end
--[[--------------------< M A K E _ C I T E R E F _ I D >-----------------------
Generates a CITEREF anchor ID if we have at least one name or a date. Otherwise
returns an empty string.
namelist is one of the contributor-, author-, or editor-name lists chosen in that
order. year is Year or anchor_year.
]]
local function make_citeref_id (namelist, year)
local names={}; -- a table for the one to four names and year
for i,v in ipairs (namelist) do -- loop through the list and take up to the first four last names
names[i] = v.last
if i == 4 then break end -- if four then done
end
table.insert (names, year); -- add the year at the end
local id = table.concat(names); -- concatenate names and year for CITEREF id
if utilities.is_set (id) then -- if concatenation is not an empty string
return "CITEREF" .. id; -- add the CITEREF portion
else
return ''; -- return an empty string; no reason to include CITEREF id in this citation
end
end
--[[--------------------------< C I T E _ C L A S S _A T T R I B U T E _M A K E >------------------------------
construct <cite> tag class attribute for this citation.
<cite_class> – config.CitationClass from calling template
<mode> – value from |mode= parameter
]]
local function cite_class_attribute_make (cite_class, mode)
local class_t = {};
table.insert (class_t, 'citation'); -- required for blue highlight
if 'citation' ~= cite_class then
table.insert (class_t, cite_class); -- identify this template for user css
table.insert (class_t, utilities.is_set (mode) and mode or 'cs1'); -- identify the citation style for user css or javascript
else
table.insert (class_t, utilities.is_set (mode) and mode or 'cs2'); -- identify the citation style for user css or javascript
end
for _, prop_key in ipairs (z.prop_keys_t) do
table.insert (class_t, prop_key); -- identify various properties for user css or javascript
end
return table.concat (class_t, ' '); -- make a big string and done
end
--[[---------------------< N A M E _ H A S _ E T A L >--------------------------
Evaluates the content of name parameters (author, editor, etc.) for variations on
the theme of et al. If found, the et al. is removed, a flag is set to true and
the function returns the modified name and the flag.
This function never sets the flag to false but returns its previous state because
it may have been set by previous passes through this function or by the associated
|display-<names>=etal parameter
]]
local function name_has_etal (name, etal, nocat, param)
if utilities.is_set (name) then -- name can be nil in which case just return
local patterns = cfg.et_al_patterns; -- get patterns from configuration
for _, pattern in ipairs (patterns) do -- loop through all of the patterns
if name:match (pattern) then -- if this 'et al' pattern is found in name
name = name:gsub (pattern, ''); -- remove the offending text
etal = true; -- set flag (may have been set previously here or by |display-<names>=etal)
if not nocat then -- no categorization for |vauthors=
utilities.set_message ('err_etal', {param}); -- and set an error if not added
end
end
end
end
return name, etal;
end
--[[---------------------< N A M E _ I S _ N U M E R I C >----------------------
Add an error message and category when <name> parameter value does not contain letters.
Add a maintenance category when <name> parameter value has numeric characters mixed with characters that are
not numeric characters; could be letters and/or punctuation characters.
This function will only emit one error and one maint message for the current template. Does not emit both error
and maint messages/categories for the same parameter value.
returns nothing
]]
local function name_is_numeric (name, name_alias, list_name)
local patterns = {
'^%D+%d', -- <name> must have digits preceded by other characters
'^%D*%d+%D+', -- <name> must have digits followed by other characters
}
if not added_numeric_name_errs and mw.ustring.match (name, '^[%A]+$') then -- if we have not already set an error message and <name> does not have any alpha characters
utilities.set_message ('err_numeric_names', name_alias); -- add an error message
added_numeric_name_errs = true; -- set the flag so we emit only one error message
return; -- when here no point in further testing; abandon
end
if not added_numeric_name_maint then -- if we have already set a maint message
for _, pattern in ipairs (patterns) do -- spin through list of patterns
if mw.ustring.match (name, pattern) then -- digits preceded or followed by anything but digits; %D+ includes punctuation
utilities.set_message ('maint_numeric_names', cfg.special_case_translation [list_name]); -- add a maint cat for this template
added_numeric_name_maint = true; -- set the flag so we emit only one maint message
return; -- when here no point in further testing; abandon
end
end
end
end
--[[-----------------< N A M E _ H A S _ M U L T _ N A M E S >------------------
Evaluates the content of last/surname (authors etc.) parameters for multiple names.
Multiple names are indicated if there is more than one comma or any "unescaped"
semicolons. Escaped semicolons are ones used as part of selected HTML entities.
If the condition is met, the function adds the multiple name maintenance category.
Same test for first except that commas should not appear in given names (MOS:JR says
that the generational suffix does not take a separator character). Titles, degrees,
postnominals, affiliations, all normally comma separated don't belong in a citation.
<name> – name parameter value
<list_name> – AuthorList, EditorList, etc
<limit> – number of allowed commas; 1 (default) for surnames; 0 for given names
returns nothing
]]
local function name_has_mult_names (name, list_name, limit)
local _, commas, semicolons, nbsps;
limit = limit and limit or 1;
if utilities.is_set (name) then
_, commas = name:gsub (',', ''); -- count the number of commas
_, semicolons = name:gsub (';', ''); -- count the number of semicolons
-- nbsps probably should be its own separate count rather than merged in
-- some way with semicolons because Lua patterns do not support the
-- grouping operator that regex does, which means there is no way to add
-- more entities to escape except by adding more counts with the new
-- entities
_, nbsps = name:gsub (' ',''); -- count nbsps
-- There is exactly 1 semicolon per entity, so subtract nbsps
-- from semicolons to 'escape' them. If additional entities are added,
-- they also can be subtracted.
if limit < commas or 0 < (semicolons - nbsps) then
utilities.set_message ('maint_mult_names', cfg.special_case_translation [list_name]); -- add a maint message
end
end
end
--[=[-------------------------< I S _ G E N E R I C >----------------------------------------------------------
Compares values assigned to various parameters according to the string provided as <item> in the function call.
<item> can have on of two values:
'generic_names' – for name-holding parameters: |last=, |first=, |editor-last=, etc
'generic_titles' – for |title=
There are two types of generic tests. The 'accept' tests look for a pattern that should not be rejected by the
'reject' test. For example,
|author=[[John Smith (author)|Smith, John]]
would be rejected by the 'author' reject test. But piped wikilinks with 'author' disambiguation should not be
rejected so the 'accept' test prevents that from happening. Accept tests are always performed before reject
tests.
Each of the 'accept' and 'reject' sequence tables hold tables for en.wiki (['en']) and local.wiki (['local'])
that each can hold a test sequence table The sequence table holds, at index [1], a test pattern, and, at index
[2], a boolean control value. The control value tells string.find() or mw.ustring.find() to do plain-text search (true)
or a pattern search (false). The intent of all this complexity is to make these searches as fast as possible so
that we don't run out of processing time on very large articles.
Returns
true when a reject test finds the pattern or string
false when an accept test finds the pattern or string
nil else
]=]
local function is_generic (item, value, wiki)
local test_val;
local str_lower = { -- use string.lower() for en.wiki (['en']) and use mw.ustring.lower() or local.wiki (['local'])
['en'] = string.lower,
['local'] = mw.ustring.lower,
}
local str_find = { -- use string.find() for en.wiki (['en']) and use mw.ustring.find() or local.wiki (['local'])
['en'] = string.find,
['local'] = mw.ustring.find,
}
local function test (val, test_t, wiki) -- local function to do the testing; <wiki> selects lower() and find() functions
val = test_t[2] and str_lower[wiki](value) or val; -- when <test_t[2]> set to 'true', plaintext search using lowercase value
return str_find[wiki] (val, test_t[1], 1, test_t[2]); -- return nil when not found or matched
end
local test_types_t = {'accept', 'reject'}; -- test accept patterns first, then reject patterns
local wikis_t = {'en', 'local'}; -- do tests for each of these keys; en.wiki first, local.wiki second
for _, test_type in ipairs (test_types_t) do -- for each test type
for _, generic_value in pairs (cfg.special_case_translation[item][test_type]) do -- spin through the list of generic value fragments to accept or reject
for _, wiki in ipairs (wikis_t) do
if generic_value[wiki] then
if test (value, generic_value[wiki], wiki) then -- go do the test
return ('reject' == test_type); -- param value rejected, return true; false else
end
end
end
end
end
end
--[[--------------------------< N A M E _ I S _ G E N E R I C >------------------------------------------------
calls is_generic() to determine if <name> is a 'generic name' listed in cfg.generic_names; <name_alias> is the
parameter name used in error messaging
]]
local function name_is_generic (name, name_alias)
if not added_generic_name_errs and is_generic ('generic_names', name) then
utilities.set_message ('err_generic_name', name_alias); -- set an error message
added_generic_name_errs = true;
end
end
--[[--------------------------< N A M E _ C H E C K S >--------------------------------------------------------
This function calls various name checking functions used to validate the content of the various name-holding parameters.
]]
local function name_checks (last, first, list_name, last_alias, first_alias)
local accept_name;
if utilities.is_set (last) then
last, accept_name = utilities.has_accept_as_written (last); -- remove accept-this-as-written markup when it wraps all of <last>
if not accept_name then -- <last> not wrapped in accept-as-written markup
name_has_mult_names (last, list_name); -- check for multiple names in the parameter
name_is_numeric (last, last_alias, list_name); -- check for names that have no letters or are a mix of digits and other characters
name_is_generic (last, last_alias); -- check for names found in the generic names list
end
end
if utilities.is_set (first) then
first, accept_name = utilities.has_accept_as_written (first); -- remove accept-this-as-written markup when it wraps all of <first>
if not accept_name then -- <first> not wrapped in accept-as-written markup
name_has_mult_names (first, list_name, 0); -- check for multiple names in the parameter; 0 is number of allowed commas in a given name
name_is_numeric (first, first_alias, list_name); -- check for names that have no letters or are a mix of digits and other characters
name_is_generic (first, first_alias); -- check for names found in the generic names list
end
local wl_type, D = utilities.is_wikilink (first);
if 0 ~= wl_type then
first = D;
utilities.set_message ('err_bad_paramlink', first_alias);
end
end
return last, first; -- done
end
--[[----------------------< E X T R A C T _ N A M E S >-------------------------
Gets name list from the input arguments
Searches through args in sequential order to find |lastn= and |firstn= parameters
(or their aliases), and their matching link and mask parameters. Stops searching
when both |lastn= and |firstn= are not found in args after two sequential attempts:
found |last1=, |last2=, and |last3= but doesn't find |last4= and |last5= then the
search is done.
This function emits an error message when there is a |firstn= without a matching
|lastn=. When there are 'holes' in the list of last names, |last1= and |last3=
are present but |last2= is missing, an error message is emitted. |lastn= is not
required to have a matching |firstn=.
When an author or editor parameter contains some form of 'et al.', the 'et al.'
is stripped from the parameter and a flag (etal) returned that will cause list_people()
to add the static 'et al.' text from Module:Citation/CS1/Configuration. This keeps
'et al.' out of the template's metadata. When this occurs, an error is emitted.
]]
local function extract_names(args, list_name)
local names = {}; -- table of names
local last; -- individual name components
local first;
local link;
local mask;
local i = 1; -- loop counter/indexer
local n = 1; -- output table indexer
local count = 0; -- used to count the number of times we haven't found a |last= (or alias for authors, |editor-last or alias for editors)
local etal = false; -- return value set to true when we find some form of et al. in an author parameter
local last_alias, first_alias, link_alias; -- selected parameter aliases used in error messaging
while true do
last, last_alias = utilities.select_one ( args, cfg.aliases[list_name .. '-Last'], 'err_redundant_parameters', i ); -- search through args for name components beginning at 1
first, first_alias = utilities.select_one ( args, cfg.aliases[list_name .. '-First'], 'err_redundant_parameters', i );
link, link_alias = utilities.select_one ( args, cfg.aliases[list_name .. '-Link'], 'err_redundant_parameters', i );
mask = utilities.select_one ( args, cfg.aliases[list_name .. '-Mask'], 'err_redundant_parameters', i );
if last then -- error check |lastn= alias for unknown interwiki link prefix; done here because this is where we have the parameter name
local project, language = interwiki_prefixen_get (last, true); -- true because we expect interwiki links in |lastn= to be wikilinked
if nil == project and nil == language then -- when both are nil
utilities.set_message ('err_bad_paramlink', last_alias); -- not known, emit an error message -- TODO: err_bad_interwiki?
last = utilities.remove_wiki_link (last); -- remove wikilink markup; show display value only
end
end
if link then -- error check |linkn= alias for unknown interwiki link prefix
local project, language = interwiki_prefixen_get (link, false); -- false because wiki links in |author-linkn= is an error
if nil == project and nil == language then -- when both are nil
utilities.set_message ('err_bad_paramlink', link_alias); -- not known, emit an error message -- TODO: err_bad_interwiki?
link = nil; -- unset so we don't link
link_alias = nil;
end
end
last, etal = name_has_etal (last, etal, false, last_alias); -- find and remove variations on et al.
first, etal = name_has_etal (first, etal, false, first_alias); -- find and remove variations on et al.
last, first = name_checks (last, first, list_name, last_alias, first_alias); -- multiple names, extraneous annotation, etc. checks
if first and not last then -- if there is a firstn without a matching lastn
local alias = first_alias:find ('given', 1, true) and 'given' or 'first'; -- get first or given form of the alias
utilities.set_message ('err_first_missing_last', {
first_alias, -- param name of alias missing its mate
first_alias:gsub (alias, {['first'] = 'last', ['given'] = 'surname'}), -- make param name appropriate to the alias form
}); -- add this error message
elseif not first and not last then -- if both firstn and lastn aren't found, are we done?
count = count + 1; -- number of times we haven't found last and first
if 2 <= count then -- two missing names and we give up
break; -- normal exit or there is a two-name hole in the list; can't tell which
end
else -- we have last with or without a first
local result;
link = link_title_ok (link, link_alias, last, last_alias); -- check for improper wiki-markup
if first then
link = link_title_ok (link, link_alias, first, first_alias); -- check for improper wiki-markup
end
names[n] = {last = last, first = first, link = link, mask = mask, corporate = false}; -- add this name to our names list (corporate for |vauthors= only)
n = n + 1; -- point to next location in the names table
if 1 == count then -- if the previous name was missing
utilities.set_message ('err_missing_name', {list_name:match ("(%w+)List"):lower(), i - 1}); -- add this error message
end
count = 0; -- reset the counter, we're looking for two consecutive missing names
end
i = i + 1; -- point to next args location
end
return names, etal; -- all done, return our list of names and the etal flag
end
--[[--------------------------< N A M E _ T A G _ G E T >------------------------------------------------------
attempt to decode |language=<lang_param> and return language name and matching tag; nil else.
This function looks for:
<lang_param> as a tag in cfg.lang_tag_remap{}
<lang_param> as a name in cfg.lang_name_remap{}
<lang_param> as a name in cfg.mw_languages_by_name_t
<lang_param> as a tag in cfg.mw_languages_by_tag_t
when those fail, presume that <lang_param> is an IETF-like tag that MediaWiki does not recognize. Strip all
script, region, variant, whatever subtags from <lang_param> to leave just a two or three character language tag
and look for the new <lang_param> in cfg.mw_languages_by_tag_t{}
on success, returns name (in properly capitalized form) and matching tag (in lowercase); on failure returns nil
]]
local function name_tag_get (lang_param)
local lang_param_lc = mw.ustring.lower (lang_param); -- use lowercase as an index into the various tables
local name;
local tag;
name = cfg.lang_tag_remap[lang_param_lc]; -- assume <lang_param_lc> is a tag; attempt to get remapped language name
if name then -- when <name>, <lang_param> is a tag for a remapped language name
if cfg.lang_name_remap[name:lower()][2] ~= lang_param_lc then
utilities.set_message ('maint_unknown_lang'); -- add maint category if not already added
return name, cfg.lang_name_remap[name:lower()][2]; -- so return name and tag from lang_name_remap[name]; special case to xlate sr-ec and sr-el to sr-cyrl and sr-latn
end
return name, lang_param_lc; -- so return <name> from remap and <lang_param_lc>
end
tag = lang_param_lc:match ('^(%a%a%a?)%-.*'); -- still assuming that <lang_param_lc> is a tag; strip script, region, variant subtags
name = cfg.lang_tag_remap[tag]; -- attempt to get remapped language name with language subtag only
if name then -- when <name>, <tag> is a tag for a remapped language name
return name, tag; -- so return <name> from remap and <tag>
end
if cfg.lang_name_remap[lang_param_lc] then -- not a remapped tag, assume <lang_param_lc> is a name; attempt to get remapped language tag
return cfg.lang_name_remap[lang_param_lc][1], cfg.lang_name_remap[lang_param_lc][2]; -- for this <lang_param_lc>, return a (possibly) new name and appropriate tag
end
name = cfg.mw_languages_by_tag_t[lang_param_lc]; -- assume that <lang_param_lc> is a tag; attempt to get its matching language name
if name then
return name, lang_param_lc; -- <lang_param_lc> is a tag so return it and <name>
end
tag = cfg.mw_languages_by_name_t[lang_param_lc]; -- assume that <lang_param_lc> is a language name; attempt to get its matching tag
if tag then
return cfg.mw_languages_by_tag_t[tag], tag; -- <lang_param_lc> is a name so return the name from the table and <tag>
end
tag = lang_param_lc:match ('^(%a%a%a?)%-.*'); -- is <lang_param_lc> an IETF-like tag that MediaWiki doesn't recognize? <tag> gets the language subtag; nil else
if tag then
name = cfg.mw_languages_by_tag_t[tag]; -- attempt to get a language name using the shortened <tag>
if name then
return name, tag; -- <lang_param_lc> is an unrecognized IETF-like tag so return <name> and language subtag
end
end
end
--[[-------------------< L A N G U A G E _ P A R A M E T E R >------------------
Gets language name from a provided two- or three-character ISO 639 code. If a code
is recognized by MediaWiki, use the returned name; if not, then use the value that
was provided with the language parameter.
When |language= contains a recognized language (either code or name), the page is
assigned to the category for that code: Category:Norwegian-language sources (no).
For valid three-character code languages, the page is assigned to the single category
for '639-2' codes: Category:CS1 ISO 639-2 language sources.
Languages that are the same as the local wiki are not categorized. MediaWiki does
not recognize three-character equivalents of two-character codes: code 'ar' is
recognized but code 'ara' is not.
This function supports multiple languages in the form |language=nb, French, th
where the language names or codes are separated from each other by commas with
optional space characters.
]]
local function language_parameter (lang)
local tag; -- some form of IETF-like language tag; language subtag with optional region, sript, vatiant, etc subtags
local lang_subtag; -- ve populates |language= with mostly unecessary region subtags the MediaWiki does not recognize; this is the base language subtag
local name; -- the language name
local language_list = {}; -- table of language names to be rendered
local names_t = {}; -- table made from the value assigned to |language=
local this_wiki_name = mw.language.fetchLanguageName (cfg.this_wiki_code, cfg.this_wiki_code); -- get this wiki's language name
names_t = mw.text.split (lang, '%s*,%s*'); -- names should be a comma separated list
for _, lang in ipairs (names_t) do -- reuse lang here because we don't yet know if lang is a language name or a language tag
name, tag = name_tag_get (lang); -- attempt to get name/tag pair for <lang>; <name> has proper capitalization; <tag> is lowercase
if utilities.is_set (tag) then
lang_subtag = tag:gsub ('^(%a%a%a?)%-.*', '%1'); -- for categorization, strip any IETF-like tags from language tag
if cfg.this_wiki_code ~= lang_subtag then -- when the language is not the same as this wiki's language
if 2 == lang_subtag:len() then -- and is a two-character tag
utilities.add_prop_cat ('foreign-lang-source', {name, tag}, lang_subtag); -- categorize it; tag appended to allow for multiple language categorization
else -- or is a recognized language (but has a three-character tag)
utilities.add_prop_cat ('foreign-lang-source-2', {lang_subtag}, lang_subtag); -- categorize it differently TODO: support multiple three-character tag categories per cs1|2 template?
end
elseif cfg.local_lang_cat_enable then -- when the language and this wiki's language are the same and categorization is enabled
utilities.add_prop_cat ('local-lang-source', {name, lang_subtag}); -- categorize it
end
else
name = lang; -- return whatever <lang> has so that we show something
utilities.set_message ('maint_unknown_lang'); -- add maint category if not already added
end
table.insert (language_list, name);
name = ''; -- so we can reuse it
end
name = utilities.make_sep_list (#language_list, language_list);
if (1 == #language_list) and (lang_subtag == cfg.this_wiki_code) then -- when only one language, find lang name in this wiki lang name; for |language=en-us, 'English' in 'American English'
return ''; -- if one language and that language is this wiki's return an empty string (no annotation)
end
return (" " .. wrap_msg ('language', name)); -- otherwise wrap with '(in ...)'
--[[ TODO: should only return blank or name rather than full list
so we can clean up the bunched parenthetical elements Language, Type, Format
]]
end
--[[-----------------------< S E T _ C S _ S T Y L E >--------------------------
Gets the default CS style configuration for the given mode.
Returns default separator and either postscript as passed in or the default.
In CS1, the default postscript and separator are '.'.
In CS2, the default postscript is the empty string and the default separator is ','.
]]
local function set_cs_style (postscript, mode)
if utilities.is_set(postscript) then
-- emit a maintenance message if user postscript is the default cs1 postscript
-- we catch the opposite case for cs2 in set_style
if mode == 'cs1' and postscript == cfg.presentation['ps_' .. mode] then
utilities.set_message ('maint_postscript');
end
else
postscript = cfg.presentation['ps_' .. mode];
end
return cfg.presentation['sep_' .. mode], postscript;
end
--[[--------------------------< S E T _ S T Y L E >-----------------------------
Sets the separator and postscript styles. Checks the |mode= first and the
#invoke CitationClass second. Removes the postscript if postscript == none.
]]
local function set_style (mode, postscript, cite_class)
local sep;
if 'cs2' == mode then
sep, postscript = set_cs_style (postscript, 'cs2');
elseif 'cs1' == mode then
sep, postscript = set_cs_style (postscript, 'cs1');
elseif 'citation' == cite_class then
sep, postscript = set_cs_style (postscript, 'cs2');
else
sep, postscript = set_cs_style (postscript, 'cs1');
end
if cfg.keywords_xlate[postscript:lower()] == 'none' then
-- emit a maintenance message if user postscript is the default cs2 postscript
-- we catch the opposite case for cs1 in set_cs_style
if 'cs2' == mode or 'citation' == cite_class then
utilities.set_message ('maint_postscript');
end
postscript = '';
end
return sep, postscript
end
--[=[-------------------------< I S _ P D F >-----------------------------------
Determines if a URL has the file extension that is one of the PDF file extensions
used by [[MediaWiki:Common.css]] when applying the PDF icon to external links.
returns true if file extension is one of the recognized extensions, else false
]=]
local function is_pdf (url)
return url:match ('%.pdf$') or url:match ('%.PDF$') or
url:match ('%.pdf[%?#]') or url:match ('%.PDF[%?#]') or
url:match ('%.PDF#') or url:match ('%.pdf#');
end
--[[--------------------------< S T Y L E _ F O R M A T >-----------------------
Applies CSS style to |format=, |chapter-format=, etc. Also emits an error message
if the format parameter does not have a matching URL parameter. If the format parameter
is not set and the URL contains a file extension that is recognized as a PDF document
by MediaWiki's commons.css, this code will set the format parameter to (PDF) with
the appropriate styling.
]]
local function style_format (format, url, fmt_param, url_param)
if utilities.is_set (format) then
format = utilities.wrap_style ('format', format); -- add leading space, parentheses, resize
if not utilities.is_set (url) then
utilities.set_message ('err_format_missing_url', {fmt_param, url_param}); -- add an error message
end
elseif is_pdf (url) then -- format is not set so if URL is a PDF file then
format = utilities.wrap_style ('format', 'PDF'); -- set format to PDF
else
format = ''; -- empty string for concatenation
end
return format;
end
--[[---------------------< G E T _ D I S P L A Y _ N A M E S >------------------
Returns a number that defines the number of names displayed for author and editor
name lists and a Boolean flag to indicate when et al. should be appended to the name list.
When the value assigned to |display-xxxxors= is a number greater than or equal to zero,
return the number and the previous state of the 'etal' flag (false by default
but may have been set to true if the name list contains some variant of the text 'et al.').
When the value assigned to |display-xxxxors= is the keyword 'etal', return a number
that is one greater than the number of authors in the list and set the 'etal' flag true.
This will cause the list_people() to display all of the names in the name list followed by 'et al.'
In all other cases, returns nil and the previous state of the 'etal' flag.
inputs:
max: A['DisplayAuthors'] or A['DisplayEditors'], etc; a number or some flavor of etal
count: #a or #e
list_name: 'authors' or 'editors'
etal: author_etal or editor_etal
This function sets an error message when |display-xxxxors= value greater than or equal to number of names but
not when <max> comes from {{cs1 config}} global settings. When using global settings, <param> is set to the
keyword 'cs1 config' which is used to supress the normal error. Error is suppressed because it is to be expected
that some citations in an article will have the same or fewer names that the limit specified in {{cs1 config}}.
]]
local function get_display_names (max, count, list_name, etal, param)
if utilities.is_set (max) then
if 'etal' == max:lower():gsub("[ '%.]", '') then -- the :gsub() portion makes 'etal' from a variety of 'et al.' spellings and stylings
max = count + 1; -- number of authors + 1 so display all author name plus et al.
etal = true; -- overrides value set by extract_names()
elseif max:match ('^%d+$') then -- if is a string of numbers
max = tonumber (max); -- make it a number
if (max >= count) and ('cs1 config' ~= param) then -- error when local |display-xxxxors= value greater than or equal to number of names; not an error when using global setting
utilities.set_message ('err_disp_name', {param, max}); -- add error message
max = nil;
end
else -- not a valid keyword or number
utilities.set_message ('err_disp_name', {param, max}); -- add error message
max = nil; -- unset; as if |display-xxxxors= had not been set
end
end
return max, etal;
end
--[[----------< E X T R A _ T E X T _ I N _ P A G E _ C H E C K >---------------
Adds error if |page=, |pages=, |quote-page=, |quote-pages= has what appears to be
some form of p. or pp. abbreviation in the first characters of the parameter content.
check page for extraneous p, p., pp, pp., pg, pg. at start of parameter value:
good pattern: '^P[^%.P%l]' matches when page begins PX or P# but not Px
where x and X are letters and # is a digit
bad pattern: '^[Pp][PpGg]' matches when page begins pp, pP, Pp, PP, pg, pG, Pg, PG
]]
local function extra_text_in_page_check (val, name)
if not val:match (cfg.vol_iss_pg_patterns.good_ppattern) then
for _, pattern in ipairs (cfg.vol_iss_pg_patterns.bad_ppatterns) do -- spin through the selected sequence table of patterns
if val:match (pattern) then -- when a match, error so
utilities.set_message ('err_extra_text_pages', name); -- add error message
return; -- and done
end
end
end
end
--[[--------------------------< E X T R A _ T E X T _ I N _ V O L _ I S S _ C H E C K >------------------------
Adds error if |volume= or |issue= has what appears to be some form of redundant 'type' indicator.
For |volume=:
'V.', or 'Vol.' (with or without the dot) abbreviations or 'Volume' in the first characters of the parameter
content (all case insensitive). 'V' and 'v' (without the dot) are presumed to be roman numerals so
are allowed.
For |issue=:
'No.', 'I.', 'Iss.' (with or without the dot) abbreviations, or 'Issue' in the first characters of the
parameter content (all case insensitive).
Single character values ('v', 'i', 'n') allowed when not followed by separator character ('.', ':', '=', or
whitespace character) – param values are trimmed of whitespace by MediaWiki before delivered to the module.
<val> is |volume= or |issue= parameter value
<name> is |volume= or |issue= parameter name for error message
<selector> is 'v' for |volume=, 'i' for |issue=
sets error message on failure; returns nothing
]]
local function extra_text_in_vol_iss_check (val, name, selector)
if not utilities.is_set (val) then
return;
end
local patterns = 'v' == selector and cfg.vol_iss_pg_patterns.vpatterns or cfg.vol_iss_pg_patterns.ipatterns;
local handler = 'v' == selector and 'err_extra_text_volume' or 'err_extra_text_issue';
val = val:lower(); -- force parameter value to lower case
for _, pattern in ipairs (patterns) do -- spin through the selected sequence table of patterns
if val:match (pattern) then -- when a match, error so
utilities.set_message (handler, name); -- add error message
return; -- and done
end
end
end
--[=[-------------------------< G E T _ V _ N A M E _ T A B L E >----------------------------------------------
split apart a |vauthors= or |veditors= parameter. This function allows for corporate names, wrapped in doubled
parentheses to also have commas; in the old version of the code, the doubled parentheses were included in the
rendered citation and in the metadata. Individual author names may be wikilinked
|vauthors=Jones AB, [[E. B. White|White EB]], ((Black, Brown, and Co.))
]=]
local function get_v_name_table (vparam, output_table, output_link_table)
local name_table = mw.text.split(vparam, "%s*,%s*"); -- names are separated by commas
local wl_type, label, link; -- wl_type not used here; just a placeholder
local i = 1;
while name_table[i] do
if name_table[i]:match ('^%(%(.*[^%)][^%)]$') then -- first segment of corporate with one or more commas; this segment has the opening doubled parentheses
local name = name_table[i];
i = i + 1; -- bump indexer to next segment
while name_table[i] do
name = name .. ', ' .. name_table[i]; -- concatenate with previous segments
if name_table[i]:match ('^.*%)%)$') then -- if this table member has the closing doubled parentheses
break; -- and done reassembling so
end
i = i + 1; -- bump indexer
end
table.insert (output_table, name); -- and add corporate name to the output table
table.insert (output_link_table, ''); -- no wikilink
else
wl_type, label, link = utilities.is_wikilink (name_table[i]); -- wl_type is: 0, no wl (text in label variable); 1, [[D]]; 2, [[L|D]]
table.insert (output_table, label); -- add this name
if 1 == wl_type then
table.insert (output_link_table, label); -- simple wikilink [[D]]
else
table.insert (output_link_table, link); -- no wikilink or [[L|D]]; add this link if there is one, else empty string
end
end
i = i + 1;
end
return output_table;
end
--[[--------------------------< P A R S E _ V A U T H O R S _ V E D I T O R S >--------------------------------
This function extracts author / editor names from |vauthors= or |veditors= and finds matching |xxxxor-maskn= and
|xxxxor-linkn= in args. It then returns a table of assembled names just as extract_names() does.
Author / editor names in |vauthors= or |veditors= must be in Vancouver system style. Corporate or institutional names
may sometimes be required and because such names will often fail the is_good_vanc_name() and other format compliance
tests, are wrapped in doubled parentheses ((corporate name)) to suppress the format tests.
Supports generational suffixes Jr, 2nd, 3rd, 4th–6th.
This function sets the Vancouver error when a required comma is missing and when there is a space between an author's initials.
]]
local function parse_vauthors_veditors (args, vparam, list_name)
local names = {}; -- table of names assembled from |vauthors=, |author-maskn=, |author-linkn=
local v_name_table = {};
local v_link_table = {}; -- when name is wikilinked, targets go in this table
local etal = false; -- return value set to true when we find some form of et al. vauthors parameter
local last, first, link, mask, suffix;
local corporate = false;
vparam, etal = name_has_etal (vparam, etal, true); -- find and remove variations on et al. do not categorize (do it here because et al. might have a period)
v_name_table = get_v_name_table (vparam, v_name_table, v_link_table); -- names are separated by commas
for i, v_name in ipairs(v_name_table) do
first = ''; -- set to empty string for concatenation and because it may have been set for previous author/editor
local accept_name;
v_name, accept_name = utilities.has_accept_as_written (v_name); -- remove accept-this-as-written markup when it wraps all of <v_name>
if accept_name then
last = v_name;
corporate = true; -- flag used in list_people()
elseif string.find(v_name, "%s") then
if v_name:find('[;%.]') then -- look for commonly occurring punctuation characters;
add_vanc_error (cfg.err_msg_supl.punctuation, i);
end
local lastfirstTable = {}
lastfirstTable = mw.text.split(v_name, "%s+")
first = table.remove(lastfirstTable); -- removes and returns value of last element in table which should be initials or generational suffix
if not mw.ustring.match (first, '^%u+$') then -- mw.ustring here so that later we will catch non-Latin characters
suffix = first; -- not initials so assume that whatever we got is a generational suffix
first = table.remove(lastfirstTable); -- get what should be the initials from the table
end
last = table.concat(lastfirstTable, ' ') -- returns a string that is the concatenation of all other names that are not initials and generational suffix
if not utilities.is_set (last) then
first = ''; -- unset
last = v_name; -- last empty because something wrong with first
add_vanc_error (cfg.err_msg_supl.name, i);
end
if mw.ustring.match (last, '%a+%s+%u+%s+%a+') then
add_vanc_error (cfg.err_msg_supl['missing comma'], i); -- matches last II last; the case when a comma is missing
end
if mw.ustring.match (v_name, ' %u %u$') then -- this test is in the wrong place TODO: move or replace with a more appropriate test
add_vanc_error (cfg.err_msg_supl.initials, i); -- matches a space between two initials
end
else
last = v_name; -- last name or single corporate name? Doesn't support multiword corporate names? do we need this?
end
if utilities.is_set (first) then
if not mw.ustring.match (first, "^%u?%u$") then -- first shall contain one or two upper-case letters, nothing else
add_vanc_error (cfg.err_msg_supl.initials, i); -- too many initials; mixed case initials (which may be ok Romanization); hyphenated initials
end
is_good_vanc_name (last, first, suffix, i); -- check first and last before restoring the suffix which may have a non-Latin digit
if utilities.is_set (suffix) then
first = first .. ' ' .. suffix; -- if there was a suffix concatenate with the initials
suffix = ''; -- unset so we don't add this suffix to all subsequent names
end
else
if not corporate then
is_good_vanc_name (last, '', nil, i);
end
end
link = utilities.select_one ( args, cfg.aliases[list_name .. '-Link'], 'err_redundant_parameters', i ) or v_link_table[i];
mask = utilities.select_one ( args, cfg.aliases[list_name .. '-Mask'], 'err_redundant_parameters', i );
names[i] = {last = last, first = first, link = link, mask = mask, corporate = corporate}; -- add this assembled name to our names list
end
return names, etal; -- all done, return our list of names
end
--[[--------------------------< S E L E C T _ A U T H O R _ E D I T O R _ S O U R C E >------------------------
Select one of |authors=, |authorn= / |lastn / firstn=, or |vauthors= as the source of the author name list or
select one of |editorn= / editor-lastn= / |editor-firstn= or |veditors= as the source of the editor name list.
Only one of these appropriate three will be used. The hierarchy is: |authorn= (and aliases) highest and |authors= lowest;
|editorn= (and aliases) highest and |veditors= lowest (support for |editors= withdrawn)
When looking for |authorn= / |editorn= parameters, test |xxxxor1= and |xxxxor2= (and all of their aliases); stops after the second
test which mimicks the test used in extract_names() when looking for a hole in the author name list. There may be a better
way to do this, I just haven't discovered what that way is.
Emits an error message when more than one xxxxor name source is provided.
In this function, vxxxxors = vauthors or veditors; xxxxors = authors as appropriate.
]]
local function select_author_editor_source (vxxxxors, xxxxors, args, list_name)
local lastfirst = false;
if utilities.select_one ( args, cfg.aliases[list_name .. '-Last'], 'none', 1 ) or -- do this twice in case we have a |first1= without a |last1=; this ...
utilities.select_one ( args, cfg.aliases[list_name .. '-First'], 'none', 1 ) or -- ... also catches the case where |first= is used with |vauthors=
utilities.select_one ( args, cfg.aliases[list_name .. '-Last'], 'none', 2 ) or
utilities.select_one ( args, cfg.aliases[list_name .. '-First'], 'none', 2 ) then
lastfirst = true;
end
if (utilities.is_set (vxxxxors) and true == lastfirst) or -- these are the three error conditions
(utilities.is_set (vxxxxors) and utilities.is_set (xxxxors)) or
(true == lastfirst and utilities.is_set (xxxxors)) then
local err_name;
if 'AuthorList' == list_name then -- figure out which name should be used in error message
err_name = 'author';
else
err_name = 'editor';
end
utilities.set_message ('err_redundant_parameters', err_name .. '-name-list parameters'); -- add error message
end
if true == lastfirst then return 1 end; -- return a number indicating which author name source to use
if utilities.is_set (vxxxxors) then return 2 end;
if utilities.is_set (xxxxors) then return 3 end;
return 1; -- no authors so return 1; this allows missing author name test to run in case there is a first without last
end
--[[--------------------------< I S _ V A L I D _ P A R A M E T E R _ V A L U E >------------------------------
This function is used to validate a parameter's assigned value for those parameters that have only a limited number
of allowable values (yes, y, true, live, dead, etc.). When the parameter value has not been assigned a value (missing
or empty in the source template) the function returns the value specified by ret_val. If the parameter value is one
of the list of allowed values returns the translated value; else, emits an error message and returns the value
specified by ret_val.
TODO: explain <invert>
]]
local function is_valid_parameter_value (value, name, possible, ret_val, invert)
if not utilities.is_set (value) then
return ret_val; -- an empty parameter is ok
end
if (not invert and utilities.in_array (value, possible)) then -- normal; <value> is in <possible> table
return cfg.keywords_xlate[value]; -- return translation of parameter keyword
elseif invert and not utilities.in_array (value, possible) then -- invert; <value> is not in <possible> table
return value; -- return <value> as it is
else
utilities.set_message ('err_invalid_param_val', {name, value}); -- not an allowed value so add error message
return ret_val;
end
end
--[[--------------------------< T E R M I N A T E _ N A M E _ L I S T >----------------------------------------
This function terminates a name list (author, contributor, editor) with a separator character (sepc) and a space
when the last character is not a sepc character or when the last three characters are not sepc followed by two
closing square brackets (close of a wikilink). When either of these is true, the name_list is terminated with a
single space character.
]]
local function terminate_name_list (name_list, sepc)
if (string.sub (name_list, -3, -1) == sepc .. '. ') then -- if already properly terminated
return name_list; -- just return the name list
elseif (string.sub (name_list, -1, -1) == sepc) or (string.sub (name_list, -3, -1) == sepc .. ']]') then -- if last name in list ends with sepc char
return name_list .. " "; -- don't add another
else
return name_list .. sepc .. ' '; -- otherwise terminate the name list
end
end
--[[-------------------------< F O R M A T _ V O L U M E _ I S S U E >-----------------------------------------
returns the concatenation of the formatted volume and issue (or journal article number) parameters as a single
string; or formatted volume or formatted issue, or an empty string if neither are set.
]]
local function format_volume_issue (volume, issue, article, cite_class, origin, sepc, lower)
if not utilities.is_set (volume) and not utilities.is_set (issue) and not utilities.is_set (article) then
return '';
end
-- same condition as in format_pages_sheets()
local is_journal = 'journal' == cite_class or (utilities.in_array (cite_class, {'citation', 'map', 'interview'}) and 'journal' == origin);
local is_numeric_vol = volume and (volume:match ('^[MDCLXVI]+$') or volume:match ('^%d+$')); -- is only uppercase roman numerals or only digits?
local is_long_vol = volume and (4 < mw.ustring.len(volume)); -- is |volume= value longer than 4 characters?
if volume and (not is_numeric_vol and is_long_vol) then -- when not all digits or Roman numerals, is |volume= longer than 4 characters?
utilities.add_prop_cat ('long-vol'); -- yes, add properties cat
end
if is_journal then -- journal-style formatting
local vol = '';
if utilities.is_set (volume) then
if is_numeric_vol then -- |volume= value all digits or all uppercase Roman numerals?
vol = utilities.substitute (cfg.presentation['vol-bold'], {sepc, volume}); -- render in bold face
elseif is_long_vol then -- not all digits or Roman numerals; longer than 4 characters?
vol = utilities.substitute (cfg.messages['j-vol'], {sepc, utilities.hyphen_to_dash (volume)}); -- not bold
else -- four or fewer characters
vol = utilities.substitute (cfg.presentation['vol-bold'], {sepc, utilities.hyphen_to_dash (volume)}); -- bold
end
end
vol = vol .. (utilities.is_set (issue) and utilities.substitute (cfg.messages['j-issue'], issue) or '')
vol = vol .. (utilities.is_set (article) and utilities.substitute (cfg.messages['j-article-num'], article) or '')
return vol;
end
if 'podcast' == cite_class and utilities.is_set (issue) then
return wrap_msg ('issue', {sepc, issue}, lower);
end
if 'conference' == cite_class and utilities.is_set (article) then -- |article-number= supported only in journal and conference cites
if utilities.is_set (volume) and utilities.is_set (article) then -- both volume and article number
return wrap_msg ('vol-art', {sepc, utilities.hyphen_to_dash (volume), article}, lower);
elseif utilities.is_set (article) then -- article number alone; when volume alone, handled below
return wrap_msg ('art', {sepc, article}, lower);
end
end
-- all other types of citation
if utilities.is_set (volume) and utilities.is_set (issue) then
return wrap_msg ('vol-no', {sepc, utilities.hyphen_to_dash (volume), issue}, lower);
elseif utilities.is_set (volume) then
return wrap_msg ('vol', {sepc, utilities.hyphen_to_dash (volume)}, lower);
else
return wrap_msg ('issue', {sepc, issue}, lower);
end
end
--[[-------------------------< F O R M A T _ P A G E S _ S H E E T S >-----------------------------------------
adds static text to one of |page(s)= or |sheet(s)= values and returns it with all of the others set to empty strings.
The return order is:
page, pages, sheet, sheets
Singular has priority over plural when both are provided.
]]
local function format_pages_sheets (page, pages, sheet, sheets, cite_class, origin, sepc, nopp, lower)
if 'map' == cite_class then -- only cite map supports sheet(s) as in-source locators
if utilities.is_set (sheet) then
if 'journal' == origin then
return '', '', wrap_msg ('j-sheet', sheet, lower), '';
else
return '', '', wrap_msg ('sheet', {sepc, sheet}, lower), '';
end
elseif utilities.is_set (sheets) then
if 'journal' == origin then
return '', '', '', wrap_msg ('j-sheets', sheets, lower);
else
return '', '', '', wrap_msg ('sheets', {sepc, sheets}, lower);
end
end
end
local is_journal = 'journal' == cite_class or (utilities.in_array (cite_class, {'citation', 'map', 'interview'}) and 'journal' == origin);
if utilities.is_set (page) then
if is_journal then
return utilities.substitute (cfg.messages['j-page(s)'], page), '', '', '';
elseif not nopp then
return utilities.substitute (cfg.messages['p-prefix'], {sepc, page}), '', '', '';
else
return utilities.substitute (cfg.messages['nopp'], {sepc, page}), '', '', '';
end
elseif utilities.is_set (pages) then
if is_journal then
return utilities.substitute (cfg.messages['j-page(s)'], pages), '', '', '';
elseif tonumber(pages) ~= nil and not nopp then -- if pages is only digits, assume a single page number
return '', utilities.substitute (cfg.messages['p-prefix'], {sepc, pages}), '', '';
elseif not nopp then
return '', utilities.substitute (cfg.messages['pp-prefix'], {sepc, pages}), '', '';
else
return '', utilities.substitute (cfg.messages['nopp'], {sepc, pages}), '', '';
end
end
return '', '', '', ''; -- return empty strings
end
--[[--------------------------< I N S O U R C E _ L O C _ G E T >----------------------------------------------
returns one of the in-source locators: page, pages, or at.
If any of these are interwiki links to Wikisource, returns the label portion of the interwiki-link as plain text
for use in COinS. This COinS thing is done because here we convert an interwiki-link to an external link and
add an icon span around that; get_coins_pages() doesn't know about the span. TODO: should it?
TODO: add support for sheet and sheets?; streamline;
TODO: make it so that this function returns only one of the three as the single in-source (the return value assigned
to a new name)?
]]
local function insource_loc_get (page, page_orig, pages, pages_orig, at)
local ws_url, ws_label, coins_pages, L; -- for Wikisource interwiki-links; TODO: this corrupts page metadata (span remains in place after cleanup; fix there?)
if utilities.is_set (page) then
if utilities.is_set (pages) or utilities.is_set (at) then
pages = ''; -- unset the others
at = '';
end
extra_text_in_page_check (page, page_orig); -- emit error message when |page= value begins with what looks like p., pp., etc.
ws_url, ws_label, L = wikisource_url_make (page); -- make ws URL from |page= interwiki link; link portion L becomes tooltip label
if ws_url then
page = external_link (ws_url, ws_label .. ' ', 'ws link in page'); -- space char after label to move icon away from in-source text; TODO: a better way to do this?
page = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], L, page});
coins_pages = ws_label;
end
elseif utilities.is_set (pages) then
if utilities.is_set (at) then
at = ''; -- unset
end
extra_text_in_page_check (pages, pages_orig); -- emit error message when |page= value begins with what looks like p., pp., etc.
ws_url, ws_label, L = wikisource_url_make (pages); -- make ws URL from |pages= interwiki link; link portion L becomes tooltip label
if ws_url then
pages = external_link (ws_url, ws_label .. ' ', 'ws link in pages'); -- space char after label to move icon away from in-source text; TODO: a better way to do this?
pages = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], L, pages});
coins_pages = ws_label;
end
elseif utilities.is_set (at) then
ws_url, ws_label, L = wikisource_url_make (at); -- make ws URL from |at= interwiki link; link portion L becomes tooltip label
if ws_url then
at = external_link (ws_url, ws_label .. ' ', 'ws link in at'); -- space char after label to move icon away from in-source text; TODO: a better way to do this?
at = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], L, at});
coins_pages = ws_label;
end
end
return page, pages, at, coins_pages;
end
--[[--------------------------< I S _ U N I Q U E _ A R C H I V E _ U R L >------------------------------------
add error message when |archive-url= value is same as |url= or chapter-url= (or alias...) value
]]
local function is_unique_archive_url (archive, url, c_url, source, date)
if utilities.is_set (archive) then
if archive == url or archive == c_url then
utilities.set_message ('err_bad_url', {utilities.wrap_style ('parameter', source)}); -- add error message
return '', ''; -- unset |archive-url= and |archive-date= because same as |url= or |chapter-url=
end
end
return archive, date;
end
--[=[-------------------------< A R C H I V E _ U R L _ C H E C K >--------------------------------------------
Check archive.org URLs to make sure they at least look like they are pointing at valid archives and not to the
save snapshot URL or to calendar pages. When the archive URL is 'https://web.archive.org/save/' (or http://...)
archive.org saves a snapshot of the target page in the URL. That is something that Wikipedia should not allow
unwitting readers to do.
When the archive.org URL does not have a complete timestamp, archive.org chooses a snapshot according to its own
algorithm or provides a calendar 'search' result. [[WP:ELNO]] discourages links to search results.
This function looks at the value assigned to |archive-url= and returns empty strings for |archive-url= and
|archive-date= and an error message when:
|archive-url= holds an archive.org save command URL
|archive-url= is an archive.org URL that does not have a complete timestamp (YYYYMMDDhhmmss 14 digits) in the
correct place
otherwise returns |archive-url= and |archive-date=
There are two mostly compatible archive.org URLs:
//web.archive.org/<timestamp>... -- the old form
//web.archive.org/web/<timestamp>... -- the new form
The old form does not support or map to the new form when it contains a display flag. There are four identified flags
('id_', 'js_', 'cs_', 'im_') but since archive.org ignores others following the same form (two letters and an underscore)
we don't check for these specific flags but we do check the form.
This function supports a preview mode. When the article is rendered in preview mode, this function may return a modified
archive URL:
for save command errors, return undated wildcard (/*/)
for timestamp errors when the timestamp has a wildcard, return the URL unmodified
for timestamp errors when the timestamp does not have a wildcard, return with timestamp limited to six digits plus wildcard (/yyyymm*/)
A secondary function is to return an archive-url timestamp from those urls that have them (archive.org and
archive.today). The timestamp is used by validation.archive_date_check() to see if the value in |archive-date=
matches the timestamp in the archive url.
]=]
local function archive_url_check (url, date)
local err_msg = ''; -- start with the error message empty
local path, timestamp, flag; -- portions of the archive.org URL
timestamp = url:match ('//archive.today/(%d%d%d%d%d%d%d%d%d%d%d%d%d%d)/'); -- get timestamp from archive.today urls
if timestamp then -- if this was an archive.today url ...
return url, date, timestamp; -- return ArchiveURL, ArchiveDate, and timestamp from |archive-url=, and done
end
-- here for archive.org urls
if (not url:match('//web%.archive%.org/')) and (not url:match('//liveweb%.archive%.org/')) then -- also deprecated liveweb Wayback machine URL
return url, date; -- not an archive.org archive, return ArchiveURL and ArchiveDate
end
if url:match('//web%.archive%.org/save/') then -- if a save command URL, we don't want to allow saving of the target page
err_msg = cfg.err_msg_supl.save;
url = url:gsub ('(//web%.archive%.org)/save/', '%1/*/', 1); -- for preview mode: modify ArchiveURL
elseif url:match('//liveweb%.archive%.org/') then
err_msg = cfg.err_msg_supl.liveweb;
else
path, timestamp, flag = url:match('//web%.archive%.org/([^%d]*)(%d+)([^/]*)/'); -- split out some of the URL parts for evaluation
if not path then -- malformed in some way; pattern did not match
err_msg = cfg.err_msg_supl.timestamp;
elseif 14 ~= timestamp:len() then -- path and flag optional, must have 14-digit timestamp here
err_msg = cfg.err_msg_supl.timestamp;
if '*' ~= flag then
local replacement = timestamp:match ('^%d%d%d%d%d%d') or timestamp:match ('^%d%d%d%d'); -- get the first 6 (YYYYMM) or first 4 digits (YYYY)
if replacement then -- nil if there aren't at least 4 digits (year)
replacement = replacement .. string.rep ('0', 14 - replacement:len()); -- year or yearmo (4 or 6 digits) zero-fill to make 14-digit timestamp
url=url:gsub ('(//web%.archive%.org/[^%d]*)%d[^/]*', '%1' .. replacement .. '*', 1) -- for preview, modify ts to 14 digits plus splat for calendar display
end
end
elseif utilities.is_set (path) and 'web/' ~= path then -- older archive URLs do not have the extra 'web/' path element
err_msg = cfg.err_msg_supl.path;
elseif utilities.is_set (flag) and not utilities.is_set (path) then -- flag not allowed with the old form URL (without the 'web/' path element)
err_msg = cfg.err_msg_supl.flag;
elseif utilities.is_set (flag) and not flag:match ('%a%a_') then -- flag if present must be two alpha characters and underscore (requires 'web/' path element)
err_msg = cfg.err_msg_supl.flag;
else
return url, date, timestamp; -- return ArchiveURL, ArchiveDate, and timestamp from |archive-url=
end
end
-- if here, something not right so
utilities.set_message ('err_archive_url', {err_msg}); -- add error message and
if is_preview_mode then
return url, date, timestamp; -- preview mode so return ArchiveURL, ArchiveDate, and timestamp from |archive-url=
else
return '', ''; -- return empty strings for ArchiveURL and ArchiveDate
end
end
--[[--------------------------< P L A C E _ C H E C K >--------------------------------------------------------
check |place=, |publication-place=, |location= to see if these params include digits. This function added because
many editors misuse location to specify the in-source location (|page(s)= and |at= are supposed to do that)
returns the original parameter value without modification; added maint cat when parameter value contains digits
]]
local function place_check (param_val)
if not utilities.is_set (param_val) then -- parameter empty or omitted
return param_val; -- return that empty state
end
if mw.ustring.find (param_val, '%d') then -- not empty, are there digits in the parameter value
utilities.set_message ('maint_location'); -- yep, add maint cat
end
return param_val; -- and done
end
--[[--------------------------< I S _ A R C H I V E D _ C O P Y >----------------------------------------------
compares |title= to 'Archived copy' (placeholder added by bots that can't find proper title); if matches, return true; nil else
]]
local function is_archived_copy (title)
title = mw.ustring.lower(title); -- switch title to lower case
if title:find (cfg.special_case_translation.archived_copy.en) then -- if title is 'Archived copy'
return true;
elseif cfg.special_case_translation.archived_copy['local'] then
if mw.ustring.find (title, cfg.special_case_translation.archived_copy['local']) then -- mw.ustring() because might not be Latin script
return true;
end
end
end
--[[--------------------------< D I S P L A Y _ N A M E S _ S E L E C T >--------------------------------------
for any of the |display-authors=, |display-editors=, etc parameters, select either the local or global setting.
When both are present, look at <local_display_names> value. When the value is some sort of 'et al.'string,
special handling is required.
When {{cs1 config}} has |display-<namelist>= AND this template has |display-<namelist>=etal AND:
the number of names specified by <number_of_names> is:
greater than the number specified in the global |display-<namelist>= parameter (<global_display_names>)
use global |display-<namelist>= parameter value
set overridden maint category
less than or equal to the number specified in the global |display-<namelist>= parameter
use local |display-<namelist>= parameter value
The purpose of this function is to prevent categorizing a template that has fewer names than the global setting
to keep the etal annotation specified by <local_display_names>.
]]
local function display_names_select (global_display_names, local_display_names, param_name, number_of_names, test)
if global_display_names and utilities.is_set (local_display_names) then -- when both
if 'etal' == local_display_names:lower():gsub("[ '%.]", '') then -- the :gsub() portion makes 'etal' from a variety of 'et al.' spellings and stylings
number_of_names = tonumber (number_of_names); -- convert these to numbers for comparison
local global_display_names_num = tonumber (global_display_names); -- <global_display_names> not set when parameter value is not digits
if number_of_names > global_display_names_num then -- template has more names than global config allows to be displayed?
utilities.set_message ('maint_overridden_setting'); -- set a maint message because global is overriding local |display-<namelist>=etal
return global_display_names, 'cs1 config'; -- return global with spoof parameter name (for get_display_names())
else
return local_display_names, param_name; -- return local because fewer names so let <local_display_names> control
end
end
-- here when <global_display_names> and <local_display_names> both numbers; <global_display_names> controls
utilities.set_message ('maint_overridden_setting'); -- set a maint message
return global_display_names, 'cs1 config'; -- return global with spoof parameter name (for get_display_names())
end
-- here when only one of <global_display_names> or <local_display_names> set
if global_display_names then
return global_display_names, 'cs1 config'; -- return global with spoof parameter name (for get_display_names())
else
return local_display_names, param_name; -- return local
end
end
--[[--------------------------< C I T A T I O N 0 >------------------------------------------------------------
This is the main function doing the majority of the citation formatting.
]]
local function citation0( config, args )
--[[
Load Input Parameters
The argument_wrapper facilitates the mapping of multiple aliases to single internal variable.
]]
local A = argument_wrapper ( args );
local i
-- Pick out the relevant fields from the arguments. Different citation templates
-- define different field names for the same underlying things.
local author_etal;
local a = {}; -- authors list from |lastn= / |firstn= pairs or |vauthors=
local Authors;
local NameListStyle;
if cfg.global_cs1_config_t['NameListStyle'] then -- global setting in {{cs1 config}} overrides local |name-list-style= parameter value; nil when empty or assigned value invalid
NameListStyle = is_valid_parameter_value (cfg.global_cs1_config_t['NameListStyle'], 'cs1 config: name-list-style', cfg.keywords_lists['name-list-style'], ''); -- error messaging 'param' here is a hoax
else
NameListStyle = is_valid_parameter_value (A['NameListStyle'], A:ORIGIN('NameListStyle'), cfg.keywords_lists['name-list-style'], '');
end
if cfg.global_cs1_config_t['NameListStyle'] and utilities.is_set (A['NameListStyle']) then -- when template has |name-list-style=<something> which global setting has overridden
utilities.set_message ('maint_overridden_setting'); -- set a maint message
end
local Collaboration = A['Collaboration'];
do -- to limit scope of selected
local selected = select_author_editor_source (A['Vauthors'], A['Authors'], args, 'AuthorList');
if 1 == selected then
a, author_etal = extract_names (args, 'AuthorList'); -- fetch author list from |authorn= / |lastn= / |firstn=, |author-linkn=, and |author-maskn=
elseif 2 == selected then
NameListStyle = 'vanc'; -- override whatever |name-list-style= might be
a, author_etal = parse_vauthors_veditors (args, A['Vauthors'], 'AuthorList'); -- fetch author list from |vauthors=, |author-linkn=, and |author-maskn=
elseif 3 == selected then
Authors = A['Authors']; -- use content of |people= or |credits=; |authors= is deprecated; TODO: constrain |people= and |credits= to cite av media, episode, serial?
end
if utilities.is_set (Collaboration) then
author_etal = true; -- so that |display-authors=etal not required
end
end
local editor_etal;
local e = {}; -- editors list from |editor-lastn= / |editor-firstn= pairs or |veditors=
do -- to limit scope of selected
local selected = select_author_editor_source (A['Veditors'], nil, args, 'EditorList'); -- support for |editors= withdrawn
if 1 == selected then
e, editor_etal = extract_names (args, 'EditorList'); -- fetch editor list from |editorn= / |editor-lastn= / |editor-firstn=, |editor-linkn=, and |editor-maskn=
elseif 2 == selected then
NameListStyle = 'vanc'; -- override whatever |name-list-style= might be
e, editor_etal = parse_vauthors_veditors (args, args.veditors, 'EditorList'); -- fetch editor list from |veditors=, |editor-linkn=, and |editor-maskn=
end
end
local Chapter = A['Chapter']; -- done here so that we have access to |contribution= from |chapter= aliases
local Chapter_origin = A:ORIGIN ('Chapter');
local Contribution; -- because contribution is required for contributor(s)
if 'contribution' == Chapter_origin then
Contribution = Chapter; -- get the name of the contribution
end
local c = {}; -- contributors list from |contributor-lastn= / contributor-firstn= pairs
if utilities.in_array (config.CitationClass, {"book", "citation"}) and not utilities.is_set (A['Periodical']) then -- |contributor= and |contribution= only supported in book cites
c = extract_names (args, 'ContributorList'); -- fetch contributor list from |contributorn= / |contributor-lastn=, -firstn=, -linkn=, -maskn=
if 0 < #c then
if not utilities.is_set (Contribution) then -- |contributor= requires |contribution=
utilities.set_message ('err_contributor_missing_required_param', 'contribution'); -- add missing contribution error message
c = {}; -- blank the contributors' table; it is used as a flag later
end
if 0 == #a then -- |contributor= requires |author=
utilities.set_message ('err_contributor_missing_required_param', 'author'); -- add missing author error message
c = {}; -- blank the contributors' table; it is used as a flag later
end
end
else -- if not a book cite
if utilities.select_one (args, cfg.aliases['ContributorList-Last'], 'err_redundant_parameters', 1 ) then -- are there contributor name list parameters?
utilities.set_message ('err_contributor_ignored'); -- add contributor ignored error message
end
Contribution = nil; -- unset
end
local Title = A['Title'];
local TitleLink = A['TitleLink'];
local auto_select = ''; -- default is auto
local accept_link;
TitleLink, accept_link = utilities.has_accept_as_written (TitleLink, true); -- test for accept-this-as-written markup
if (not accept_link) and utilities.in_array (TitleLink, {'none', 'pmc', 'doi'}) then -- check for special keywords
auto_select = TitleLink; -- remember selection for later
TitleLink = ''; -- treat as if |title-link= would have been empty
end
TitleLink = link_title_ok (TitleLink, A:ORIGIN ('TitleLink'), Title, 'title'); -- check for wiki-markup in |title-link= or wiki-markup in |title= when |title-link= is set
local Section = ''; -- {{cite map}} only; preset to empty string for concatenation if not used
if 'map' == config.CitationClass and 'section' == Chapter_origin then
Section = A['Chapter']; -- get |section= from |chapter= alias list; |chapter= and the other aliases not supported in {{cite map}}
Chapter = ''; -- unset for now; will be reset later from |map= if present
end
local Periodical = A['Periodical'];
local Periodical_origin = A:ORIGIN('Periodical');
local ScriptPeriodical = A['ScriptPeriodical'];
local ScriptPeriodical_origin = A:ORIGIN('ScriptPeriodical');
local TransPeriodical = A['TransPeriodical'];
local TransPeriodical_origin = A:ORIGIN ('TransPeriodical');
if (utilities.in_array (config.CitationClass, {'book', 'encyclopaedia'}) and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical) or utilities.is_set (TransPeriodical))) then
local param;
if utilities.is_set (Periodical) then -- get a parameter name from one of these periodical related meta-parameters
Periodical = ''; -- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters
param = Periodical_origin -- get parameter name for error messaging
elseif utilities.is_set (TransPeriodical) then
TransPeriodical = ''; -- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters
param = TransPeriodical_origin; -- get parameter name for error messaging
elseif utilities.is_set (ScriptPeriodical) then
ScriptPeriodical = ''; -- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters
param = ScriptPeriodical_origin; -- get parameter name for error messaging
end
if utilities.is_set (param) then -- if we found one
utilities.set_message ('err_periodical_ignored', {param}); -- emit an error message
end
end
if utilities.is_set (Periodical) then
local i;
Periodical, i = utilities.strip_apostrophe_markup (Periodical); -- strip apostrophe markup so that metadata isn't contaminated
if i then -- non-zero when markup was stripped so emit an error message
utilities.set_message ('err_apostrophe_markup', {Periodical_origin});
end
end
if 'mailinglist' == config.CitationClass then -- special case for {{cite mailing list}}
if utilities.is_set (Periodical) and utilities.is_set (A ['MailingList']) then -- both set emit an error TODO: make a function for this and similar?
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', Periodical_origin) .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'mailinglist')});
end
Periodical = A ['MailingList']; -- error or no, set Periodical to |mailinglist= value because this template is {{cite mailing list}}
Periodical_origin = A:ORIGIN('MailingList');
end
-- web and news not tested for now because of
-- Wikipedia:Administrators%27_noticeboard#Is_there_a_semi-automated_tool_that_could_fix_these_annoying_"Cite_Web"_errors?
if not (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) then -- 'periodical' templates require periodical parameter
-- local p = {['journal'] = 'journal', ['magazine'] = 'magazine', ['news'] = 'newspaper', ['web'] = 'website'}; -- for error message
local p = {['journal'] = 'journal', ['magazine'] = 'magazine'}; -- for error message
if p[config.CitationClass] then
utilities.set_message ('err_missing_periodical', {config.CitationClass, p[config.CitationClass]});
end
end
local Volume;
if 'citation' == config.CitationClass then
if utilities.is_set (Periodical) then
if not utilities.in_array (Periodical_origin, cfg.citation_no_volume_t) then -- {{citation}} does not render |volume= when these parameters are used
Volume = A['Volume']; -- but does for all other 'periodicals'
end
elseif utilities.is_set (ScriptPeriodical) then
if 'script-website' ~= ScriptPeriodical_origin then -- {{citation}} does not render volume for |script-website=
Volume = A['Volume']; -- but does for all other 'periodicals'
end
else
Volume = A['Volume']; -- and does for non-'periodical' cites
end
elseif utilities.in_array (config.CitationClass, cfg.templates_using_volume) then -- render |volume= for cs1 according to the configuration settings
Volume = A['Volume'];
end
extra_text_in_vol_iss_check (Volume, A:ORIGIN ('Volume'), 'v');
local Issue;
if 'citation' == config.CitationClass then
if utilities.is_set (Periodical) and utilities.in_array (Periodical_origin, cfg.citation_issue_t) then -- {{citation}} may render |issue= when these parameters are used
Issue = utilities.hyphen_to_dash (A['Issue']);
end
elseif utilities.in_array (config.CitationClass, cfg.templates_using_issue) then -- conference & map books do not support issue; {{citation}} listed here because included in settings table
if not (utilities.in_array (config.CitationClass, {'conference', 'map', 'citation'}) and not (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical))) then
Issue = utilities.hyphen_to_dash (A['Issue']);
end
end
local ArticleNumber;
if utilities.in_array (config.CitationClass, {'journal', 'conference'}) or ('citation' == config.CitationClass and utilities.is_set (Periodical) and 'journal' == Periodical_origin) then
ArticleNumber = A['ArticleNumber'];
end
extra_text_in_vol_iss_check (Issue, A:ORIGIN ('Issue'), 'i');
local Page;
local Pages;
local At;
local QuotePage;
local QuotePages;
if not utilities.in_array (config.CitationClass, cfg.templates_not_using_page) then -- TODO: rewrite to emit ignored parameter error message?
Page = A['Page'];
Pages = utilities.hyphen_to_dash (A['Pages']);
At = A['At'];
QuotePage = A['QuotePage'];
QuotePages = utilities.hyphen_to_dash (A['QuotePages']);
end
local Edition = A['Edition'];
local PublicationPlace = place_check (A['PublicationPlace'], A:ORIGIN('PublicationPlace'));
local Place = place_check (A['Place'], A:ORIGIN('Place'));
local PublisherName = A['PublisherName'];
local PublisherName_origin = A:ORIGIN('PublisherName');
if utilities.is_set (PublisherName) and (cfg.keywords_xlate['none'] ~= PublisherName) then
local i = 0;
PublisherName, i = utilities.strip_apostrophe_markup (PublisherName); -- strip apostrophe markup so that metadata isn't contaminated; publisher is never italicized
if i and (0 < i) then -- non-zero when markup was stripped so emit an error message
utilities.set_message ('err_apostrophe_markup', {PublisherName_origin});
end
end
if ('document' == config.CitationClass) and not utilities.is_set (PublisherName) then
utilities.set_message ('err_missing_publisher', {config.CitationClass, 'publisher'});
end
local Newsgroup = A['Newsgroup']; -- TODO: strip apostrophe markup?
local Newsgroup_origin = A:ORIGIN('Newsgroup');
if 'newsgroup' == config.CitationClass then
if utilities.is_set (PublisherName) and (cfg.keywords_xlate['none'] ~= PublisherName) then -- general use parameter |publisher= not allowed in cite newsgroup
utilities.set_message ('err_parameter_ignored', {PublisherName_origin});
end
PublisherName = nil; -- ensure that this parameter is unset for the time being; will be used again after COinS
end
local URL = A['URL']; -- TODO: better way to do this for URL, ChapterURL, and MapURL?
local UrlAccess = is_valid_parameter_value (A['UrlAccess'], A:ORIGIN('UrlAccess'), cfg.keywords_lists['url-access'], nil);
if not utilities.is_set (URL) and utilities.is_set (UrlAccess) then
UrlAccess = nil;
utilities.set_message ('err_param_access_requires_param', 'url');
end
local ChapterURL = A['ChapterURL'];
local ChapterUrlAccess = is_valid_parameter_value (A['ChapterUrlAccess'], A:ORIGIN('ChapterUrlAccess'), cfg.keywords_lists['url-access'], nil);
if not utilities.is_set (ChapterURL) and utilities.is_set (ChapterUrlAccess) then
ChapterUrlAccess = nil;
utilities.set_message ('err_param_access_requires_param', {A:ORIGIN('ChapterUrlAccess'):gsub ('%-access', '')});
end
local MapUrlAccess = is_valid_parameter_value (A['MapUrlAccess'], A:ORIGIN('MapUrlAccess'), cfg.keywords_lists['url-access'], nil);
if not utilities.is_set (A['MapURL']) and utilities.is_set (MapUrlAccess) then
MapUrlAccess = nil;
utilities.set_message ('err_param_access_requires_param', {'map-url'});
end
local this_page = mw.title.getCurrentTitle(); -- also used for COinS and for language
local no_tracking_cats = is_valid_parameter_value (A['NoTracking'], A:ORIGIN('NoTracking'), cfg.keywords_lists['yes_true_y'], nil);
-- check this page to see if it is in one of the namespaces that cs1 is not supposed to add to the error categories
if not utilities.is_set (no_tracking_cats) then -- ignore if we are already not going to categorize this page
if cfg.uncategorized_namespaces[this_page.namespace] then -- is this page's namespace id one of the uncategorized namespace ids?
no_tracking_cats = "true"; -- set no_tracking_cats
end
for _, v in ipairs (cfg.uncategorized_subpages) do -- cycle through page name patterns
if this_page.text:match (v) then -- test page name against each pattern
no_tracking_cats = "true"; -- set no_tracking_cats
break; -- bail out if one is found
end
end
end
-- check for extra |page=, |pages= or |at= parameters. (also sheet and sheets while we're at it)
utilities.select_one (args, {'page', 'p', 'pp', 'pages', 'at', 'sheet', 'sheets'}, 'err_redundant_parameters'); -- this is a dummy call simply to get the error message and category
local coins_pages;
Page, Pages, At, coins_pages = insource_loc_get (Page, A:ORIGIN('Page'), Pages, A:ORIGIN('Pages'), At);
local NoPP = is_valid_parameter_value (A['NoPP'], A:ORIGIN('NoPP'), cfg.keywords_lists['yes_true_y'], nil);
if utilities.is_set (PublicationPlace) and utilities.is_set (Place) then -- both |publication-place= and |place= (|location=) allowed if different
utilities.add_prop_cat ('location-test'); -- add property cat to evaluate how often PublicationPlace and Place are used together
if PublicationPlace == Place then
Place = ''; -- unset; don't need both if they are the same
end
elseif not utilities.is_set (PublicationPlace) and utilities.is_set (Place) then -- when only |place= (|location=) is set ...
PublicationPlace = Place; -- promote |place= (|location=) to |publication-place
end
if PublicationPlace == Place then Place = ''; end -- don't need both if they are the same
local URL_origin = A:ORIGIN('URL'); -- get name of parameter that holds URL
local ChapterURL_origin = A:ORIGIN('ChapterURL'); -- get name of parameter that holds ChapterURL
local ScriptChapter = A['ScriptChapter'];
local ScriptChapter_origin = A:ORIGIN ('ScriptChapter');
local Format = A['Format'];
local ChapterFormat = A['ChapterFormat'];
local TransChapter = A['TransChapter'];
local TransChapter_origin = A:ORIGIN ('TransChapter');
local TransTitle = A['TransTitle'];
local ScriptTitle = A['ScriptTitle'];
--[[
Parameter remapping for cite encyclopedia:
When the citation has these parameters:
|encyclopedia= and |title= then map |title= to |article= and |encyclopedia= to |title= for rendering
|encyclopedia= and |article= then map |encyclopedia= to |title= for rendering
|trans-title= maps to |trans-chapter= when |title= is re-mapped
|url= maps to |chapter-url= when |title= is remapped
All other combinations of |encyclopedia=, |title=, and |article= are not modified
]]
local Encyclopedia = A['Encyclopedia']; -- used as a flag by this module and by ~/COinS
if utilities.is_set (Encyclopedia) then -- emit error message when Encyclopedia set but template is other than {{cite encyclopedia}} or {{citation}}
if 'encyclopaedia' ~= config.CitationClass and 'citation' ~= config.CitationClass then
utilities.set_message ('err_parameter_ignored', {A:ORIGIN ('Encyclopedia')});
Encyclopedia = nil; -- unset because not supported by this template
end
end
if ('encyclopaedia' == config.CitationClass) or ('citation' == config.CitationClass and utilities.is_set (Encyclopedia)) then
if utilities.is_set (Periodical) and utilities.is_set (Encyclopedia) then -- when both parameters set emit an error message; {{citation}} only; Periodical not allowed in {{cite encyclopedia}}
utilities.set_message ('err_periodical_ignored', {Periodical_origin});
end
if utilities.is_set (Encyclopedia) then
Periodical = Encyclopedia; -- error or no, set Periodical to Encyclopedia for rendering; {{citation}} could (not legitimately) have both; use Encyclopedia
Periodical_origin = A:ORIGIN ('Encyclopedia');
if utilities.is_set (Title) or utilities.is_set (ScriptTitle) then
if not utilities.is_set (Chapter) then
Chapter = Title; -- |encyclopedia= and |title= are set so map |title= to |article= and |encyclopedia= to |title= for rendering
ScriptChapter = ScriptTitle;
ScriptChapter_origin = A:ORIGIN('ScriptTitle')
TransChapter = TransTitle;
ChapterURL = URL;
ChapterURL_origin = URL_origin;
ChapterUrlAccess = UrlAccess;
if not utilities.is_set (ChapterURL) and utilities.is_set (TitleLink) then
Chapter = utilities.make_wikilink (TitleLink, Chapter);
end
Title = Periodical;
ChapterFormat = Format;
Periodical = ''; -- redundant so unset
TransTitle = '';
URL = '';
Format = '';
TitleLink = '';
ScriptTitle = '';
end
elseif utilities.is_set (Chapter) or utilities.is_set (ScriptChapter) then -- |title= not set
Title = Periodical; -- |encyclopedia= set and |article= set so map |encyclopedia= to |title= for rendering
Periodical = ''; -- redundant so unset
end
end
end
-- special case for cite techreport.
local ID = A['ID'];
if (config.CitationClass == "techreport") then -- special case for cite techreport
if utilities.is_set (A['Number']) then -- cite techreport uses 'number', which other citations alias to 'issue'
if not utilities.is_set (ID) then -- can we use ID for the "number"?
ID = A['Number']; -- yes, use it
else -- ID has a value so emit error message
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'id') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'number')});
end
end
end
-- Account for the oddity that is {{cite conference}}, before generation of COinS data.
local ChapterLink -- = A['ChapterLink']; -- deprecated as a parameter but still used internally by cite episode
local Conference = A['Conference'];
local BookTitle = A['BookTitle'];
local TransTitle_origin = A:ORIGIN ('TransTitle');
if 'conference' == config.CitationClass then
if utilities.is_set (BookTitle) then
Chapter = Title;
Chapter_origin = 'title';
-- ChapterLink = TitleLink; -- |chapter-link= is deprecated
ChapterURL = URL;
ChapterUrlAccess = UrlAccess;
ChapterURL_origin = URL_origin;
URL_origin = '';
ChapterFormat = Format;
TransChapter = TransTitle;
TransChapter_origin = TransTitle_origin;
Title = BookTitle;
Format = '';
-- TitleLink = '';
TransTitle = '';
URL = '';
end
elseif 'speech' ~= config.CitationClass then
Conference = ''; -- not cite conference or cite speech so make sure this is empty string
end
-- CS1/2 mode
local Mode;
if cfg.global_cs1_config_t['Mode'] then -- global setting in {{cs1 config}} overrides local |mode= parameter value; nil when empty or assigned value invalid
Mode = is_valid_parameter_value (cfg.global_cs1_config_t['Mode'], 'cs1 config: mode', cfg.keywords_lists['mode'], ''); -- error messaging 'param' here is a hoax
else
Mode = is_valid_parameter_value (A['Mode'], A:ORIGIN('Mode'), cfg.keywords_lists['mode'], '');
end
if cfg.global_cs1_config_t['Mode'] and utilities.is_set (A['Mode']) then -- when template has |mode=<something> which global setting has overridden
utilities.set_message ('maint_overridden_setting'); -- set a maint message
end
-- separator character and postscript
local sepc, PostScript = set_style (Mode:lower(), A['PostScript'], config.CitationClass);
-- controls capitalization of certain static text
local use_lowercase = ( sepc == ',' );
-- cite map oddities
local Cartography = "";
local Scale = "";
local Sheet = A['Sheet'] or '';
local Sheets = A['Sheets'] or '';
if config.CitationClass == "map" then
if utilities.is_set (Chapter) then --TODO: make a function for this and similar?
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'map') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', Chapter_origin)}); -- add error message
end
Chapter = A['Map'];
Chapter_origin = A:ORIGIN('Map');
ChapterURL = A['MapURL'];
ChapterURL_origin = A:ORIGIN('MapURL');
TransChapter = A['TransMap'];
ScriptChapter = A['ScriptMap']
ScriptChapter_origin = A:ORIGIN('ScriptMap')
ChapterUrlAccess = MapUrlAccess;
ChapterFormat = A['MapFormat'];
Cartography = A['Cartography'];
if utilities.is_set ( Cartography ) then
Cartography = sepc .. " " .. wrap_msg ('cartography', Cartography, use_lowercase);
end
Scale = A['Scale'];
if utilities.is_set ( Scale ) then
Scale = sepc .. " " .. Scale;
end
end
-- Account for the oddities that are {{cite episode}} and {{cite serial}}, before generation of COinS data.
local Series = A['Series'];
if 'episode' == config.CitationClass or 'serial' == config.CitationClass then
local SeriesLink = A['SeriesLink'];
SeriesLink = link_title_ok (SeriesLink, A:ORIGIN ('SeriesLink'), Series, 'series'); -- check for wiki-markup in |series-link= or wiki-markup in |series= when |series-link= is set
local Network = A['Network'];
local Station = A['Station'];
local s, n = {}, {};
-- do common parameters first
if utilities.is_set (Network) then table.insert(n, Network); end
if utilities.is_set (Station) then table.insert(n, Station); end
ID = table.concat(n, sepc .. ' ');
if 'episode' == config.CitationClass then -- handle the oddities that are strictly {{cite episode}}
local Season = A['Season'];
local SeriesNumber = A['SeriesNumber'];
if utilities.is_set (Season) and utilities.is_set (SeriesNumber) then -- these are mutually exclusive so if both are set TODO: make a function for this and similar?
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'season') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'seriesno')}); -- add error message
SeriesNumber = ''; -- unset; prefer |season= over |seriesno=
end
-- assemble a table of parts concatenated later into Series
if utilities.is_set (Season) then table.insert(s, wrap_msg ('season', Season, use_lowercase)); end
if utilities.is_set (SeriesNumber) then table.insert(s, wrap_msg ('seriesnum', SeriesNumber, use_lowercase)); end
if utilities.is_set (Issue) then table.insert(s, wrap_msg ('episode', Issue, use_lowercase)); end
Issue = ''; -- unset because this is not a unique parameter
Chapter = Title; -- promote title parameters to chapter
ScriptChapter = ScriptTitle;
ScriptChapter_origin = A:ORIGIN('ScriptTitle');
ChapterLink = TitleLink; -- alias |episode-link=
TransChapter = TransTitle;
ChapterURL = URL;
ChapterUrlAccess = UrlAccess;
ChapterURL_origin = URL_origin;
ChapterFormat = Format;
Title = Series; -- promote series to title
TitleLink = SeriesLink;
Series = table.concat(s, sepc .. ' '); -- this is concatenation of season, seriesno, episode number
if utilities.is_set (ChapterLink) and not utilities.is_set (ChapterURL) then -- link but not URL
Chapter = utilities.make_wikilink (ChapterLink, Chapter);
elseif utilities.is_set (ChapterLink) and utilities.is_set (ChapterURL) then -- if both are set, URL links episode;
Series = utilities.make_wikilink (ChapterLink, Series);
end
URL = ''; -- unset
TransTitle = '';
ScriptTitle = '';
Format = '';
else -- now oddities that are cite serial
Issue = ''; -- unset because this parameter no longer supported by the citation/core version of cite serial
Chapter = A['Episode']; -- TODO: make |episode= available to cite episode someday?
if utilities.is_set (Series) and utilities.is_set (SeriesLink) then
Series = utilities.make_wikilink (SeriesLink, Series);
end
Series = utilities.wrap_style ('italic-title', Series); -- series is italicized
end
end
-- end of {{cite episode}} stuff
-- handle type parameter for those CS1 citations that have default values
local TitleType = A['TitleType'];
local Degree = A['Degree'];
if utilities.in_array (config.CitationClass, {'AV-media-notes', 'document', 'interview', 'mailinglist', 'map', 'podcast', 'pressrelease', 'report', 'speech', 'techreport', 'thesis'}) then
TitleType = set_titletype (config.CitationClass, TitleType);
if utilities.is_set (Degree) and "Thesis" == TitleType then -- special case for cite thesis
TitleType = Degree .. ' ' .. cfg.title_types ['thesis']:lower();
end
end
if utilities.is_set (TitleType) then -- if type parameter is specified
TitleType = utilities.substitute ( cfg.messages['type'], TitleType); -- display it in parentheses
-- TODO: Hack on TitleType to fix bunched parentheses problem
end
-- legacy: promote PublicationDate to Date if neither Date nor Year are set.
local Date = A['Date'];
local Date_origin; -- to hold the name of parameter promoted to Date; required for date error messaging
local PublicationDate = A['PublicationDate'];
local Year = A['Year'];
if not utilities.is_set (Date) then
Date = Year; -- promote Year to Date
Year = nil; -- make nil so Year as empty string isn't used for CITEREF
if not utilities.is_set (Date) and utilities.is_set (PublicationDate) then -- use PublicationDate when |date= and |year= are not set
Date = PublicationDate; -- promote PublicationDate to Date
PublicationDate = ''; -- unset, no longer needed
Date_origin = A:ORIGIN('PublicationDate'); -- save the name of the promoted parameter
else
Date_origin = A:ORIGIN('Year'); -- save the name of the promoted parameter
end
else
Date_origin = A:ORIGIN('Date'); -- not a promotion; name required for error messaging
end
if PublicationDate == Date then PublicationDate = ''; end -- if PublicationDate is same as Date, don't display in rendered citation
--[[
Go test all of the date-holding parameters for valid MOS:DATE format and make sure that dates are real dates. This must be done before we do COinS because here is where
we get the date used in the metadata.
Date validation supporting code is in Module:Citation/CS1/Date_validation
]]
local DF = is_valid_parameter_value (A['DF'], A:ORIGIN('DF'), cfg.keywords_lists['df'], '');
if not utilities.is_set (DF) then
DF = cfg.global_df; -- local |df= if present overrides global df set by {{use xxx date}} template
end
local ArchiveURL;
local ArchiveDate;
local ArchiveFormat = A['ArchiveFormat'];
local archive_url_timestamp; -- timestamp from wayback machine url
ArchiveURL, ArchiveDate, archive_url_timestamp = archive_url_check (A['ArchiveURL'], A['ArchiveDate'])
ArchiveFormat = style_format (ArchiveFormat, ArchiveURL, 'archive-format', 'archive-url');
ArchiveURL, ArchiveDate = is_unique_archive_url (ArchiveURL, URL, ChapterURL, A:ORIGIN('ArchiveURL'), ArchiveDate); -- add error message when URL or ChapterURL == ArchiveURL
local AccessDate = A['AccessDate'];
local COinS_date = {}; -- holds date info extracted from |date= for the COinS metadata by Module:Date verification
local DoiBroken = A['DoiBroken'];
local Embargo = A['Embargo'];
local anchor_year; -- used in the CITEREF identifier
do -- create defined block to contain local variables error_message, date_parameters_list, mismatch
local error_message = '';
-- AirDate has been promoted to Date so not necessary to check it
local date_parameters_list = {
['access-date'] = {val = AccessDate, name = A:ORIGIN ('AccessDate')},
['archive-date'] = {val = ArchiveDate, name = A:ORIGIN ('ArchiveDate')},
['date'] = {val = Date, name = Date_origin},
['doi-broken-date'] = {val = DoiBroken, name = A:ORIGIN ('DoiBroken')},
['pmc-embargo-date'] = {val = Embargo, name = A:ORIGIN ('Embargo')},
['publication-date'] = {val = PublicationDate, name = A:ORIGIN ('PublicationDate')},
['year'] = {val = Year, name = A:ORIGIN ('Year')},
};
local error_list = {};
anchor_year, Embargo = validation.dates(date_parameters_list, COinS_date, error_list);
-- start temporary Julian / Gregorian calendar uncertainty categorization
if COinS_date.inter_cal_cat then
utilities.add_prop_cat ('jul-greg-uncertainty');
end
-- end temporary Julian / Gregorian calendar uncertainty categorization
if utilities.is_set (Year) and utilities.is_set (Date) then -- both |date= and |year= not normally needed;
validation.year_date_check (Year, A:ORIGIN ('Year'), Date, A:ORIGIN ('Date'), error_list);
end
if 0 == #error_list then -- error free dates only; 0 when error_list is empty
local modified = false; -- flag
if utilities.is_set (DF) then -- if we need to reformat dates
modified = validation.reformat_dates (date_parameters_list, DF); -- reformat to DF format, use long month names if appropriate
end
if true == validation.date_hyphen_to_dash (date_parameters_list) then -- convert hyphens to dashes where appropriate
modified = true;
utilities.set_message ('maint_date_format'); -- hyphens were converted so add maint category
end
-- for those wikis that can and want to have English date names translated to the local language; not supported at en.wiki
if cfg.date_name_auto_xlate_enable and validation.date_name_xlate (date_parameters_list, cfg.date_digit_auto_xlate_enable ) then
utilities.set_message ('maint_date_auto_xlated'); -- add maint cat
modified = true;
end
if modified then -- if the date_parameters_list values were modified
AccessDate = date_parameters_list['access-date'].val; -- overwrite date holding parameters with modified values
ArchiveDate = date_parameters_list['archive-date'].val;
Date = date_parameters_list['date'].val;
DoiBroken = date_parameters_list['doi-broken-date'].val;
PublicationDate = date_parameters_list['publication-date'].val;
end
if archive_url_timestamp and utilities.is_set (ArchiveDate) then
validation.archive_date_check (ArchiveDate, archive_url_timestamp, DF); -- does YYYYMMDD in archive_url_timestamp match date in ArchiveDate
end
else
utilities.set_message ('err_bad_date', {utilities.make_sep_list (#error_list, error_list)}); -- add this error message
end
end -- end of do
if utilities.in_array (config.CitationClass, {'book', 'encyclopaedia'}) or -- {{cite book}}, {{cite encyclopedia}}; TODO: {{cite conference}} and others?
('citation' == config.CitationClass and utilities.is_set (Encyclopedia)) or -- {{citation}} as an encylopedia citation
('citation' == config.CitationClass and not utilities.is_set (Periodical)) then -- {{citation}} as a book citation
if utilities.is_set (PublicationPlace) then
if not utilities.is_set (PublisherName) then
local date = COinS_date.rftdate and tonumber (COinS_date.rftdate:match ('%d%d%d%d')); -- get year portion of COinS date (because in Arabic numerals); convert string to number
if date and (1850 <= date) then -- location has no publisher; if date is 1850 or later
utilities.set_message ('maint_location_no_publisher'); -- add maint cat
end
else -- PublisherName has a value
if cfg.keywords_xlate['none'] == PublisherName then -- if that value is 'none' (only for book and encyclopedia citations)
PublisherName = ''; -- unset
end
end
end
end
local ID_list = {}; -- sequence table of rendered identifiers
local ID_list_coins = {}; -- table of identifiers and their values from args; key is same as cfg.id_handlers's key
local Class = A['Class']; -- arxiv class identifier
local ID_support = {
{A['ASINTLD'], 'ASIN', 'err_asintld_missing_asin', A:ORIGIN ('ASINTLD')},
{DoiBroken, 'DOI', 'err_doibroken_missing_doi', A:ORIGIN ('DoiBroken')},
{Embargo, 'PMC', 'err_embargo_missing_pmc', A:ORIGIN ('Embargo')},
}
ID_list, ID_list_coins = identifiers.identifier_lists_get (args, {DoiBroken = DoiBroken, ASINTLD = A['ASINTLD'], Embargo = Embargo, Class = Class}, ID_support);
-- Account for the oddities that are {{cite arxiv}}, {{cite biorxiv}}, {{cite citeseerx}}, {{cite medrxiv}}, {{cite ssrn}}, before generation of COinS data.
if utilities.in_array (config.CitationClass, whitelist.preprint_template_list_t) then -- |arxiv= or |eprint= required for cite arxiv; |biorxiv=, |citeseerx=, |medrxiv=, |ssrn= required for their templates
if not (args[cfg.id_handlers[config.CitationClass:upper()].parameters[1]] or -- can't use ID_list_coins k/v table here because invalid parameters omitted
args[cfg.id_handlers[config.CitationClass:upper()].parameters[2]]) then -- which causes unexpected parameter missing error message
utilities.set_message ('err_' .. config.CitationClass .. '_missing'); -- add error message
end
Periodical = ({['arxiv'] = 'arXiv', ['biorxiv'] = 'bioRxiv', ['citeseerx'] = 'CiteSeerX', ['medrxiv'] = 'medRxiv', ['ssrn'] = 'Social Science Research Network'})[config.CitationClass];
end
-- Link the title of the work if no |url= was provided, but we have a |pmc= or a |doi= with |doi-access=free
if config.CitationClass == "journal" and not utilities.is_set (URL) and not utilities.is_set (TitleLink) and not utilities.in_array (cfg.keywords_xlate[Title], {'off', 'none'}) then -- TODO: remove 'none' once existing citations have been switched to 'off', so 'none' can be used as token for "no title" instead
if 'none' ~= cfg.keywords_xlate[auto_select] then -- if auto-linking not disabled
if identifiers.auto_link_urls[auto_select] then -- manual selection
URL = identifiers.auto_link_urls[auto_select]; -- set URL to be the same as identifier's external link
URL_origin = cfg.id_handlers[auto_select:upper()].parameters[1]; -- set URL_origin to parameter name for use in error message if citation is missing a |title=
elseif identifiers.auto_link_urls['pmc'] then -- auto-select PMC
URL = identifiers.auto_link_urls['pmc']; -- set URL to be the same as the PMC external link if not embargoed
URL_origin = cfg.id_handlers['PMC'].parameters[1]; -- set URL_origin to parameter name for use in error message if citation is missing a |title=
elseif identifiers.auto_link_urls['doi'] then -- auto-select DOI
URL = identifiers.auto_link_urls['doi'];
URL_origin = cfg.id_handlers['DOI'].parameters[1];
end
end
if utilities.is_set (URL) then -- set when using an identifier-created URL
if utilities.is_set (AccessDate) then -- |access-date= requires |url=; identifier-created URL is not |url=
utilities.set_message ('err_accessdate_missing_url'); -- add an error message
AccessDate = ''; -- unset
end
if utilities.is_set (ArchiveURL) then -- |archive-url= requires |url=; identifier-created URL is not |url=
utilities.set_message ('err_archive_missing_url'); -- add an error message
ArchiveURL = ''; -- unset
end
end
end
-- At this point fields may be nil if they weren't specified in the template use. We can use that fact.
-- Test if citation has no title
if not utilities.is_set (Title) and not utilities.is_set (TransTitle) and not utilities.is_set (ScriptTitle) then -- has special case for cite episode
utilities.set_message ('err_citation_missing_title', {'episode' == config.CitationClass and 'series' or 'title'});
end
if utilities.in_array (cfg.keywords_xlate[Title], {'off', 'none'}) and
utilities.in_array (config.CitationClass, {'journal', 'citation'}) and
(utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and
('journal' == Periodical_origin or 'script-journal' == ScriptPeriodical_origin) then -- special case for journal cites
Title = ''; -- set title to empty string
utilities.set_message ('maint_untitled'); -- add maint cat
end
-- COinS metadata (see <http://ocoins.info/>) for automated parsing of citation information.
-- handle the oddity that is cite encyclopedia and {{citation |encyclopedia=something}}. Here we presume that
-- when Periodical, Title, and Chapter are all set, then Periodical is the book (encyclopedia) title, Title
-- is the article title, and Chapter is a section within the article. So, we remap
local coins_chapter = Chapter; -- default assuming that remapping not required
local coins_title = Title; -- et tu
if 'encyclopaedia' == config.CitationClass or ('citation' == config.CitationClass and utilities.is_set (Encyclopedia)) then
if utilities.is_set (Chapter) and utilities.is_set (Title) and utilities.is_set (Periodical) then -- if all are used then
coins_chapter = Title; -- remap
coins_title = Periodical;
end
end
local coins_author = a; -- default for coins rft.au
if 0 < #c then -- but if contributor list
coins_author = c; -- use that instead
end
-- this is the function call to COinS()
local OCinSoutput = metadata.COinS({
['Periodical'] = utilities.strip_apostrophe_markup (Periodical), -- no markup in the metadata
['Encyclopedia'] = Encyclopedia, -- just a flag; content ignored by ~/COinS
['Chapter'] = metadata.make_coins_title (coins_chapter, ScriptChapter), -- Chapter and ScriptChapter stripped of bold / italic / accept-as-written markup
['Degree'] = Degree; -- cite thesis only
['Title'] = metadata.make_coins_title (coins_title, ScriptTitle), -- Title and ScriptTitle stripped of bold / italic / accept-as-written markup
['PublicationPlace'] = PublicationPlace,
['Date'] = COinS_date.rftdate, -- COinS_date.* has correctly formatted date values if Date is valid;
['Season'] = COinS_date.rftssn,
['Quarter'] = COinS_date.rftquarter,
['Chron'] = COinS_date.rftchron,
['Series'] = Series,
['Volume'] = Volume,
['Issue'] = Issue,
['ArticleNumber'] = ArticleNumber,
['Pages'] = coins_pages or metadata.get_coins_pages (first_set ({Sheet, Sheets, Page, Pages, At, QuotePage, QuotePages}, 7)), -- pages stripped of external links
['Edition'] = Edition,
['PublisherName'] = PublisherName or Newsgroup, -- any apostrophe markup already removed from PublisherName
['URL'] = first_set ({ChapterURL, URL}, 2),
['Authors'] = coins_author,
['ID_list'] = ID_list_coins,
['RawPage'] = this_page.prefixedText,
}, config.CitationClass);
-- Account for the oddities that are {{cite arxiv}}, {{cite biorxiv}}, {{cite citeseerx}}, {{cite medrxiv}}, and {{cite ssrn}} AFTER generation of COinS data.
if utilities.in_array (config.CitationClass, whitelist.preprint_template_list_t) then -- we have set rft.jtitle in COinS to arXiv, bioRxiv, CiteSeerX, medRxiv, or ssrn now unset so it isn't displayed
Periodical = ''; -- periodical not allowed in these templates; if article has been published, use cite journal
end
-- special case for cite newsgroup. Do this after COinS because we are modifying Publishername to include some static text
if 'newsgroup' == config.CitationClass and utilities.is_set (Newsgroup) then
PublisherName = utilities.substitute (cfg.messages['newsgroup'], external_link( 'news:' .. Newsgroup, Newsgroup, Newsgroup_origin, nil ));
end
local Editors;
local EditorCount; -- used only for choosing {ed.) or (eds.) annotation at end of editor name-list
local Contributors; -- assembled contributors name list
local contributor_etal;
local Translators; -- assembled translators name list
local translator_etal;
local t = {}; -- translators list from |translator-lastn= / translator-firstn= pairs
t = extract_names (args, 'TranslatorList'); -- fetch translator list from |translatorn= / |translator-lastn=, -firstn=, -linkn=, -maskn=
local Interviewers;
local interviewers_list = {};
interviewers_list = extract_names (args, 'InterviewerList'); -- process preferred interviewers parameters
local interviewer_etal;
-- Now perform various field substitutions.
-- We also add leading spaces and surrounding markup and punctuation to the
-- various parts of the citation, but only when they are non-nil.
do
local last_first_list;
local control = {
format = NameListStyle, -- empty string, '&', 'amp', 'and', or 'vanc'
maximum = nil, -- as if display-authors or display-editors not set
mode = Mode
};
do -- do editor name list first because the now unsupported coauthors used to modify control table
local display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayEditors'], A['DisplayEditors'], A:ORIGIN ('DisplayEditors'), #e);
control.maximum, editor_etal = get_display_names (display_names, #e, 'editors', editor_etal, param);
Editors, EditorCount = list_people (control, e, editor_etal);
if 1 == EditorCount and (true == editor_etal or 1 < #e) then -- only one editor displayed but includes etal then
EditorCount = 2; -- spoof to display (eds.) annotation
end
end
do -- now do interviewers
local display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayInterviewers'], A['DisplayInterviewers'], A:ORIGIN ('DisplayInterviewers'), #interviewers_list);
control.maximum, interviewer_etal = get_display_names (display_names, #interviewers_list, 'interviewers', interviewer_etal, param);
Interviewers = list_people (control, interviewers_list, interviewer_etal);
end
do -- now do translators
local display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayTranslators'], A['DisplayTranslators'], A:ORIGIN ('DisplayTranslators'), #t);
control.maximum, translator_etal = get_display_names (display_names, #t, 'translators', translator_etal, param);
Translators = list_people (control, t, translator_etal);
end
do -- now do contributors
local display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayContributors'], A['DisplayContributors'], A:ORIGIN ('DisplayContributors'), #c);
control.maximum, contributor_etal = get_display_names (display_names, #c, 'contributors', contributor_etal, param);
Contributors = list_people (control, c, contributor_etal);
end
do -- now do authors
local display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayAuthors'], A['DisplayAuthors'], A:ORIGIN ('DisplayAuthors'), #a, author_etal);
control.maximum, author_etal = get_display_names (display_names, #a, 'authors', author_etal, param);
last_first_list = list_people (control, a, author_etal);
if utilities.is_set (Authors) then
Authors, author_etal = name_has_etal (Authors, author_etal, false, 'authors'); -- find and remove variations on et al.
if author_etal then
Authors = Authors .. ' ' .. cfg.messages['et al']; -- add et al. to authors parameter
end
else
Authors = last_first_list; -- either an author name list or an empty string
end
end -- end of do
if utilities.is_set (Authors) and utilities.is_set (Collaboration) then
Authors = Authors .. ' (' .. Collaboration .. ')'; -- add collaboration after et al.
end
end
local ConferenceFormat = A['ConferenceFormat'];
local ConferenceURL = A['ConferenceURL'];
ConferenceFormat = style_format (ConferenceFormat, ConferenceURL, 'conference-format', 'conference-url');
Format = style_format (Format, URL, 'format', 'url');
-- special case for chapter format so no error message or cat when chapter not supported
if not (utilities.in_array (config.CitationClass, {'web', 'news', 'journal', 'magazine', 'pressrelease', 'podcast', 'newsgroup', 'arxiv', 'biorxiv', 'citeseerx', 'medrxiv', 'ssrn'}) or
('citation' == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and not utilities.is_set (Encyclopedia))) then
ChapterFormat = style_format (ChapterFormat, ChapterURL, 'chapter-format', 'chapter-url');
end
if not utilities.is_set (URL) then
if utilities.in_array (config.CitationClass, {"web", "podcast", "mailinglist"}) or -- |url= required for cite web, cite podcast, and cite mailinglist
('citation' == config.CitationClass and ('website' == Periodical_origin or 'script-website' == ScriptPeriodical_origin)) then -- and required for {{citation}} with |website= or |script-website=
utilities.set_message ('err_cite_web_url');
end
-- do we have |accessdate= without either |url= or |chapter-url=?
if utilities.is_set (AccessDate) and not utilities.is_set (ChapterURL) then -- ChapterURL may be set when URL is not set;
utilities.set_message ('err_accessdate_missing_url');
AccessDate = '';
end
end
local UrlStatus = is_valid_parameter_value (A['UrlStatus'], A:ORIGIN('UrlStatus'), cfg.keywords_lists['url-status'], '');
local OriginalURL
local OriginalURL_origin
local OriginalFormat
local OriginalAccess;
UrlStatus = UrlStatus:lower(); -- used later when assembling archived text
if utilities.is_set ( ArchiveURL ) then
if utilities.is_set (ChapterURL) then -- if chapter-url= is set apply archive url to it
OriginalURL = ChapterURL; -- save copy of source chapter's url for archive text
OriginalURL_origin = ChapterURL_origin; -- name of |chapter-url= parameter for error messages
OriginalFormat = ChapterFormat; -- and original |chapter-format=
if 'live' ~= UrlStatus then
ChapterURL = ArchiveURL -- swap-in the archive's URL
ChapterURL_origin = A:ORIGIN('ArchiveURL') -- name of |archive-url= parameter for error messages
ChapterFormat = ArchiveFormat or ''; -- swap in archive's format
ChapterUrlAccess = nil; -- restricted access levels do not make sense for archived URLs
end
elseif utilities.is_set (URL) then
OriginalURL = URL; -- save copy of original source URL
OriginalURL_origin = URL_origin; -- name of URL parameter for error messages
OriginalFormat = Format; -- and original |format=
OriginalAccess = UrlAccess;
if 'live' ~= UrlStatus then -- if URL set then |archive-url= applies to it
URL = ArchiveURL -- swap-in the archive's URL
URL_origin = A:ORIGIN('ArchiveURL') -- name of archive URL parameter for error messages
Format = ArchiveFormat or ''; -- swap in archive's format
UrlAccess = nil; -- restricted access levels do not make sense for archived URLs
end
end
elseif utilities.is_set (UrlStatus) then -- if |url-status= is set when |archive-url= is not set
utilities.set_message ('maint_url_status'); -- add maint cat
end
if utilities.in_array (config.CitationClass, {'web', 'news', 'journal', 'magazine', 'pressrelease', 'podcast', 'newsgroup', 'arxiv', 'biorxiv', 'citeseerx', 'medrxiv', 'ssrn'}) or -- if any of the 'periodical' cites except encyclopedia
('citation' == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and not utilities.is_set (Encyclopedia)) then
local chap_param;
if utilities.is_set (Chapter) then -- get a parameter name from one of these chapter related meta-parameters
chap_param = A:ORIGIN ('Chapter')
elseif utilities.is_set (TransChapter) then
chap_param = A:ORIGIN ('TransChapter')
elseif utilities.is_set (ChapterURL) then
chap_param = A:ORIGIN ('ChapterURL')
elseif utilities.is_set (ScriptChapter) then
chap_param = ScriptChapter_origin;
else utilities.is_set (ChapterFormat)
chap_param = A:ORIGIN ('ChapterFormat')
end
if utilities.is_set (chap_param) then -- if we found one
utilities.set_message ('err_chapter_ignored', {chap_param}); -- add error message
Chapter = ''; -- and set them to empty string to be safe with concatenation
TransChapter = '';
ChapterURL = '';
ScriptChapter = '';
ChapterFormat = '';
end
else -- otherwise, format chapter / article title
local no_quotes = false; -- default assume that we will be quoting the chapter parameter value
if utilities.is_set (Contribution) and 0 < #c then -- if this is a contribution with contributor(s)
if utilities.in_array (Contribution:lower(), cfg.keywords_lists.contribution) then -- and a generic contribution title
no_quotes = true; -- then render it unquoted
end
end
Chapter = format_chapter_title (ScriptChapter, ScriptChapter_origin, Chapter, Chapter_origin, TransChapter, TransChapter_origin, ChapterURL, ChapterURL_origin, no_quotes, ChapterUrlAccess); -- Contribution is also in Chapter
if utilities.is_set (Chapter) then
Chapter = Chapter .. ChapterFormat ;
if 'map' == config.CitationClass and utilities.is_set (TitleType) then
Chapter = Chapter .. ' ' .. TitleType; -- map annotation here; not after title
end
Chapter = Chapter .. sepc .. ' ';
elseif utilities.is_set (ChapterFormat) then -- |chapter= not set but |chapter-format= is so ...
Chapter = ChapterFormat .. sepc .. ' '; -- ... ChapterFormat has error message, we want to see it
end
end
-- Format main title
local plain_title = false;
local accept_title;
Title, accept_title = utilities.has_accept_as_written (Title, true); -- remove accept-this-as-written markup when it wraps all of <Title>
if accept_title and ('' == Title) then -- only support forced empty for now "(())"
Title = cfg.messages['notitle']; -- replace by predefined "No title" message
-- TODO: utilities.set_message ( 'err_redundant_parameters', ...); -- issue proper error message instead of muting
ScriptTitle = ''; -- just mute for now
TransTitle = ''; -- just mute for now
plain_title = true; -- suppress text decoration for descriptive title
utilities.set_message ('maint_untitled'); -- add maint cat
end
if not accept_title then -- <Title> not wrapped in accept-as-written markup
if '...' == Title:sub (-3) then -- if ellipsis is the last three characters of |title=
Title = Title:gsub ('(%.%.%.)%.+$', '%1'); -- limit the number of dots to three
elseif not mw.ustring.find (Title, '%.%s*%a%.$') and -- end of title is not a 'dot-(optional space-)letter-dot' initialism ...
not mw.ustring.find (Title, '%s+%a%.$') then -- ...and not a 'space-letter-dot' initial (''Allium canadense'' L.)
Title = mw.ustring.gsub(Title, '%' .. sepc .. '$', ''); -- remove any trailing separator character; sepc and ms.ustring() here for languages that use multibyte separator characters
end
if utilities.is_set (ArchiveURL) and is_archived_copy (Title) then
utilities.set_message ('maint_archived_copy'); -- add maintenance category before we modify the content of Title
end
if is_generic ('generic_titles', Title) then
utilities.set_message ('err_generic_title'); -- set an error message
end
end
if (not plain_title) and (utilities.in_array (config.CitationClass, {'web', 'news', 'journal', 'magazine', 'document', 'pressrelease', 'podcast', 'newsgroup', 'mailinglist', 'interview', 'arxiv', 'biorxiv', 'citeseerx', 'medrxiv', 'ssrn'}) or
('citation' == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and not utilities.is_set (Encyclopedia)) or
('map' == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)))) then -- special case for cite map when the map is in a periodical treat as an article
Title = kern_quotes (Title); -- if necessary, separate title's leading and trailing quote marks from module provided quote marks
Title = utilities.wrap_style ('quoted-title', Title);
Title = script_concatenate (Title, ScriptTitle, 'script-title'); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped
TransTitle = utilities.wrap_style ('trans-quoted-title', TransTitle );
elseif plain_title or ('report' == config.CitationClass) then -- no styling for cite report and descriptive titles (otherwise same as above)
Title = script_concatenate (Title, ScriptTitle, 'script-title'); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped
TransTitle = utilities.wrap_style ('trans-quoted-title', TransTitle ); -- for cite report, use this form for trans-title
else
Title = utilities.wrap_style ('italic-title', Title);
Title = script_concatenate (Title, ScriptTitle, 'script-title'); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped
TransTitle = utilities.wrap_style ('trans-italic-title', TransTitle);
end
if utilities.is_set (TransTitle) then
if utilities.is_set (Title) then
TransTitle = " " .. TransTitle;
else
utilities.set_message ('err_trans_missing_title', {'title'});
end
end
if utilities.is_set (Title) then -- TODO: is this the right place to be making Wikisource URLs?
if utilities.is_set (TitleLink) and utilities.is_set (URL) then
utilities.set_message ('err_wikilink_in_url'); -- set an error message because we can't have both
TitleLink = ''; -- unset
end
if not utilities.is_set (TitleLink) and utilities.is_set (URL) then
Title = external_link (URL, Title, URL_origin, UrlAccess) .. TransTitle .. Format;
URL = ''; -- unset these because no longer needed
Format = "";
elseif utilities.is_set (TitleLink) and not utilities.is_set (URL) then
local ws_url;
ws_url = wikisource_url_make (TitleLink); -- ignore ws_label return; not used here
if ws_url then
Title = external_link (ws_url, Title .. ' ', 'ws link in title-link'); -- space char after Title to move icon away from italic text; TODO: a better way to do this?
Title = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], TitleLink, Title});
Title = Title .. TransTitle;
else
Title = utilities.make_wikilink (TitleLink, Title) .. TransTitle;
end
else
local ws_url, ws_label, L; -- Title has italic or quote markup by the time we get here which causes is_wikilink() to return 0 (not a wikilink)
ws_url, ws_label, L = wikisource_url_make (Title:gsub('^[\'"]*(.-)[\'"]*$', '%1')); -- make ws URL from |title= interwiki link (strip italic or quote markup); link portion L becomes tooltip label
if ws_url then
Title = Title:gsub ('%b[]', ws_label); -- replace interwiki link with ws_label to retain markup
Title = external_link (ws_url, Title .. ' ', 'ws link in title'); -- space char after Title to move icon away from italic text; TODO: a better way to do this?
Title = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], L, Title});
Title = Title .. TransTitle;
else
Title = Title .. TransTitle;
end
end
else
Title = TransTitle;
end
if utilities.is_set (Place) then
Place = " " .. wrap_msg ('written', Place, use_lowercase) .. sepc .. " ";
end
local ConferenceURL_origin = A:ORIGIN('ConferenceURL'); -- get name of parameter that holds ConferenceURL
if utilities.is_set (Conference) then
if utilities.is_set (ConferenceURL) then
Conference = external_link( ConferenceURL, Conference, ConferenceURL_origin, nil );
end
Conference = sepc .. " " .. Conference .. ConferenceFormat;
elseif utilities.is_set (ConferenceURL) then
Conference = sepc .. " " .. external_link( ConferenceURL, nil, ConferenceURL_origin, nil );
end
local Position = '';
if not utilities.is_set (Position) then
local Minutes = A['Minutes'];
local Time = A['Time'];
if utilities.is_set (Minutes) then
if utilities.is_set (Time) then --TODO: make a function for this and similar?
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'minutes') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'time')});
end
Position = " " .. Minutes .. " " .. cfg.messages['minutes'];
else
if utilities.is_set (Time) then
local TimeCaption = A['TimeCaption']
if not utilities.is_set (TimeCaption) then
TimeCaption = cfg.messages['event'];
if sepc ~= '.' then
TimeCaption = TimeCaption:lower();
end
end
Position = " " .. TimeCaption .. " " .. Time;
end
end
else
Position = " " .. Position;
At = '';
end
Page, Pages, Sheet, Sheets = format_pages_sheets (Page, Pages, Sheet, Sheets, config.CitationClass, Periodical_origin, sepc, NoPP, use_lowercase);
At = utilities.is_set (At) and (sepc .. " " .. At) or "";
Position = utilities.is_set (Position) and (sepc .. " " .. Position) or "";
if config.CitationClass == 'map' then
local Sections = A['Sections']; -- Section (singular) is an alias of Chapter so set earlier
local Inset = A['Inset'];
if utilities.is_set ( Inset ) then
Inset = sepc .. " " .. wrap_msg ('inset', Inset, use_lowercase);
end
if utilities.is_set ( Sections ) then
Section = sepc .. " " .. wrap_msg ('sections', Sections, use_lowercase);
elseif utilities.is_set ( Section ) then
Section = sepc .. " " .. wrap_msg ('section', Section, use_lowercase);
end
At = At .. Inset .. Section;
end
local Others = A['Others'];
if utilities.is_set (Others) and 0 == #a and 0 == #e then -- add maint cat when |others= has value and used without |author=, |editor=
if config.CitationClass == "AV-media-notes"
or config.CitationClass == "audio-visual" then -- special maint for AV/M which has a lot of 'false' positives right now
utilities.set_message ('maint_others_avm')
else
utilities.set_message ('maint_others');
end
end
Others = utilities.is_set (Others) and (sepc .. " " .. Others) or "";
if utilities.is_set (Translators) then
Others = safe_join ({sepc .. ' ', wrap_msg ('translated', Translators, use_lowercase), Others}, sepc);
end
if utilities.is_set (Interviewers) then
Others = safe_join ({sepc .. ' ', wrap_msg ('interview', Interviewers, use_lowercase), Others}, sepc);
end
local TitleNote = A['TitleNote'];
TitleNote = utilities.is_set (TitleNote) and (sepc .. " " .. TitleNote) or "";
if utilities.is_set (Edition) then
if Edition:match ('%f[%a][Ee]d%n?%.?$') or Edition:match ('%f[%a][Ee]dition$') then -- Ed, ed, Ed., ed., Edn, edn, Edn., edn.
utilities.set_message ('err_extra_text_edition'); -- add error message
end
Edition = " " .. wrap_msg ('edition', Edition);
else
Edition = '';
end
Series = utilities.is_set (Series) and wrap_msg ('series', {sepc, Series}) or ""; -- not the same as SeriesNum
local Agency = A['Agency'];
Agency = utilities.is_set (Agency) and wrap_msg ('agency', {sepc, Agency}) or "";
Volume = format_volume_issue (Volume, Issue, ArticleNumber, config.CitationClass, Periodical_origin, sepc, use_lowercase);
if utilities.is_set (AccessDate) then
local retrv_text = " " .. cfg.messages['retrieved']
AccessDate = nowrap_date (AccessDate); -- wrap in nowrap span if date in appropriate format
if (sepc ~= ".") then retrv_text = retrv_text:lower() end -- if mode is cs2, lower case
AccessDate = utilities.substitute (retrv_text, AccessDate); -- add retrieved text
AccessDate = utilities.substitute (cfg.presentation['accessdate'], {sepc, AccessDate}); -- allow editors to hide accessdates
end
if utilities.is_set (ID) then ID = sepc .. " " .. ID; end
local Docket = A['Docket'];
if "thesis" == config.CitationClass and utilities.is_set (Docket) then
ID = sepc .. " Docket " .. Docket .. ID;
end
if "report" == config.CitationClass and utilities.is_set (Docket) then -- for cite report when |docket= is set
ID = sepc .. ' ' .. Docket; -- overwrite ID even if |id= is set
end
if utilities.is_set (URL) then
URL = " " .. external_link( URL, nil, URL_origin, UrlAccess );
end
local Quote = A['Quote'];
local TransQuote = A['TransQuote'];
local ScriptQuote = A['ScriptQuote'];
if utilities.is_set (Quote) or utilities.is_set (TransQuote) or utilities.is_set (ScriptQuote) then
if utilities.is_set (Quote) then
if Quote:sub(1, 1) == '"' and Quote:sub(-1, -1) == '"' then -- if first and last characters of quote are quote marks
Quote = Quote:sub(2, -2); -- strip them off
end
end
Quote = kern_quotes (Quote); -- kern if needed
Quote = utilities.wrap_style ('quoted-text', Quote ); -- wrap in <q>...</q> tags
if utilities.is_set (ScriptQuote) then
Quote = script_concatenate (Quote, ScriptQuote, 'script-quote'); -- <bdi> tags, lang attribute, categorization, etc.; must be done after quote is wrapped
end
if utilities.is_set (TransQuote) then
if TransQuote:sub(1, 1) == '"' and TransQuote:sub(-1, -1) == '"' then -- if first and last characters of |trans-quote are quote marks
TransQuote = TransQuote:sub(2, -2); -- strip them off
end
Quote = Quote .. " " .. utilities.wrap_style ('trans-quoted-title', TransQuote );
end
if utilities.is_set (QuotePage) or utilities.is_set (QuotePages) then -- add page prefix
local quote_prefix = '';
if utilities.is_set (QuotePage) then
extra_text_in_page_check (QuotePage, 'quote-page'); -- add to maint cat if |quote-page= value begins with what looks like p., pp., etc.
if not NoPP then
quote_prefix = utilities.substitute (cfg.messages['p-prefix'], {sepc, QuotePage}), '', '', '';
else
quote_prefix = utilities.substitute (cfg.messages['nopp'], {sepc, QuotePage}), '', '', '';
end
elseif utilities.is_set (QuotePages) then
extra_text_in_page_check (QuotePages, 'quote-pages'); -- add to maint cat if |quote-pages= value begins with what looks like p., pp., etc.
if tonumber(QuotePages) ~= nil and not NoPP then -- if only digits, assume single page
quote_prefix = utilities.substitute (cfg.messages['p-prefix'], {sepc, QuotePages}), '', '';
elseif not NoPP then
quote_prefix = utilities.substitute (cfg.messages['pp-prefix'], {sepc, QuotePages}), '', '';
else
quote_prefix = utilities.substitute (cfg.messages['nopp'], {sepc, QuotePages}), '', '';
end
end
Quote = quote_prefix .. ": " .. Quote;
else
Quote = sepc .. " " .. Quote;
end
PostScript = ""; -- cs1|2 does not supply terminal punctuation when |quote= is set
end
-- We check length of PostScript here because it will have been nuked by
-- the quote parameters. We'd otherwise emit a message even if there wasn't
-- a displayed postscript.
-- TODO: Should the max size (1) be configurable?
-- TODO: Should we check a specific pattern?
if utilities.is_set(PostScript) and mw.ustring.len(PostScript) > 1 then
utilities.set_message ('maint_postscript')
end
local Archived;
if utilities.is_set (ArchiveURL) then
if not utilities.is_set (ArchiveDate) then -- ArchiveURL set but ArchiveDate not set
utilities.set_message ('err_archive_missing_date'); -- emit an error message
ArchiveURL = ''; -- empty string for concatenation
ArchiveDate = ''; -- empty string for concatenation
end
else
if utilities.is_set (ArchiveDate) then -- ArchiveURL not set but ArchiveDate is set
utilities.set_message ('err_archive_date_missing_url'); -- emit an error message
ArchiveURL = ''; -- empty string for concatenation
ArchiveDate = ''; -- empty string for concatenation
end
end
if utilities.is_set (ArchiveURL) then
local arch_text;
if "live" == UrlStatus then
arch_text = cfg.messages['archived'];
if sepc ~= "." then arch_text = arch_text:lower() end
if utilities.is_set (ArchiveDate) then
Archived = sepc .. ' ' .. utilities.substitute ( cfg.messages['archived-live'],
{external_link( ArchiveURL, arch_text, A:ORIGIN('ArchiveURL'), nil) .. ArchiveFormat, ArchiveDate } );
else
Archived = '';
end
if not utilities.is_set (OriginalURL) then
utilities.set_message ('err_archive_missing_url');
Archived = ''; -- empty string for concatenation
end
elseif utilities.is_set (OriginalURL) then -- UrlStatus is empty, 'dead', 'unfit', 'usurped', 'bot: unknown'
if utilities.in_array (UrlStatus, {'unfit', 'usurped', 'bot: unknown'}) then
arch_text = cfg.messages['archived-unfit'];
if sepc ~= "." then arch_text = arch_text:lower() end
Archived = sepc .. ' ' .. arch_text .. ArchiveDate; -- format already styled
if 'bot: unknown' == UrlStatus then
utilities.set_message ('maint_bot_unknown'); -- and add a category if not already added
else
utilities.set_message ('maint_unfit'); -- and add a category if not already added
end
else -- UrlStatus is empty, 'dead'
arch_text = cfg.messages['archived-dead'];
if sepc ~= "." then arch_text = arch_text:lower() end
if utilities.is_set (ArchiveDate) then
Archived = sepc .. " " .. utilities.substitute ( arch_text,
{ external_link( OriginalURL, cfg.messages['original'], OriginalURL_origin, OriginalAccess ) .. OriginalFormat, ArchiveDate } ); -- format already styled
else
Archived = ''; -- unset for concatenation
end
end
else -- OriginalUrl not set
utilities.set_message ('err_archive_missing_url');
Archived = ''; -- empty string for concatenation
end
elseif utilities.is_set (ArchiveFormat) then
Archived = ArchiveFormat; -- if set and ArchiveURL not set ArchiveFormat has error message
else
Archived = '';
end
local TranscriptURL = A['TranscriptURL']
local TranscriptFormat = A['TranscriptFormat'];
TranscriptFormat = style_format (TranscriptFormat, TranscriptURL, 'transcript-format', 'transcripturl');
local Transcript = A['Transcript'];
local TranscriptURL_origin = A:ORIGIN('TranscriptURL'); -- get name of parameter that holds TranscriptURL
if utilities.is_set (Transcript) then
if utilities.is_set (TranscriptURL) then
Transcript = external_link( TranscriptURL, Transcript, TranscriptURL_origin, nil );
end
Transcript = sepc .. ' ' .. Transcript .. TranscriptFormat;
elseif utilities.is_set (TranscriptURL) then
Transcript = external_link( TranscriptURL, nil, TranscriptURL_origin, nil );
end
local Publisher;
if utilities.is_set (PublicationDate) then
PublicationDate = wrap_msg ('published', PublicationDate);
end
if utilities.is_set (PublisherName) then
if utilities.is_set (PublicationPlace) then
Publisher = sepc .. " " .. PublicationPlace .. ": " .. PublisherName .. PublicationDate;
else
Publisher = sepc .. " " .. PublisherName .. PublicationDate;
end
elseif utilities.is_set (PublicationPlace) then
Publisher= sepc .. " " .. PublicationPlace .. PublicationDate;
else
Publisher = PublicationDate;
end
-- Several of the above rely upon detecting this as nil, so do it last.
if (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical) or utilities.is_set (TransPeriodical)) then
if utilities.is_set (Title) or utilities.is_set (TitleNote) then
Periodical = sepc .. " " .. format_periodical (ScriptPeriodical, ScriptPeriodical_origin, Periodical, TransPeriodical, TransPeriodical_origin);
else
Periodical = format_periodical (ScriptPeriodical, ScriptPeriodical_origin, Periodical, TransPeriodical, TransPeriodical_origin);
end
end
local Language = A['Language'];
if utilities.is_set (Language) then
Language = language_parameter (Language); -- format, categories, name from ISO639-1, etc.
else
Language=''; -- language not specified so make sure this is an empty string;
--[[ TODO: need to extract the wrap_msg from language_parameter
so that we can solve parentheses bunching problem with Format/Language/TitleType
]]
end
--[[
Handle the oddity that is cite speech. This code overrides whatever may be the value assigned to TitleNote (through |department=) and forces it to be " (Speech)" so that
the annotation directly follows the |title= parameter value in the citation rather than the |event= parameter value (if provided).
]]
if "speech" == config.CitationClass then -- cite speech only
TitleNote = TitleType; -- move TitleType to TitleNote so that it renders ahead of |event=
TitleType = ''; -- and unset
if utilities.is_set (Periodical) then -- if Periodical, perhaps because of an included |website= or |journal= parameter
if utilities.is_set (Conference) then -- and if |event= is set
Conference = Conference .. sepc .. " "; -- then add appropriate punctuation to the end of the Conference variable before rendering
end
end
end
-- Piece all bits together at last. Here, all should be non-nil.
-- We build things this way because it is more efficient in LUA
-- not to keep reassigning to the same string variable over and over.
local tcommon;
local tcommon2; -- used for book cite when |contributor= is set
if utilities.in_array (config.CitationClass, {"journal", "citation"}) and utilities.is_set (Periodical) then
if not (utilities.is_set (Authors) or utilities.is_set (Editors)) then
Others = Others:gsub ('^' .. sepc .. ' ', ''); -- when no authors and no editors, strip leading sepc and space
end
if utilities.is_set (Others) then Others = safe_join ({Others, sepc .. " "}, sepc) end -- add terminal punctuation & space; check for dup sepc; TODO why do we need to do this here?
tcommon = safe_join( {Others, Title, TitleNote, Conference, Periodical, Format, TitleType, Series, Language, Edition, Publisher, Agency, Volume}, sepc );
elseif utilities.in_array (config.CitationClass, {"book", "citation"}) and not utilities.is_set (Periodical) then -- special cases for book cites
if utilities.is_set (Contributors) then -- when we are citing foreword, preface, introduction, etc.
tcommon = safe_join( {Title, TitleNote}, sepc ); -- author and other stuff will come after this and before tcommon2
tcommon2 = safe_join( {Conference, Periodical, Format, TitleType, Series, Language, Volume, Others, Edition, Publisher, Agency}, sepc );
else
tcommon = safe_join( {Title, TitleNote, Conference, Periodical, Format, TitleType, Series, Language, Volume, Others, Edition, Publisher, Agency}, sepc );
end
elseif 'map' == config.CitationClass then -- special cases for cite map
if utilities.is_set (Chapter) then -- map in a book; TitleType is part of Chapter
tcommon = safe_join( {Title, Format, Edition, Scale, Series, Language, Cartography, Others, Publisher, Volume}, sepc );
elseif utilities.is_set (Periodical) then -- map in a periodical
tcommon = safe_join( {Title, TitleType, Format, Periodical, Scale, Series, Language, Cartography, Others, Publisher, Volume}, sepc );
else -- a sheet or stand-alone map
tcommon = safe_join( {Title, TitleType, Format, Edition, Scale, Series, Language, Cartography, Others, Publisher}, sepc );
end
elseif 'episode' == config.CitationClass then -- special case for cite episode
tcommon = safe_join( {Title, TitleNote, TitleType, Series, Language, Edition, Publisher}, sepc );
else -- all other CS1 templates
tcommon = safe_join( {Title, TitleNote, Conference, Periodical, Format, TitleType, Series, Language,
Volume, Others, Edition, Publisher, Agency}, sepc );
end
if #ID_list > 0 then
ID_list = safe_join( { sepc .. " ", table.concat( ID_list, sepc .. " " ), ID }, sepc );
else
ID_list = ID;
end
local Via = A['Via'];
Via = utilities.is_set (Via) and wrap_msg ('via', Via) or '';
local idcommon;
if 'audio-visual' == config.CitationClass or 'episode' == config.CitationClass then -- special case for cite AV media & cite episode position transcript
idcommon = safe_join( { ID_list, URL, Archived, Transcript, AccessDate, Via, Quote }, sepc );
else
idcommon = safe_join( { ID_list, URL, Archived, AccessDate, Via, Quote }, sepc );
end
local text;
local pgtext = Position .. Sheet .. Sheets .. Page .. Pages .. At;
local OrigDate = A['OrigDate'];
OrigDate = utilities.is_set (OrigDate) and wrap_msg ('origdate', OrigDate) or '';
if utilities.is_set (Date) then
if utilities.is_set (Authors) or utilities.is_set (Editors) then -- date follows authors or editors when authors not set
Date = " (" .. Date .. ")" .. OrigDate .. sepc .. " "; -- in parentheses
else -- neither of authors and editors set
if (string.sub(tcommon, -1, -1) == sepc) then -- if the last character of tcommon is sepc
Date = " " .. Date .. OrigDate; -- Date does not begin with sepc
else
Date = sepc .. " " .. Date .. OrigDate; -- Date begins with sepc
end
end
end
if utilities.is_set (Authors) then
if (not utilities.is_set (Date)) then -- when date is set it's in parentheses; no Authors termination
Authors = terminate_name_list (Authors, sepc); -- when no date, terminate with 0 or 1 sepc and a space
end
if utilities.is_set (Editors) then
local in_text = '';
local post_text = '';
if utilities.is_set (Chapter) and 0 == #c then
in_text = cfg.messages['in'] .. ' ';
if (sepc ~= '.') then
in_text = in_text:lower(); -- lowercase for cs2
end
end
if EditorCount <= 1 then
post_text = ' (' .. cfg.messages['editor'] .. ')'; -- be consistent with no-author, no-date case
else
post_text = ' (' .. cfg.messages['editors'] .. ')';
end
Editors = terminate_name_list (in_text .. Editors .. post_text, sepc); -- terminate with 0 or 1 sepc and a space
end
if utilities.is_set (Contributors) then -- book cite and we're citing the intro, preface, etc.
local by_text = sepc .. ' ' .. cfg.messages['by'] .. ' ';
if (sepc ~= '.') then by_text = by_text:lower() end -- lowercase for cs2
Authors = by_text .. Authors; -- author follows title so tweak it here
if utilities.is_set (Editors) and utilities.is_set (Date) then -- when Editors make sure that Authors gets terminated
Authors = terminate_name_list (Authors, sepc); -- terminate with 0 or 1 sepc and a space
end
if (not utilities.is_set (Date)) then -- when date is set it's in parentheses; no Contributors termination
Contributors = terminate_name_list (Contributors, sepc); -- terminate with 0 or 1 sepc and a space
end
text = safe_join( {Contributors, Date, Chapter, tcommon, Authors, Place, Editors, tcommon2, pgtext, idcommon }, sepc );
else
text = safe_join( {Authors, Date, Chapter, Place, Editors, tcommon, pgtext, idcommon }, sepc );
end
elseif utilities.is_set (Editors) then
if utilities.is_set (Date) then
if EditorCount <= 1 then
Editors = Editors .. cfg.presentation['sep_name'] .. cfg.messages['editor'];
else
Editors = Editors .. cfg.presentation['sep_name'] .. cfg.messages['editors'];
end
else
if EditorCount <= 1 then
Editors = Editors .. " (" .. cfg.messages['editor'] .. ")" .. sepc .. " "
else
Editors = Editors .. " (" .. cfg.messages['editors'] .. ")" .. sepc .. " "
end
end
text = safe_join( {Editors, Date, Chapter, Place, tcommon, pgtext, idcommon}, sepc );
else
if utilities.in_array (config.CitationClass, {"journal", "citation"}) and utilities.is_set (Periodical) then
text = safe_join( {Chapter, Place, tcommon, pgtext, Date, idcommon}, sepc );
else
text = safe_join( {Chapter, Place, tcommon, Date, pgtext, idcommon}, sepc );
end
end
if utilities.is_set (PostScript) and PostScript ~= sepc then
text = safe_join( {text, sepc}, sepc ); -- Deals with italics, spaces, etc.
text = text:sub(1, -sepc:len() - 1);
end
text = safe_join( {text, PostScript}, sepc );
-- Now enclose the whole thing in a <cite> element
local options_t = {};
options_t.class = cite_class_attribute_make (config.CitationClass, Mode);
local Ref = is_valid_parameter_value (A['Ref'], A:ORIGIN('Ref'), cfg.keywords_lists['ref'], nil, true); -- nil when |ref=harv; A['Ref'] else
if 'none' ~= cfg.keywords_xlate[(Ref and Ref:lower()) or ''] then
local namelist_t = {}; -- holds selected contributor, author, editor name list
local year = first_set ({Year, anchor_year}, 2); -- Year first for legacy citations and for YMD dates that require disambiguation
if #c > 0 then -- if there is a contributor list
namelist_t = c; -- select it
elseif #a > 0 then -- or an author list
namelist_t = a;
elseif #e > 0 then -- or an editor list
namelist_t = e;
end
local citeref_id;
if #namelist_t > 0 then -- if there are names in namelist_t
citeref_id = make_citeref_id (namelist_t, year); -- go make the CITEREF anchor
if mw.uri.anchorEncode (citeref_id) == ((Ref and mw.uri.anchorEncode (Ref)) or '') then -- Ref may already be encoded (by {{sfnref}}) so citeref_id must be encoded before comparison
utilities.set_message ('maint_ref_duplicates_default');
end
else
citeref_id = ''; -- unset
end
options_t.id = Ref or citeref_id;
end
if string.len (text:gsub('%b<>', '')) <= 2 then -- remove html and html-like tags; then get length of what remains;
z.error_cats_t = {}; -- blank the categories list
z.error_msgs_t = {}; -- blank the error messages list
OCinSoutput = nil; -- blank the metadata string
text = ''; -- blank the the citation
utilities.set_message ('err_empty_citation'); -- set empty citation message and category
end
local render_t = {}; -- here we collect the final bits for concatenation into the rendered citation
if utilities.is_set (options_t.id) then -- here we wrap the rendered citation in <cite ...>...</cite> tags
table.insert (render_t, utilities.substitute (cfg.presentation['cite-id'], {mw.uri.anchorEncode(options_t.id), mw.text.nowiki(options_t.class), text})); -- when |ref= is set or when there is a namelist
else
table.insert (render_t, utilities.substitute (cfg.presentation['cite'], {mw.text.nowiki(options_t.class), text})); -- when |ref=none or when namelist_t empty and |ref= is missing or is empty
end
if OCinSoutput then -- blanked when citation is 'empty' so don't bother to add boilerplate metadata span
table.insert (render_t, utilities.substitute (cfg.presentation['ocins'], OCinSoutput)); -- format and append metadata to the citation
end
local template_name = ('citation' == config.CitationClass) and 'citation' or 'cite ' .. (cfg.citation_class_map_t[config.CitationClass] or config.CitationClass);
local template_link = '[[Template:' .. template_name .. '|' .. template_name .. ']]';
local msg_prefix = '<code class="cs1-code">{{' .. template_link .. '}}</code>: ';
if 0 ~= #z.error_msgs_t then
mw.addWarning (utilities.substitute (cfg.messages.warning_msg_e, template_link));
table.insert (render_t, ' '); -- insert a space between citation and its error messages
table.sort (z.error_msgs_t); -- sort the error messages list; sorting includes wrapping <span> and <code> tags; hidden-error sorts ahead of visible-error
local hidden = true; -- presume that the only error messages emited by this template are hidden
for _, v in ipairs (z.error_msgs_t) do -- spin through the list of error messages
if v:find ('cs1-visible-error', 1, true) then -- look for the visible error class name
hidden = false; -- found one; so don't hide the error message prefix
break; -- and done because no need to look further
end
end
z.error_msgs_t[1] = table.concat ({utilities.error_comment (msg_prefix, hidden), z.error_msgs_t[1]}); -- add error message prefix to first error message to prevent extraneous punctuation
table.insert (render_t, table.concat (z.error_msgs_t, '; ')); -- make a big string of error messages and add it to the rendering
end
if 0 ~= #z.maint_cats_t then
mw.addWarning (utilities.substitute (cfg.messages.warning_msg_m, template_link));
table.sort (z.maint_cats_t); -- sort the maintenance messages list
local maint_msgs_t = {}; -- here we collect all of the maint messages
if 0 == #z.error_msgs_t then -- if no error messages
table.insert (maint_msgs_t, msg_prefix); -- insert message prefix in maint message livery
end
for _, v in ipairs( z.maint_cats_t ) do -- append maintenance categories
table.insert (maint_msgs_t, -- assemble new maint message and add it to the maint_msgs_t table
table.concat ({v, ' (', utilities.substitute (cfg.messages[':cat wikilink'], v), ')'})
);
end
table.insert (render_t, utilities.substitute (cfg.presentation['hidden-maint'], table.concat (maint_msgs_t, ' '))); -- wrap the group of maint messages with proper presentation and save
end
if not no_tracking_cats then
local sort_key;
local cat_wikilink = 'cat wikilink';
if cfg.enable_sort_keys then -- when namespace sort keys enabled
local namespace_number = mw.title.getCurrentTitle().namespace; -- get namespace number for this wikitext
sort_key = (0 ~= namespace_number and (cfg.name_space_sort_keys[namespace_number] or cfg.name_space_sort_keys.other)) or nil; -- get sort key character; nil for mainspace
cat_wikilink = (not sort_key and 'cat wikilink') or 'cat wikilink sk'; -- make <cfg.messages> key
end
for _, v in ipairs (z.error_cats_t) do -- append error categories
table.insert (render_t, utilities.substitute (cfg.messages[cat_wikilink], {v, sort_key}));
end
for _, v in ipairs (z.maint_cats_t) do -- append maintenance categories
table.insert (render_t, utilities.substitute (cfg.messages[cat_wikilink], {v, sort_key}));
end
for _, v in ipairs (z.prop_cats_t) do -- append properties categories
table.insert (render_t, utilities.substitute (cfg.messages['cat wikilink'], v)); -- no sort keys
end
end
return table.concat (render_t); -- make a big string and done
end
--[[--------------------------< V A L I D A T E >--------------------------------------------------------------
Looks for a parameter's name in one of several whitelists.
Parameters in the whitelist can have three values:
true - active, supported parameters
false - deprecated, supported parameters
nil - unsupported parameters
]]
local function validate (name, cite_class, empty)
local name = tostring (name);
local enum_name; -- parameter name with enumerator (if any) replaced with '#'
local state;
local function state_test (state, name) -- local function to do testing of state values
if true == state then return true; end -- valid actively supported parameter
if false == state then
if empty then return nil; end -- empty deprecated parameters are treated as unknowns
deprecated_parameter (name); -- parameter is deprecated but still supported
return true;
end
if 'tracked' == state then
local base_name = name:gsub ('%d', ''); -- strip enumerators from parameter names that have them to get the base name
utilities.add_prop_cat ('tracked-param', {base_name}, base_name); -- add a properties category; <base_name> modifies <key>
return true;
end
return nil;
end
if name:find ('#') then -- # is a cs1|2 reserved character so parameters with # not permitted
return nil;
end
-- replace wnumerator digit(s) with # (|last25= becomes |last#=) (mw.ustring because non-Western 'local' digits)
enum_name = mw.ustring.gsub (name, '%d+$', '#'); -- where enumerator is last charaters in parameter name (these to protect |s2cid=)
enum_name = mw.ustring.gsub (enum_name, '%d+([%-l])', '#%1'); -- where enumerator is in the middle of the parameter name; |author#link= is the oddity
if 'document' == cite_class then -- special case for {{cite document}}
state = whitelist.document_parameters_t[enum_name]; -- this list holds enumerated and nonenumerated parameters
if true == state_test (state, name) then return true; end
return false;
end
if utilities.in_array (cite_class, whitelist.preprint_template_list_t) then -- limited parameter sets allowed for these templates
state = whitelist.limited_parameters_t[enum_name]; -- this list holds enumerated and nonenumerated parameters
if true == state_test (state, name) then return true; end
state = whitelist.preprint_arguments_t[cite_class][name]; -- look in the parameter-list for the template identified by cite_class
if true == state_test (state, name) then return true; end
return false; -- not supported because not found or name is set to nil
end -- end limited parameter-set templates
if utilities.in_array (cite_class, whitelist.unique_param_template_list_t) then -- template-specific parameters for templates that accept parameters from the basic argument list
state = whitelist.unique_arguments_t[cite_class][name]; -- look in the template-specific parameter-lists for the template identified by cite_class
if true == state_test (state, name) then return true; end
end -- if here, fall into general validation
state = whitelist.common_parameters_t[enum_name]; -- all other templates; all normal parameters allowed; this list holds enumerated and nonenumerated parameters
if true == state_test (state, name) then return true; end
return false; -- not supported because not found or name is set to nil
end
--[=[-------------------------< I N T E R _ W I K I _ C H E C K >----------------------------------------------
check <value> for inter-language interwiki-link markup. <prefix> must be a MediaWiki-recognized language
code. when these values have the form (without leading colon):
[[<prefix>:link|label]] return label as plain-text
[[<prefix>:link]] return <prefix>:link as plain-text
return value as is else
]=]
local function inter_wiki_check (parameter, value)
local prefix = value:match ('%[%[(%a+):'); -- get an interwiki prefix if one exists
local _;
if prefix and cfg.inter_wiki_map[prefix:lower()] then -- if prefix is in the map, needs preceding colon so
utilities.set_message ('err_bad_paramlink', parameter); -- emit an error message
_, value, _ = utilities.is_wikilink (value); -- extract label portion from wikilink
end
return value;
end
--[[--------------------------< M I S S I N G _ P I P E _ C H E C K >------------------------------------------
Look at the contents of a parameter. If the content has a string of characters and digits followed by an equal
sign, compare the alphanumeric string to the list of cs1|2 parameters. If found, then the string is possibly a
parameter that is missing its pipe. There are two tests made:
{{cite ... |title=Title access-date=2016-03-17}} -- the first parameter has a value and whitespace separates that value from the missing pipe parameter name
{{cite ... |title=access-date=2016-03-17}} -- the first parameter has no value (whitespace after the first = is trimmed by MediaWiki)
cs1|2 shares some parameter names with XML/HTML attributes: class=, title=, etc. To prevent false positives XML/HTML
tags are removed before the search.
If a missing pipe is detected, this function adds the missing pipe maintenance category.
]]
local function missing_pipe_check (parameter, value)
local capture;
value = value:gsub ('%b<>', ''); -- remove XML/HTML tags because attributes: class=, title=, etc.
capture = value:match ('%s+(%a[%w%-]+)%s*=') or value:match ('^(%a[%w%-]+)%s*='); -- find and categorize parameters with possible missing pipes
if capture and validate (capture) then -- if the capture is a valid parameter name
utilities.set_message ('err_missing_pipe', parameter);
end
end
--[[--------------------------< H A S _ E X T R A N E O U S _ P U N C T >--------------------------------------
look for extraneous terminal punctuation in most parameter values; parameters listed in skip table are not checked
]]
local function has_extraneous_punc (param, value)
if 'number' == type (param) then
return;
end
param = param:gsub ('%d+', '#'); -- enumerated name-list mask params allow terminal punct; normalize
if cfg.punct_skip[param] then
return; -- parameter name found in the skip table so done
end
if value:match ('[,;:]$') then
utilities.set_message ('maint_extra_punct'); -- has extraneous punctuation; add maint cat
end
if value:match ('^=') then -- sometimes an extraneous '=' character appears ...
utilities.set_message ('maint_extra_punct'); -- has extraneous punctuation; add maint cat
end
end
--[[--------------------------< H A S _ E X T R A N E O U S _ U R L >------------------------------------------
look for extraneous url parameter values; parameters listed in skip table are not checked
]]
local function has_extraneous_url (url_param_t)
local url_error_t = {};
check_for_url (url_param_t, url_error_t); -- extraneous url check
if 0 ~= #url_error_t then -- non-zero when there are errors
table.sort (url_error_t);
utilities.set_message ('err_param_has_ext_link', {utilities.make_sep_list (#url_error_t, url_error_t)}); -- add this error message
end
end
--[[--------------------------< C I T A T I O N >--------------------------------------------------------------
This is used by templates such as {{cite book}} to create the actual citation text.
]]
local function citation(frame)
Frame = frame; -- save a copy in case we need to display an error message in preview mode
local config = {}; -- table to store parameters from the module {{#invoke:}}
for k, v in pairs( frame.args ) do -- get parameters from the {{#invoke}} frame
config[k] = v;
-- args[k] = v; -- crude debug support that allows us to render a citation from module {{#invoke:}}; skips parameter validation; TODO: keep?
end
-- i18n: set the name that your wiki uses to identify sandbox subpages from sandbox template invoke (or can be set here)
local sandbox = ((config.SandboxPath and '' ~= config.SandboxPath) and config.SandboxPath) or '/sandbox'; -- sandbox path from {{#invoke:Citation/CS1/sandbox|citation|SandboxPath=/...}}
is_sandbox = nil ~= string.find (frame:getTitle(), sandbox, 1, true); -- is this invoke the sandbox module?
sandbox = is_sandbox and sandbox or ''; -- use i18n sandbox to load sandbox modules when this module is the sandox; live modules else
local pframe = frame:getParent()
local styles;
cfg = mw.loadData ('Module:Citation/CS1/Configuration' .. sandbox); -- load sandbox versions of support modules when {{#invoke:Citation/CS1/sandbox|...}}; live modules else
whitelist = mw.loadData ('Module:Citation/CS1/Whitelist' .. sandbox);
utilities = require ('Module:Citation/CS1/Utilities' .. sandbox);
validation = require ('Module:Citation/CS1/Date_validation' .. sandbox);
identifiers = require ('Module:Citation/CS1/Identifiers' .. sandbox);
metadata = require ('Module:Citation/CS1/COinS' .. sandbox);
styles = 'Module:Citation/CS1' .. sandbox .. '/styles.css';
utilities.set_selected_modules (cfg); -- so that functions in Utilities can see the selected cfg tables
identifiers.set_selected_modules (cfg, utilities); -- so that functions in Identifiers can see the selected cfg tables and selected Utilities module
validation.set_selected_modules (cfg, utilities); -- so that functions in Date validataion can see selected cfg tables and the selected Utilities module
metadata.set_selected_modules (cfg, utilities); -- so that functions in COinS can see the selected cfg tables and selected Utilities module
z = utilities.z; -- table of error and category tables in Module:Citation/CS1/Utilities
is_preview_mode = not utilities.is_set (frame:preprocess ('{{REVISIONID}}'));
local args = {}; -- table where we store all of the template's arguments
local suggestions = {}; -- table where we store suggestions if we need to loadData them
local error_text; -- used as a flag
local capture; -- the single supported capture when matching unknown parameters using patterns
local empty_unknowns = {}; -- sequence table to hold empty unknown params for error message listing
for k, v in pairs( pframe.args ) do -- get parameters from the parent (template) frame
v = mw.ustring.gsub (v, '^%s*(.-)%s*$', '%1'); -- trim leading/trailing whitespace; when v is only whitespace, becomes empty string
if v ~= '' then
if ('string' == type (k)) then
k = mw.ustring.gsub (k, '%d', cfg.date_names.local_digits); -- for enumerated parameters, translate 'local' digits to Western 0-9
end
if not validate( k, config.CitationClass ) then
if type (k) ~= 'string' then -- exclude empty numbered parameters
if v:match("%S+") ~= nil then
error_text = utilities.set_message ('err_text_ignored', {v});
end
elseif validate (k:lower(), config.CitationClass) then
error_text = utilities.set_message ('err_parameter_ignored_suggest', {k, k:lower()}); -- suggest the lowercase version of the parameter
else
if nil == suggestions.suggestions then -- if this table is nil then we need to load it
suggestions = mw.loadData ('Module:Citation/CS1/Suggestions' .. sandbox); --load sandbox version of suggestion module when {{#invoke:Citation/CS1/sandbox|...}}; live module else
end
for pattern, param in pairs (suggestions.patterns) do -- loop through the patterns to see if we can suggest a proper parameter
capture = k:match (pattern); -- the whole match if no capture in pattern else the capture if a match
if capture then -- if the pattern matches
param = utilities.substitute (param, capture); -- add the capture to the suggested parameter (typically the enumerator)
if validate (param, config.CitationClass) then -- validate the suggestion to make sure that the suggestion is supported by this template (necessary for limited parameter lists)
error_text = utilities.set_message ('err_parameter_ignored_suggest', {k, param}); -- set the suggestion error message
else
error_text = utilities.set_message ('err_parameter_ignored', {k}); -- suggested param not supported by this template
v = ''; -- unset
end
end
end
if not utilities.is_set (error_text) then -- couldn't match with a pattern, is there an explicit suggestion?
if (suggestions.suggestions[ k:lower() ] ~= nil) and validate (suggestions.suggestions[ k:lower() ], config.CitationClass) then
utilities.set_message ('err_parameter_ignored_suggest', {k, suggestions.suggestions[ k:lower() ]});
else
utilities.set_message ('err_parameter_ignored', {k});
v = ''; -- unset value assigned to unrecognized parameters (this for the limited parameter lists)
end
end
end
end
args[k] = v; -- save this parameter and its value
elseif not utilities.is_set (v) then -- for empty parameters
if not validate (k, config.CitationClass, true) then -- is this empty parameter a valid parameter
k = ('' == k) and '(empty string)' or k; -- when k is empty string (or was space(s) trimmed to empty string), replace with descriptive text
table.insert (empty_unknowns, utilities.wrap_style ('parameter', k)); -- format for error message and add to the list
end
-- crude debug support that allows us to render a citation from module {{#invoke:}} TODO: keep?
-- elseif args[k] ~= nil or (k == 'postscript') then -- when args[k] has a value from {{#invoke}} frame (we don't normally do that)
-- args[k] = v; -- overwrite args[k] with empty string from pframe.args[k] (template frame); v is empty string here
end -- not sure about the postscript bit; that gets handled in parameter validation; historical artifact?
end
if 0 ~= #empty_unknowns then -- create empty unknown error message
utilities.set_message ('err_param_unknown_empty', {
1 == #empty_unknowns and '' or 's',
utilities.make_sep_list (#empty_unknowns, empty_unknowns)
});
end
local url_param_t = {};
for k, v in pairs( args ) do
if 'string' == type (k) then -- don't evaluate positional parameters
has_invisible_chars (k, v); -- look for invisible characters
end
has_extraneous_punc (k, v); -- look for extraneous terminal punctuation in parameter values
missing_pipe_check (k, v); -- do we think that there is a parameter that is missing a pipe?
args[k] = inter_wiki_check (k, v); -- when language interwiki-linked parameter missing leading colon replace with wiki-link label
if 'string' == type (k) and not cfg.url_skip[k] then -- when parameter k is not positional and not in url skip table
url_param_t[k] = v; -- make a parameter/value list for extraneous url check
end
end
has_extraneous_url (url_param_t); -- look for url in parameter values where a url does not belong
return table.concat ({
frame:extensionTag ('templatestyles', '', {src=styles}),
citation0( config, args)
});
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {citation = citation};
0cad9fbfae76bef4d92d29d611ccebeb2039ca10
28
27
2023-12-24T02:01:02Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Citation/CS1]]
Scribunto
text/plain
require ('strict');
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
each of these counts against the Lua upvalue limit
]]
local validation; -- functions in Module:Citation/CS1/Date_validation
local utilities; -- functions in Module:Citation/CS1/Utilities
local z = {}; -- table of tables in Module:Citation/CS1/Utilities
local identifiers; -- functions and tables in Module:Citation/CS1/Identifiers
local metadata; -- functions in Module:Citation/CS1/COinS
local cfg = {}; -- table of configuration tables that are defined in Module:Citation/CS1/Configuration
local whitelist = {}; -- table of tables listing valid template parameter names; defined in Module:Citation/CS1/Whitelist
--[[------------------< P A G E S C O P E V A R I A B L E S >---------------
declare variables here that have page-wide scope that are not brought in from
other modules; that are created here and used here
]]
local added_deprecated_cat; -- Boolean flag so that the category is added only once
local added_vanc_errs; -- Boolean flag so we only emit one Vancouver error / category
local added_generic_name_errs; -- Boolean flag so we only emit one generic name error / category and stop testing names once an error is encountered
local added_numeric_name_errs; -- Boolean flag so we only emit one numeric name error / category and stop testing names once an error is encountered
local added_numeric_name_maint; -- Boolean flag so we only emit one numeric name maint category and stop testing names once a category has been emitted
local Frame; -- holds the module's frame table
local is_preview_mode; -- true when article is in preview mode; false when using 'Preview page with this template' (previewing the module)
local is_sandbox; -- true when using sandbox modules to render citation
--[[--------------------------< F I R S T _ S E T >------------------------------------------------------------
Locates and returns the first set value in a table of values where the order established in the table,
left-to-right (or top-to-bottom), is the order in which the values are evaluated. Returns nil if none are set.
This version replaces the original 'for _, val in pairs do' and a similar version that used ipairs. With the pairs
version the order of evaluation could not be guaranteed. With the ipairs version, a nil value would terminate
the for-loop before it reached the actual end of the list.
]]
local function first_set (list, count)
local i = 1;
while i <= count do -- loop through all items in list
if utilities.is_set( list[i] ) then
return list[i]; -- return the first set list member
end
i = i + 1; -- point to next
end
end
--[[--------------------------< A D D _ V A N C _ E R R O R >----------------------------------------------------
Adds a single Vancouver system error message to the template's output regardless of how many error actually exist.
To prevent duplication, added_vanc_errs is nil until an error message is emitted.
added_vanc_errs is a Boolean declared in page scope variables above
]]
local function add_vanc_error (source, position)
if added_vanc_errs then return end
added_vanc_errs = true; -- note that we've added this category
utilities.set_message ('err_vancouver', {source, position});
end
--[[--------------------------< I S _ S C H E M E >------------------------------------------------------------
does this thing that purports to be a URI scheme seem to be a valid scheme? The scheme is checked to see if it
is in agreement with http://tools.ietf.org/html/std66#section-3.1 which says:
Scheme names consist of a sequence of characters beginning with a
letter and followed by any combination of letters, digits, plus
("+"), period ("."), or hyphen ("-").
returns true if it does, else false
]]
local function is_scheme (scheme)
return scheme and scheme:match ('^%a[%a%d%+%.%-]*:'); -- true if scheme is set and matches the pattern
end
--[=[-------------------------< I S _ D O M A I N _ N A M E >--------------------------------------------------
Does this thing that purports to be a domain name seem to be a valid domain name?
Syntax defined here: http://tools.ietf.org/html/rfc1034#section-3.5
BNF defined here: https://tools.ietf.org/html/rfc4234
Single character names are generally reserved; see https://tools.ietf.org/html/draft-ietf-dnsind-iana-dns-01#page-15;
see also [[Single-letter second-level domain]]
list of TLDs: https://www.iana.org/domains/root/db
RFC 952 (modified by RFC 1123) requires the first and last character of a hostname to be a letter or a digit. Between
the first and last characters the name may use letters, digits, and the hyphen.
Also allowed are IPv4 addresses. IPv6 not supported
domain is expected to be stripped of any path so that the last character in the last character of the TLD. tld
is two or more alpha characters. Any preceding '//' (from splitting a URL with a scheme) will be stripped
here. Perhaps not necessary but retained in case it is necessary for IPv4 dot decimal.
There are several tests:
the first character of the whole domain name including subdomains must be a letter or a digit
internationalized domain name (ASCII characters with .xn-- ASCII Compatible Encoding (ACE) prefix xn-- in the TLD) see https://tools.ietf.org/html/rfc3490
single-letter/digit second-level domains in the .org, .cash, and .today TLDs
q, x, and z SL domains in the .com TLD
i and q SL domains in the .net TLD
single-letter SL domains in the ccTLDs (where the ccTLD is two letters)
two-character SL domains in gTLDs (where the gTLD is two or more letters)
three-plus-character SL domains in gTLDs (where the gTLD is two or more letters)
IPv4 dot-decimal address format; TLD not allowed
returns true if domain appears to be a proper name and TLD or IPv4 address, else false
]=]
local function is_domain_name (domain)
if not domain then
return false; -- if not set, abandon
end
domain = domain:gsub ('^//', ''); -- strip '//' from domain name if present; done here so we only have to do it once
if not domain:match ('^[%w]') then -- first character must be letter or digit
return false;
end
if domain:match ('^%a+:') then -- hack to detect things that look like s:Page:Title where Page: is namespace at Wikisource
return false;
end
local patterns = { -- patterns that look like URLs
'%f[%w][%w][%w%-]+[%w]%.%a%a+$', -- three or more character hostname.hostname or hostname.tld
'%f[%w][%w][%w%-]+[%w]%.xn%-%-[%w]+$', -- internationalized domain name with ACE prefix
'%f[%a][qxz]%.com$', -- assigned one character .com hostname (x.com times out 2015-12-10)
'%f[%a][iq]%.net$', -- assigned one character .net hostname (q.net registered but not active 2015-12-10)
'%f[%w][%w]%.%a%a$', -- one character hostname and ccTLD (2 chars)
'%f[%w][%w][%w]%.%a%a+$', -- two character hostname and TLD
'^%d%d?%d?%.%d%d?%d?%.%d%d?%d?%.%d%d?%d?', -- IPv4 address
}
for _, pattern in ipairs (patterns) do -- loop through the patterns list
if domain:match (pattern) then
return true; -- if a match then we think that this thing that purports to be a URL is a URL
end
end
for _, d in ipairs (cfg.single_letter_2nd_lvl_domains_t) do -- look for single letter second level domain names for these top level domains
if domain:match ('%f[%w][%w]%.' .. d) then
return true
end
end
return false; -- no matches, we don't know what this thing is
end
--[[--------------------------< I S _ U R L >------------------------------------------------------------------
returns true if the scheme and domain parts of a URL appear to be a valid URL; else false.
This function is the last step in the validation process. This function is separate because there are cases that
are not covered by split_url(), for example is_parameter_ext_wikilink() which is looking for bracketted external
wikilinks.
]]
local function is_url (scheme, domain)
if utilities.is_set (scheme) then -- if scheme is set check it and domain
return is_scheme (scheme) and is_domain_name (domain);
else
return is_domain_name (domain); -- scheme not set when URL is protocol-relative
end
end
--[[--------------------------< S P L I T _ U R L >------------------------------------------------------------
Split a URL into a scheme, authority indicator, and domain.
First remove Fully Qualified Domain Name terminator (a dot following TLD) (if any) and any path(/), query(?) or fragment(#).
If protocol-relative URL, return nil scheme and domain else return nil for both scheme and domain.
When not protocol-relative, get scheme, authority indicator, and domain. If there is an authority indicator (one
or more '/' characters immediately following the scheme's colon), make sure that there are only 2.
Any URL that does not have news: scheme must have authority indicator (//). TODO: are there other common schemes
like news: that don't use authority indicator?
Strip off any port and path;
]]
local function split_url (url_str)
local scheme, authority, domain;
url_str = url_str:gsub ('([%a%d])%.?[/%?#].*$', '%1'); -- strip FQDN terminator and path(/), query(?), fragment (#) (the capture prevents false replacement of '//')
if url_str:match ('^//%S*') then -- if there is what appears to be a protocol-relative URL
domain = url_str:match ('^//(%S*)')
elseif url_str:match ('%S-:/*%S+') then -- if there is what appears to be a scheme, optional authority indicator, and domain name
scheme, authority, domain = url_str:match ('(%S-:)(/*)(%S+)'); -- extract the scheme, authority indicator, and domain portions
if utilities.is_set (authority) then
authority = authority:gsub ('//', '', 1); -- replace place 1 pair of '/' with nothing;
if utilities.is_set(authority) then -- if anything left (1 or 3+ '/' where authority should be) then
return scheme; -- return scheme only making domain nil which will cause an error message
end
else
if not scheme:match ('^news:') then -- except for news:..., MediaWiki won't link URLs that do not have authority indicator; TODO: a better way to do this test?
return scheme; -- return scheme only making domain nil which will cause an error message
end
end
domain = domain:gsub ('(%a):%d+', '%1'); -- strip port number if present
end
return scheme, domain;
end
--[[--------------------------< L I N K _ P A R A M _ O K >---------------------------------------------------
checks the content of |title-link=, |series-link=, |author-link=, etc. for properly formatted content: no wikilinks, no URLs
Link parameters are to hold the title of a Wikipedia article, so none of the WP:TITLESPECIALCHARACTERS are allowed:
# < > [ ] | { } _
except the underscore which is used as a space in wiki URLs and # which is used for section links
returns false when the value contains any of these characters.
When there are no illegal characters, this function returns TRUE if value DOES NOT appear to be a valid URL (the
|<param>-link= parameter is ok); else false when value appears to be a valid URL (the |<param>-link= parameter is NOT ok).
]]
local function link_param_ok (value)
local scheme, domain;
if value:find ('[<>%[%]|{}]') then -- if any prohibited characters
return false;
end
scheme, domain = split_url (value); -- get scheme or nil and domain or nil from URL;
return not is_url (scheme, domain); -- return true if value DOES NOT appear to be a valid URL
end
--[[--------------------------< L I N K _ T I T L E _ O K >---------------------------------------------------
Use link_param_ok() to validate |<param>-link= value and its matching |<title>= value.
|<title>= may be wiki-linked but not when |<param>-link= has a value. This function emits an error message when
that condition exists
check <link> for inter-language interwiki-link prefix. prefix must be a MediaWiki-recognized language
code and must begin with a colon.
]]
local function link_title_ok (link, lorig, title, torig)
local orig;
if utilities.is_set (link) then -- don't bother if <param>-link doesn't have a value
if not link_param_ok (link) then -- check |<param>-link= markup
orig = lorig; -- identify the failing link parameter
elseif title:find ('%[%[') then -- check |title= for wikilink markup
orig = torig; -- identify the failing |title= parameter
elseif link:match ('^%a+:') then -- if the link is what looks like an interwiki
local prefix = link:match ('^(%a+):'):lower(); -- get the interwiki prefix
if cfg.inter_wiki_map[prefix] then -- if prefix is in the map, must have preceding colon
orig = lorig; -- flag as error
end
end
end
if utilities.is_set (orig) then
link = ''; -- unset
utilities.set_message ('err_bad_paramlink', orig); -- URL or wikilink in |title= with |title-link=;
end
return link; -- link if ok, empty string else
end
--[[--------------------------< C H E C K _ U R L >------------------------------------------------------------
Determines whether a URL string appears to be valid.
First we test for space characters. If any are found, return false. Then split the URL into scheme and domain
portions, or for protocol-relative (//example.com) URLs, just the domain. Use is_url() to validate the two
portions of the URL. If both are valid, or for protocol-relative if domain is valid, return true, else false.
Because it is different from a standard URL, and because this module used external_link() to make external links
that work for standard and news: links, we validate newsgroup names here. The specification for a newsgroup name
is at https://tools.ietf.org/html/rfc5536#section-3.1.4
]]
local function check_url( url_str )
if nil == url_str:match ("^%S+$") then -- if there are any spaces in |url=value it can't be a proper URL
return false;
end
local scheme, domain;
scheme, domain = split_url (url_str); -- get scheme or nil and domain or nil from URL;
if 'news:' == scheme then -- special case for newsgroups
return domain:match('^[%a%d%+%-_]+%.[%a%d%+%-_%.]*[%a%d%+%-_]$');
end
return is_url (scheme, domain); -- return true if value appears to be a valid URL
end
--[=[-------------------------< I S _ P A R A M E T E R _ E X T _ W I K I L I N K >----------------------------
Return true if a parameter value has a string that begins and ends with square brackets [ and ] and the first
non-space characters following the opening bracket appear to be a URL. The test will also find external wikilinks
that use protocol-relative URLs. Also finds bare URLs.
The frontier pattern prevents a match on interwiki-links which are similar to scheme:path URLs. The tests that
find bracketed URLs are required because the parameters that call this test (currently |title=, |chapter=, |work=,
and |publisher=) may have wikilinks and there are articles or redirects like '//Hus' so, while uncommon, |title=[[//Hus]]
is possible as might be [[en://Hus]].
]=]
local function is_parameter_ext_wikilink (value)
local scheme, domain;
if value:match ('%f[%[]%[%a%S*:%S+.*%]') then -- if ext. wikilink with scheme and domain: [xxxx://yyyyy.zzz]
scheme, domain = split_url (value:match ('%f[%[]%[(%a%S*:%S+).*%]'));
elseif value:match ('%f[%[]%[//%S+.*%]') then -- if protocol-relative ext. wikilink: [//yyyyy.zzz]
scheme, domain = split_url (value:match ('%f[%[]%[(//%S+).*%]'));
elseif value:match ('%a%S*:%S+') then -- if bare URL with scheme; may have leading or trailing plain text
scheme, domain = split_url (value:match ('(%a%S*:%S+)'));
elseif value:match ('//%S+') then -- if protocol-relative bare URL: //yyyyy.zzz; may have leading or trailing plain text
scheme, domain = split_url (value:match ('(//%S+)')); -- what is left should be the domain
else
return false; -- didn't find anything that is obviously a URL
end
return is_url (scheme, domain); -- return true if value appears to be a valid URL
end
--[[-------------------------< C H E C K _ F O R _ U R L >-----------------------------------------------------
loop through a list of parameters and their values. Look at the value and if it has an external link, emit an error message.
]]
local function check_for_url (parameter_list, error_list)
for k, v in pairs (parameter_list) do -- for each parameter in the list
if is_parameter_ext_wikilink (v) then -- look at the value; if there is a URL add an error message
table.insert (error_list, utilities.wrap_style ('parameter', k));
end
end
end
--[[--------------------------< S A F E _ F O R _ U R L >------------------------------------------------------
Escape sequences for content that will be used for URL descriptions
]]
local function safe_for_url( str )
if str:match( "%[%[.-%]%]" ) ~= nil then
utilities.set_message ('err_wikilink_in_url', {});
end
return str:gsub( '[%[%]\n]', {
['['] = '[',
[']'] = ']',
['\n'] = ' ' } );
end
--[[--------------------------< E X T E R N A L _ L I N K >----------------------------------------------------
Format an external link with error checking
]]
local function external_link (URL, label, source, access)
local err_msg = '';
local domain;
local path;
local base_url;
if not utilities.is_set (label) then
label = URL;
if utilities.is_set (source) then
utilities.set_message ('err_bare_url_missing_title', {utilities.wrap_style ('parameter', source)});
else
error (cfg.messages["bare_url_no_origin"]); -- programmer error; valid parameter name does not have matching meta-parameter
end
end
if not check_url (URL) then
utilities.set_message ('err_bad_url', {utilities.wrap_style ('parameter', source)});
end
domain, path = URL:match ('^([/%.%-%+:%a%d]+)([/%?#].*)$'); -- split the URL into scheme plus domain and path
if path then -- if there is a path portion
path = path:gsub ('[%[%]]', {['['] = '%5b', [']'] = '%5d'}); -- replace '[' and ']' with their percent-encoded values
URL = table.concat ({domain, path}); -- and reassemble
end
base_url = table.concat ({ "[", URL, " ", safe_for_url (label), "]" }); -- assemble a wiki-markup URL
if utilities.is_set (access) then -- access level (subscription, registration, limited)
base_url = utilities.substitute (cfg.presentation['ext-link-access-signal'], {cfg.presentation[access].class, cfg.presentation[access].title, base_url}); -- add the appropriate icon
end
return base_url;
end
--[[--------------------------< D E P R E C A T E D _ P A R A M E T E R >--------------------------------------
Categorize and emit an error message when the citation contains one or more deprecated parameters. The function includes the
offending parameter name to the error message. Only one error message is emitted regardless of the number of deprecated
parameters in the citation.
added_deprecated_cat is a Boolean declared in page scope variables above
]]
local function deprecated_parameter(name)
if not added_deprecated_cat then
added_deprecated_cat = true; -- note that we've added this category
utilities.set_message ('err_deprecated_params', {name}); -- add error message
end
end
--[=[-------------------------< K E R N _ Q U O T E S >--------------------------------------------------------
Apply kerning to open the space between the quote mark provided by the module and a leading or trailing quote
mark contained in a |title= or |chapter= parameter's value.
This function will positive kern either single or double quotes:
"'Unkerned title with leading and trailing single quote marks'"
" 'Kerned title with leading and trailing single quote marks' " (in real life the kerning isn't as wide as this example)
Double single quotes (italic or bold wiki-markup) are not kerned.
Replaces Unicode quote marks in plain text or in the label portion of a [[L|D]] style wikilink with typewriter
quote marks regardless of the need for kerning. Unicode quote marks are not replaced in simple [[D]] wikilinks.
Call this function for chapter titles, for website titles, etc.; not for book titles.
]=]
local function kern_quotes (str)
local cap = '';
local wl_type, label, link;
wl_type, label, link = utilities.is_wikilink (str); -- wl_type is: 0, no wl (text in label variable); 1, [[D]]; 2, [[L|D]]
if 1 == wl_type then -- [[D]] simple wikilink with or without quote marks
if mw.ustring.match (str, '%[%[[\"“”\'‘’].+[\"“”\'‘’]%]%]') then -- leading and trailing quote marks
str = utilities.substitute (cfg.presentation['kern-left'], str);
str = utilities.substitute (cfg.presentation['kern-right'], str);
elseif mw.ustring.match (str, '%[%[[\"“”\'‘’].+%]%]') then -- leading quote marks
str = utilities.substitute (cfg.presentation['kern-left'], str);
elseif mw.ustring.match (str, '%[%[.+[\"“”\'‘’]%]%]') then -- trailing quote marks
str = utilities.substitute (cfg.presentation['kern-right'], str);
end
else -- plain text or [[L|D]]; text in label variable
label = mw.ustring.gsub (label, '[“”]', '\"'); -- replace “” (U+201C & U+201D) with " (typewriter double quote mark)
label = mw.ustring.gsub (label, '[‘’]', '\''); -- replace ‘’ (U+2018 & U+2019) with ' (typewriter single quote mark)
cap = mw.ustring.match (label, "^([\"\'][^\'].+)"); -- match leading double or single quote but not doubled single quotes (italic markup)
if utilities.is_set (cap) then
label = utilities.substitute (cfg.presentation['kern-left'], cap);
end
cap = mw.ustring.match (label, "^(.+[^\'][\"\'])$") -- match trailing double or single quote but not doubled single quotes (italic markup)
if utilities.is_set (cap) then
label = utilities.substitute (cfg.presentation['kern-right'], cap);
end
if 2 == wl_type then
str = utilities.make_wikilink (link, label); -- reassemble the wikilink
else
str = label;
end
end
return str;
end
--[[--------------------------< F O R M A T _ S C R I P T _ V A L U E >----------------------------------------
|script-title= holds title parameters that are not written in Latin-based scripts: Chinese, Japanese, Arabic, Hebrew, etc. These scripts should
not be italicized and may be written right-to-left. The value supplied by |script-title= is concatenated onto Title after Title has been wrapped
in italic markup.
Regardless of language, all values provided by |script-title= are wrapped in <bdi>...</bdi> tags to isolate RTL languages from the English left to right.
|script-title= provides a unique feature. The value in |script-title= may be prefixed with a two-character ISO 639-1 language code and a colon:
|script-title=ja:*** *** (where * represents a Japanese character)
Spaces between the two-character code and the colon and the colon and the first script character are allowed:
|script-title=ja : *** ***
|script-title=ja: *** ***
|script-title=ja :*** ***
Spaces preceding the prefix are allowed: |script-title = ja:*** ***
The prefix is checked for validity. If it is a valid ISO 639-1 language code, the lang attribute (lang="ja") is added to the <bdi> tag so that browsers can
know the language the tag contains. This may help the browser render the script more correctly. If the prefix is invalid, the lang attribute
is not added. At this time there is no error message for this condition.
Supports |script-title=, |script-chapter=, |script-<periodical>=
]]
local function format_script_value (script_value, script_param)
local lang=''; -- initialize to empty string
local name;
if script_value:match('^%l%l%l?%s*:') then -- if first 3 or 4 non-space characters are script language prefix
lang = script_value:match('^(%l%l%l?)%s*:%s*%S.*'); -- get the language prefix or nil if there is no script
if not utilities.is_set (lang) then
utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['missing title part']}); -- prefix without 'title'; add error message
return ''; -- script_value was just the prefix so return empty string
end
-- if we get this far we have prefix and script
name = cfg.lang_tag_remap[lang] or mw.language.fetchLanguageName( lang, cfg.this_wiki_code ); -- get language name so that we can use it to categorize
if utilities.is_set (name) then -- is prefix a proper ISO 639-1 language code?
script_value = script_value:gsub ('^%l+%s*:%s*', ''); -- strip prefix from script
-- is prefix one of these language codes?
if utilities.in_array (lang, cfg.script_lang_codes) then
utilities.add_prop_cat ('script', {name, lang})
else
utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['unknown language code']}); -- unknown script-language; add error message
end
lang = ' lang="' .. lang .. '" '; -- convert prefix into a lang attribute
else
utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['invalid language code']}); -- invalid language code; add error message
lang = ''; -- invalid so set lang to empty string
end
else
utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['missing prefix']}); -- no language code prefix; add error message
end
script_value = utilities.substitute (cfg.presentation['bdi'], {lang, script_value}); -- isolate in case script is RTL
return script_value;
end
--[[--------------------------< S C R I P T _ C O N C A T E N A T E >------------------------------------------
Initially for |title= and |script-title=, this function concatenates those two parameter values after the script
value has been wrapped in <bdi> tags.
]]
local function script_concatenate (title, script, script_param)
if utilities.is_set (script) then
script = format_script_value (script, script_param); -- <bdi> tags, lang attribute, categorization, etc.; returns empty string on error
if utilities.is_set (script) then
title = title .. ' ' .. script; -- concatenate title and script title
end
end
return title;
end
--[[--------------------------< W R A P _ M S G >--------------------------------------------------------------
Applies additional message text to various parameter values. Supplied string is wrapped using a message_list
configuration taking one argument. Supports lower case text for {{citation}} templates. Additional text taken
from citation_config.messages - the reason this function is similar to but separate from wrap_style().
]]
local function wrap_msg (key, str, lower)
if not utilities.is_set ( str ) then
return "";
end
if true == lower then
local msg;
msg = cfg.messages[key]:lower(); -- set the message to lower case before
return utilities.substitute ( msg, str ); -- including template text
else
return utilities.substitute ( cfg.messages[key], str );
end
end
--[[----------------< W I K I S O U R C E _ U R L _ M A K E >-------------------
Makes a Wikisource URL from Wikisource interwiki-link. Returns the URL and appropriate
label; nil else.
str is the value assigned to |chapter= (or aliases) or |title= or |title-link=
]]
local function wikisource_url_make (str)
local wl_type, D, L;
local ws_url, ws_label;
local wikisource_prefix = table.concat ({'https://', cfg.this_wiki_code, '.wikisource.org/wiki/'});
wl_type, D, L = utilities.is_wikilink (str); -- wl_type is 0 (not a wikilink), 1 (simple wikilink), 2 (complex wikilink)
if 0 == wl_type then -- not a wikilink; might be from |title-link=
str = D:match ('^[Ww]ikisource:(.+)') or D:match ('^[Ss]:(.+)'); -- article title from interwiki link with long-form or short-form namespace
if utilities.is_set (str) then
ws_url = table.concat ({ -- build a Wikisource URL
wikisource_prefix, -- prefix
str, -- article title
});
ws_label = str; -- label for the URL
end
elseif 1 == wl_type then -- simple wikilink: [[Wikisource:ws article]]
str = D:match ('^[Ww]ikisource:(.+)') or D:match ('^[Ss]:(.+)'); -- article title from interwiki link with long-form or short-form namespace
if utilities.is_set (str) then
ws_url = table.concat ({ -- build a Wikisource URL
wikisource_prefix, -- prefix
str, -- article title
});
ws_label = str; -- label for the URL
end
elseif 2 == wl_type then -- non-so-simple wikilink: [[Wikisource:ws article|displayed text]] ([[L|D]])
str = L:match ('^[Ww]ikisource:(.+)') or L:match ('^[Ss]:(.+)'); -- article title from interwiki link with long-form or short-form namespace
if utilities.is_set (str) then
ws_label = D; -- get ws article name from display portion of interwiki link
ws_url = table.concat ({ -- build a Wikisource URL
wikisource_prefix, -- prefix
str, -- article title without namespace from link portion of wikilink
});
end
end
if ws_url then
ws_url = mw.uri.encode (ws_url, 'WIKI'); -- make a usable URL
ws_url = ws_url:gsub ('%%23', '#'); -- undo percent-encoding of fragment marker
end
return ws_url, ws_label, L or D; -- return proper URL or nil and a label or nil
end
--[[----------------< F O R M A T _ P E R I O D I C A L >-----------------------
Format the three periodical parameters: |script-<periodical>=, |<periodical>=,
and |trans-<periodical>= into a single Periodical meta-parameter.
]]
local function format_periodical (script_periodical, script_periodical_source, periodical, trans_periodical)
if not utilities.is_set (periodical) then
periodical = ''; -- to be safe for concatenation
else
periodical = utilities.wrap_style ('italic-title', periodical); -- style
end
periodical = script_concatenate (periodical, script_periodical, script_periodical_source); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped
if utilities.is_set (trans_periodical) then
trans_periodical = utilities.wrap_style ('trans-italic-title', trans_periodical);
if utilities.is_set (periodical) then
periodical = periodical .. ' ' .. trans_periodical;
else -- here when trans-periodical without periodical or script-periodical
periodical = trans_periodical;
utilities.set_message ('err_trans_missing_title', {'periodical'});
end
end
return periodical;
end
--[[------------------< F O R M A T _ C H A P T E R _ T I T L E >---------------
Format the four chapter parameters: |script-chapter=, |chapter=, |trans-chapter=,
and |chapter-url= into a single chapter meta- parameter (chapter_url_source used
for error messages).
]]
local function format_chapter_title (script_chapter, script_chapter_source, chapter, chapter_source, trans_chapter, trans_chapter_source, chapter_url, chapter_url_source, no_quotes, access)
local ws_url, ws_label, L = wikisource_url_make (chapter); -- make a wikisource URL and label from a wikisource interwiki link
if ws_url then
ws_label = ws_label:gsub ('_', ' '); -- replace underscore separators with space characters
chapter = ws_label;
end
if not utilities.is_set (chapter) then
chapter = ''; -- to be safe for concatenation
else
if false == no_quotes then
chapter = kern_quotes (chapter); -- if necessary, separate chapter title's leading and trailing quote marks from module provided quote marks
chapter = utilities.wrap_style ('quoted-title', chapter);
end
end
chapter = script_concatenate (chapter, script_chapter, script_chapter_source); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped
if utilities.is_set (chapter_url) then
chapter = external_link (chapter_url, chapter, chapter_url_source, access); -- adds bare_url_missing_title error if appropriate
elseif ws_url then
chapter = external_link (ws_url, chapter .. ' ', 'ws link in chapter'); -- adds bare_url_missing_title error if appropriate; space char to move icon away from chap text; TODO: better way to do this?
chapter = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], L, chapter});
end
if utilities.is_set (trans_chapter) then
trans_chapter = utilities.wrap_style ('trans-quoted-title', trans_chapter);
if utilities.is_set (chapter) then
chapter = chapter .. ' ' .. trans_chapter;
else -- here when trans_chapter without chapter or script-chapter
chapter = trans_chapter;
chapter_source = trans_chapter_source:match ('trans%-?(.+)'); -- when no chapter, get matching name from trans-<param>
utilities.set_message ('err_trans_missing_title', {chapter_source});
end
end
return chapter;
end
--[[----------------< H A S _ I N V I S I B L E _ C H A R S >-------------------
This function searches a parameter's value for non-printable or invisible characters.
The search stops at the first match.
This function will detect the visible replacement character when it is part of the Wikisource.
Detects but ignores nowiki and math stripmarkers. Also detects other named stripmarkers
(gallery, math, pre, ref) and identifies them with a slightly different error message.
See also coins_cleanup().
Output of this function is an error message that identifies the character or the
Unicode group, or the stripmarker that was detected along with its position (or,
for multi-byte characters, the position of its first byte) in the parameter value.
]]
local function has_invisible_chars (param, v)
local position = ''; -- position of invisible char or starting position of stripmarker
local capture; -- used by stripmarker detection to hold name of the stripmarker
local stripmarker; -- boolean set true when a stripmarker is found
capture = string.match (v, '[%w%p ]*'); -- test for values that are simple ASCII text and bypass other tests if true
if capture == v then -- if same there are no Unicode characters
return;
end
for _, invisible_char in ipairs (cfg.invisible_chars) do
local char_name = invisible_char[1]; -- the character or group name
local pattern = invisible_char[2]; -- the pattern used to find it
position, _, capture = mw.ustring.find (v, pattern); -- see if the parameter value contains characters that match the pattern
if position and (cfg.invisible_defs.zwj == capture) then -- if we found a zero-width joiner character
if mw.ustring.find (v, cfg.indic_script) then -- it's ok if one of the Indic scripts
position = nil; -- unset position
elseif cfg.emoji_t[mw.ustring.codepoint (v, position+1)] then -- is zwj followed by a character listed in emoji{}?
position = nil; -- unset position
end
end
if position then
if 'nowiki' == capture or 'math' == capture or -- nowiki and math stripmarkers (not an error condition)
('templatestyles' == capture and utilities.in_array (param, {'id', 'quote'})) then -- templatestyles stripmarker allowed in these parameters
stripmarker = true; -- set a flag
elseif true == stripmarker and cfg.invisible_defs.del == capture then -- because stripmakers begin and end with the delete char, assume that we've found one end of a stripmarker
position = nil; -- unset
else
local err_msg;
if capture and not (cfg.invisible_defs.del == capture or cfg.invisible_defs.zwj == capture) then
err_msg = capture .. ' ' .. char_name;
else
err_msg = char_name .. ' ' .. 'character';
end
utilities.set_message ('err_invisible_char', {err_msg, utilities.wrap_style ('parameter', param), position}); -- add error message
return; -- and done with this parameter
end
end
end
end
--[[-------------------< A R G U M E N T _ W R A P P E R >----------------------
Argument wrapper. This function provides support for argument mapping defined
in the configuration file so that multiple names can be transparently aliased to
single internal variable.
]]
local function argument_wrapper ( args )
local origin = {};
return setmetatable({
ORIGIN = function ( self, k )
local dummy = self[k]; -- force the variable to be loaded.
return origin[k];
end
},
{
__index = function ( tbl, k )
if origin[k] ~= nil then
return nil;
end
local args, list, v = args, cfg.aliases[k];
if type( list ) == 'table' then
v, origin[k] = utilities.select_one ( args, list, 'err_redundant_parameters' );
if origin[k] == nil then
origin[k] = ''; -- Empty string, not nil
end
elseif list ~= nil then
v, origin[k] = args[list], list;
else
-- maybe let through instead of raising an error?
-- v, origin[k] = args[k], k;
error( cfg.messages['unknown_argument_map'] .. ': ' .. k);
end
-- Empty strings, not nil;
if v == nil then
v = '';
origin[k] = '';
end
tbl = rawset( tbl, k, v );
return v;
end,
});
end
--[[--------------------------< N O W R A P _ D A T E >-------------------------
When date is YYYY-MM-DD format wrap in nowrap span: <span ...>YYYY-MM-DD</span>.
When date is DD MMMM YYYY or is MMMM DD, YYYY then wrap in nowrap span:
<span ...>DD MMMM</span> YYYY or <span ...>MMMM DD,</span> YYYY
DOES NOT yet support MMMM YYYY or any of the date ranges.
]]
local function nowrap_date (date)
local cap = '';
local cap2 = '';
if date:match("^%d%d%d%d%-%d%d%-%d%d$") then
date = utilities.substitute (cfg.presentation['nowrap1'], date);
elseif date:match("^%a+%s*%d%d?,%s+%d%d%d%d$") or date:match ("^%d%d?%s*%a+%s+%d%d%d%d$") then
cap, cap2 = string.match (date, "^(.*)%s+(%d%d%d%d)$");
date = utilities.substitute (cfg.presentation['nowrap2'], {cap, cap2});
end
return date;
end
--[[--------------------------< S E T _ T I T L E T Y P E >---------------------
This function sets default title types (equivalent to the citation including
|type=<default value>) for those templates that have defaults. Also handles the
special case where it is desirable to omit the title type from the rendered citation
(|type=none).
]]
local function set_titletype (cite_class, title_type)
if utilities.is_set (title_type) then
if 'none' == cfg.keywords_xlate[title_type] then
title_type = ''; -- if |type=none then type parameter not displayed
end
return title_type; -- if |type= has been set to any other value use that value
end
return cfg.title_types [cite_class] or ''; -- set template's default title type; else empty string for concatenation
end
--[[--------------------------< S A F E _ J O I N >-----------------------------
Joins a sequence of strings together while checking for duplicate separation characters.
]]
local function safe_join( tbl, duplicate_char )
local f = {}; -- create a function table appropriate to type of 'duplicate character'
if 1 == #duplicate_char then -- for single byte ASCII characters use the string library functions
f.gsub = string.gsub
f.match = string.match
f.sub = string.sub
else -- for multi-byte characters use the ustring library functions
f.gsub = mw.ustring.gsub
f.match = mw.ustring.match
f.sub = mw.ustring.sub
end
local str = ''; -- the output string
local comp = ''; -- what does 'comp' mean?
local end_chr = '';
local trim;
for _, value in ipairs( tbl ) do
if value == nil then value = ''; end
if str == '' then -- if output string is empty
str = value; -- assign value to it (first time through the loop)
elseif value ~= '' then
if value:sub(1, 1) == '<' then -- special case of values enclosed in spans and other markup.
comp = value:gsub( "%b<>", "" ); -- remove HTML markup (<span>string</span> -> string)
else
comp = value;
end
-- typically duplicate_char is sepc
if f.sub(comp, 1, 1) == duplicate_char then -- is first character same as duplicate_char? why test first character?
-- Because individual string segments often (always?) begin with terminal punct for the
-- preceding segment: 'First element' .. 'sepc next element' .. etc.?
trim = false;
end_chr = f.sub(str, -1, -1); -- get the last character of the output string
-- str = str .. "<HERE(enchr=" .. end_chr .. ")" -- debug stuff?
if end_chr == duplicate_char then -- if same as separator
str = f.sub(str, 1, -2); -- remove it
elseif end_chr == "'" then -- if it might be wiki-markup
if f.sub(str, -3, -1) == duplicate_char .. "''" then -- if last three chars of str are sepc''
str = f.sub(str, 1, -4) .. "''"; -- remove them and add back ''
elseif f.sub(str, -5, -1) == duplicate_char .. "]]''" then -- if last five chars of str are sepc]]''
trim = true; -- why? why do this and next differently from previous?
elseif f.sub(str, -4, -1) == duplicate_char .. "]''" then -- if last four chars of str are sepc]''
trim = true; -- same question
end
elseif end_chr == "]" then -- if it might be wiki-markup
if f.sub(str, -3, -1) == duplicate_char .. "]]" then -- if last three chars of str are sepc]] wikilink
trim = true;
elseif f.sub(str, -3, -1) == duplicate_char .. '"]' then -- if last three chars of str are sepc"] quoted external link
trim = true;
elseif f.sub(str, -2, -1) == duplicate_char .. "]" then -- if last two chars of str are sepc] external link
trim = true;
elseif f.sub(str, -4, -1) == duplicate_char .. "'']" then -- normal case when |url=something & |title=Title.
trim = true;
end
elseif end_chr == " " then -- if last char of output string is a space
if f.sub(str, -2, -1) == duplicate_char .. " " then -- if last two chars of str are <sepc><space>
str = f.sub(str, 1, -3); -- remove them both
end
end
if trim then
if value ~= comp then -- value does not equal comp when value contains HTML markup
local dup2 = duplicate_char;
if f.match(dup2, "%A" ) then dup2 = "%" .. dup2; end -- if duplicate_char not a letter then escape it
value = f.gsub(value, "(%b<>)" .. dup2, "%1", 1 ) -- remove duplicate_char if it follows HTML markup
else
value = f.sub(value, 2, -1 ); -- remove duplicate_char when it is first character
end
end
end
str = str .. value; -- add it to the output string
end
end
return str;
end
--[[--------------------------< I S _ S U F F I X >-----------------------------
returns true if suffix is properly formed Jr, Sr, or ordinal in the range 1–9.
Puncutation not allowed.
]]
local function is_suffix (suffix)
if utilities.in_array (suffix, {'Jr', 'Sr', 'Jnr', 'Snr', '1st', '2nd', '3rd'}) or suffix:match ('^%dth$') then
return true;
end
return false;
end
--[[--------------------< I S _ G O O D _ V A N C _ N A M E >-------------------
For Vancouver style, author/editor names are supposed to be rendered in Latin
(read ASCII) characters. When a name uses characters that contain diacritical
marks, those characters are to be converted to the corresponding Latin
character. When a name is written using a non-Latin alphabet or logogram, that
name is to be transliterated into Latin characters. The module doesn't do this
so editors may/must.
This test allows |first= and |last= names to contain any of the letters defined
in the four Unicode Latin character sets
[http://www.unicode.org/charts/PDF/U0000.pdf C0 Controls and Basic Latin] 0041–005A, 0061–007A
[http://www.unicode.org/charts/PDF/U0080.pdf C1 Controls and Latin-1 Supplement] 00C0–00D6, 00D8–00F6, 00F8–00FF
[http://www.unicode.org/charts/PDF/U0100.pdf Latin Extended-A] 0100–017F
[http://www.unicode.org/charts/PDF/U0180.pdf Latin Extended-B] 0180–01BF, 01C4–024F
|lastn= also allowed to contain hyphens, spaces, and apostrophes.
(http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35029/)
|firstn= also allowed to contain hyphens, spaces, apostrophes, and periods
This original test:
if nil == mw.ustring.find (last, "^[A-Za-zÀ-ÖØ-öø-ƿDŽ-ɏ%-%s%']*$")
or nil == mw.ustring.find (first, "^[A-Za-zÀ-ÖØ-öø-ƿDŽ-ɏ%-%s%'%.]+[2-6%a]*$") then
was written outside of the code editor and pasted here because the code editor
gets confused between character insertion point and cursor position. The test has
been rewritten to use decimal character escape sequence for the individual bytes
of the Unicode characters so that it is not necessary to use an external editor
to maintain this code.
\195\128-\195\150 – À-Ö (U+00C0–U+00D6 – C0 controls)
\195\152-\195\182 – Ø-ö (U+00D8-U+00F6 – C0 controls)
\195\184-\198\191 – ø-ƿ (U+00F8-U+01BF – C0 controls, Latin extended A & B)
\199\132-\201\143 – DŽ-ɏ (U+01C4-U+024F – Latin extended B)
]]
local function is_good_vanc_name (last, first, suffix, position)
if not suffix then
if first:find ('[,%s]') then -- when there is a space or comma, might be first name/initials + generational suffix
first = first:match ('(.-)[,%s]+'); -- get name/initials
suffix = first:match ('[,%s]+(.+)$'); -- get generational suffix
end
end
if utilities.is_set (suffix) then
if not is_suffix (suffix) then
add_vanc_error (cfg.err_msg_supl.suffix, position);
return false; -- not a name with an appropriate suffix
end
end
if nil == mw.ustring.find (last, "^[A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143%-%s%']*$") or
nil == mw.ustring.find (first, "^[A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143%-%s%'%.]*$") then
add_vanc_error (cfg.err_msg_supl['non-Latin char'], position);
return false; -- not a string of Latin characters; Vancouver requires Romanization
end;
return true;
end
--[[--------------------------< R E D U C E _ T O _ I N I T I A L S >------------------------------------------
Attempts to convert names to initials in support of |name-list-style=vanc.
Names in |firstn= may be separated by spaces or hyphens, or for initials, a period.
See http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35062/.
Vancouver style requires family rank designations (Jr, II, III, etc.) to be rendered
as Jr, 2nd, 3rd, etc. See http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35085/.
This code only accepts and understands generational suffix in the Vancouver format
because Roman numerals look like, and can be mistaken for, initials.
This function uses ustring functions because firstname initials may be any of the
Unicode Latin characters accepted by is_good_vanc_name ().
]]
local function reduce_to_initials(first, position)
local name, suffix = mw.ustring.match(first, "^(%u+) ([%dJS][%drndth]+)$");
if not name then -- if not initials and a suffix
name = mw.ustring.match(first, "^(%u+)$"); -- is it just initials?
end
if name then -- if first is initials with or without suffix
if 3 > mw.ustring.len (name) then -- if one or two initials
if suffix then -- if there is a suffix
if is_suffix (suffix) then -- is it legitimate?
return first; -- one or two initials and a valid suffix so nothing to do
else
add_vanc_error (cfg.err_msg_supl.suffix, position); -- one or two initials with invalid suffix so error message
return first; -- and return first unmolested
end
else
return first; -- one or two initials without suffix; nothing to do
end
end
end -- if here then name has 3 or more uppercase letters so treat them as a word
local initials, names = {}, {}; -- tables to hold name parts and initials
local i = 1; -- counter for number of initials
names = mw.text.split (first, '[%s,]+'); -- split into a table of names and possible suffix
while names[i] do -- loop through the table
if 1 < i and names[i]:match ('[%dJS][%drndth]+%.?$') then -- if not the first name, and looks like a suffix (may have trailing dot)
names[i] = names[i]:gsub ('%.', ''); -- remove terminal dot if present
if is_suffix (names[i]) then -- if a legitimate suffix
table.insert (initials, ' ' .. names[i]); -- add a separator space, insert at end of initials table
break; -- and done because suffix must fall at the end of a name
end -- no error message if not a suffix; possibly because of Romanization
end
if 3 > i then
table.insert (initials, mw.ustring.sub(names[i], 1, 1)); -- insert the initial at end of initials table
end
i = i + 1; -- bump the counter
end
return table.concat(initials) -- Vancouver format does not include spaces.
end
--[[--------------------------< I N T E R W I K I _ P R E F I X E N _ G E T >----------------------------------
extract interwiki prefixen from <value>. Returns two one or two values:
false – no prefixen
nil – prefix exists but not recognized
project prefix, language prefix – when value has either of:
:<project>:<language>:<article>
:<language>:<project>:<article>
project prefix, nil – when <value> has only a known single-letter prefix
nil, language prefix – when <value> has only a known language prefix
accepts single-letter project prefixen: 'd' (wikidata), 's' (wikisource), and 'w' (wikipedia) prefixes; at this
writing, the other single-letter prefixen (b (wikibook), c (commons), m (meta), n (wikinews), q (wikiquote), and
v (wikiversity)) are not supported.
]]
local function interwiki_prefixen_get (value, is_link)
if not value:find (':%l+:') then -- if no prefix
return false; -- abandon; boolean here to distinguish from nil fail returns later
end
local prefix_patterns_linked_t = { -- sequence of valid interwiki and inter project prefixen
'^%[%[:([dsw]):(%l%l+):', -- wikilinked; project and language prefixes
'^%[%[:(%l%l+):([dsw]):', -- wikilinked; language and project prefixes
'^%[%[:([dsw]):', -- wikilinked; project prefix
'^%[%[:(%l%l+):', -- wikilinked; language prefix
}
local prefix_patterns_unlinked_t = { -- sequence of valid interwiki and inter project prefixen
'^:([dsw]):(%l%l+):', -- project and language prefixes
'^:(%l%l+):([dsw]):', -- language and project prefixes
'^:([dsw]):', -- project prefix
'^:(%l%l+):', -- language prefix
}
local cap1, cap2;
for _, pattern in ipairs ((is_link and prefix_patterns_linked_t) or prefix_patterns_unlinked_t) do
cap1, cap2 = value:match (pattern);
if cap1 then
break; -- found a match so stop looking
end
end
if cap1 and cap2 then -- when both then :project:language: or :language:project: (both forms allowed)
if 1 == #cap1 then -- length == 1 then :project:language:
if cfg.inter_wiki_map[cap2] then -- is language prefix in the interwiki map?
return cap1, cap2; -- return interwiki project and interwiki language
end
else -- here when :language:project:
if cfg.inter_wiki_map[cap1] then -- is language prefix in the interwiki map?
return cap2, cap1; -- return interwiki project and interwiki language
end
end
return nil; -- unknown interwiki language
elseif not (cap1 or cap2) then -- both are nil?
return nil; -- we got something that looks like a project prefix but isn't; return fail
elseif 1 == #cap1 then -- here when one capture
return cap1, nil; -- length is 1 so return project, nil language
else -- here when one capture and its length it more than 1
if cfg.inter_wiki_map[cap1] then -- is language prefix in the interwiki map?
return nil, cap1; -- return nil project, language
end
end
end
--[[--------------------------< L I S T _ P E O P L E >--------------------------
Formats a list of people (authors, contributors, editors, interviewers, translators)
names in the list will be linked when
|<name>-link= has a value
|<name>-mask- does NOT have a value; masked names are presumed to have been
rendered previously so should have been linked there
when |<name>-mask=0, the associated name is not rendered
]]
local function list_people (control, people, etal)
local sep;
local namesep;
local format = control.format;
local maximum = control.maximum;
local name_list = {};
if 'vanc' == format then -- Vancouver-like name styling?
sep = cfg.presentation['sep_nl_vanc']; -- name-list separator between names is a comma
namesep = cfg.presentation['sep_name_vanc']; -- last/first separator is a space
else
sep = cfg.presentation['sep_nl']; -- name-list separator between names is a semicolon
namesep = cfg.presentation['sep_name']; -- last/first separator is <comma><space>
end
if sep:sub (-1, -1) ~= " " then sep = sep .. " " end
if utilities.is_set (maximum) and maximum < 1 then return "", 0; end -- returned 0 is for EditorCount; not used for other names
for i, person in ipairs (people) do
if utilities.is_set (person.last) then
local mask = person.mask;
local one;
local sep_one = sep;
if utilities.is_set (maximum) and i > maximum then
etal = true;
break;
end
if mask then
local n = tonumber (mask); -- convert to a number if it can be converted; nil else
if n then
one = 0 ~= n and string.rep("—", n) or nil; -- make a string of (n > 0) mdashes, nil else, to replace name
person.link = nil; -- don't create link to name if name is replaces with mdash string or has been set nil
else
one = mask; -- replace name with mask text (must include name-list separator)
sep_one = " "; -- modify name-list separator
end
else
one = person.last; -- get surname
local first = person.first -- get given name
if utilities.is_set (first) then
if ("vanc" == format) then -- if Vancouver format
one = one:gsub ('%.', ''); -- remove periods from surnames (http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35029/)
if not person.corporate and is_good_vanc_name (one, first, nil, i) then -- and name is all Latin characters; corporate authors not tested
first = reduce_to_initials (first, i); -- attempt to convert first name(s) to initials
end
end
one = one .. namesep .. first;
end
end
if utilities.is_set (person.link) then
one = utilities.make_wikilink (person.link, one); -- link author/editor
end
if one then -- if <one> has a value (name, mdash replacement, or mask text replacement)
local proj, tag = interwiki_prefixen_get (one, true); -- get the interwiki prefixen if present
if 'w' == proj and ('Wikipedia' == mw.site.namespaces.Project['name']) then
proj = nil; -- for stuff like :w:de:<article>, :w is unnecessary TODO: maint cat?
end
if proj then
proj = ({['d'] = 'Wikidata', ['s'] = 'Wikisource', ['w'] = 'Wikipedia'})[proj]; -- :w (wikipedia) for linking from a non-wikipedia project
if proj then
one = one .. utilities.wrap_style ('interproj', proj); -- add resized leading space, brackets, static text, language name
tag = nil; -- unset; don't do both project and language
end
end
if tag == cfg.this_wiki_code then
tag = nil; -- stuff like :en:<article> at en.wiki is pointless TODO: maint cat?
end
if tag then
local lang = cfg.lang_tag_remap[tag] or cfg.mw_languages_by_tag_t[tag];
if lang then -- error messaging done in extract_names() where we know parameter names
one = one .. utilities.wrap_style ('interwiki', lang); -- add resized leading space, brackets, static text, language name
end
end
table.insert (name_list, one); -- add it to the list of names
table.insert (name_list, sep_one); -- add the proper name-list separator
end
end
end
local count = #name_list / 2; -- (number of names + number of separators) divided by 2
if 0 < count then
if 1 < count and not etal then
if 'amp' == format then
name_list[#name_list-2] = " & "; -- replace last separator with ampersand text
elseif 'and' == format then
if 2 == count then
name_list[#name_list-2] = cfg.presentation.sep_nl_and; -- replace last separator with 'and' text
else
name_list[#name_list-2] = cfg.presentation.sep_nl_end; -- replace last separator with '(sep) and' text
end
end
end
name_list[#name_list] = nil; -- erase the last separator
end
local result = table.concat (name_list); -- construct list
if etal and utilities.is_set (result) then -- etal may be set by |display-authors=etal but we might not have a last-first list
result = result .. sep .. cfg.messages['et al']; -- we've got a last-first list and etal so add et al.
end
return result, count; -- return name-list string and count of number of names (count used for editor names only)
end
--[[--------------------< M A K E _ C I T E R E F _ I D >-----------------------
Generates a CITEREF anchor ID if we have at least one name or a date. Otherwise
returns an empty string.
namelist is one of the contributor-, author-, or editor-name lists chosen in that
order. year is Year or anchor_year.
]]
local function make_citeref_id (namelist, year)
local names={}; -- a table for the one to four names and year
for i,v in ipairs (namelist) do -- loop through the list and take up to the first four last names
names[i] = v.last
if i == 4 then break end -- if four then done
end
table.insert (names, year); -- add the year at the end
local id = table.concat(names); -- concatenate names and year for CITEREF id
if utilities.is_set (id) then -- if concatenation is not an empty string
return "CITEREF" .. id; -- add the CITEREF portion
else
return ''; -- return an empty string; no reason to include CITEREF id in this citation
end
end
--[[--------------------------< C I T E _ C L A S S _A T T R I B U T E _M A K E >------------------------------
construct <cite> tag class attribute for this citation.
<cite_class> – config.CitationClass from calling template
<mode> – value from |mode= parameter
]]
local function cite_class_attribute_make (cite_class, mode)
local class_t = {};
table.insert (class_t, 'citation'); -- required for blue highlight
if 'citation' ~= cite_class then
table.insert (class_t, cite_class); -- identify this template for user css
table.insert (class_t, utilities.is_set (mode) and mode or 'cs1'); -- identify the citation style for user css or javascript
else
table.insert (class_t, utilities.is_set (mode) and mode or 'cs2'); -- identify the citation style for user css or javascript
end
for _, prop_key in ipairs (z.prop_keys_t) do
table.insert (class_t, prop_key); -- identify various properties for user css or javascript
end
return table.concat (class_t, ' '); -- make a big string and done
end
--[[---------------------< N A M E _ H A S _ E T A L >--------------------------
Evaluates the content of name parameters (author, editor, etc.) for variations on
the theme of et al. If found, the et al. is removed, a flag is set to true and
the function returns the modified name and the flag.
This function never sets the flag to false but returns its previous state because
it may have been set by previous passes through this function or by the associated
|display-<names>=etal parameter
]]
local function name_has_etal (name, etal, nocat, param)
if utilities.is_set (name) then -- name can be nil in which case just return
local patterns = cfg.et_al_patterns; -- get patterns from configuration
for _, pattern in ipairs (patterns) do -- loop through all of the patterns
if name:match (pattern) then -- if this 'et al' pattern is found in name
name = name:gsub (pattern, ''); -- remove the offending text
etal = true; -- set flag (may have been set previously here or by |display-<names>=etal)
if not nocat then -- no categorization for |vauthors=
utilities.set_message ('err_etal', {param}); -- and set an error if not added
end
end
end
end
return name, etal;
end
--[[---------------------< N A M E _ I S _ N U M E R I C >----------------------
Add an error message and category when <name> parameter value does not contain letters.
Add a maintenance category when <name> parameter value has numeric characters mixed with characters that are
not numeric characters; could be letters and/or punctuation characters.
This function will only emit one error and one maint message for the current template. Does not emit both error
and maint messages/categories for the same parameter value.
returns nothing
]]
local function name_is_numeric (name, name_alias, list_name)
local patterns = {
'^%D+%d', -- <name> must have digits preceded by other characters
'^%D*%d+%D+', -- <name> must have digits followed by other characters
}
if not added_numeric_name_errs and mw.ustring.match (name, '^[%A]+$') then -- if we have not already set an error message and <name> does not have any alpha characters
utilities.set_message ('err_numeric_names', name_alias); -- add an error message
added_numeric_name_errs = true; -- set the flag so we emit only one error message
return; -- when here no point in further testing; abandon
end
if not added_numeric_name_maint then -- if we have already set a maint message
for _, pattern in ipairs (patterns) do -- spin through list of patterns
if mw.ustring.match (name, pattern) then -- digits preceded or followed by anything but digits; %D+ includes punctuation
utilities.set_message ('maint_numeric_names', cfg.special_case_translation [list_name]); -- add a maint cat for this template
added_numeric_name_maint = true; -- set the flag so we emit only one maint message
return; -- when here no point in further testing; abandon
end
end
end
end
--[[-----------------< N A M E _ H A S _ M U L T _ N A M E S >------------------
Evaluates the content of last/surname (authors etc.) parameters for multiple names.
Multiple names are indicated if there is more than one comma or any "unescaped"
semicolons. Escaped semicolons are ones used as part of selected HTML entities.
If the condition is met, the function adds the multiple name maintenance category.
Same test for first except that commas should not appear in given names (MOS:JR says
that the generational suffix does not take a separator character). Titles, degrees,
postnominals, affiliations, all normally comma separated don't belong in a citation.
<name> – name parameter value
<list_name> – AuthorList, EditorList, etc
<limit> – number of allowed commas; 1 (default) for surnames; 0 for given names
returns nothing
]]
local function name_has_mult_names (name, list_name, limit)
local _, commas, semicolons, nbsps;
limit = limit and limit or 1;
if utilities.is_set (name) then
_, commas = name:gsub (',', ''); -- count the number of commas
_, semicolons = name:gsub (';', ''); -- count the number of semicolons
-- nbsps probably should be its own separate count rather than merged in
-- some way with semicolons because Lua patterns do not support the
-- grouping operator that regex does, which means there is no way to add
-- more entities to escape except by adding more counts with the new
-- entities
_, nbsps = name:gsub (' ',''); -- count nbsps
-- There is exactly 1 semicolon per entity, so subtract nbsps
-- from semicolons to 'escape' them. If additional entities are added,
-- they also can be subtracted.
if limit < commas or 0 < (semicolons - nbsps) then
utilities.set_message ('maint_mult_names', cfg.special_case_translation [list_name]); -- add a maint message
end
end
end
--[=[-------------------------< I S _ G E N E R I C >----------------------------------------------------------
Compares values assigned to various parameters according to the string provided as <item> in the function call.
<item> can have on of two values:
'generic_names' – for name-holding parameters: |last=, |first=, |editor-last=, etc
'generic_titles' – for |title=
There are two types of generic tests. The 'accept' tests look for a pattern that should not be rejected by the
'reject' test. For example,
|author=[[John Smith (author)|Smith, John]]
would be rejected by the 'author' reject test. But piped wikilinks with 'author' disambiguation should not be
rejected so the 'accept' test prevents that from happening. Accept tests are always performed before reject
tests.
Each of the 'accept' and 'reject' sequence tables hold tables for en.wiki (['en']) and local.wiki (['local'])
that each can hold a test sequence table The sequence table holds, at index [1], a test pattern, and, at index
[2], a boolean control value. The control value tells string.find() or mw.ustring.find() to do plain-text search (true)
or a pattern search (false). The intent of all this complexity is to make these searches as fast as possible so
that we don't run out of processing time on very large articles.
Returns
true when a reject test finds the pattern or string
false when an accept test finds the pattern or string
nil else
]=]
local function is_generic (item, value, wiki)
local test_val;
local str_lower = { -- use string.lower() for en.wiki (['en']) and use mw.ustring.lower() or local.wiki (['local'])
['en'] = string.lower,
['local'] = mw.ustring.lower,
}
local str_find = { -- use string.find() for en.wiki (['en']) and use mw.ustring.find() or local.wiki (['local'])
['en'] = string.find,
['local'] = mw.ustring.find,
}
local function test (val, test_t, wiki) -- local function to do the testing; <wiki> selects lower() and find() functions
val = test_t[2] and str_lower[wiki](value) or val; -- when <test_t[2]> set to 'true', plaintext search using lowercase value
return str_find[wiki] (val, test_t[1], 1, test_t[2]); -- return nil when not found or matched
end
local test_types_t = {'accept', 'reject'}; -- test accept patterns first, then reject patterns
local wikis_t = {'en', 'local'}; -- do tests for each of these keys; en.wiki first, local.wiki second
for _, test_type in ipairs (test_types_t) do -- for each test type
for _, generic_value in pairs (cfg.special_case_translation[item][test_type]) do -- spin through the list of generic value fragments to accept or reject
for _, wiki in ipairs (wikis_t) do
if generic_value[wiki] then
if test (value, generic_value[wiki], wiki) then -- go do the test
return ('reject' == test_type); -- param value rejected, return true; false else
end
end
end
end
end
end
--[[--------------------------< N A M E _ I S _ G E N E R I C >------------------------------------------------
calls is_generic() to determine if <name> is a 'generic name' listed in cfg.generic_names; <name_alias> is the
parameter name used in error messaging
]]
local function name_is_generic (name, name_alias)
if not added_generic_name_errs and is_generic ('generic_names', name) then
utilities.set_message ('err_generic_name', name_alias); -- set an error message
added_generic_name_errs = true;
end
end
--[[--------------------------< N A M E _ C H E C K S >--------------------------------------------------------
This function calls various name checking functions used to validate the content of the various name-holding parameters.
]]
local function name_checks (last, first, list_name, last_alias, first_alias)
local accept_name;
if utilities.is_set (last) then
last, accept_name = utilities.has_accept_as_written (last); -- remove accept-this-as-written markup when it wraps all of <last>
if not accept_name then -- <last> not wrapped in accept-as-written markup
name_has_mult_names (last, list_name); -- check for multiple names in the parameter
name_is_numeric (last, last_alias, list_name); -- check for names that have no letters or are a mix of digits and other characters
name_is_generic (last, last_alias); -- check for names found in the generic names list
end
end
if utilities.is_set (first) then
first, accept_name = utilities.has_accept_as_written (first); -- remove accept-this-as-written markup when it wraps all of <first>
if not accept_name then -- <first> not wrapped in accept-as-written markup
name_has_mult_names (first, list_name, 0); -- check for multiple names in the parameter; 0 is number of allowed commas in a given name
name_is_numeric (first, first_alias, list_name); -- check for names that have no letters or are a mix of digits and other characters
name_is_generic (first, first_alias); -- check for names found in the generic names list
end
local wl_type, D = utilities.is_wikilink (first);
if 0 ~= wl_type then
first = D;
utilities.set_message ('err_bad_paramlink', first_alias);
end
end
return last, first; -- done
end
--[[----------------------< E X T R A C T _ N A M E S >-------------------------
Gets name list from the input arguments
Searches through args in sequential order to find |lastn= and |firstn= parameters
(or their aliases), and their matching link and mask parameters. Stops searching
when both |lastn= and |firstn= are not found in args after two sequential attempts:
found |last1=, |last2=, and |last3= but doesn't find |last4= and |last5= then the
search is done.
This function emits an error message when there is a |firstn= without a matching
|lastn=. When there are 'holes' in the list of last names, |last1= and |last3=
are present but |last2= is missing, an error message is emitted. |lastn= is not
required to have a matching |firstn=.
When an author or editor parameter contains some form of 'et al.', the 'et al.'
is stripped from the parameter and a flag (etal) returned that will cause list_people()
to add the static 'et al.' text from Module:Citation/CS1/Configuration. This keeps
'et al.' out of the template's metadata. When this occurs, an error is emitted.
]]
local function extract_names(args, list_name)
local names = {}; -- table of names
local last; -- individual name components
local first;
local link;
local mask;
local i = 1; -- loop counter/indexer
local n = 1; -- output table indexer
local count = 0; -- used to count the number of times we haven't found a |last= (or alias for authors, |editor-last or alias for editors)
local etal = false; -- return value set to true when we find some form of et al. in an author parameter
local last_alias, first_alias, link_alias; -- selected parameter aliases used in error messaging
while true do
last, last_alias = utilities.select_one ( args, cfg.aliases[list_name .. '-Last'], 'err_redundant_parameters', i ); -- search through args for name components beginning at 1
first, first_alias = utilities.select_one ( args, cfg.aliases[list_name .. '-First'], 'err_redundant_parameters', i );
link, link_alias = utilities.select_one ( args, cfg.aliases[list_name .. '-Link'], 'err_redundant_parameters', i );
mask = utilities.select_one ( args, cfg.aliases[list_name .. '-Mask'], 'err_redundant_parameters', i );
if last then -- error check |lastn= alias for unknown interwiki link prefix; done here because this is where we have the parameter name
local project, language = interwiki_prefixen_get (last, true); -- true because we expect interwiki links in |lastn= to be wikilinked
if nil == project and nil == language then -- when both are nil
utilities.set_message ('err_bad_paramlink', last_alias); -- not known, emit an error message -- TODO: err_bad_interwiki?
last = utilities.remove_wiki_link (last); -- remove wikilink markup; show display value only
end
end
if link then -- error check |linkn= alias for unknown interwiki link prefix
local project, language = interwiki_prefixen_get (link, false); -- false because wiki links in |author-linkn= is an error
if nil == project and nil == language then -- when both are nil
utilities.set_message ('err_bad_paramlink', link_alias); -- not known, emit an error message -- TODO: err_bad_interwiki?
link = nil; -- unset so we don't link
link_alias = nil;
end
end
last, etal = name_has_etal (last, etal, false, last_alias); -- find and remove variations on et al.
first, etal = name_has_etal (first, etal, false, first_alias); -- find and remove variations on et al.
last, first = name_checks (last, first, list_name, last_alias, first_alias); -- multiple names, extraneous annotation, etc. checks
if first and not last then -- if there is a firstn without a matching lastn
local alias = first_alias:find ('given', 1, true) and 'given' or 'first'; -- get first or given form of the alias
utilities.set_message ('err_first_missing_last', {
first_alias, -- param name of alias missing its mate
first_alias:gsub (alias, {['first'] = 'last', ['given'] = 'surname'}), -- make param name appropriate to the alias form
}); -- add this error message
elseif not first and not last then -- if both firstn and lastn aren't found, are we done?
count = count + 1; -- number of times we haven't found last and first
if 2 <= count then -- two missing names and we give up
break; -- normal exit or there is a two-name hole in the list; can't tell which
end
else -- we have last with or without a first
local result;
link = link_title_ok (link, link_alias, last, last_alias); -- check for improper wiki-markup
if first then
link = link_title_ok (link, link_alias, first, first_alias); -- check for improper wiki-markup
end
names[n] = {last = last, first = first, link = link, mask = mask, corporate = false}; -- add this name to our names list (corporate for |vauthors= only)
n = n + 1; -- point to next location in the names table
if 1 == count then -- if the previous name was missing
utilities.set_message ('err_missing_name', {list_name:match ("(%w+)List"):lower(), i - 1}); -- add this error message
end
count = 0; -- reset the counter, we're looking for two consecutive missing names
end
i = i + 1; -- point to next args location
end
return names, etal; -- all done, return our list of names and the etal flag
end
--[[--------------------------< N A M E _ T A G _ G E T >------------------------------------------------------
attempt to decode |language=<lang_param> and return language name and matching tag; nil else.
This function looks for:
<lang_param> as a tag in cfg.lang_tag_remap{}
<lang_param> as a name in cfg.lang_name_remap{}
<lang_param> as a name in cfg.mw_languages_by_name_t
<lang_param> as a tag in cfg.mw_languages_by_tag_t
when those fail, presume that <lang_param> is an IETF-like tag that MediaWiki does not recognize. Strip all
script, region, variant, whatever subtags from <lang_param> to leave just a two or three character language tag
and look for the new <lang_param> in cfg.mw_languages_by_tag_t{}
on success, returns name (in properly capitalized form) and matching tag (in lowercase); on failure returns nil
]]
local function name_tag_get (lang_param)
local lang_param_lc = mw.ustring.lower (lang_param); -- use lowercase as an index into the various tables
local name;
local tag;
name = cfg.lang_tag_remap[lang_param_lc]; -- assume <lang_param_lc> is a tag; attempt to get remapped language name
if name then -- when <name>, <lang_param> is a tag for a remapped language name
if cfg.lang_name_remap[name:lower()][2] ~= lang_param_lc then
utilities.set_message ('maint_unknown_lang'); -- add maint category if not already added
return name, cfg.lang_name_remap[name:lower()][2]; -- so return name and tag from lang_name_remap[name]; special case to xlate sr-ec and sr-el to sr-cyrl and sr-latn
end
return name, lang_param_lc; -- so return <name> from remap and <lang_param_lc>
end
tag = lang_param_lc:match ('^(%a%a%a?)%-.*'); -- still assuming that <lang_param_lc> is a tag; strip script, region, variant subtags
name = cfg.lang_tag_remap[tag]; -- attempt to get remapped language name with language subtag only
if name then -- when <name>, <tag> is a tag for a remapped language name
return name, tag; -- so return <name> from remap and <tag>
end
if cfg.lang_name_remap[lang_param_lc] then -- not a remapped tag, assume <lang_param_lc> is a name; attempt to get remapped language tag
return cfg.lang_name_remap[lang_param_lc][1], cfg.lang_name_remap[lang_param_lc][2]; -- for this <lang_param_lc>, return a (possibly) new name and appropriate tag
end
name = cfg.mw_languages_by_tag_t[lang_param_lc]; -- assume that <lang_param_lc> is a tag; attempt to get its matching language name
if name then
return name, lang_param_lc; -- <lang_param_lc> is a tag so return it and <name>
end
tag = cfg.mw_languages_by_name_t[lang_param_lc]; -- assume that <lang_param_lc> is a language name; attempt to get its matching tag
if tag then
return cfg.mw_languages_by_tag_t[tag], tag; -- <lang_param_lc> is a name so return the name from the table and <tag>
end
tag = lang_param_lc:match ('^(%a%a%a?)%-.*'); -- is <lang_param_lc> an IETF-like tag that MediaWiki doesn't recognize? <tag> gets the language subtag; nil else
if tag then
name = cfg.mw_languages_by_tag_t[tag]; -- attempt to get a language name using the shortened <tag>
if name then
return name, tag; -- <lang_param_lc> is an unrecognized IETF-like tag so return <name> and language subtag
end
end
end
--[[-------------------< L A N G U A G E _ P A R A M E T E R >------------------
Gets language name from a provided two- or three-character ISO 639 code. If a code
is recognized by MediaWiki, use the returned name; if not, then use the value that
was provided with the language parameter.
When |language= contains a recognized language (either code or name), the page is
assigned to the category for that code: Category:Norwegian-language sources (no).
For valid three-character code languages, the page is assigned to the single category
for '639-2' codes: Category:CS1 ISO 639-2 language sources.
Languages that are the same as the local wiki are not categorized. MediaWiki does
not recognize three-character equivalents of two-character codes: code 'ar' is
recognized but code 'ara' is not.
This function supports multiple languages in the form |language=nb, French, th
where the language names or codes are separated from each other by commas with
optional space characters.
]]
local function language_parameter (lang)
local tag; -- some form of IETF-like language tag; language subtag with optional region, sript, vatiant, etc subtags
local lang_subtag; -- ve populates |language= with mostly unecessary region subtags the MediaWiki does not recognize; this is the base language subtag
local name; -- the language name
local language_list = {}; -- table of language names to be rendered
local names_t = {}; -- table made from the value assigned to |language=
local this_wiki_name = mw.language.fetchLanguageName (cfg.this_wiki_code, cfg.this_wiki_code); -- get this wiki's language name
names_t = mw.text.split (lang, '%s*,%s*'); -- names should be a comma separated list
for _, lang in ipairs (names_t) do -- reuse lang here because we don't yet know if lang is a language name or a language tag
name, tag = name_tag_get (lang); -- attempt to get name/tag pair for <lang>; <name> has proper capitalization; <tag> is lowercase
if utilities.is_set (tag) then
lang_subtag = tag:gsub ('^(%a%a%a?)%-.*', '%1'); -- for categorization, strip any IETF-like tags from language tag
if cfg.this_wiki_code ~= lang_subtag then -- when the language is not the same as this wiki's language
if 2 == lang_subtag:len() then -- and is a two-character tag
utilities.add_prop_cat ('foreign-lang-source', {name, tag}, lang_subtag); -- categorize it; tag appended to allow for multiple language categorization
else -- or is a recognized language (but has a three-character tag)
utilities.add_prop_cat ('foreign-lang-source-2', {lang_subtag}, lang_subtag); -- categorize it differently TODO: support multiple three-character tag categories per cs1|2 template?
end
elseif cfg.local_lang_cat_enable then -- when the language and this wiki's language are the same and categorization is enabled
utilities.add_prop_cat ('local-lang-source', {name, lang_subtag}); -- categorize it
end
else
name = lang; -- return whatever <lang> has so that we show something
utilities.set_message ('maint_unknown_lang'); -- add maint category if not already added
end
table.insert (language_list, name);
name = ''; -- so we can reuse it
end
name = utilities.make_sep_list (#language_list, language_list);
if (1 == #language_list) and (lang_subtag == cfg.this_wiki_code) then -- when only one language, find lang name in this wiki lang name; for |language=en-us, 'English' in 'American English'
return ''; -- if one language and that language is this wiki's return an empty string (no annotation)
end
return (" " .. wrap_msg ('language', name)); -- otherwise wrap with '(in ...)'
--[[ TODO: should only return blank or name rather than full list
so we can clean up the bunched parenthetical elements Language, Type, Format
]]
end
--[[-----------------------< S E T _ C S _ S T Y L E >--------------------------
Gets the default CS style configuration for the given mode.
Returns default separator and either postscript as passed in or the default.
In CS1, the default postscript and separator are '.'.
In CS2, the default postscript is the empty string and the default separator is ','.
]]
local function set_cs_style (postscript, mode)
if utilities.is_set(postscript) then
-- emit a maintenance message if user postscript is the default cs1 postscript
-- we catch the opposite case for cs2 in set_style
if mode == 'cs1' and postscript == cfg.presentation['ps_' .. mode] then
utilities.set_message ('maint_postscript');
end
else
postscript = cfg.presentation['ps_' .. mode];
end
return cfg.presentation['sep_' .. mode], postscript;
end
--[[--------------------------< S E T _ S T Y L E >-----------------------------
Sets the separator and postscript styles. Checks the |mode= first and the
#invoke CitationClass second. Removes the postscript if postscript == none.
]]
local function set_style (mode, postscript, cite_class)
local sep;
if 'cs2' == mode then
sep, postscript = set_cs_style (postscript, 'cs2');
elseif 'cs1' == mode then
sep, postscript = set_cs_style (postscript, 'cs1');
elseif 'citation' == cite_class then
sep, postscript = set_cs_style (postscript, 'cs2');
else
sep, postscript = set_cs_style (postscript, 'cs1');
end
if cfg.keywords_xlate[postscript:lower()] == 'none' then
-- emit a maintenance message if user postscript is the default cs2 postscript
-- we catch the opposite case for cs1 in set_cs_style
if 'cs2' == mode or 'citation' == cite_class then
utilities.set_message ('maint_postscript');
end
postscript = '';
end
return sep, postscript
end
--[=[-------------------------< I S _ P D F >-----------------------------------
Determines if a URL has the file extension that is one of the PDF file extensions
used by [[MediaWiki:Common.css]] when applying the PDF icon to external links.
returns true if file extension is one of the recognized extensions, else false
]=]
local function is_pdf (url)
return url:match ('%.pdf$') or url:match ('%.PDF$') or
url:match ('%.pdf[%?#]') or url:match ('%.PDF[%?#]') or
url:match ('%.PDF#') or url:match ('%.pdf#');
end
--[[--------------------------< S T Y L E _ F O R M A T >-----------------------
Applies CSS style to |format=, |chapter-format=, etc. Also emits an error message
if the format parameter does not have a matching URL parameter. If the format parameter
is not set and the URL contains a file extension that is recognized as a PDF document
by MediaWiki's commons.css, this code will set the format parameter to (PDF) with
the appropriate styling.
]]
local function style_format (format, url, fmt_param, url_param)
if utilities.is_set (format) then
format = utilities.wrap_style ('format', format); -- add leading space, parentheses, resize
if not utilities.is_set (url) then
utilities.set_message ('err_format_missing_url', {fmt_param, url_param}); -- add an error message
end
elseif is_pdf (url) then -- format is not set so if URL is a PDF file then
format = utilities.wrap_style ('format', 'PDF'); -- set format to PDF
else
format = ''; -- empty string for concatenation
end
return format;
end
--[[---------------------< G E T _ D I S P L A Y _ N A M E S >------------------
Returns a number that defines the number of names displayed for author and editor
name lists and a Boolean flag to indicate when et al. should be appended to the name list.
When the value assigned to |display-xxxxors= is a number greater than or equal to zero,
return the number and the previous state of the 'etal' flag (false by default
but may have been set to true if the name list contains some variant of the text 'et al.').
When the value assigned to |display-xxxxors= is the keyword 'etal', return a number
that is one greater than the number of authors in the list and set the 'etal' flag true.
This will cause the list_people() to display all of the names in the name list followed by 'et al.'
In all other cases, returns nil and the previous state of the 'etal' flag.
inputs:
max: A['DisplayAuthors'] or A['DisplayEditors'], etc; a number or some flavor of etal
count: #a or #e
list_name: 'authors' or 'editors'
etal: author_etal or editor_etal
This function sets an error message when |display-xxxxors= value greater than or equal to number of names but
not when <max> comes from {{cs1 config}} global settings. When using global settings, <param> is set to the
keyword 'cs1 config' which is used to supress the normal error. Error is suppressed because it is to be expected
that some citations in an article will have the same or fewer names that the limit specified in {{cs1 config}}.
]]
local function get_display_names (max, count, list_name, etal, param)
if utilities.is_set (max) then
if 'etal' == max:lower():gsub("[ '%.]", '') then -- the :gsub() portion makes 'etal' from a variety of 'et al.' spellings and stylings
max = count + 1; -- number of authors + 1 so display all author name plus et al.
etal = true; -- overrides value set by extract_names()
elseif max:match ('^%d+$') then -- if is a string of numbers
max = tonumber (max); -- make it a number
if (max >= count) and ('cs1 config' ~= param) then -- error when local |display-xxxxors= value greater than or equal to number of names; not an error when using global setting
utilities.set_message ('err_disp_name', {param, max}); -- add error message
max = nil;
end
else -- not a valid keyword or number
utilities.set_message ('err_disp_name', {param, max}); -- add error message
max = nil; -- unset; as if |display-xxxxors= had not been set
end
end
return max, etal;
end
--[[----------< E X T R A _ T E X T _ I N _ P A G E _ C H E C K >---------------
Adds error if |page=, |pages=, |quote-page=, |quote-pages= has what appears to be
some form of p. or pp. abbreviation in the first characters of the parameter content.
check page for extraneous p, p., pp, pp., pg, pg. at start of parameter value:
good pattern: '^P[^%.P%l]' matches when page begins PX or P# but not Px
where x and X are letters and # is a digit
bad pattern: '^[Pp][PpGg]' matches when page begins pp, pP, Pp, PP, pg, pG, Pg, PG
]]
local function extra_text_in_page_check (val, name)
if not val:match (cfg.vol_iss_pg_patterns.good_ppattern) then
for _, pattern in ipairs (cfg.vol_iss_pg_patterns.bad_ppatterns) do -- spin through the selected sequence table of patterns
if val:match (pattern) then -- when a match, error so
utilities.set_message ('err_extra_text_pages', name); -- add error message
return; -- and done
end
end
end
end
--[[--------------------------< E X T R A _ T E X T _ I N _ V O L _ I S S _ C H E C K >------------------------
Adds error if |volume= or |issue= has what appears to be some form of redundant 'type' indicator.
For |volume=:
'V.', or 'Vol.' (with or without the dot) abbreviations or 'Volume' in the first characters of the parameter
content (all case insensitive). 'V' and 'v' (without the dot) are presumed to be roman numerals so
are allowed.
For |issue=:
'No.', 'I.', 'Iss.' (with or without the dot) abbreviations, or 'Issue' in the first characters of the
parameter content (all case insensitive).
Single character values ('v', 'i', 'n') allowed when not followed by separator character ('.', ':', '=', or
whitespace character) – param values are trimmed of whitespace by MediaWiki before delivered to the module.
<val> is |volume= or |issue= parameter value
<name> is |volume= or |issue= parameter name for error message
<selector> is 'v' for |volume=, 'i' for |issue=
sets error message on failure; returns nothing
]]
local function extra_text_in_vol_iss_check (val, name, selector)
if not utilities.is_set (val) then
return;
end
local patterns = 'v' == selector and cfg.vol_iss_pg_patterns.vpatterns or cfg.vol_iss_pg_patterns.ipatterns;
local handler = 'v' == selector and 'err_extra_text_volume' or 'err_extra_text_issue';
val = val:lower(); -- force parameter value to lower case
for _, pattern in ipairs (patterns) do -- spin through the selected sequence table of patterns
if val:match (pattern) then -- when a match, error so
utilities.set_message (handler, name); -- add error message
return; -- and done
end
end
end
--[=[-------------------------< G E T _ V _ N A M E _ T A B L E >----------------------------------------------
split apart a |vauthors= or |veditors= parameter. This function allows for corporate names, wrapped in doubled
parentheses to also have commas; in the old version of the code, the doubled parentheses were included in the
rendered citation and in the metadata. Individual author names may be wikilinked
|vauthors=Jones AB, [[E. B. White|White EB]], ((Black, Brown, and Co.))
]=]
local function get_v_name_table (vparam, output_table, output_link_table)
local name_table = mw.text.split(vparam, "%s*,%s*"); -- names are separated by commas
local wl_type, label, link; -- wl_type not used here; just a placeholder
local i = 1;
while name_table[i] do
if name_table[i]:match ('^%(%(.*[^%)][^%)]$') then -- first segment of corporate with one or more commas; this segment has the opening doubled parentheses
local name = name_table[i];
i = i + 1; -- bump indexer to next segment
while name_table[i] do
name = name .. ', ' .. name_table[i]; -- concatenate with previous segments
if name_table[i]:match ('^.*%)%)$') then -- if this table member has the closing doubled parentheses
break; -- and done reassembling so
end
i = i + 1; -- bump indexer
end
table.insert (output_table, name); -- and add corporate name to the output table
table.insert (output_link_table, ''); -- no wikilink
else
wl_type, label, link = utilities.is_wikilink (name_table[i]); -- wl_type is: 0, no wl (text in label variable); 1, [[D]]; 2, [[L|D]]
table.insert (output_table, label); -- add this name
if 1 == wl_type then
table.insert (output_link_table, label); -- simple wikilink [[D]]
else
table.insert (output_link_table, link); -- no wikilink or [[L|D]]; add this link if there is one, else empty string
end
end
i = i + 1;
end
return output_table;
end
--[[--------------------------< P A R S E _ V A U T H O R S _ V E D I T O R S >--------------------------------
This function extracts author / editor names from |vauthors= or |veditors= and finds matching |xxxxor-maskn= and
|xxxxor-linkn= in args. It then returns a table of assembled names just as extract_names() does.
Author / editor names in |vauthors= or |veditors= must be in Vancouver system style. Corporate or institutional names
may sometimes be required and because such names will often fail the is_good_vanc_name() and other format compliance
tests, are wrapped in doubled parentheses ((corporate name)) to suppress the format tests.
Supports generational suffixes Jr, 2nd, 3rd, 4th–6th.
This function sets the Vancouver error when a required comma is missing and when there is a space between an author's initials.
]]
local function parse_vauthors_veditors (args, vparam, list_name)
local names = {}; -- table of names assembled from |vauthors=, |author-maskn=, |author-linkn=
local v_name_table = {};
local v_link_table = {}; -- when name is wikilinked, targets go in this table
local etal = false; -- return value set to true when we find some form of et al. vauthors parameter
local last, first, link, mask, suffix;
local corporate = false;
vparam, etal = name_has_etal (vparam, etal, true); -- find and remove variations on et al. do not categorize (do it here because et al. might have a period)
v_name_table = get_v_name_table (vparam, v_name_table, v_link_table); -- names are separated by commas
for i, v_name in ipairs(v_name_table) do
first = ''; -- set to empty string for concatenation and because it may have been set for previous author/editor
local accept_name;
v_name, accept_name = utilities.has_accept_as_written (v_name); -- remove accept-this-as-written markup when it wraps all of <v_name>
if accept_name then
last = v_name;
corporate = true; -- flag used in list_people()
elseif string.find(v_name, "%s") then
if v_name:find('[;%.]') then -- look for commonly occurring punctuation characters;
add_vanc_error (cfg.err_msg_supl.punctuation, i);
end
local lastfirstTable = {}
lastfirstTable = mw.text.split(v_name, "%s+")
first = table.remove(lastfirstTable); -- removes and returns value of last element in table which should be initials or generational suffix
if not mw.ustring.match (first, '^%u+$') then -- mw.ustring here so that later we will catch non-Latin characters
suffix = first; -- not initials so assume that whatever we got is a generational suffix
first = table.remove(lastfirstTable); -- get what should be the initials from the table
end
last = table.concat(lastfirstTable, ' ') -- returns a string that is the concatenation of all other names that are not initials and generational suffix
if not utilities.is_set (last) then
first = ''; -- unset
last = v_name; -- last empty because something wrong with first
add_vanc_error (cfg.err_msg_supl.name, i);
end
if mw.ustring.match (last, '%a+%s+%u+%s+%a+') then
add_vanc_error (cfg.err_msg_supl['missing comma'], i); -- matches last II last; the case when a comma is missing
end
if mw.ustring.match (v_name, ' %u %u$') then -- this test is in the wrong place TODO: move or replace with a more appropriate test
add_vanc_error (cfg.err_msg_supl.initials, i); -- matches a space between two initials
end
else
last = v_name; -- last name or single corporate name? Doesn't support multiword corporate names? do we need this?
end
if utilities.is_set (first) then
if not mw.ustring.match (first, "^%u?%u$") then -- first shall contain one or two upper-case letters, nothing else
add_vanc_error (cfg.err_msg_supl.initials, i); -- too many initials; mixed case initials (which may be ok Romanization); hyphenated initials
end
is_good_vanc_name (last, first, suffix, i); -- check first and last before restoring the suffix which may have a non-Latin digit
if utilities.is_set (suffix) then
first = first .. ' ' .. suffix; -- if there was a suffix concatenate with the initials
suffix = ''; -- unset so we don't add this suffix to all subsequent names
end
else
if not corporate then
is_good_vanc_name (last, '', nil, i);
end
end
link = utilities.select_one ( args, cfg.aliases[list_name .. '-Link'], 'err_redundant_parameters', i ) or v_link_table[i];
mask = utilities.select_one ( args, cfg.aliases[list_name .. '-Mask'], 'err_redundant_parameters', i );
names[i] = {last = last, first = first, link = link, mask = mask, corporate = corporate}; -- add this assembled name to our names list
end
return names, etal; -- all done, return our list of names
end
--[[--------------------------< S E L E C T _ A U T H O R _ E D I T O R _ S O U R C E >------------------------
Select one of |authors=, |authorn= / |lastn / firstn=, or |vauthors= as the source of the author name list or
select one of |editorn= / editor-lastn= / |editor-firstn= or |veditors= as the source of the editor name list.
Only one of these appropriate three will be used. The hierarchy is: |authorn= (and aliases) highest and |authors= lowest;
|editorn= (and aliases) highest and |veditors= lowest (support for |editors= withdrawn)
When looking for |authorn= / |editorn= parameters, test |xxxxor1= and |xxxxor2= (and all of their aliases); stops after the second
test which mimicks the test used in extract_names() when looking for a hole in the author name list. There may be a better
way to do this, I just haven't discovered what that way is.
Emits an error message when more than one xxxxor name source is provided.
In this function, vxxxxors = vauthors or veditors; xxxxors = authors as appropriate.
]]
local function select_author_editor_source (vxxxxors, xxxxors, args, list_name)
local lastfirst = false;
if utilities.select_one ( args, cfg.aliases[list_name .. '-Last'], 'none', 1 ) or -- do this twice in case we have a |first1= without a |last1=; this ...
utilities.select_one ( args, cfg.aliases[list_name .. '-First'], 'none', 1 ) or -- ... also catches the case where |first= is used with |vauthors=
utilities.select_one ( args, cfg.aliases[list_name .. '-Last'], 'none', 2 ) or
utilities.select_one ( args, cfg.aliases[list_name .. '-First'], 'none', 2 ) then
lastfirst = true;
end
if (utilities.is_set (vxxxxors) and true == lastfirst) or -- these are the three error conditions
(utilities.is_set (vxxxxors) and utilities.is_set (xxxxors)) or
(true == lastfirst and utilities.is_set (xxxxors)) then
local err_name;
if 'AuthorList' == list_name then -- figure out which name should be used in error message
err_name = 'author';
else
err_name = 'editor';
end
utilities.set_message ('err_redundant_parameters', err_name .. '-name-list parameters'); -- add error message
end
if true == lastfirst then return 1 end; -- return a number indicating which author name source to use
if utilities.is_set (vxxxxors) then return 2 end;
if utilities.is_set (xxxxors) then return 3 end;
return 1; -- no authors so return 1; this allows missing author name test to run in case there is a first without last
end
--[[--------------------------< I S _ V A L I D _ P A R A M E T E R _ V A L U E >------------------------------
This function is used to validate a parameter's assigned value for those parameters that have only a limited number
of allowable values (yes, y, true, live, dead, etc.). When the parameter value has not been assigned a value (missing
or empty in the source template) the function returns the value specified by ret_val. If the parameter value is one
of the list of allowed values returns the translated value; else, emits an error message and returns the value
specified by ret_val.
TODO: explain <invert>
]]
local function is_valid_parameter_value (value, name, possible, ret_val, invert)
if not utilities.is_set (value) then
return ret_val; -- an empty parameter is ok
end
if (not invert and utilities.in_array (value, possible)) then -- normal; <value> is in <possible> table
return cfg.keywords_xlate[value]; -- return translation of parameter keyword
elseif invert and not utilities.in_array (value, possible) then -- invert; <value> is not in <possible> table
return value; -- return <value> as it is
else
utilities.set_message ('err_invalid_param_val', {name, value}); -- not an allowed value so add error message
return ret_val;
end
end
--[[--------------------------< T E R M I N A T E _ N A M E _ L I S T >----------------------------------------
This function terminates a name list (author, contributor, editor) with a separator character (sepc) and a space
when the last character is not a sepc character or when the last three characters are not sepc followed by two
closing square brackets (close of a wikilink). When either of these is true, the name_list is terminated with a
single space character.
]]
local function terminate_name_list (name_list, sepc)
if (string.sub (name_list, -3, -1) == sepc .. '. ') then -- if already properly terminated
return name_list; -- just return the name list
elseif (string.sub (name_list, -1, -1) == sepc) or (string.sub (name_list, -3, -1) == sepc .. ']]') then -- if last name in list ends with sepc char
return name_list .. " "; -- don't add another
else
return name_list .. sepc .. ' '; -- otherwise terminate the name list
end
end
--[[-------------------------< F O R M A T _ V O L U M E _ I S S U E >-----------------------------------------
returns the concatenation of the formatted volume and issue (or journal article number) parameters as a single
string; or formatted volume or formatted issue, or an empty string if neither are set.
]]
local function format_volume_issue (volume, issue, article, cite_class, origin, sepc, lower)
if not utilities.is_set (volume) and not utilities.is_set (issue) and not utilities.is_set (article) then
return '';
end
-- same condition as in format_pages_sheets()
local is_journal = 'journal' == cite_class or (utilities.in_array (cite_class, {'citation', 'map', 'interview'}) and 'journal' == origin);
local is_numeric_vol = volume and (volume:match ('^[MDCLXVI]+$') or volume:match ('^%d+$')); -- is only uppercase roman numerals or only digits?
local is_long_vol = volume and (4 < mw.ustring.len(volume)); -- is |volume= value longer than 4 characters?
if volume and (not is_numeric_vol and is_long_vol) then -- when not all digits or Roman numerals, is |volume= longer than 4 characters?
utilities.add_prop_cat ('long-vol'); -- yes, add properties cat
end
if is_journal then -- journal-style formatting
local vol = '';
if utilities.is_set (volume) then
if is_numeric_vol then -- |volume= value all digits or all uppercase Roman numerals?
vol = utilities.substitute (cfg.presentation['vol-bold'], {sepc, volume}); -- render in bold face
elseif is_long_vol then -- not all digits or Roman numerals; longer than 4 characters?
vol = utilities.substitute (cfg.messages['j-vol'], {sepc, utilities.hyphen_to_dash (volume)}); -- not bold
else -- four or fewer characters
vol = utilities.substitute (cfg.presentation['vol-bold'], {sepc, utilities.hyphen_to_dash (volume)}); -- bold
end
end
vol = vol .. (utilities.is_set (issue) and utilities.substitute (cfg.messages['j-issue'], issue) or '')
vol = vol .. (utilities.is_set (article) and utilities.substitute (cfg.messages['j-article-num'], article) or '')
return vol;
end
if 'podcast' == cite_class and utilities.is_set (issue) then
return wrap_msg ('issue', {sepc, issue}, lower);
end
if 'conference' == cite_class and utilities.is_set (article) then -- |article-number= supported only in journal and conference cites
if utilities.is_set (volume) and utilities.is_set (article) then -- both volume and article number
return wrap_msg ('vol-art', {sepc, utilities.hyphen_to_dash (volume), article}, lower);
elseif utilities.is_set (article) then -- article number alone; when volume alone, handled below
return wrap_msg ('art', {sepc, article}, lower);
end
end
-- all other types of citation
if utilities.is_set (volume) and utilities.is_set (issue) then
return wrap_msg ('vol-no', {sepc, utilities.hyphen_to_dash (volume), issue}, lower);
elseif utilities.is_set (volume) then
return wrap_msg ('vol', {sepc, utilities.hyphen_to_dash (volume)}, lower);
else
return wrap_msg ('issue', {sepc, issue}, lower);
end
end
--[[-------------------------< F O R M A T _ P A G E S _ S H E E T S >-----------------------------------------
adds static text to one of |page(s)= or |sheet(s)= values and returns it with all of the others set to empty strings.
The return order is:
page, pages, sheet, sheets
Singular has priority over plural when both are provided.
]]
local function format_pages_sheets (page, pages, sheet, sheets, cite_class, origin, sepc, nopp, lower)
if 'map' == cite_class then -- only cite map supports sheet(s) as in-source locators
if utilities.is_set (sheet) then
if 'journal' == origin then
return '', '', wrap_msg ('j-sheet', sheet, lower), '';
else
return '', '', wrap_msg ('sheet', {sepc, sheet}, lower), '';
end
elseif utilities.is_set (sheets) then
if 'journal' == origin then
return '', '', '', wrap_msg ('j-sheets', sheets, lower);
else
return '', '', '', wrap_msg ('sheets', {sepc, sheets}, lower);
end
end
end
local is_journal = 'journal' == cite_class or (utilities.in_array (cite_class, {'citation', 'map', 'interview'}) and 'journal' == origin);
if utilities.is_set (page) then
if is_journal then
return utilities.substitute (cfg.messages['j-page(s)'], page), '', '', '';
elseif not nopp then
return utilities.substitute (cfg.messages['p-prefix'], {sepc, page}), '', '', '';
else
return utilities.substitute (cfg.messages['nopp'], {sepc, page}), '', '', '';
end
elseif utilities.is_set (pages) then
if is_journal then
return utilities.substitute (cfg.messages['j-page(s)'], pages), '', '', '';
elseif tonumber(pages) ~= nil and not nopp then -- if pages is only digits, assume a single page number
return '', utilities.substitute (cfg.messages['p-prefix'], {sepc, pages}), '', '';
elseif not nopp then
return '', utilities.substitute (cfg.messages['pp-prefix'], {sepc, pages}), '', '';
else
return '', utilities.substitute (cfg.messages['nopp'], {sepc, pages}), '', '';
end
end
return '', '', '', ''; -- return empty strings
end
--[[--------------------------< I N S O U R C E _ L O C _ G E T >----------------------------------------------
returns one of the in-source locators: page, pages, or at.
If any of these are interwiki links to Wikisource, returns the label portion of the interwiki-link as plain text
for use in COinS. This COinS thing is done because here we convert an interwiki-link to an external link and
add an icon span around that; get_coins_pages() doesn't know about the span. TODO: should it?
TODO: add support for sheet and sheets?; streamline;
TODO: make it so that this function returns only one of the three as the single in-source (the return value assigned
to a new name)?
]]
local function insource_loc_get (page, page_orig, pages, pages_orig, at)
local ws_url, ws_label, coins_pages, L; -- for Wikisource interwiki-links; TODO: this corrupts page metadata (span remains in place after cleanup; fix there?)
if utilities.is_set (page) then
if utilities.is_set (pages) or utilities.is_set (at) then
pages = ''; -- unset the others
at = '';
end
extra_text_in_page_check (page, page_orig); -- emit error message when |page= value begins with what looks like p., pp., etc.
ws_url, ws_label, L = wikisource_url_make (page); -- make ws URL from |page= interwiki link; link portion L becomes tooltip label
if ws_url then
page = external_link (ws_url, ws_label .. ' ', 'ws link in page'); -- space char after label to move icon away from in-source text; TODO: a better way to do this?
page = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], L, page});
coins_pages = ws_label;
end
elseif utilities.is_set (pages) then
if utilities.is_set (at) then
at = ''; -- unset
end
extra_text_in_page_check (pages, pages_orig); -- emit error message when |page= value begins with what looks like p., pp., etc.
ws_url, ws_label, L = wikisource_url_make (pages); -- make ws URL from |pages= interwiki link; link portion L becomes tooltip label
if ws_url then
pages = external_link (ws_url, ws_label .. ' ', 'ws link in pages'); -- space char after label to move icon away from in-source text; TODO: a better way to do this?
pages = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], L, pages});
coins_pages = ws_label;
end
elseif utilities.is_set (at) then
ws_url, ws_label, L = wikisource_url_make (at); -- make ws URL from |at= interwiki link; link portion L becomes tooltip label
if ws_url then
at = external_link (ws_url, ws_label .. ' ', 'ws link in at'); -- space char after label to move icon away from in-source text; TODO: a better way to do this?
at = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], L, at});
coins_pages = ws_label;
end
end
return page, pages, at, coins_pages;
end
--[[--------------------------< I S _ U N I Q U E _ A R C H I V E _ U R L >------------------------------------
add error message when |archive-url= value is same as |url= or chapter-url= (or alias...) value
]]
local function is_unique_archive_url (archive, url, c_url, source, date)
if utilities.is_set (archive) then
if archive == url or archive == c_url then
utilities.set_message ('err_bad_url', {utilities.wrap_style ('parameter', source)}); -- add error message
return '', ''; -- unset |archive-url= and |archive-date= because same as |url= or |chapter-url=
end
end
return archive, date;
end
--[=[-------------------------< A R C H I V E _ U R L _ C H E C K >--------------------------------------------
Check archive.org URLs to make sure they at least look like they are pointing at valid archives and not to the
save snapshot URL or to calendar pages. When the archive URL is 'https://web.archive.org/save/' (or http://...)
archive.org saves a snapshot of the target page in the URL. That is something that Wikipedia should not allow
unwitting readers to do.
When the archive.org URL does not have a complete timestamp, archive.org chooses a snapshot according to its own
algorithm or provides a calendar 'search' result. [[WP:ELNO]] discourages links to search results.
This function looks at the value assigned to |archive-url= and returns empty strings for |archive-url= and
|archive-date= and an error message when:
|archive-url= holds an archive.org save command URL
|archive-url= is an archive.org URL that does not have a complete timestamp (YYYYMMDDhhmmss 14 digits) in the
correct place
otherwise returns |archive-url= and |archive-date=
There are two mostly compatible archive.org URLs:
//web.archive.org/<timestamp>... -- the old form
//web.archive.org/web/<timestamp>... -- the new form
The old form does not support or map to the new form when it contains a display flag. There are four identified flags
('id_', 'js_', 'cs_', 'im_') but since archive.org ignores others following the same form (two letters and an underscore)
we don't check for these specific flags but we do check the form.
This function supports a preview mode. When the article is rendered in preview mode, this function may return a modified
archive URL:
for save command errors, return undated wildcard (/*/)
for timestamp errors when the timestamp has a wildcard, return the URL unmodified
for timestamp errors when the timestamp does not have a wildcard, return with timestamp limited to six digits plus wildcard (/yyyymm*/)
A secondary function is to return an archive-url timestamp from those urls that have them (archive.org and
archive.today). The timestamp is used by validation.archive_date_check() to see if the value in |archive-date=
matches the timestamp in the archive url.
]=]
local function archive_url_check (url, date)
local err_msg = ''; -- start with the error message empty
local path, timestamp, flag; -- portions of the archive.org URL
timestamp = url:match ('//archive.today/(%d%d%d%d%d%d%d%d%d%d%d%d%d%d)/'); -- get timestamp from archive.today urls
if timestamp then -- if this was an archive.today url ...
return url, date, timestamp; -- return ArchiveURL, ArchiveDate, and timestamp from |archive-url=, and done
end
-- here for archive.org urls
if (not url:match('//web%.archive%.org/')) and (not url:match('//liveweb%.archive%.org/')) then -- also deprecated liveweb Wayback machine URL
return url, date; -- not an archive.org archive, return ArchiveURL and ArchiveDate
end
if url:match('//web%.archive%.org/save/') then -- if a save command URL, we don't want to allow saving of the target page
err_msg = cfg.err_msg_supl.save;
url = url:gsub ('(//web%.archive%.org)/save/', '%1/*/', 1); -- for preview mode: modify ArchiveURL
elseif url:match('//liveweb%.archive%.org/') then
err_msg = cfg.err_msg_supl.liveweb;
else
path, timestamp, flag = url:match('//web%.archive%.org/([^%d]*)(%d+)([^/]*)/'); -- split out some of the URL parts for evaluation
if not path then -- malformed in some way; pattern did not match
err_msg = cfg.err_msg_supl.timestamp;
elseif 14 ~= timestamp:len() then -- path and flag optional, must have 14-digit timestamp here
err_msg = cfg.err_msg_supl.timestamp;
if '*' ~= flag then
local replacement = timestamp:match ('^%d%d%d%d%d%d') or timestamp:match ('^%d%d%d%d'); -- get the first 6 (YYYYMM) or first 4 digits (YYYY)
if replacement then -- nil if there aren't at least 4 digits (year)
replacement = replacement .. string.rep ('0', 14 - replacement:len()); -- year or yearmo (4 or 6 digits) zero-fill to make 14-digit timestamp
url=url:gsub ('(//web%.archive%.org/[^%d]*)%d[^/]*', '%1' .. replacement .. '*', 1) -- for preview, modify ts to 14 digits plus splat for calendar display
end
end
elseif utilities.is_set (path) and 'web/' ~= path then -- older archive URLs do not have the extra 'web/' path element
err_msg = cfg.err_msg_supl.path;
elseif utilities.is_set (flag) and not utilities.is_set (path) then -- flag not allowed with the old form URL (without the 'web/' path element)
err_msg = cfg.err_msg_supl.flag;
elseif utilities.is_set (flag) and not flag:match ('%a%a_') then -- flag if present must be two alpha characters and underscore (requires 'web/' path element)
err_msg = cfg.err_msg_supl.flag;
else
return url, date, timestamp; -- return ArchiveURL, ArchiveDate, and timestamp from |archive-url=
end
end
-- if here, something not right so
utilities.set_message ('err_archive_url', {err_msg}); -- add error message and
if is_preview_mode then
return url, date, timestamp; -- preview mode so return ArchiveURL, ArchiveDate, and timestamp from |archive-url=
else
return '', ''; -- return empty strings for ArchiveURL and ArchiveDate
end
end
--[[--------------------------< P L A C E _ C H E C K >--------------------------------------------------------
check |place=, |publication-place=, |location= to see if these params include digits. This function added because
many editors misuse location to specify the in-source location (|page(s)= and |at= are supposed to do that)
returns the original parameter value without modification; added maint cat when parameter value contains digits
]]
local function place_check (param_val)
if not utilities.is_set (param_val) then -- parameter empty or omitted
return param_val; -- return that empty state
end
if mw.ustring.find (param_val, '%d') then -- not empty, are there digits in the parameter value
utilities.set_message ('maint_location'); -- yep, add maint cat
end
return param_val; -- and done
end
--[[--------------------------< I S _ A R C H I V E D _ C O P Y >----------------------------------------------
compares |title= to 'Archived copy' (placeholder added by bots that can't find proper title); if matches, return true; nil else
]]
local function is_archived_copy (title)
title = mw.ustring.lower(title); -- switch title to lower case
if title:find (cfg.special_case_translation.archived_copy.en) then -- if title is 'Archived copy'
return true;
elseif cfg.special_case_translation.archived_copy['local'] then
if mw.ustring.find (title, cfg.special_case_translation.archived_copy['local']) then -- mw.ustring() because might not be Latin script
return true;
end
end
end
--[[--------------------------< D I S P L A Y _ N A M E S _ S E L E C T >--------------------------------------
for any of the |display-authors=, |display-editors=, etc parameters, select either the local or global setting.
When both are present, look at <local_display_names> value. When the value is some sort of 'et al.'string,
special handling is required.
When {{cs1 config}} has |display-<namelist>= AND this template has |display-<namelist>=etal AND:
the number of names specified by <number_of_names> is:
greater than the number specified in the global |display-<namelist>= parameter (<global_display_names>)
use global |display-<namelist>= parameter value
set overridden maint category
less than or equal to the number specified in the global |display-<namelist>= parameter
use local |display-<namelist>= parameter value
The purpose of this function is to prevent categorizing a template that has fewer names than the global setting
to keep the etal annotation specified by <local_display_names>.
]]
local function display_names_select (global_display_names, local_display_names, param_name, number_of_names, test)
if global_display_names and utilities.is_set (local_display_names) then -- when both
if 'etal' == local_display_names:lower():gsub("[ '%.]", '') then -- the :gsub() portion makes 'etal' from a variety of 'et al.' spellings and stylings
number_of_names = tonumber (number_of_names); -- convert these to numbers for comparison
local global_display_names_num = tonumber (global_display_names); -- <global_display_names> not set when parameter value is not digits
if number_of_names > global_display_names_num then -- template has more names than global config allows to be displayed?
utilities.set_message ('maint_overridden_setting'); -- set a maint message because global is overriding local |display-<namelist>=etal
return global_display_names, 'cs1 config'; -- return global with spoof parameter name (for get_display_names())
else
return local_display_names, param_name; -- return local because fewer names so let <local_display_names> control
end
end
-- here when <global_display_names> and <local_display_names> both numbers; <global_display_names> controls
utilities.set_message ('maint_overridden_setting'); -- set a maint message
return global_display_names, 'cs1 config'; -- return global with spoof parameter name (for get_display_names())
end
-- here when only one of <global_display_names> or <local_display_names> set
if global_display_names then
return global_display_names, 'cs1 config'; -- return global with spoof parameter name (for get_display_names())
else
return local_display_names, param_name; -- return local
end
end
--[[--------------------------< C I T A T I O N 0 >------------------------------------------------------------
This is the main function doing the majority of the citation formatting.
]]
local function citation0( config, args )
--[[
Load Input Parameters
The argument_wrapper facilitates the mapping of multiple aliases to single internal variable.
]]
local A = argument_wrapper ( args );
local i
-- Pick out the relevant fields from the arguments. Different citation templates
-- define different field names for the same underlying things.
local author_etal;
local a = {}; -- authors list from |lastn= / |firstn= pairs or |vauthors=
local Authors;
local NameListStyle;
if cfg.global_cs1_config_t['NameListStyle'] then -- global setting in {{cs1 config}} overrides local |name-list-style= parameter value; nil when empty or assigned value invalid
NameListStyle = is_valid_parameter_value (cfg.global_cs1_config_t['NameListStyle'], 'cs1 config: name-list-style', cfg.keywords_lists['name-list-style'], ''); -- error messaging 'param' here is a hoax
else
NameListStyle = is_valid_parameter_value (A['NameListStyle'], A:ORIGIN('NameListStyle'), cfg.keywords_lists['name-list-style'], '');
end
if cfg.global_cs1_config_t['NameListStyle'] and utilities.is_set (A['NameListStyle']) then -- when template has |name-list-style=<something> which global setting has overridden
utilities.set_message ('maint_overridden_setting'); -- set a maint message
end
local Collaboration = A['Collaboration'];
do -- to limit scope of selected
local selected = select_author_editor_source (A['Vauthors'], A['Authors'], args, 'AuthorList');
if 1 == selected then
a, author_etal = extract_names (args, 'AuthorList'); -- fetch author list from |authorn= / |lastn= / |firstn=, |author-linkn=, and |author-maskn=
elseif 2 == selected then
NameListStyle = 'vanc'; -- override whatever |name-list-style= might be
a, author_etal = parse_vauthors_veditors (args, A['Vauthors'], 'AuthorList'); -- fetch author list from |vauthors=, |author-linkn=, and |author-maskn=
elseif 3 == selected then
Authors = A['Authors']; -- use content of |people= or |credits=; |authors= is deprecated; TODO: constrain |people= and |credits= to cite av media, episode, serial?
end
if utilities.is_set (Collaboration) then
author_etal = true; -- so that |display-authors=etal not required
end
end
local editor_etal;
local e = {}; -- editors list from |editor-lastn= / |editor-firstn= pairs or |veditors=
do -- to limit scope of selected
local selected = select_author_editor_source (A['Veditors'], nil, args, 'EditorList'); -- support for |editors= withdrawn
if 1 == selected then
e, editor_etal = extract_names (args, 'EditorList'); -- fetch editor list from |editorn= / |editor-lastn= / |editor-firstn=, |editor-linkn=, and |editor-maskn=
elseif 2 == selected then
NameListStyle = 'vanc'; -- override whatever |name-list-style= might be
e, editor_etal = parse_vauthors_veditors (args, args.veditors, 'EditorList'); -- fetch editor list from |veditors=, |editor-linkn=, and |editor-maskn=
end
end
local Chapter = A['Chapter']; -- done here so that we have access to |contribution= from |chapter= aliases
local Chapter_origin = A:ORIGIN ('Chapter');
local Contribution; -- because contribution is required for contributor(s)
if 'contribution' == Chapter_origin then
Contribution = Chapter; -- get the name of the contribution
end
local c = {}; -- contributors list from |contributor-lastn= / contributor-firstn= pairs
if utilities.in_array (config.CitationClass, {"book", "citation"}) and not utilities.is_set (A['Periodical']) then -- |contributor= and |contribution= only supported in book cites
c = extract_names (args, 'ContributorList'); -- fetch contributor list from |contributorn= / |contributor-lastn=, -firstn=, -linkn=, -maskn=
if 0 < #c then
if not utilities.is_set (Contribution) then -- |contributor= requires |contribution=
utilities.set_message ('err_contributor_missing_required_param', 'contribution'); -- add missing contribution error message
c = {}; -- blank the contributors' table; it is used as a flag later
end
if 0 == #a then -- |contributor= requires |author=
utilities.set_message ('err_contributor_missing_required_param', 'author'); -- add missing author error message
c = {}; -- blank the contributors' table; it is used as a flag later
end
end
else -- if not a book cite
if utilities.select_one (args, cfg.aliases['ContributorList-Last'], 'err_redundant_parameters', 1 ) then -- are there contributor name list parameters?
utilities.set_message ('err_contributor_ignored'); -- add contributor ignored error message
end
Contribution = nil; -- unset
end
local Title = A['Title'];
local TitleLink = A['TitleLink'];
local auto_select = ''; -- default is auto
local accept_link;
TitleLink, accept_link = utilities.has_accept_as_written (TitleLink, true); -- test for accept-this-as-written markup
if (not accept_link) and utilities.in_array (TitleLink, {'none', 'pmc', 'doi'}) then -- check for special keywords
auto_select = TitleLink; -- remember selection for later
TitleLink = ''; -- treat as if |title-link= would have been empty
end
TitleLink = link_title_ok (TitleLink, A:ORIGIN ('TitleLink'), Title, 'title'); -- check for wiki-markup in |title-link= or wiki-markup in |title= when |title-link= is set
local Section = ''; -- {{cite map}} only; preset to empty string for concatenation if not used
if 'map' == config.CitationClass and 'section' == Chapter_origin then
Section = A['Chapter']; -- get |section= from |chapter= alias list; |chapter= and the other aliases not supported in {{cite map}}
Chapter = ''; -- unset for now; will be reset later from |map= if present
end
local Periodical = A['Periodical'];
local Periodical_origin = A:ORIGIN('Periodical');
local ScriptPeriodical = A['ScriptPeriodical'];
local ScriptPeriodical_origin = A:ORIGIN('ScriptPeriodical');
local TransPeriodical = A['TransPeriodical'];
local TransPeriodical_origin = A:ORIGIN ('TransPeriodical');
if (utilities.in_array (config.CitationClass, {'book', 'encyclopaedia'}) and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical) or utilities.is_set (TransPeriodical))) then
local param;
if utilities.is_set (Periodical) then -- get a parameter name from one of these periodical related meta-parameters
Periodical = ''; -- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters
param = Periodical_origin -- get parameter name for error messaging
elseif utilities.is_set (TransPeriodical) then
TransPeriodical = ''; -- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters
param = TransPeriodical_origin; -- get parameter name for error messaging
elseif utilities.is_set (ScriptPeriodical) then
ScriptPeriodical = ''; -- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters
param = ScriptPeriodical_origin; -- get parameter name for error messaging
end
if utilities.is_set (param) then -- if we found one
utilities.set_message ('err_periodical_ignored', {param}); -- emit an error message
end
end
if utilities.is_set (Periodical) then
local i;
Periodical, i = utilities.strip_apostrophe_markup (Periodical); -- strip apostrophe markup so that metadata isn't contaminated
if i then -- non-zero when markup was stripped so emit an error message
utilities.set_message ('err_apostrophe_markup', {Periodical_origin});
end
end
if 'mailinglist' == config.CitationClass then -- special case for {{cite mailing list}}
if utilities.is_set (Periodical) and utilities.is_set (A ['MailingList']) then -- both set emit an error TODO: make a function for this and similar?
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', Periodical_origin) .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'mailinglist')});
end
Periodical = A ['MailingList']; -- error or no, set Periodical to |mailinglist= value because this template is {{cite mailing list}}
Periodical_origin = A:ORIGIN('MailingList');
end
-- web and news not tested for now because of
-- Wikipedia:Administrators%27_noticeboard#Is_there_a_semi-automated_tool_that_could_fix_these_annoying_"Cite_Web"_errors?
if not (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) then -- 'periodical' templates require periodical parameter
-- local p = {['journal'] = 'journal', ['magazine'] = 'magazine', ['news'] = 'newspaper', ['web'] = 'website'}; -- for error message
local p = {['journal'] = 'journal', ['magazine'] = 'magazine'}; -- for error message
if p[config.CitationClass] then
utilities.set_message ('err_missing_periodical', {config.CitationClass, p[config.CitationClass]});
end
end
local Volume;
if 'citation' == config.CitationClass then
if utilities.is_set (Periodical) then
if not utilities.in_array (Periodical_origin, cfg.citation_no_volume_t) then -- {{citation}} does not render |volume= when these parameters are used
Volume = A['Volume']; -- but does for all other 'periodicals'
end
elseif utilities.is_set (ScriptPeriodical) then
if 'script-website' ~= ScriptPeriodical_origin then -- {{citation}} does not render volume for |script-website=
Volume = A['Volume']; -- but does for all other 'periodicals'
end
else
Volume = A['Volume']; -- and does for non-'periodical' cites
end
elseif utilities.in_array (config.CitationClass, cfg.templates_using_volume) then -- render |volume= for cs1 according to the configuration settings
Volume = A['Volume'];
end
extra_text_in_vol_iss_check (Volume, A:ORIGIN ('Volume'), 'v');
local Issue;
if 'citation' == config.CitationClass then
if utilities.is_set (Periodical) and utilities.in_array (Periodical_origin, cfg.citation_issue_t) then -- {{citation}} may render |issue= when these parameters are used
Issue = utilities.hyphen_to_dash (A['Issue']);
end
elseif utilities.in_array (config.CitationClass, cfg.templates_using_issue) then -- conference & map books do not support issue; {{citation}} listed here because included in settings table
if not (utilities.in_array (config.CitationClass, {'conference', 'map', 'citation'}) and not (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical))) then
Issue = utilities.hyphen_to_dash (A['Issue']);
end
end
local ArticleNumber;
if utilities.in_array (config.CitationClass, {'journal', 'conference'}) or ('citation' == config.CitationClass and utilities.is_set (Periodical) and 'journal' == Periodical_origin) then
ArticleNumber = A['ArticleNumber'];
end
extra_text_in_vol_iss_check (Issue, A:ORIGIN ('Issue'), 'i');
local Page;
local Pages;
local At;
local QuotePage;
local QuotePages;
if not utilities.in_array (config.CitationClass, cfg.templates_not_using_page) then -- TODO: rewrite to emit ignored parameter error message?
Page = A['Page'];
Pages = utilities.hyphen_to_dash (A['Pages']);
At = A['At'];
QuotePage = A['QuotePage'];
QuotePages = utilities.hyphen_to_dash (A['QuotePages']);
end
local Edition = A['Edition'];
local PublicationPlace = place_check (A['PublicationPlace'], A:ORIGIN('PublicationPlace'));
local Place = place_check (A['Place'], A:ORIGIN('Place'));
local PublisherName = A['PublisherName'];
local PublisherName_origin = A:ORIGIN('PublisherName');
if utilities.is_set (PublisherName) and (cfg.keywords_xlate['none'] ~= PublisherName) then
local i = 0;
PublisherName, i = utilities.strip_apostrophe_markup (PublisherName); -- strip apostrophe markup so that metadata isn't contaminated; publisher is never italicized
if i and (0 < i) then -- non-zero when markup was stripped so emit an error message
utilities.set_message ('err_apostrophe_markup', {PublisherName_origin});
end
end
if ('document' == config.CitationClass) and not utilities.is_set (PublisherName) then
utilities.set_message ('err_missing_publisher', {config.CitationClass, 'publisher'});
end
local Newsgroup = A['Newsgroup']; -- TODO: strip apostrophe markup?
local Newsgroup_origin = A:ORIGIN('Newsgroup');
if 'newsgroup' == config.CitationClass then
if utilities.is_set (PublisherName) and (cfg.keywords_xlate['none'] ~= PublisherName) then -- general use parameter |publisher= not allowed in cite newsgroup
utilities.set_message ('err_parameter_ignored', {PublisherName_origin});
end
PublisherName = nil; -- ensure that this parameter is unset for the time being; will be used again after COinS
end
local URL = A['URL']; -- TODO: better way to do this for URL, ChapterURL, and MapURL?
local UrlAccess = is_valid_parameter_value (A['UrlAccess'], A:ORIGIN('UrlAccess'), cfg.keywords_lists['url-access'], nil);
if not utilities.is_set (URL) and utilities.is_set (UrlAccess) then
UrlAccess = nil;
utilities.set_message ('err_param_access_requires_param', 'url');
end
local ChapterURL = A['ChapterURL'];
local ChapterUrlAccess = is_valid_parameter_value (A['ChapterUrlAccess'], A:ORIGIN('ChapterUrlAccess'), cfg.keywords_lists['url-access'], nil);
if not utilities.is_set (ChapterURL) and utilities.is_set (ChapterUrlAccess) then
ChapterUrlAccess = nil;
utilities.set_message ('err_param_access_requires_param', {A:ORIGIN('ChapterUrlAccess'):gsub ('%-access', '')});
end
local MapUrlAccess = is_valid_parameter_value (A['MapUrlAccess'], A:ORIGIN('MapUrlAccess'), cfg.keywords_lists['url-access'], nil);
if not utilities.is_set (A['MapURL']) and utilities.is_set (MapUrlAccess) then
MapUrlAccess = nil;
utilities.set_message ('err_param_access_requires_param', {'map-url'});
end
local this_page = mw.title.getCurrentTitle(); -- also used for COinS and for language
local no_tracking_cats = is_valid_parameter_value (A['NoTracking'], A:ORIGIN('NoTracking'), cfg.keywords_lists['yes_true_y'], nil);
-- check this page to see if it is in one of the namespaces that cs1 is not supposed to add to the error categories
if not utilities.is_set (no_tracking_cats) then -- ignore if we are already not going to categorize this page
if cfg.uncategorized_namespaces[this_page.namespace] then -- is this page's namespace id one of the uncategorized namespace ids?
no_tracking_cats = "true"; -- set no_tracking_cats
end
for _, v in ipairs (cfg.uncategorized_subpages) do -- cycle through page name patterns
if this_page.text:match (v) then -- test page name against each pattern
no_tracking_cats = "true"; -- set no_tracking_cats
break; -- bail out if one is found
end
end
end
-- check for extra |page=, |pages= or |at= parameters. (also sheet and sheets while we're at it)
utilities.select_one (args, {'page', 'p', 'pp', 'pages', 'at', 'sheet', 'sheets'}, 'err_redundant_parameters'); -- this is a dummy call simply to get the error message and category
local coins_pages;
Page, Pages, At, coins_pages = insource_loc_get (Page, A:ORIGIN('Page'), Pages, A:ORIGIN('Pages'), At);
local NoPP = is_valid_parameter_value (A['NoPP'], A:ORIGIN('NoPP'), cfg.keywords_lists['yes_true_y'], nil);
if utilities.is_set (PublicationPlace) and utilities.is_set (Place) then -- both |publication-place= and |place= (|location=) allowed if different
utilities.add_prop_cat ('location-test'); -- add property cat to evaluate how often PublicationPlace and Place are used together
if PublicationPlace == Place then
Place = ''; -- unset; don't need both if they are the same
end
elseif not utilities.is_set (PublicationPlace) and utilities.is_set (Place) then -- when only |place= (|location=) is set ...
PublicationPlace = Place; -- promote |place= (|location=) to |publication-place
end
if PublicationPlace == Place then Place = ''; end -- don't need both if they are the same
local URL_origin = A:ORIGIN('URL'); -- get name of parameter that holds URL
local ChapterURL_origin = A:ORIGIN('ChapterURL'); -- get name of parameter that holds ChapterURL
local ScriptChapter = A['ScriptChapter'];
local ScriptChapter_origin = A:ORIGIN ('ScriptChapter');
local Format = A['Format'];
local ChapterFormat = A['ChapterFormat'];
local TransChapter = A['TransChapter'];
local TransChapter_origin = A:ORIGIN ('TransChapter');
local TransTitle = A['TransTitle'];
local ScriptTitle = A['ScriptTitle'];
--[[
Parameter remapping for cite encyclopedia:
When the citation has these parameters:
|encyclopedia= and |title= then map |title= to |article= and |encyclopedia= to |title= for rendering
|encyclopedia= and |article= then map |encyclopedia= to |title= for rendering
|trans-title= maps to |trans-chapter= when |title= is re-mapped
|url= maps to |chapter-url= when |title= is remapped
All other combinations of |encyclopedia=, |title=, and |article= are not modified
]]
local Encyclopedia = A['Encyclopedia']; -- used as a flag by this module and by ~/COinS
if utilities.is_set (Encyclopedia) then -- emit error message when Encyclopedia set but template is other than {{cite encyclopedia}} or {{citation}}
if 'encyclopaedia' ~= config.CitationClass and 'citation' ~= config.CitationClass then
utilities.set_message ('err_parameter_ignored', {A:ORIGIN ('Encyclopedia')});
Encyclopedia = nil; -- unset because not supported by this template
end
end
if ('encyclopaedia' == config.CitationClass) or ('citation' == config.CitationClass and utilities.is_set (Encyclopedia)) then
if utilities.is_set (Periodical) and utilities.is_set (Encyclopedia) then -- when both parameters set emit an error message; {{citation}} only; Periodical not allowed in {{cite encyclopedia}}
utilities.set_message ('err_periodical_ignored', {Periodical_origin});
end
if utilities.is_set (Encyclopedia) then
Periodical = Encyclopedia; -- error or no, set Periodical to Encyclopedia for rendering; {{citation}} could (not legitimately) have both; use Encyclopedia
Periodical_origin = A:ORIGIN ('Encyclopedia');
if utilities.is_set (Title) or utilities.is_set (ScriptTitle) then
if not utilities.is_set (Chapter) then
Chapter = Title; -- |encyclopedia= and |title= are set so map |title= to |article= and |encyclopedia= to |title= for rendering
ScriptChapter = ScriptTitle;
ScriptChapter_origin = A:ORIGIN('ScriptTitle')
TransChapter = TransTitle;
ChapterURL = URL;
ChapterURL_origin = URL_origin;
ChapterUrlAccess = UrlAccess;
if not utilities.is_set (ChapterURL) and utilities.is_set (TitleLink) then
Chapter = utilities.make_wikilink (TitleLink, Chapter);
end
Title = Periodical;
ChapterFormat = Format;
Periodical = ''; -- redundant so unset
TransTitle = '';
URL = '';
Format = '';
TitleLink = '';
ScriptTitle = '';
end
elseif utilities.is_set (Chapter) or utilities.is_set (ScriptChapter) then -- |title= not set
Title = Periodical; -- |encyclopedia= set and |article= set so map |encyclopedia= to |title= for rendering
Periodical = ''; -- redundant so unset
end
end
end
-- special case for cite techreport.
local ID = A['ID'];
if (config.CitationClass == "techreport") then -- special case for cite techreport
if utilities.is_set (A['Number']) then -- cite techreport uses 'number', which other citations alias to 'issue'
if not utilities.is_set (ID) then -- can we use ID for the "number"?
ID = A['Number']; -- yes, use it
else -- ID has a value so emit error message
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'id') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'number')});
end
end
end
-- Account for the oddity that is {{cite conference}}, before generation of COinS data.
local ChapterLink -- = A['ChapterLink']; -- deprecated as a parameter but still used internally by cite episode
local Conference = A['Conference'];
local BookTitle = A['BookTitle'];
local TransTitle_origin = A:ORIGIN ('TransTitle');
if 'conference' == config.CitationClass then
if utilities.is_set (BookTitle) then
Chapter = Title;
Chapter_origin = 'title';
-- ChapterLink = TitleLink; -- |chapter-link= is deprecated
ChapterURL = URL;
ChapterUrlAccess = UrlAccess;
ChapterURL_origin = URL_origin;
URL_origin = '';
ChapterFormat = Format;
TransChapter = TransTitle;
TransChapter_origin = TransTitle_origin;
Title = BookTitle;
Format = '';
-- TitleLink = '';
TransTitle = '';
URL = '';
end
elseif 'speech' ~= config.CitationClass then
Conference = ''; -- not cite conference or cite speech so make sure this is empty string
end
-- CS1/2 mode
local Mode;
if cfg.global_cs1_config_t['Mode'] then -- global setting in {{cs1 config}} overrides local |mode= parameter value; nil when empty or assigned value invalid
Mode = is_valid_parameter_value (cfg.global_cs1_config_t['Mode'], 'cs1 config: mode', cfg.keywords_lists['mode'], ''); -- error messaging 'param' here is a hoax
else
Mode = is_valid_parameter_value (A['Mode'], A:ORIGIN('Mode'), cfg.keywords_lists['mode'], '');
end
if cfg.global_cs1_config_t['Mode'] and utilities.is_set (A['Mode']) then -- when template has |mode=<something> which global setting has overridden
utilities.set_message ('maint_overridden_setting'); -- set a maint message
end
-- separator character and postscript
local sepc, PostScript = set_style (Mode:lower(), A['PostScript'], config.CitationClass);
-- controls capitalization of certain static text
local use_lowercase = ( sepc == ',' );
-- cite map oddities
local Cartography = "";
local Scale = "";
local Sheet = A['Sheet'] or '';
local Sheets = A['Sheets'] or '';
if config.CitationClass == "map" then
if utilities.is_set (Chapter) then --TODO: make a function for this and similar?
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'map') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', Chapter_origin)}); -- add error message
end
Chapter = A['Map'];
Chapter_origin = A:ORIGIN('Map');
ChapterURL = A['MapURL'];
ChapterURL_origin = A:ORIGIN('MapURL');
TransChapter = A['TransMap'];
ScriptChapter = A['ScriptMap']
ScriptChapter_origin = A:ORIGIN('ScriptMap')
ChapterUrlAccess = MapUrlAccess;
ChapterFormat = A['MapFormat'];
Cartography = A['Cartography'];
if utilities.is_set ( Cartography ) then
Cartography = sepc .. " " .. wrap_msg ('cartography', Cartography, use_lowercase);
end
Scale = A['Scale'];
if utilities.is_set ( Scale ) then
Scale = sepc .. " " .. Scale;
end
end
-- Account for the oddities that are {{cite episode}} and {{cite serial}}, before generation of COinS data.
local Series = A['Series'];
if 'episode' == config.CitationClass or 'serial' == config.CitationClass then
local SeriesLink = A['SeriesLink'];
SeriesLink = link_title_ok (SeriesLink, A:ORIGIN ('SeriesLink'), Series, 'series'); -- check for wiki-markup in |series-link= or wiki-markup in |series= when |series-link= is set
local Network = A['Network'];
local Station = A['Station'];
local s, n = {}, {};
-- do common parameters first
if utilities.is_set (Network) then table.insert(n, Network); end
if utilities.is_set (Station) then table.insert(n, Station); end
ID = table.concat(n, sepc .. ' ');
if 'episode' == config.CitationClass then -- handle the oddities that are strictly {{cite episode}}
local Season = A['Season'];
local SeriesNumber = A['SeriesNumber'];
if utilities.is_set (Season) and utilities.is_set (SeriesNumber) then -- these are mutually exclusive so if both are set TODO: make a function for this and similar?
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'season') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'seriesno')}); -- add error message
SeriesNumber = ''; -- unset; prefer |season= over |seriesno=
end
-- assemble a table of parts concatenated later into Series
if utilities.is_set (Season) then table.insert(s, wrap_msg ('season', Season, use_lowercase)); end
if utilities.is_set (SeriesNumber) then table.insert(s, wrap_msg ('seriesnum', SeriesNumber, use_lowercase)); end
if utilities.is_set (Issue) then table.insert(s, wrap_msg ('episode', Issue, use_lowercase)); end
Issue = ''; -- unset because this is not a unique parameter
Chapter = Title; -- promote title parameters to chapter
ScriptChapter = ScriptTitle;
ScriptChapter_origin = A:ORIGIN('ScriptTitle');
ChapterLink = TitleLink; -- alias |episode-link=
TransChapter = TransTitle;
ChapterURL = URL;
ChapterUrlAccess = UrlAccess;
ChapterURL_origin = URL_origin;
ChapterFormat = Format;
Title = Series; -- promote series to title
TitleLink = SeriesLink;
Series = table.concat(s, sepc .. ' '); -- this is concatenation of season, seriesno, episode number
if utilities.is_set (ChapterLink) and not utilities.is_set (ChapterURL) then -- link but not URL
Chapter = utilities.make_wikilink (ChapterLink, Chapter);
elseif utilities.is_set (ChapterLink) and utilities.is_set (ChapterURL) then -- if both are set, URL links episode;
Series = utilities.make_wikilink (ChapterLink, Series);
end
URL = ''; -- unset
TransTitle = '';
ScriptTitle = '';
Format = '';
else -- now oddities that are cite serial
Issue = ''; -- unset because this parameter no longer supported by the citation/core version of cite serial
Chapter = A['Episode']; -- TODO: make |episode= available to cite episode someday?
if utilities.is_set (Series) and utilities.is_set (SeriesLink) then
Series = utilities.make_wikilink (SeriesLink, Series);
end
Series = utilities.wrap_style ('italic-title', Series); -- series is italicized
end
end
-- end of {{cite episode}} stuff
-- handle type parameter for those CS1 citations that have default values
local TitleType = A['TitleType'];
local Degree = A['Degree'];
if utilities.in_array (config.CitationClass, {'AV-media-notes', 'document', 'interview', 'mailinglist', 'map', 'podcast', 'pressrelease', 'report', 'speech', 'techreport', 'thesis'}) then
TitleType = set_titletype (config.CitationClass, TitleType);
if utilities.is_set (Degree) and "Thesis" == TitleType then -- special case for cite thesis
TitleType = Degree .. ' ' .. cfg.title_types ['thesis']:lower();
end
end
if utilities.is_set (TitleType) then -- if type parameter is specified
TitleType = utilities.substitute ( cfg.messages['type'], TitleType); -- display it in parentheses
-- TODO: Hack on TitleType to fix bunched parentheses problem
end
-- legacy: promote PublicationDate to Date if neither Date nor Year are set.
local Date = A['Date'];
local Date_origin; -- to hold the name of parameter promoted to Date; required for date error messaging
local PublicationDate = A['PublicationDate'];
local Year = A['Year'];
if not utilities.is_set (Date) then
Date = Year; -- promote Year to Date
Year = nil; -- make nil so Year as empty string isn't used for CITEREF
if not utilities.is_set (Date) and utilities.is_set (PublicationDate) then -- use PublicationDate when |date= and |year= are not set
Date = PublicationDate; -- promote PublicationDate to Date
PublicationDate = ''; -- unset, no longer needed
Date_origin = A:ORIGIN('PublicationDate'); -- save the name of the promoted parameter
else
Date_origin = A:ORIGIN('Year'); -- save the name of the promoted parameter
end
else
Date_origin = A:ORIGIN('Date'); -- not a promotion; name required for error messaging
end
if PublicationDate == Date then PublicationDate = ''; end -- if PublicationDate is same as Date, don't display in rendered citation
--[[
Go test all of the date-holding parameters for valid MOS:DATE format and make sure that dates are real dates. This must be done before we do COinS because here is where
we get the date used in the metadata.
Date validation supporting code is in Module:Citation/CS1/Date_validation
]]
local DF = is_valid_parameter_value (A['DF'], A:ORIGIN('DF'), cfg.keywords_lists['df'], '');
if not utilities.is_set (DF) then
DF = cfg.global_df; -- local |df= if present overrides global df set by {{use xxx date}} template
end
local ArchiveURL;
local ArchiveDate;
local ArchiveFormat = A['ArchiveFormat'];
local archive_url_timestamp; -- timestamp from wayback machine url
ArchiveURL, ArchiveDate, archive_url_timestamp = archive_url_check (A['ArchiveURL'], A['ArchiveDate'])
ArchiveFormat = style_format (ArchiveFormat, ArchiveURL, 'archive-format', 'archive-url');
ArchiveURL, ArchiveDate = is_unique_archive_url (ArchiveURL, URL, ChapterURL, A:ORIGIN('ArchiveURL'), ArchiveDate); -- add error message when URL or ChapterURL == ArchiveURL
local AccessDate = A['AccessDate'];
local COinS_date = {}; -- holds date info extracted from |date= for the COinS metadata by Module:Date verification
local DoiBroken = A['DoiBroken'];
local Embargo = A['Embargo'];
local anchor_year; -- used in the CITEREF identifier
do -- create defined block to contain local variables error_message, date_parameters_list, mismatch
local error_message = '';
-- AirDate has been promoted to Date so not necessary to check it
local date_parameters_list = {
['access-date'] = {val = AccessDate, name = A:ORIGIN ('AccessDate')},
['archive-date'] = {val = ArchiveDate, name = A:ORIGIN ('ArchiveDate')},
['date'] = {val = Date, name = Date_origin},
['doi-broken-date'] = {val = DoiBroken, name = A:ORIGIN ('DoiBroken')},
['pmc-embargo-date'] = {val = Embargo, name = A:ORIGIN ('Embargo')},
['publication-date'] = {val = PublicationDate, name = A:ORIGIN ('PublicationDate')},
['year'] = {val = Year, name = A:ORIGIN ('Year')},
};
local error_list = {};
anchor_year, Embargo = validation.dates(date_parameters_list, COinS_date, error_list);
-- start temporary Julian / Gregorian calendar uncertainty categorization
if COinS_date.inter_cal_cat then
utilities.add_prop_cat ('jul-greg-uncertainty');
end
-- end temporary Julian / Gregorian calendar uncertainty categorization
if utilities.is_set (Year) and utilities.is_set (Date) then -- both |date= and |year= not normally needed;
validation.year_date_check (Year, A:ORIGIN ('Year'), Date, A:ORIGIN ('Date'), error_list);
end
if 0 == #error_list then -- error free dates only; 0 when error_list is empty
local modified = false; -- flag
if utilities.is_set (DF) then -- if we need to reformat dates
modified = validation.reformat_dates (date_parameters_list, DF); -- reformat to DF format, use long month names if appropriate
end
if true == validation.date_hyphen_to_dash (date_parameters_list) then -- convert hyphens to dashes where appropriate
modified = true;
utilities.set_message ('maint_date_format'); -- hyphens were converted so add maint category
end
-- for those wikis that can and want to have English date names translated to the local language; not supported at en.wiki
if cfg.date_name_auto_xlate_enable and validation.date_name_xlate (date_parameters_list, cfg.date_digit_auto_xlate_enable ) then
utilities.set_message ('maint_date_auto_xlated'); -- add maint cat
modified = true;
end
if modified then -- if the date_parameters_list values were modified
AccessDate = date_parameters_list['access-date'].val; -- overwrite date holding parameters with modified values
ArchiveDate = date_parameters_list['archive-date'].val;
Date = date_parameters_list['date'].val;
DoiBroken = date_parameters_list['doi-broken-date'].val;
PublicationDate = date_parameters_list['publication-date'].val;
end
if archive_url_timestamp and utilities.is_set (ArchiveDate) then
validation.archive_date_check (ArchiveDate, archive_url_timestamp, DF); -- does YYYYMMDD in archive_url_timestamp match date in ArchiveDate
end
else
utilities.set_message ('err_bad_date', {utilities.make_sep_list (#error_list, error_list)}); -- add this error message
end
end -- end of do
if utilities.in_array (config.CitationClass, {'book', 'encyclopaedia'}) or -- {{cite book}}, {{cite encyclopedia}}; TODO: {{cite conference}} and others?
('citation' == config.CitationClass and utilities.is_set (Encyclopedia)) or -- {{citation}} as an encylopedia citation
('citation' == config.CitationClass and not utilities.is_set (Periodical)) then -- {{citation}} as a book citation
if utilities.is_set (PublicationPlace) then
if not utilities.is_set (PublisherName) then
local date = COinS_date.rftdate and tonumber (COinS_date.rftdate:match ('%d%d%d%d')); -- get year portion of COinS date (because in Arabic numerals); convert string to number
if date and (1850 <= date) then -- location has no publisher; if date is 1850 or later
utilities.set_message ('maint_location_no_publisher'); -- add maint cat
end
else -- PublisherName has a value
if cfg.keywords_xlate['none'] == PublisherName then -- if that value is 'none' (only for book and encyclopedia citations)
PublisherName = ''; -- unset
end
end
end
end
local ID_list = {}; -- sequence table of rendered identifiers
local ID_list_coins = {}; -- table of identifiers and their values from args; key is same as cfg.id_handlers's key
local Class = A['Class']; -- arxiv class identifier
local ID_support = {
{A['ASINTLD'], 'ASIN', 'err_asintld_missing_asin', A:ORIGIN ('ASINTLD')},
{DoiBroken, 'DOI', 'err_doibroken_missing_doi', A:ORIGIN ('DoiBroken')},
{Embargo, 'PMC', 'err_embargo_missing_pmc', A:ORIGIN ('Embargo')},
}
ID_list, ID_list_coins = identifiers.identifier_lists_get (args, {DoiBroken = DoiBroken, ASINTLD = A['ASINTLD'], Embargo = Embargo, Class = Class}, ID_support);
-- Account for the oddities that are {{cite arxiv}}, {{cite biorxiv}}, {{cite citeseerx}}, {{cite medrxiv}}, {{cite ssrn}}, before generation of COinS data.
if utilities.in_array (config.CitationClass, whitelist.preprint_template_list_t) then -- |arxiv= or |eprint= required for cite arxiv; |biorxiv=, |citeseerx=, |medrxiv=, |ssrn= required for their templates
if not (args[cfg.id_handlers[config.CitationClass:upper()].parameters[1]] or -- can't use ID_list_coins k/v table here because invalid parameters omitted
args[cfg.id_handlers[config.CitationClass:upper()].parameters[2]]) then -- which causes unexpected parameter missing error message
utilities.set_message ('err_' .. config.CitationClass .. '_missing'); -- add error message
end
Periodical = ({['arxiv'] = 'arXiv', ['biorxiv'] = 'bioRxiv', ['citeseerx'] = 'CiteSeerX', ['medrxiv'] = 'medRxiv', ['ssrn'] = 'Social Science Research Network'})[config.CitationClass];
end
-- Link the title of the work if no |url= was provided, but we have a |pmc= or a |doi= with |doi-access=free
if config.CitationClass == "journal" and not utilities.is_set (URL) and not utilities.is_set (TitleLink) and not utilities.in_array (cfg.keywords_xlate[Title], {'off', 'none'}) then -- TODO: remove 'none' once existing citations have been switched to 'off', so 'none' can be used as token for "no title" instead
if 'none' ~= cfg.keywords_xlate[auto_select] then -- if auto-linking not disabled
if identifiers.auto_link_urls[auto_select] then -- manual selection
URL = identifiers.auto_link_urls[auto_select]; -- set URL to be the same as identifier's external link
URL_origin = cfg.id_handlers[auto_select:upper()].parameters[1]; -- set URL_origin to parameter name for use in error message if citation is missing a |title=
elseif identifiers.auto_link_urls['pmc'] then -- auto-select PMC
URL = identifiers.auto_link_urls['pmc']; -- set URL to be the same as the PMC external link if not embargoed
URL_origin = cfg.id_handlers['PMC'].parameters[1]; -- set URL_origin to parameter name for use in error message if citation is missing a |title=
elseif identifiers.auto_link_urls['doi'] then -- auto-select DOI
URL = identifiers.auto_link_urls['doi'];
URL_origin = cfg.id_handlers['DOI'].parameters[1];
end
end
if utilities.is_set (URL) then -- set when using an identifier-created URL
if utilities.is_set (AccessDate) then -- |access-date= requires |url=; identifier-created URL is not |url=
utilities.set_message ('err_accessdate_missing_url'); -- add an error message
AccessDate = ''; -- unset
end
if utilities.is_set (ArchiveURL) then -- |archive-url= requires |url=; identifier-created URL is not |url=
utilities.set_message ('err_archive_missing_url'); -- add an error message
ArchiveURL = ''; -- unset
end
end
end
-- At this point fields may be nil if they weren't specified in the template use. We can use that fact.
-- Test if citation has no title
if not utilities.is_set (Title) and not utilities.is_set (TransTitle) and not utilities.is_set (ScriptTitle) then -- has special case for cite episode
utilities.set_message ('err_citation_missing_title', {'episode' == config.CitationClass and 'series' or 'title'});
end
if utilities.in_array (cfg.keywords_xlate[Title], {'off', 'none'}) and
utilities.in_array (config.CitationClass, {'journal', 'citation'}) and
(utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and
('journal' == Periodical_origin or 'script-journal' == ScriptPeriodical_origin) then -- special case for journal cites
Title = ''; -- set title to empty string
utilities.set_message ('maint_untitled'); -- add maint cat
end
-- COinS metadata (see <http://ocoins.info/>) for automated parsing of citation information.
-- handle the oddity that is cite encyclopedia and {{citation |encyclopedia=something}}. Here we presume that
-- when Periodical, Title, and Chapter are all set, then Periodical is the book (encyclopedia) title, Title
-- is the article title, and Chapter is a section within the article. So, we remap
local coins_chapter = Chapter; -- default assuming that remapping not required
local coins_title = Title; -- et tu
if 'encyclopaedia' == config.CitationClass or ('citation' == config.CitationClass and utilities.is_set (Encyclopedia)) then
if utilities.is_set (Chapter) and utilities.is_set (Title) and utilities.is_set (Periodical) then -- if all are used then
coins_chapter = Title; -- remap
coins_title = Periodical;
end
end
local coins_author = a; -- default for coins rft.au
if 0 < #c then -- but if contributor list
coins_author = c; -- use that instead
end
-- this is the function call to COinS()
local OCinSoutput = metadata.COinS({
['Periodical'] = utilities.strip_apostrophe_markup (Periodical), -- no markup in the metadata
['Encyclopedia'] = Encyclopedia, -- just a flag; content ignored by ~/COinS
['Chapter'] = metadata.make_coins_title (coins_chapter, ScriptChapter), -- Chapter and ScriptChapter stripped of bold / italic / accept-as-written markup
['Degree'] = Degree; -- cite thesis only
['Title'] = metadata.make_coins_title (coins_title, ScriptTitle), -- Title and ScriptTitle stripped of bold / italic / accept-as-written markup
['PublicationPlace'] = PublicationPlace,
['Date'] = COinS_date.rftdate, -- COinS_date.* has correctly formatted date values if Date is valid;
['Season'] = COinS_date.rftssn,
['Quarter'] = COinS_date.rftquarter,
['Chron'] = COinS_date.rftchron,
['Series'] = Series,
['Volume'] = Volume,
['Issue'] = Issue,
['ArticleNumber'] = ArticleNumber,
['Pages'] = coins_pages or metadata.get_coins_pages (first_set ({Sheet, Sheets, Page, Pages, At, QuotePage, QuotePages}, 7)), -- pages stripped of external links
['Edition'] = Edition,
['PublisherName'] = PublisherName or Newsgroup, -- any apostrophe markup already removed from PublisherName
['URL'] = first_set ({ChapterURL, URL}, 2),
['Authors'] = coins_author,
['ID_list'] = ID_list_coins,
['RawPage'] = this_page.prefixedText,
}, config.CitationClass);
-- Account for the oddities that are {{cite arxiv}}, {{cite biorxiv}}, {{cite citeseerx}}, {{cite medrxiv}}, and {{cite ssrn}} AFTER generation of COinS data.
if utilities.in_array (config.CitationClass, whitelist.preprint_template_list_t) then -- we have set rft.jtitle in COinS to arXiv, bioRxiv, CiteSeerX, medRxiv, or ssrn now unset so it isn't displayed
Periodical = ''; -- periodical not allowed in these templates; if article has been published, use cite journal
end
-- special case for cite newsgroup. Do this after COinS because we are modifying Publishername to include some static text
if 'newsgroup' == config.CitationClass and utilities.is_set (Newsgroup) then
PublisherName = utilities.substitute (cfg.messages['newsgroup'], external_link( 'news:' .. Newsgroup, Newsgroup, Newsgroup_origin, nil ));
end
local Editors;
local EditorCount; -- used only for choosing {ed.) or (eds.) annotation at end of editor name-list
local Contributors; -- assembled contributors name list
local contributor_etal;
local Translators; -- assembled translators name list
local translator_etal;
local t = {}; -- translators list from |translator-lastn= / translator-firstn= pairs
t = extract_names (args, 'TranslatorList'); -- fetch translator list from |translatorn= / |translator-lastn=, -firstn=, -linkn=, -maskn=
local Interviewers;
local interviewers_list = {};
interviewers_list = extract_names (args, 'InterviewerList'); -- process preferred interviewers parameters
local interviewer_etal;
-- Now perform various field substitutions.
-- We also add leading spaces and surrounding markup and punctuation to the
-- various parts of the citation, but only when they are non-nil.
do
local last_first_list;
local control = {
format = NameListStyle, -- empty string, '&', 'amp', 'and', or 'vanc'
maximum = nil, -- as if display-authors or display-editors not set
mode = Mode
};
do -- do editor name list first because the now unsupported coauthors used to modify control table
local display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayEditors'], A['DisplayEditors'], A:ORIGIN ('DisplayEditors'), #e);
control.maximum, editor_etal = get_display_names (display_names, #e, 'editors', editor_etal, param);
Editors, EditorCount = list_people (control, e, editor_etal);
if 1 == EditorCount and (true == editor_etal or 1 < #e) then -- only one editor displayed but includes etal then
EditorCount = 2; -- spoof to display (eds.) annotation
end
end
do -- now do interviewers
local display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayInterviewers'], A['DisplayInterviewers'], A:ORIGIN ('DisplayInterviewers'), #interviewers_list);
control.maximum, interviewer_etal = get_display_names (display_names, #interviewers_list, 'interviewers', interviewer_etal, param);
Interviewers = list_people (control, interviewers_list, interviewer_etal);
end
do -- now do translators
local display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayTranslators'], A['DisplayTranslators'], A:ORIGIN ('DisplayTranslators'), #t);
control.maximum, translator_etal = get_display_names (display_names, #t, 'translators', translator_etal, param);
Translators = list_people (control, t, translator_etal);
end
do -- now do contributors
local display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayContributors'], A['DisplayContributors'], A:ORIGIN ('DisplayContributors'), #c);
control.maximum, contributor_etal = get_display_names (display_names, #c, 'contributors', contributor_etal, param);
Contributors = list_people (control, c, contributor_etal);
end
do -- now do authors
local display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayAuthors'], A['DisplayAuthors'], A:ORIGIN ('DisplayAuthors'), #a, author_etal);
control.maximum, author_etal = get_display_names (display_names, #a, 'authors', author_etal, param);
last_first_list = list_people (control, a, author_etal);
if utilities.is_set (Authors) then
Authors, author_etal = name_has_etal (Authors, author_etal, false, 'authors'); -- find and remove variations on et al.
if author_etal then
Authors = Authors .. ' ' .. cfg.messages['et al']; -- add et al. to authors parameter
end
else
Authors = last_first_list; -- either an author name list or an empty string
end
end -- end of do
if utilities.is_set (Authors) and utilities.is_set (Collaboration) then
Authors = Authors .. ' (' .. Collaboration .. ')'; -- add collaboration after et al.
end
end
local ConferenceFormat = A['ConferenceFormat'];
local ConferenceURL = A['ConferenceURL'];
ConferenceFormat = style_format (ConferenceFormat, ConferenceURL, 'conference-format', 'conference-url');
Format = style_format (Format, URL, 'format', 'url');
-- special case for chapter format so no error message or cat when chapter not supported
if not (utilities.in_array (config.CitationClass, {'web', 'news', 'journal', 'magazine', 'pressrelease', 'podcast', 'newsgroup', 'arxiv', 'biorxiv', 'citeseerx', 'medrxiv', 'ssrn'}) or
('citation' == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and not utilities.is_set (Encyclopedia))) then
ChapterFormat = style_format (ChapterFormat, ChapterURL, 'chapter-format', 'chapter-url');
end
if not utilities.is_set (URL) then
if utilities.in_array (config.CitationClass, {"web", "podcast", "mailinglist"}) or -- |url= required for cite web, cite podcast, and cite mailinglist
('citation' == config.CitationClass and ('website' == Periodical_origin or 'script-website' == ScriptPeriodical_origin)) then -- and required for {{citation}} with |website= or |script-website=
utilities.set_message ('err_cite_web_url');
end
-- do we have |accessdate= without either |url= or |chapter-url=?
if utilities.is_set (AccessDate) and not utilities.is_set (ChapterURL) then -- ChapterURL may be set when URL is not set;
utilities.set_message ('err_accessdate_missing_url');
AccessDate = '';
end
end
local UrlStatus = is_valid_parameter_value (A['UrlStatus'], A:ORIGIN('UrlStatus'), cfg.keywords_lists['url-status'], '');
local OriginalURL
local OriginalURL_origin
local OriginalFormat
local OriginalAccess;
UrlStatus = UrlStatus:lower(); -- used later when assembling archived text
if utilities.is_set ( ArchiveURL ) then
if utilities.is_set (ChapterURL) then -- if chapter-url= is set apply archive url to it
OriginalURL = ChapterURL; -- save copy of source chapter's url for archive text
OriginalURL_origin = ChapterURL_origin; -- name of |chapter-url= parameter for error messages
OriginalFormat = ChapterFormat; -- and original |chapter-format=
if 'live' ~= UrlStatus then
ChapterURL = ArchiveURL -- swap-in the archive's URL
ChapterURL_origin = A:ORIGIN('ArchiveURL') -- name of |archive-url= parameter for error messages
ChapterFormat = ArchiveFormat or ''; -- swap in archive's format
ChapterUrlAccess = nil; -- restricted access levels do not make sense for archived URLs
end
elseif utilities.is_set (URL) then
OriginalURL = URL; -- save copy of original source URL
OriginalURL_origin = URL_origin; -- name of URL parameter for error messages
OriginalFormat = Format; -- and original |format=
OriginalAccess = UrlAccess;
if 'live' ~= UrlStatus then -- if URL set then |archive-url= applies to it
URL = ArchiveURL -- swap-in the archive's URL
URL_origin = A:ORIGIN('ArchiveURL') -- name of archive URL parameter for error messages
Format = ArchiveFormat or ''; -- swap in archive's format
UrlAccess = nil; -- restricted access levels do not make sense for archived URLs
end
end
elseif utilities.is_set (UrlStatus) then -- if |url-status= is set when |archive-url= is not set
utilities.set_message ('maint_url_status'); -- add maint cat
end
if utilities.in_array (config.CitationClass, {'web', 'news', 'journal', 'magazine', 'pressrelease', 'podcast', 'newsgroup', 'arxiv', 'biorxiv', 'citeseerx', 'medrxiv', 'ssrn'}) or -- if any of the 'periodical' cites except encyclopedia
('citation' == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and not utilities.is_set (Encyclopedia)) then
local chap_param;
if utilities.is_set (Chapter) then -- get a parameter name from one of these chapter related meta-parameters
chap_param = A:ORIGIN ('Chapter')
elseif utilities.is_set (TransChapter) then
chap_param = A:ORIGIN ('TransChapter')
elseif utilities.is_set (ChapterURL) then
chap_param = A:ORIGIN ('ChapterURL')
elseif utilities.is_set (ScriptChapter) then
chap_param = ScriptChapter_origin;
else utilities.is_set (ChapterFormat)
chap_param = A:ORIGIN ('ChapterFormat')
end
if utilities.is_set (chap_param) then -- if we found one
utilities.set_message ('err_chapter_ignored', {chap_param}); -- add error message
Chapter = ''; -- and set them to empty string to be safe with concatenation
TransChapter = '';
ChapterURL = '';
ScriptChapter = '';
ChapterFormat = '';
end
else -- otherwise, format chapter / article title
local no_quotes = false; -- default assume that we will be quoting the chapter parameter value
if utilities.is_set (Contribution) and 0 < #c then -- if this is a contribution with contributor(s)
if utilities.in_array (Contribution:lower(), cfg.keywords_lists.contribution) then -- and a generic contribution title
no_quotes = true; -- then render it unquoted
end
end
Chapter = format_chapter_title (ScriptChapter, ScriptChapter_origin, Chapter, Chapter_origin, TransChapter, TransChapter_origin, ChapterURL, ChapterURL_origin, no_quotes, ChapterUrlAccess); -- Contribution is also in Chapter
if utilities.is_set (Chapter) then
Chapter = Chapter .. ChapterFormat ;
if 'map' == config.CitationClass and utilities.is_set (TitleType) then
Chapter = Chapter .. ' ' .. TitleType; -- map annotation here; not after title
end
Chapter = Chapter .. sepc .. ' ';
elseif utilities.is_set (ChapterFormat) then -- |chapter= not set but |chapter-format= is so ...
Chapter = ChapterFormat .. sepc .. ' '; -- ... ChapterFormat has error message, we want to see it
end
end
-- Format main title
local plain_title = false;
local accept_title;
Title, accept_title = utilities.has_accept_as_written (Title, true); -- remove accept-this-as-written markup when it wraps all of <Title>
if accept_title and ('' == Title) then -- only support forced empty for now "(())"
Title = cfg.messages['notitle']; -- replace by predefined "No title" message
-- TODO: utilities.set_message ( 'err_redundant_parameters', ...); -- issue proper error message instead of muting
ScriptTitle = ''; -- just mute for now
TransTitle = ''; -- just mute for now
plain_title = true; -- suppress text decoration for descriptive title
utilities.set_message ('maint_untitled'); -- add maint cat
end
if not accept_title then -- <Title> not wrapped in accept-as-written markup
if '...' == Title:sub (-3) then -- if ellipsis is the last three characters of |title=
Title = Title:gsub ('(%.%.%.)%.+$', '%1'); -- limit the number of dots to three
elseif not mw.ustring.find (Title, '%.%s*%a%.$') and -- end of title is not a 'dot-(optional space-)letter-dot' initialism ...
not mw.ustring.find (Title, '%s+%a%.$') then -- ...and not a 'space-letter-dot' initial (''Allium canadense'' L.)
Title = mw.ustring.gsub(Title, '%' .. sepc .. '$', ''); -- remove any trailing separator character; sepc and ms.ustring() here for languages that use multibyte separator characters
end
if utilities.is_set (ArchiveURL) and is_archived_copy (Title) then
utilities.set_message ('maint_archived_copy'); -- add maintenance category before we modify the content of Title
end
if is_generic ('generic_titles', Title) then
utilities.set_message ('err_generic_title'); -- set an error message
end
end
if (not plain_title) and (utilities.in_array (config.CitationClass, {'web', 'news', 'journal', 'magazine', 'document', 'pressrelease', 'podcast', 'newsgroup', 'mailinglist', 'interview', 'arxiv', 'biorxiv', 'citeseerx', 'medrxiv', 'ssrn'}) or
('citation' == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and not utilities.is_set (Encyclopedia)) or
('map' == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)))) then -- special case for cite map when the map is in a periodical treat as an article
Title = kern_quotes (Title); -- if necessary, separate title's leading and trailing quote marks from module provided quote marks
Title = utilities.wrap_style ('quoted-title', Title);
Title = script_concatenate (Title, ScriptTitle, 'script-title'); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped
TransTitle = utilities.wrap_style ('trans-quoted-title', TransTitle );
elseif plain_title or ('report' == config.CitationClass) then -- no styling for cite report and descriptive titles (otherwise same as above)
Title = script_concatenate (Title, ScriptTitle, 'script-title'); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped
TransTitle = utilities.wrap_style ('trans-quoted-title', TransTitle ); -- for cite report, use this form for trans-title
else
Title = utilities.wrap_style ('italic-title', Title);
Title = script_concatenate (Title, ScriptTitle, 'script-title'); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped
TransTitle = utilities.wrap_style ('trans-italic-title', TransTitle);
end
if utilities.is_set (TransTitle) then
if utilities.is_set (Title) then
TransTitle = " " .. TransTitle;
else
utilities.set_message ('err_trans_missing_title', {'title'});
end
end
if utilities.is_set (Title) then -- TODO: is this the right place to be making Wikisource URLs?
if utilities.is_set (TitleLink) and utilities.is_set (URL) then
utilities.set_message ('err_wikilink_in_url'); -- set an error message because we can't have both
TitleLink = ''; -- unset
end
if not utilities.is_set (TitleLink) and utilities.is_set (URL) then
Title = external_link (URL, Title, URL_origin, UrlAccess) .. TransTitle .. Format;
URL = ''; -- unset these because no longer needed
Format = "";
elseif utilities.is_set (TitleLink) and not utilities.is_set (URL) then
local ws_url;
ws_url = wikisource_url_make (TitleLink); -- ignore ws_label return; not used here
if ws_url then
Title = external_link (ws_url, Title .. ' ', 'ws link in title-link'); -- space char after Title to move icon away from italic text; TODO: a better way to do this?
Title = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], TitleLink, Title});
Title = Title .. TransTitle;
else
Title = utilities.make_wikilink (TitleLink, Title) .. TransTitle;
end
else
local ws_url, ws_label, L; -- Title has italic or quote markup by the time we get here which causes is_wikilink() to return 0 (not a wikilink)
ws_url, ws_label, L = wikisource_url_make (Title:gsub('^[\'"]*(.-)[\'"]*$', '%1')); -- make ws URL from |title= interwiki link (strip italic or quote markup); link portion L becomes tooltip label
if ws_url then
Title = Title:gsub ('%b[]', ws_label); -- replace interwiki link with ws_label to retain markup
Title = external_link (ws_url, Title .. ' ', 'ws link in title'); -- space char after Title to move icon away from italic text; TODO: a better way to do this?
Title = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], L, Title});
Title = Title .. TransTitle;
else
Title = Title .. TransTitle;
end
end
else
Title = TransTitle;
end
if utilities.is_set (Place) then
Place = " " .. wrap_msg ('written', Place, use_lowercase) .. sepc .. " ";
end
local ConferenceURL_origin = A:ORIGIN('ConferenceURL'); -- get name of parameter that holds ConferenceURL
if utilities.is_set (Conference) then
if utilities.is_set (ConferenceURL) then
Conference = external_link( ConferenceURL, Conference, ConferenceURL_origin, nil );
end
Conference = sepc .. " " .. Conference .. ConferenceFormat;
elseif utilities.is_set (ConferenceURL) then
Conference = sepc .. " " .. external_link( ConferenceURL, nil, ConferenceURL_origin, nil );
end
local Position = '';
if not utilities.is_set (Position) then
local Minutes = A['Minutes'];
local Time = A['Time'];
if utilities.is_set (Minutes) then
if utilities.is_set (Time) then --TODO: make a function for this and similar?
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'minutes') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'time')});
end
Position = " " .. Minutes .. " " .. cfg.messages['minutes'];
else
if utilities.is_set (Time) then
local TimeCaption = A['TimeCaption']
if not utilities.is_set (TimeCaption) then
TimeCaption = cfg.messages['event'];
if sepc ~= '.' then
TimeCaption = TimeCaption:lower();
end
end
Position = " " .. TimeCaption .. " " .. Time;
end
end
else
Position = " " .. Position;
At = '';
end
Page, Pages, Sheet, Sheets = format_pages_sheets (Page, Pages, Sheet, Sheets, config.CitationClass, Periodical_origin, sepc, NoPP, use_lowercase);
At = utilities.is_set (At) and (sepc .. " " .. At) or "";
Position = utilities.is_set (Position) and (sepc .. " " .. Position) or "";
if config.CitationClass == 'map' then
local Sections = A['Sections']; -- Section (singular) is an alias of Chapter so set earlier
local Inset = A['Inset'];
if utilities.is_set ( Inset ) then
Inset = sepc .. " " .. wrap_msg ('inset', Inset, use_lowercase);
end
if utilities.is_set ( Sections ) then
Section = sepc .. " " .. wrap_msg ('sections', Sections, use_lowercase);
elseif utilities.is_set ( Section ) then
Section = sepc .. " " .. wrap_msg ('section', Section, use_lowercase);
end
At = At .. Inset .. Section;
end
local Others = A['Others'];
if utilities.is_set (Others) and 0 == #a and 0 == #e then -- add maint cat when |others= has value and used without |author=, |editor=
if config.CitationClass == "AV-media-notes"
or config.CitationClass == "audio-visual" then -- special maint for AV/M which has a lot of 'false' positives right now
utilities.set_message ('maint_others_avm')
else
utilities.set_message ('maint_others');
end
end
Others = utilities.is_set (Others) and (sepc .. " " .. Others) or "";
if utilities.is_set (Translators) then
Others = safe_join ({sepc .. ' ', wrap_msg ('translated', Translators, use_lowercase), Others}, sepc);
end
if utilities.is_set (Interviewers) then
Others = safe_join ({sepc .. ' ', wrap_msg ('interview', Interviewers, use_lowercase), Others}, sepc);
end
local TitleNote = A['TitleNote'];
TitleNote = utilities.is_set (TitleNote) and (sepc .. " " .. TitleNote) or "";
if utilities.is_set (Edition) then
if Edition:match ('%f[%a][Ee]d%n?%.?$') or Edition:match ('%f[%a][Ee]dition$') then -- Ed, ed, Ed., ed., Edn, edn, Edn., edn.
utilities.set_message ('err_extra_text_edition'); -- add error message
end
Edition = " " .. wrap_msg ('edition', Edition);
else
Edition = '';
end
Series = utilities.is_set (Series) and wrap_msg ('series', {sepc, Series}) or ""; -- not the same as SeriesNum
local Agency = A['Agency'];
Agency = utilities.is_set (Agency) and wrap_msg ('agency', {sepc, Agency}) or "";
Volume = format_volume_issue (Volume, Issue, ArticleNumber, config.CitationClass, Periodical_origin, sepc, use_lowercase);
if utilities.is_set (AccessDate) then
local retrv_text = " " .. cfg.messages['retrieved']
AccessDate = nowrap_date (AccessDate); -- wrap in nowrap span if date in appropriate format
if (sepc ~= ".") then retrv_text = retrv_text:lower() end -- if mode is cs2, lower case
AccessDate = utilities.substitute (retrv_text, AccessDate); -- add retrieved text
AccessDate = utilities.substitute (cfg.presentation['accessdate'], {sepc, AccessDate}); -- allow editors to hide accessdates
end
if utilities.is_set (ID) then ID = sepc .. " " .. ID; end
local Docket = A['Docket'];
if "thesis" == config.CitationClass and utilities.is_set (Docket) then
ID = sepc .. " Docket " .. Docket .. ID;
end
if "report" == config.CitationClass and utilities.is_set (Docket) then -- for cite report when |docket= is set
ID = sepc .. ' ' .. Docket; -- overwrite ID even if |id= is set
end
if utilities.is_set (URL) then
URL = " " .. external_link( URL, nil, URL_origin, UrlAccess );
end
local Quote = A['Quote'];
local TransQuote = A['TransQuote'];
local ScriptQuote = A['ScriptQuote'];
if utilities.is_set (Quote) or utilities.is_set (TransQuote) or utilities.is_set (ScriptQuote) then
if utilities.is_set (Quote) then
if Quote:sub(1, 1) == '"' and Quote:sub(-1, -1) == '"' then -- if first and last characters of quote are quote marks
Quote = Quote:sub(2, -2); -- strip them off
end
end
Quote = kern_quotes (Quote); -- kern if needed
Quote = utilities.wrap_style ('quoted-text', Quote ); -- wrap in <q>...</q> tags
if utilities.is_set (ScriptQuote) then
Quote = script_concatenate (Quote, ScriptQuote, 'script-quote'); -- <bdi> tags, lang attribute, categorization, etc.; must be done after quote is wrapped
end
if utilities.is_set (TransQuote) then
if TransQuote:sub(1, 1) == '"' and TransQuote:sub(-1, -1) == '"' then -- if first and last characters of |trans-quote are quote marks
TransQuote = TransQuote:sub(2, -2); -- strip them off
end
Quote = Quote .. " " .. utilities.wrap_style ('trans-quoted-title', TransQuote );
end
if utilities.is_set (QuotePage) or utilities.is_set (QuotePages) then -- add page prefix
local quote_prefix = '';
if utilities.is_set (QuotePage) then
extra_text_in_page_check (QuotePage, 'quote-page'); -- add to maint cat if |quote-page= value begins with what looks like p., pp., etc.
if not NoPP then
quote_prefix = utilities.substitute (cfg.messages['p-prefix'], {sepc, QuotePage}), '', '', '';
else
quote_prefix = utilities.substitute (cfg.messages['nopp'], {sepc, QuotePage}), '', '', '';
end
elseif utilities.is_set (QuotePages) then
extra_text_in_page_check (QuotePages, 'quote-pages'); -- add to maint cat if |quote-pages= value begins with what looks like p., pp., etc.
if tonumber(QuotePages) ~= nil and not NoPP then -- if only digits, assume single page
quote_prefix = utilities.substitute (cfg.messages['p-prefix'], {sepc, QuotePages}), '', '';
elseif not NoPP then
quote_prefix = utilities.substitute (cfg.messages['pp-prefix'], {sepc, QuotePages}), '', '';
else
quote_prefix = utilities.substitute (cfg.messages['nopp'], {sepc, QuotePages}), '', '';
end
end
Quote = quote_prefix .. ": " .. Quote;
else
Quote = sepc .. " " .. Quote;
end
PostScript = ""; -- cs1|2 does not supply terminal punctuation when |quote= is set
end
-- We check length of PostScript here because it will have been nuked by
-- the quote parameters. We'd otherwise emit a message even if there wasn't
-- a displayed postscript.
-- TODO: Should the max size (1) be configurable?
-- TODO: Should we check a specific pattern?
if utilities.is_set(PostScript) and mw.ustring.len(PostScript) > 1 then
utilities.set_message ('maint_postscript')
end
local Archived;
if utilities.is_set (ArchiveURL) then
if not utilities.is_set (ArchiveDate) then -- ArchiveURL set but ArchiveDate not set
utilities.set_message ('err_archive_missing_date'); -- emit an error message
ArchiveURL = ''; -- empty string for concatenation
ArchiveDate = ''; -- empty string for concatenation
end
else
if utilities.is_set (ArchiveDate) then -- ArchiveURL not set but ArchiveDate is set
utilities.set_message ('err_archive_date_missing_url'); -- emit an error message
ArchiveURL = ''; -- empty string for concatenation
ArchiveDate = ''; -- empty string for concatenation
end
end
if utilities.is_set (ArchiveURL) then
local arch_text;
if "live" == UrlStatus then
arch_text = cfg.messages['archived'];
if sepc ~= "." then arch_text = arch_text:lower() end
if utilities.is_set (ArchiveDate) then
Archived = sepc .. ' ' .. utilities.substitute ( cfg.messages['archived-live'],
{external_link( ArchiveURL, arch_text, A:ORIGIN('ArchiveURL'), nil) .. ArchiveFormat, ArchiveDate } );
else
Archived = '';
end
if not utilities.is_set (OriginalURL) then
utilities.set_message ('err_archive_missing_url');
Archived = ''; -- empty string for concatenation
end
elseif utilities.is_set (OriginalURL) then -- UrlStatus is empty, 'dead', 'unfit', 'usurped', 'bot: unknown'
if utilities.in_array (UrlStatus, {'unfit', 'usurped', 'bot: unknown'}) then
arch_text = cfg.messages['archived-unfit'];
if sepc ~= "." then arch_text = arch_text:lower() end
Archived = sepc .. ' ' .. arch_text .. ArchiveDate; -- format already styled
if 'bot: unknown' == UrlStatus then
utilities.set_message ('maint_bot_unknown'); -- and add a category if not already added
else
utilities.set_message ('maint_unfit'); -- and add a category if not already added
end
else -- UrlStatus is empty, 'dead'
arch_text = cfg.messages['archived-dead'];
if sepc ~= "." then arch_text = arch_text:lower() end
if utilities.is_set (ArchiveDate) then
Archived = sepc .. " " .. utilities.substitute ( arch_text,
{ external_link( OriginalURL, cfg.messages['original'], OriginalURL_origin, OriginalAccess ) .. OriginalFormat, ArchiveDate } ); -- format already styled
else
Archived = ''; -- unset for concatenation
end
end
else -- OriginalUrl not set
utilities.set_message ('err_archive_missing_url');
Archived = ''; -- empty string for concatenation
end
elseif utilities.is_set (ArchiveFormat) then
Archived = ArchiveFormat; -- if set and ArchiveURL not set ArchiveFormat has error message
else
Archived = '';
end
local TranscriptURL = A['TranscriptURL']
local TranscriptFormat = A['TranscriptFormat'];
TranscriptFormat = style_format (TranscriptFormat, TranscriptURL, 'transcript-format', 'transcripturl');
local Transcript = A['Transcript'];
local TranscriptURL_origin = A:ORIGIN('TranscriptURL'); -- get name of parameter that holds TranscriptURL
if utilities.is_set (Transcript) then
if utilities.is_set (TranscriptURL) then
Transcript = external_link( TranscriptURL, Transcript, TranscriptURL_origin, nil );
end
Transcript = sepc .. ' ' .. Transcript .. TranscriptFormat;
elseif utilities.is_set (TranscriptURL) then
Transcript = external_link( TranscriptURL, nil, TranscriptURL_origin, nil );
end
local Publisher;
if utilities.is_set (PublicationDate) then
PublicationDate = wrap_msg ('published', PublicationDate);
end
if utilities.is_set (PublisherName) then
if utilities.is_set (PublicationPlace) then
Publisher = sepc .. " " .. PublicationPlace .. ": " .. PublisherName .. PublicationDate;
else
Publisher = sepc .. " " .. PublisherName .. PublicationDate;
end
elseif utilities.is_set (PublicationPlace) then
Publisher= sepc .. " " .. PublicationPlace .. PublicationDate;
else
Publisher = PublicationDate;
end
-- Several of the above rely upon detecting this as nil, so do it last.
if (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical) or utilities.is_set (TransPeriodical)) then
if utilities.is_set (Title) or utilities.is_set (TitleNote) then
Periodical = sepc .. " " .. format_periodical (ScriptPeriodical, ScriptPeriodical_origin, Periodical, TransPeriodical, TransPeriodical_origin);
else
Periodical = format_periodical (ScriptPeriodical, ScriptPeriodical_origin, Periodical, TransPeriodical, TransPeriodical_origin);
end
end
local Language = A['Language'];
if utilities.is_set (Language) then
Language = language_parameter (Language); -- format, categories, name from ISO639-1, etc.
else
Language=''; -- language not specified so make sure this is an empty string;
--[[ TODO: need to extract the wrap_msg from language_parameter
so that we can solve parentheses bunching problem with Format/Language/TitleType
]]
end
--[[
Handle the oddity that is cite speech. This code overrides whatever may be the value assigned to TitleNote (through |department=) and forces it to be " (Speech)" so that
the annotation directly follows the |title= parameter value in the citation rather than the |event= parameter value (if provided).
]]
if "speech" == config.CitationClass then -- cite speech only
TitleNote = TitleType; -- move TitleType to TitleNote so that it renders ahead of |event=
TitleType = ''; -- and unset
if utilities.is_set (Periodical) then -- if Periodical, perhaps because of an included |website= or |journal= parameter
if utilities.is_set (Conference) then -- and if |event= is set
Conference = Conference .. sepc .. " "; -- then add appropriate punctuation to the end of the Conference variable before rendering
end
end
end
-- Piece all bits together at last. Here, all should be non-nil.
-- We build things this way because it is more efficient in LUA
-- not to keep reassigning to the same string variable over and over.
local tcommon;
local tcommon2; -- used for book cite when |contributor= is set
if utilities.in_array (config.CitationClass, {"journal", "citation"}) and utilities.is_set (Periodical) then
if not (utilities.is_set (Authors) or utilities.is_set (Editors)) then
Others = Others:gsub ('^' .. sepc .. ' ', ''); -- when no authors and no editors, strip leading sepc and space
end
if utilities.is_set (Others) then Others = safe_join ({Others, sepc .. " "}, sepc) end -- add terminal punctuation & space; check for dup sepc; TODO why do we need to do this here?
tcommon = safe_join( {Others, Title, TitleNote, Conference, Periodical, Format, TitleType, Series, Language, Edition, Publisher, Agency, Volume}, sepc );
elseif utilities.in_array (config.CitationClass, {"book", "citation"}) and not utilities.is_set (Periodical) then -- special cases for book cites
if utilities.is_set (Contributors) then -- when we are citing foreword, preface, introduction, etc.
tcommon = safe_join( {Title, TitleNote}, sepc ); -- author and other stuff will come after this and before tcommon2
tcommon2 = safe_join( {Conference, Periodical, Format, TitleType, Series, Language, Volume, Others, Edition, Publisher, Agency}, sepc );
else
tcommon = safe_join( {Title, TitleNote, Conference, Periodical, Format, TitleType, Series, Language, Volume, Others, Edition, Publisher, Agency}, sepc );
end
elseif 'map' == config.CitationClass then -- special cases for cite map
if utilities.is_set (Chapter) then -- map in a book; TitleType is part of Chapter
tcommon = safe_join( {Title, Format, Edition, Scale, Series, Language, Cartography, Others, Publisher, Volume}, sepc );
elseif utilities.is_set (Periodical) then -- map in a periodical
tcommon = safe_join( {Title, TitleType, Format, Periodical, Scale, Series, Language, Cartography, Others, Publisher, Volume}, sepc );
else -- a sheet or stand-alone map
tcommon = safe_join( {Title, TitleType, Format, Edition, Scale, Series, Language, Cartography, Others, Publisher}, sepc );
end
elseif 'episode' == config.CitationClass then -- special case for cite episode
tcommon = safe_join( {Title, TitleNote, TitleType, Series, Language, Edition, Publisher}, sepc );
else -- all other CS1 templates
tcommon = safe_join( {Title, TitleNote, Conference, Periodical, Format, TitleType, Series, Language,
Volume, Others, Edition, Publisher, Agency}, sepc );
end
if #ID_list > 0 then
ID_list = safe_join( { sepc .. " ", table.concat( ID_list, sepc .. " " ), ID }, sepc );
else
ID_list = ID;
end
local Via = A['Via'];
Via = utilities.is_set (Via) and wrap_msg ('via', Via) or '';
local idcommon;
if 'audio-visual' == config.CitationClass or 'episode' == config.CitationClass then -- special case for cite AV media & cite episode position transcript
idcommon = safe_join( { ID_list, URL, Archived, Transcript, AccessDate, Via, Quote }, sepc );
else
idcommon = safe_join( { ID_list, URL, Archived, AccessDate, Via, Quote }, sepc );
end
local text;
local pgtext = Position .. Sheet .. Sheets .. Page .. Pages .. At;
local OrigDate = A['OrigDate'];
OrigDate = utilities.is_set (OrigDate) and wrap_msg ('origdate', OrigDate) or '';
if utilities.is_set (Date) then
if utilities.is_set (Authors) or utilities.is_set (Editors) then -- date follows authors or editors when authors not set
Date = " (" .. Date .. ")" .. OrigDate .. sepc .. " "; -- in parentheses
else -- neither of authors and editors set
if (string.sub(tcommon, -1, -1) == sepc) then -- if the last character of tcommon is sepc
Date = " " .. Date .. OrigDate; -- Date does not begin with sepc
else
Date = sepc .. " " .. Date .. OrigDate; -- Date begins with sepc
end
end
end
if utilities.is_set (Authors) then
if (not utilities.is_set (Date)) then -- when date is set it's in parentheses; no Authors termination
Authors = terminate_name_list (Authors, sepc); -- when no date, terminate with 0 or 1 sepc and a space
end
if utilities.is_set (Editors) then
local in_text = '';
local post_text = '';
if utilities.is_set (Chapter) and 0 == #c then
in_text = cfg.messages['in'] .. ' ';
if (sepc ~= '.') then
in_text = in_text:lower(); -- lowercase for cs2
end
end
if EditorCount <= 1 then
post_text = ' (' .. cfg.messages['editor'] .. ')'; -- be consistent with no-author, no-date case
else
post_text = ' (' .. cfg.messages['editors'] .. ')';
end
Editors = terminate_name_list (in_text .. Editors .. post_text, sepc); -- terminate with 0 or 1 sepc and a space
end
if utilities.is_set (Contributors) then -- book cite and we're citing the intro, preface, etc.
local by_text = sepc .. ' ' .. cfg.messages['by'] .. ' ';
if (sepc ~= '.') then by_text = by_text:lower() end -- lowercase for cs2
Authors = by_text .. Authors; -- author follows title so tweak it here
if utilities.is_set (Editors) and utilities.is_set (Date) then -- when Editors make sure that Authors gets terminated
Authors = terminate_name_list (Authors, sepc); -- terminate with 0 or 1 sepc and a space
end
if (not utilities.is_set (Date)) then -- when date is set it's in parentheses; no Contributors termination
Contributors = terminate_name_list (Contributors, sepc); -- terminate with 0 or 1 sepc and a space
end
text = safe_join( {Contributors, Date, Chapter, tcommon, Authors, Place, Editors, tcommon2, pgtext, idcommon }, sepc );
else
text = safe_join( {Authors, Date, Chapter, Place, Editors, tcommon, pgtext, idcommon }, sepc );
end
elseif utilities.is_set (Editors) then
if utilities.is_set (Date) then
if EditorCount <= 1 then
Editors = Editors .. cfg.presentation['sep_name'] .. cfg.messages['editor'];
else
Editors = Editors .. cfg.presentation['sep_name'] .. cfg.messages['editors'];
end
else
if EditorCount <= 1 then
Editors = Editors .. " (" .. cfg.messages['editor'] .. ")" .. sepc .. " "
else
Editors = Editors .. " (" .. cfg.messages['editors'] .. ")" .. sepc .. " "
end
end
text = safe_join( {Editors, Date, Chapter, Place, tcommon, pgtext, idcommon}, sepc );
else
if utilities.in_array (config.CitationClass, {"journal", "citation"}) and utilities.is_set (Periodical) then
text = safe_join( {Chapter, Place, tcommon, pgtext, Date, idcommon}, sepc );
else
text = safe_join( {Chapter, Place, tcommon, Date, pgtext, idcommon}, sepc );
end
end
if utilities.is_set (PostScript) and PostScript ~= sepc then
text = safe_join( {text, sepc}, sepc ); -- Deals with italics, spaces, etc.
text = text:sub(1, -sepc:len() - 1);
end
text = safe_join( {text, PostScript}, sepc );
-- Now enclose the whole thing in a <cite> element
local options_t = {};
options_t.class = cite_class_attribute_make (config.CitationClass, Mode);
local Ref = is_valid_parameter_value (A['Ref'], A:ORIGIN('Ref'), cfg.keywords_lists['ref'], nil, true); -- nil when |ref=harv; A['Ref'] else
if 'none' ~= cfg.keywords_xlate[(Ref and Ref:lower()) or ''] then
local namelist_t = {}; -- holds selected contributor, author, editor name list
local year = first_set ({Year, anchor_year}, 2); -- Year first for legacy citations and for YMD dates that require disambiguation
if #c > 0 then -- if there is a contributor list
namelist_t = c; -- select it
elseif #a > 0 then -- or an author list
namelist_t = a;
elseif #e > 0 then -- or an editor list
namelist_t = e;
end
local citeref_id;
if #namelist_t > 0 then -- if there are names in namelist_t
citeref_id = make_citeref_id (namelist_t, year); -- go make the CITEREF anchor
if mw.uri.anchorEncode (citeref_id) == ((Ref and mw.uri.anchorEncode (Ref)) or '') then -- Ref may already be encoded (by {{sfnref}}) so citeref_id must be encoded before comparison
utilities.set_message ('maint_ref_duplicates_default');
end
else
citeref_id = ''; -- unset
end
options_t.id = Ref or citeref_id;
end
if string.len (text:gsub('%b<>', '')) <= 2 then -- remove html and html-like tags; then get length of what remains;
z.error_cats_t = {}; -- blank the categories list
z.error_msgs_t = {}; -- blank the error messages list
OCinSoutput = nil; -- blank the metadata string
text = ''; -- blank the the citation
utilities.set_message ('err_empty_citation'); -- set empty citation message and category
end
local render_t = {}; -- here we collect the final bits for concatenation into the rendered citation
if utilities.is_set (options_t.id) then -- here we wrap the rendered citation in <cite ...>...</cite> tags
table.insert (render_t, utilities.substitute (cfg.presentation['cite-id'], {mw.uri.anchorEncode(options_t.id), mw.text.nowiki(options_t.class), text})); -- when |ref= is set or when there is a namelist
else
table.insert (render_t, utilities.substitute (cfg.presentation['cite'], {mw.text.nowiki(options_t.class), text})); -- when |ref=none or when namelist_t empty and |ref= is missing or is empty
end
if OCinSoutput then -- blanked when citation is 'empty' so don't bother to add boilerplate metadata span
table.insert (render_t, utilities.substitute (cfg.presentation['ocins'], OCinSoutput)); -- format and append metadata to the citation
end
local template_name = ('citation' == config.CitationClass) and 'citation' or 'cite ' .. (cfg.citation_class_map_t[config.CitationClass] or config.CitationClass);
local template_link = '[[Template:' .. template_name .. '|' .. template_name .. ']]';
local msg_prefix = '<code class="cs1-code">{{' .. template_link .. '}}</code>: ';
if 0 ~= #z.error_msgs_t then
mw.addWarning (utilities.substitute (cfg.messages.warning_msg_e, template_link));
table.insert (render_t, ' '); -- insert a space between citation and its error messages
table.sort (z.error_msgs_t); -- sort the error messages list; sorting includes wrapping <span> and <code> tags; hidden-error sorts ahead of visible-error
local hidden = true; -- presume that the only error messages emited by this template are hidden
for _, v in ipairs (z.error_msgs_t) do -- spin through the list of error messages
if v:find ('cs1-visible-error', 1, true) then -- look for the visible error class name
hidden = false; -- found one; so don't hide the error message prefix
break; -- and done because no need to look further
end
end
z.error_msgs_t[1] = table.concat ({utilities.error_comment (msg_prefix, hidden), z.error_msgs_t[1]}); -- add error message prefix to first error message to prevent extraneous punctuation
table.insert (render_t, table.concat (z.error_msgs_t, '; ')); -- make a big string of error messages and add it to the rendering
end
if 0 ~= #z.maint_cats_t then
mw.addWarning (utilities.substitute (cfg.messages.warning_msg_m, template_link));
table.sort (z.maint_cats_t); -- sort the maintenance messages list
local maint_msgs_t = {}; -- here we collect all of the maint messages
if 0 == #z.error_msgs_t then -- if no error messages
table.insert (maint_msgs_t, msg_prefix); -- insert message prefix in maint message livery
end
for _, v in ipairs( z.maint_cats_t ) do -- append maintenance categories
table.insert (maint_msgs_t, -- assemble new maint message and add it to the maint_msgs_t table
table.concat ({v, ' (', utilities.substitute (cfg.messages[':cat wikilink'], v), ')'})
);
end
table.insert (render_t, utilities.substitute (cfg.presentation['hidden-maint'], table.concat (maint_msgs_t, ' '))); -- wrap the group of maint messages with proper presentation and save
end
if not no_tracking_cats then
local sort_key;
local cat_wikilink = 'cat wikilink';
if cfg.enable_sort_keys then -- when namespace sort keys enabled
local namespace_number = mw.title.getCurrentTitle().namespace; -- get namespace number for this wikitext
sort_key = (0 ~= namespace_number and (cfg.name_space_sort_keys[namespace_number] or cfg.name_space_sort_keys.other)) or nil; -- get sort key character; nil for mainspace
cat_wikilink = (not sort_key and 'cat wikilink') or 'cat wikilink sk'; -- make <cfg.messages> key
end
for _, v in ipairs (z.error_cats_t) do -- append error categories
table.insert (render_t, utilities.substitute (cfg.messages[cat_wikilink], {v, sort_key}));
end
for _, v in ipairs (z.maint_cats_t) do -- append maintenance categories
table.insert (render_t, utilities.substitute (cfg.messages[cat_wikilink], {v, sort_key}));
end
for _, v in ipairs (z.prop_cats_t) do -- append properties categories
table.insert (render_t, utilities.substitute (cfg.messages['cat wikilink'], v)); -- no sort keys
end
end
return table.concat (render_t); -- make a big string and done
end
--[[--------------------------< V A L I D A T E >--------------------------------------------------------------
Looks for a parameter's name in one of several whitelists.
Parameters in the whitelist can have three values:
true - active, supported parameters
false - deprecated, supported parameters
nil - unsupported parameters
]]
local function validate (name, cite_class, empty)
local name = tostring (name);
local enum_name; -- parameter name with enumerator (if any) replaced with '#'
local state;
local function state_test (state, name) -- local function to do testing of state values
if true == state then return true; end -- valid actively supported parameter
if false == state then
if empty then return nil; end -- empty deprecated parameters are treated as unknowns
deprecated_parameter (name); -- parameter is deprecated but still supported
return true;
end
if 'tracked' == state then
local base_name = name:gsub ('%d', ''); -- strip enumerators from parameter names that have them to get the base name
utilities.add_prop_cat ('tracked-param', {base_name}, base_name); -- add a properties category; <base_name> modifies <key>
return true;
end
return nil;
end
if name:find ('#') then -- # is a cs1|2 reserved character so parameters with # not permitted
return nil;
end
-- replace wnumerator digit(s) with # (|last25= becomes |last#=) (mw.ustring because non-Western 'local' digits)
enum_name = mw.ustring.gsub (name, '%d+$', '#'); -- where enumerator is last charaters in parameter name (these to protect |s2cid=)
enum_name = mw.ustring.gsub (enum_name, '%d+([%-l])', '#%1'); -- where enumerator is in the middle of the parameter name; |author#link= is the oddity
if 'document' == cite_class then -- special case for {{cite document}}
state = whitelist.document_parameters_t[enum_name]; -- this list holds enumerated and nonenumerated parameters
if true == state_test (state, name) then return true; end
return false;
end
if utilities.in_array (cite_class, whitelist.preprint_template_list_t) then -- limited parameter sets allowed for these templates
state = whitelist.limited_parameters_t[enum_name]; -- this list holds enumerated and nonenumerated parameters
if true == state_test (state, name) then return true; end
state = whitelist.preprint_arguments_t[cite_class][name]; -- look in the parameter-list for the template identified by cite_class
if true == state_test (state, name) then return true; end
return false; -- not supported because not found or name is set to nil
end -- end limited parameter-set templates
if utilities.in_array (cite_class, whitelist.unique_param_template_list_t) then -- template-specific parameters for templates that accept parameters from the basic argument list
state = whitelist.unique_arguments_t[cite_class][name]; -- look in the template-specific parameter-lists for the template identified by cite_class
if true == state_test (state, name) then return true; end
end -- if here, fall into general validation
state = whitelist.common_parameters_t[enum_name]; -- all other templates; all normal parameters allowed; this list holds enumerated and nonenumerated parameters
if true == state_test (state, name) then return true; end
return false; -- not supported because not found or name is set to nil
end
--[=[-------------------------< I N T E R _ W I K I _ C H E C K >----------------------------------------------
check <value> for inter-language interwiki-link markup. <prefix> must be a MediaWiki-recognized language
code. when these values have the form (without leading colon):
[[<prefix>:link|label]] return label as plain-text
[[<prefix>:link]] return <prefix>:link as plain-text
return value as is else
]=]
local function inter_wiki_check (parameter, value)
local prefix = value:match ('%[%[(%a+):'); -- get an interwiki prefix if one exists
local _;
if prefix and cfg.inter_wiki_map[prefix:lower()] then -- if prefix is in the map, needs preceding colon so
utilities.set_message ('err_bad_paramlink', parameter); -- emit an error message
_, value, _ = utilities.is_wikilink (value); -- extract label portion from wikilink
end
return value;
end
--[[--------------------------< M I S S I N G _ P I P E _ C H E C K >------------------------------------------
Look at the contents of a parameter. If the content has a string of characters and digits followed by an equal
sign, compare the alphanumeric string to the list of cs1|2 parameters. If found, then the string is possibly a
parameter that is missing its pipe. There are two tests made:
{{cite ... |title=Title access-date=2016-03-17}} -- the first parameter has a value and whitespace separates that value from the missing pipe parameter name
{{cite ... |title=access-date=2016-03-17}} -- the first parameter has no value (whitespace after the first = is trimmed by MediaWiki)
cs1|2 shares some parameter names with XML/HTML attributes: class=, title=, etc. To prevent false positives XML/HTML
tags are removed before the search.
If a missing pipe is detected, this function adds the missing pipe maintenance category.
]]
local function missing_pipe_check (parameter, value)
local capture;
value = value:gsub ('%b<>', ''); -- remove XML/HTML tags because attributes: class=, title=, etc.
capture = value:match ('%s+(%a[%w%-]+)%s*=') or value:match ('^(%a[%w%-]+)%s*='); -- find and categorize parameters with possible missing pipes
if capture and validate (capture) then -- if the capture is a valid parameter name
utilities.set_message ('err_missing_pipe', parameter);
end
end
--[[--------------------------< H A S _ E X T R A N E O U S _ P U N C T >--------------------------------------
look for extraneous terminal punctuation in most parameter values; parameters listed in skip table are not checked
]]
local function has_extraneous_punc (param, value)
if 'number' == type (param) then
return;
end
param = param:gsub ('%d+', '#'); -- enumerated name-list mask params allow terminal punct; normalize
if cfg.punct_skip[param] then
return; -- parameter name found in the skip table so done
end
if value:match ('[,;:]$') then
utilities.set_message ('maint_extra_punct'); -- has extraneous punctuation; add maint cat
end
if value:match ('^=') then -- sometimes an extraneous '=' character appears ...
utilities.set_message ('maint_extra_punct'); -- has extraneous punctuation; add maint cat
end
end
--[[--------------------------< H A S _ E X T R A N E O U S _ U R L >------------------------------------------
look for extraneous url parameter values; parameters listed in skip table are not checked
]]
local function has_extraneous_url (url_param_t)
local url_error_t = {};
check_for_url (url_param_t, url_error_t); -- extraneous url check
if 0 ~= #url_error_t then -- non-zero when there are errors
table.sort (url_error_t);
utilities.set_message ('err_param_has_ext_link', {utilities.make_sep_list (#url_error_t, url_error_t)}); -- add this error message
end
end
--[[--------------------------< C I T A T I O N >--------------------------------------------------------------
This is used by templates such as {{cite book}} to create the actual citation text.
]]
local function citation(frame)
Frame = frame; -- save a copy in case we need to display an error message in preview mode
local config = {}; -- table to store parameters from the module {{#invoke:}}
for k, v in pairs( frame.args ) do -- get parameters from the {{#invoke}} frame
config[k] = v;
-- args[k] = v; -- crude debug support that allows us to render a citation from module {{#invoke:}}; skips parameter validation; TODO: keep?
end
-- i18n: set the name that your wiki uses to identify sandbox subpages from sandbox template invoke (or can be set here)
local sandbox = ((config.SandboxPath and '' ~= config.SandboxPath) and config.SandboxPath) or '/sandbox'; -- sandbox path from {{#invoke:Citation/CS1/sandbox|citation|SandboxPath=/...}}
is_sandbox = nil ~= string.find (frame:getTitle(), sandbox, 1, true); -- is this invoke the sandbox module?
sandbox = is_sandbox and sandbox or ''; -- use i18n sandbox to load sandbox modules when this module is the sandox; live modules else
local pframe = frame:getParent()
local styles;
cfg = mw.loadData ('Module:Citation/CS1/Configuration' .. sandbox); -- load sandbox versions of support modules when {{#invoke:Citation/CS1/sandbox|...}}; live modules else
whitelist = mw.loadData ('Module:Citation/CS1/Whitelist' .. sandbox);
utilities = require ('Module:Citation/CS1/Utilities' .. sandbox);
validation = require ('Module:Citation/CS1/Date_validation' .. sandbox);
identifiers = require ('Module:Citation/CS1/Identifiers' .. sandbox);
metadata = require ('Module:Citation/CS1/COinS' .. sandbox);
styles = 'Module:Citation/CS1' .. sandbox .. '/styles.css';
utilities.set_selected_modules (cfg); -- so that functions in Utilities can see the selected cfg tables
identifiers.set_selected_modules (cfg, utilities); -- so that functions in Identifiers can see the selected cfg tables and selected Utilities module
validation.set_selected_modules (cfg, utilities); -- so that functions in Date validataion can see selected cfg tables and the selected Utilities module
metadata.set_selected_modules (cfg, utilities); -- so that functions in COinS can see the selected cfg tables and selected Utilities module
z = utilities.z; -- table of error and category tables in Module:Citation/CS1/Utilities
is_preview_mode = not utilities.is_set (frame:preprocess ('{{REVISIONID}}'));
local args = {}; -- table where we store all of the template's arguments
local suggestions = {}; -- table where we store suggestions if we need to loadData them
local error_text; -- used as a flag
local capture; -- the single supported capture when matching unknown parameters using patterns
local empty_unknowns = {}; -- sequence table to hold empty unknown params for error message listing
for k, v in pairs( pframe.args ) do -- get parameters from the parent (template) frame
v = mw.ustring.gsub (v, '^%s*(.-)%s*$', '%1'); -- trim leading/trailing whitespace; when v is only whitespace, becomes empty string
if v ~= '' then
if ('string' == type (k)) then
k = mw.ustring.gsub (k, '%d', cfg.date_names.local_digits); -- for enumerated parameters, translate 'local' digits to Western 0-9
end
if not validate( k, config.CitationClass ) then
if type (k) ~= 'string' then -- exclude empty numbered parameters
if v:match("%S+") ~= nil then
error_text = utilities.set_message ('err_text_ignored', {v});
end
elseif validate (k:lower(), config.CitationClass) then
error_text = utilities.set_message ('err_parameter_ignored_suggest', {k, k:lower()}); -- suggest the lowercase version of the parameter
else
if nil == suggestions.suggestions then -- if this table is nil then we need to load it
suggestions = mw.loadData ('Module:Citation/CS1/Suggestions' .. sandbox); --load sandbox version of suggestion module when {{#invoke:Citation/CS1/sandbox|...}}; live module else
end
for pattern, param in pairs (suggestions.patterns) do -- loop through the patterns to see if we can suggest a proper parameter
capture = k:match (pattern); -- the whole match if no capture in pattern else the capture if a match
if capture then -- if the pattern matches
param = utilities.substitute (param, capture); -- add the capture to the suggested parameter (typically the enumerator)
if validate (param, config.CitationClass) then -- validate the suggestion to make sure that the suggestion is supported by this template (necessary for limited parameter lists)
error_text = utilities.set_message ('err_parameter_ignored_suggest', {k, param}); -- set the suggestion error message
else
error_text = utilities.set_message ('err_parameter_ignored', {k}); -- suggested param not supported by this template
v = ''; -- unset
end
end
end
if not utilities.is_set (error_text) then -- couldn't match with a pattern, is there an explicit suggestion?
if (suggestions.suggestions[ k:lower() ] ~= nil) and validate (suggestions.suggestions[ k:lower() ], config.CitationClass) then
utilities.set_message ('err_parameter_ignored_suggest', {k, suggestions.suggestions[ k:lower() ]});
else
utilities.set_message ('err_parameter_ignored', {k});
v = ''; -- unset value assigned to unrecognized parameters (this for the limited parameter lists)
end
end
end
end
args[k] = v; -- save this parameter and its value
elseif not utilities.is_set (v) then -- for empty parameters
if not validate (k, config.CitationClass, true) then -- is this empty parameter a valid parameter
k = ('' == k) and '(empty string)' or k; -- when k is empty string (or was space(s) trimmed to empty string), replace with descriptive text
table.insert (empty_unknowns, utilities.wrap_style ('parameter', k)); -- format for error message and add to the list
end
-- crude debug support that allows us to render a citation from module {{#invoke:}} TODO: keep?
-- elseif args[k] ~= nil or (k == 'postscript') then -- when args[k] has a value from {{#invoke}} frame (we don't normally do that)
-- args[k] = v; -- overwrite args[k] with empty string from pframe.args[k] (template frame); v is empty string here
end -- not sure about the postscript bit; that gets handled in parameter validation; historical artifact?
end
if 0 ~= #empty_unknowns then -- create empty unknown error message
utilities.set_message ('err_param_unknown_empty', {
1 == #empty_unknowns and '' or 's',
utilities.make_sep_list (#empty_unknowns, empty_unknowns)
});
end
local url_param_t = {};
for k, v in pairs( args ) do
if 'string' == type (k) then -- don't evaluate positional parameters
has_invisible_chars (k, v); -- look for invisible characters
end
has_extraneous_punc (k, v); -- look for extraneous terminal punctuation in parameter values
missing_pipe_check (k, v); -- do we think that there is a parameter that is missing a pipe?
args[k] = inter_wiki_check (k, v); -- when language interwiki-linked parameter missing leading colon replace with wiki-link label
if 'string' == type (k) and not cfg.url_skip[k] then -- when parameter k is not positional and not in url skip table
url_param_t[k] = v; -- make a parameter/value list for extraneous url check
end
end
has_extraneous_url (url_param_t); -- look for url in parameter values where a url does not belong
return table.concat ({
frame:extensionTag ('templatestyles', '', {src=styles}),
citation0( config, args)
});
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {citation = citation};
0cad9fbfae76bef4d92d29d611ccebeb2039ca10
Template:Template parameter usage
10
126
243
2023-11-27T06:57:32Z
wikipedia>Sdkb
0
Partial revert of [[User:SUM1]]'s edit [[Special:Diff/1039918972]] per [[WP:CLICKHERE]]
wikitext
text/x-wiki
{{#switch:{{{label|}}}
|=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template={{Urlencode:{{#if:{{{1|}}}|{{ROOTPAGENAME:{{{1|}}}}}|{{ROOTPAGENAME}}}}}} {{#ifeq:{{yesno-no|{{{lc}}}}}|no|S|s}}ee a monthly parameter usage report] for {{#if:{{{1|}}}|[[Template:{{ROOTPAGENAME:{{{1|}}}}}]]|this template}} in articles{{#ifeq:{{yesno-no|{{{based}}}}}|yes| based on {{#if:{{{1|}}}|its|this}} TemplateData}}.
|None|none=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template={{Urlencode:{{#if:{{{1|}}}|{{ROOTPAGENAME:{{{1|}}}}}|{{ROOTPAGENAME}}}}}} {{#ifeq:{{yesno-no|{{{lc}}}}}|no|P|p}}arameter usage report]{{#ifeq:{{yesno-no|{{{based}}}}}|yes| based on {{#if:{{{1|}}}|its|this}} TemplateData}}
|for|For=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template={{Urlencode:{{#if:{{{1|}}}|{{ROOTPAGENAME:{{{1|}}}}}|{{ROOTPAGENAME}}}}}} {{#ifeq:{{yesno-no|{{{lc}}}}}|no|P|p}}arameter usage report] for {{#if:{{{1|}}}|[[Template:{{ROOTPAGENAME:{{{1|}}}}}]]|[[Template:{{ROOTPAGENAME}}]]}}{{#ifeq:{{yesno-no|{{{based}}}}}|yes| based on {{#if:{{{1|}}}|its|this}} TemplateData}}.
|#default=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template={{Urlencode:{{#if:{{{1|}}}|{{ROOTPAGENAME:{{{1|}}}}}|{{ROOTPAGENAME}}}}}} {{{label|}}}]{{#ifeq:{{yesno-no|{{{based}}}}}|yes| based on {{#if:{{{1|}}}|its|this}} TemplateData}}
}}<noinclude>
{{documentation}}
</noinclude>
83e574f5e031df639a2cdcef5b91d6b1094ae648
Template:En dash range
10
150
291
2023-11-27T07:16:16Z
wikipedia>Neveselbert
0
Undid revision 1187066278 by [[Special:Contributions/Neveselbert|Neveselbert]] ([[User talk:Neveselbert|talk]]) - ref issue
wikitext
text/x-wiki
{{{1}}}{{#ifeq:{{#invoke:String|find|source={{#invoke:Plain text|main|{{{1}}}{{{2}}}}}|target=[%s–—-]|plain=false}}|0|–| – }}{{{2}}}<noinclude>
{{Documentation}}
</noinclude>
4f0bde90a2efc3a10317f528ce19b0e0fd212808
Template:Infobox officeholder
10
141
273
2023-11-30T00:28:20Z
wikipedia>Neveselbert
0
avoid linking from 'What links here'; -font-size: 95% per [[MOS:FONTSIZE]]
wikitext
text/x-wiki
{{#invoke:infobox|infoboxTemplate
| bodyclass = vcard {{{bodyclass|}}}
| bodystyle = {{#if:{{{mainwidth|}}}|width: {{{mainwidth}}}}}
| child = {{lc:{{{embed}}}}}
| abovestyle = font-size: 100%;
| above = {{#if:{{{honorific prefix|{{{honorific_prefix|{{{honorific-prefix|}}}}}}}}}|<div class="honorific-prefix" style="font-weight: normal;">{{{honorific prefix|{{{honorific_prefix|{{{honorific-prefix}}}}}}}}}</div>}}<!--
--><div class="fn" style="font-size:125%;">{{#if:{{{name|}}}|{{{name}}}|{{PAGENAMEBASE}}}}</div><!--
-->{{#if:{{{honorific suffix|{{{honorific_suffix|{{{honorific-suffix|}}}}}}}}}|<div class="honorific-suffix" style="font-weight: normal;">{{{honorific suffix|{{{honorific_suffix|{{{honorific-suffix}}}}}}}}}</div>}}
| subheaderstyle = font-size:125%; font-weight:bold;
| subheader = {{#ifeq:{{lc:{{{embed}}}}}|yes||{{#if:{{{native_name|}}}|{{#if:{{{native_name_lang|}}}|<div class="nickname" lang="{{{native_name_lang}}}">}}{{{native_name}}}{{#if:{{{native_name_lang|}}}|</div>}}}}}}
| image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{width|{{{imagesize|{{{image_size|}}}}}}}}}|sizedefault=frameless|upright={{{image_upright|1}}}|alt={{{alt|}}}|suppressplaceholder=yes}}
| image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image name|}}}|size={{{width|{{{imagesize|{{{image_size|}}}}}}}}}|sizedefault=frameless|upright={{{image_upright|1}}}|alt={{{image_name_alt|}}}|suppressplaceholder=yes}}
| image3 = {{#invoke:InfoboxImage|InfoboxImage|image={{{smallimage|}}}|sizedefault=frameless|upright={{{image_upright|1}}}|alt={{{smallimage_alt|}}}|suppressplaceholder=yes}}
| captionstyle = line-height:normal;padding-top:0.2em;
| caption{{#if:{{{smallimage|}}}|3|{{#if:{{{image name|}}}|2}}}} = {{{caption|}}}
| headerstyle = {{#ifeq:{{lc:{{{embed}}}}}|yes|background:#eee|background:lavender}}
| data1 =
{{#if:{{{speaker|}}}|
{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname2|}}}
| 1namedata = {{{1namedata2|}}}
| 2blankname = {{{2blankname2|}}}
| 2namedata = {{{2namedata2|}}}
| 3blankname = {{{3blankname2|}}}
| 3namedata = {{{3namedata2|}}}
| 4blankname = {{{4blankname2|}}}
| 4namedata = {{{4namedata2|}}}
| 5blankname = {{{5blankname2|}}}
| 5namedata = {{{5namedata2|}}}
| alongside = {{{alongside2|}}}
| ambassador_from = {{{ambassador_from2|}}}
| appointer = {{#if: {{{appointer2|}}} | {{{appointer2}}} | {{{appointed2|}}} }}
| assembly = {{{assembly2|}}}
| assuming = {{{assuming2|}}}
| chancellor = {{{chancellor2|}}}
| co-leader = {{{co-leader2|}}}
| constituency_{{#if:{{{constituency_AM2|}}}|AM|MP}} = {{#if: {{{constituency_AM2|}}} | {{{constituency_AM2}}} | {{{constituency_MP2|}}} }}
| constituency = {{{constituency2|}}}
| convocation = {{{convocation2|}}}
| country = {{{country2|}}}
| deputy = {{{deputy2|}}}
| district = {{{district2|}}}
| firstminister = {{{firstminister2|}}}
| governor-general = {{{governor-general2|}}}
| governor_general = {{{governor_general2|}}}
| governor = {{{governor2|}}}
| jr/sr = {{{jr/sr2|}}}
| jr/sr and state = {{{jr/sr and state2|}}}
| leader = {{{leader2|}}}
| legislature = {{{legislature2|}}}
| lieutenant_governor = {{{lieutenant_governor2|}}}
| lieutenant = {{{lieutenant2|}}}
| majority_leader = {{#if: {{{majorityleader2|}}} | {{{majorityleader2}}} | {{{majority_leader2|}}} }}
| minister_from = {{{minister_from2|}}}
| minority_floor_leader = {{{minority_floor_leader2|}}}
| majority_floor_leader = {{{majority_floor_leader2|}}}
| majority = {{{majority2|}}}
| minister = {{{minister2|}}}
| minority_leader = {{#if: {{{minorityleader2|}}} | {{{minorityleader2}}} | {{{minority_leader2|}}} }}
| monarch = {{{monarch2|}}}
| nominator = {{{nominator2|}}}
| office = {{{office2|}}}
| order = {{{order2|}}}
| parliament = {{{parliament2|}}}
| parliamentarygroup = {{{parliamentarygroup2|}}}
| predecessor = {{{predecessor2|}}}
| preceding = {{{preceding2|}}}
| preceded = {{{preceded2|}}}
| premier = {{{premier2|}}}
| president = {{{president2|}}}
| primeminister = {{{primeminister2|}}}
| riding = {{{riding2|}}}
| speaker = {{{speaker|}}}
| speaker_office = {{{speaker_office|}}}
| state_assembly = {{{state_assembly|}}}
| state_delegate = {{{state_delegate|}}}
| state_house = {{{state_house|}}}
| state_legislature = {{{state_legislature|}}}
| state_senate = {{{state_senate|}}}
| state = {{{state|}}}
| subterm = {{nobold|{{{subterm|}}}}}
| suboffice = {{{suboffice|}}}
| succeeded = {{{succeeded2|}}}
| succeeding = {{{succeeding2|}}}
| successor = {{{successor2|}}}
| taoiseach = {{{taoiseach2|}}}
| termlabel = {{{term_label2|{{{termlabel2|In office}}}}}}
| termend = {{#if:{{{termend2|}}}|{{{termend2}}}|{{{term_end2|}}}}}
| termstart = {{#if:{{{termstart2|}}}|{{{termstart2}}}|{{{term_start2|}}}}}
| term = {{{term2|}}}
| title = {{{title2|}}}
| vicegovernor = {{{vicegovernor2|}}}
| vicepresident = {{{vicepresident2|}}}
| vicepremier = {{{vicepremier2|}}}
| viceprimeminister = {{{viceprimeminister2|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term|}}}
}}}}}}<!--
-->{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname|}}}
| 1namedata = {{{1namedata|}}}
| 2blankname = {{{2blankname|}}}
| 2namedata = {{{2namedata|}}}
| 3blankname = {{{3blankname|}}}
| 3namedata = {{{3namedata|}}}
| 4blankname = {{{4blankname|}}}
| 4namedata = {{{4namedata|}}}
| 5blankname = {{{5blankname|}}}
| 5namedata = {{{5namedata|}}}
| alongside = {{{alongside|}}}
| ambassador_from = {{{ambassador_from|}}}
| appointer = {{#if: {{{appointer|}}} | {{{appointer}}} | {{{appointed|}}} }}
| assembly = {{{assembly|}}}
| assuming = {{{assuming|}}}
| candidate = {{{candidate|}}}
| chancellor = {{{chancellor|}}}
| co-leader = {{{co-leader|}}}
| constituency_{{#if:{{{constituency_AM|}}}|AM|MP}} = {{#if: {{{constituency_AM|}}} | {{{constituency_AM}}} | {{{constituency_MP|}}} }}
| constituency = {{{constituency|}}}
| convocation = {{{convocation|}}}
| country = {{{country|}}}
| deputy = {{{deputy|}}}
| district = {{{district|}}}
| election_date = {{{election_date|}}}
| firstminister = {{{firstminister|}}}
| governor-general = {{{governor-general|}}}
| governor_general = {{{governor_general|}}}
| governor = {{{governor|}}}
| incumbent = {{{incumbent|}}}
| jr/sr = {{{jr/sr|}}}
| jr/sr and state = {{{jr/sr and state|}}}
| leader = {{{leader|}}}
| legislature = {{{legislature|}}}
| lieutenant_governor = {{{lieutenant_governor|}}}
| lieutenant = {{{lieutenant|}}}
| majority_leader = {{#if: {{{majorityleader|}}} | {{{majorityleader}}} | {{{majority_leader|}}} }}
| majority = {{{majority|}}}
| minister = {{{minister|}}}
| minister_from = {{{minister_from|}}}
| minority_floor_leader = {{{minority_floor_leader|}}}
| majority_floor_leader = {{{majority_floor_leader|}}}
| minority_leader = {{#if: {{{minorityleader|}}} | {{{minorityleader}}} | {{{minority_leader|}}} }}
| monarch = {{{monarch|}}}
| nominator = {{{nominator|}}}
| nominee = {{{nominee|}}}
| office = {{{office|}}}
| opponent = {{{opponent|}}}
| order = {{{order|}}}
| parliament = {{{parliament|}}}
| parliamentarygroup = {{{parliamentarygroup|}}}
| party_election = {{{party_election|}}}
| predecessor = {{{predecessor|}}}
| preceding = {{{preceding|}}}
| preceded = {{{preceded|}}}
| premier = {{{premier|}}}
| president = {{{president|}}}
| primeminister = {{{primeminister|}}}
| riding = {{{riding|}}}
| runningmate = {{{runningmate|}}}
| state_assembly = {{{state_assembly|}}}
| state_delegate = {{{state_delegate|}}}
| state_house = {{{state_house|}}}
| state_legislature = {{{state_legislature|}}}
| state_senate = {{{state_senate|}}}
| state = {{{state|}}}
| status = {{{status|}}}
| suboffice = {{{suboffice|}}}
| subterm = {{nobold|{{{subterm|}}}}}
| succeeded = {{{succeeded|}}}
| succeeding = {{{succeeding|}}}
| successor = {{{successor|}}}
| taoiseach = {{{taoiseach|}}}
| termlabel = {{{term_label|{{{termlabel|In office}}}}}}
| termend = {{#if: {{{termend|}}} | {{{termend}}} | {{{term_end|}}} }}
| termstart = {{#if: {{{termstart|}}} | {{{termstart}}} | {{{term_start|}}} }}
| term = {{{term|}}}
| title = {{{title|}}}
| vicegovernor = {{{vicegovernor|}}}
| vicepresident = {{{vicepresident|}}}
| vicepremier = {{{vicepremier|}}}
| viceprimeminister = {{{viceprimeminister|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term|}}}
}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname1|}}}
| 1namedata = {{{1namedata1|}}}
| 2blankname = {{{2blankname1|}}}
| 2namedata = {{{2namedata1|}}}
| 3blankname = {{{3blankname1|}}}
| 3namedata = {{{3namedata1|}}}
| 4blankname = {{{4blankname1|}}}
| 4namedata = {{{4namedata1|}}}
| 5blankname = {{{5blankname1|}}}
| 5namedata = {{{5namedata1|}}}
| alongside = {{{alongside1|}}}
| ambassador_from = {{{ambassador_from1|}}}
| appointer = {{#if: {{{appointer1|}}} | {{{appointer1}}} | {{{appointed1|}}} }}
| assembly = {{{assembly1|}}}
| assuming = {{{assuming1|}}}
| chancellor = {{{chancellor1|}}}
| co-leader = {{{co-leader1|}}}
| constituency_{{#if:{{{constituency_AM1|}}}|AM|MP}} = {{#if: {{{constituency_AM1|}}} | {{{constituency_AM1}}} | {{{constituency_MP1|}}} }}
| constituency = {{{constituency1|}}}
| convocation = {{{convocation1|}}}
| country = {{{country1|}}}
| deputy = {{{deputy1|}}}
| district = {{{district1|}}}
| firstminister = {{{firstminister1|}}}
| governor-general = {{{governor-general1|}}}
| governor_general = {{{governor_general1|}}}
| governor = {{{governor1|}}}
| jr/sr = {{{jr/sr1|}}}
| jr/sr and state = {{{jr/sr and state1|}}}
| leader = {{{leader1|}}}
| legislature = {{{legislature1|}}}
| lieutenant_governor = {{{lieutenant_governor1|}}}
| lieutenant = {{{lieutenant1|}}}
| minority_floor_leader = {{{minority_floor_leader1|}}}
| minister_from = {{{minister_from1|}}}
| majority_floor_leader = {{{majority_floor_leader1|}}}
| majority_leader = {{#if: {{{majorityleader1|}}} | {{{majorityleader1}}} | {{{majority_leader1|}}} }}
| majority = {{{majority1|}}}
| minister = {{{minister1|}}}
| minority_leader = {{#if: {{{minorityleader1|}}} | {{{minorityleader1}}} | {{{minority_leader1|}}} }}
| monarch = {{{monarch1|}}}
| nominator = {{{nominator1|}}}
| office = {{{office1|}}}
| order = {{{order1|}}}
| parliament = {{{parliament1|}}}
| parliamentarygroup = {{{parliamentarygroup1|}}}
| predecessor = {{{predecessor1|}}}
| preceding = {{{preceding1|}}}
| preceded = {{{preceded1|}}}
| premier = {{{premier1|}}}
| president = {{{president1|}}}
| primeminister = {{{primeminister1|}}}
| riding = {{{riding1|}}}
| state_assembly = {{{state_assembly1|}}}
| state_delegate = {{{state_delegate1|}}}
| state_house = {{{state_house1|}}}
| state_legislature = {{{state_legislature1|}}}
| state_senate = {{{state_senate1|}}}
| state = {{{state1|}}}
| status = {{{status1|}}}
| subterm = {{nobold|{{{subterm1|}}}}}
| suboffice = {{{suboffice1|}}}
| succeeded = {{{succeeded1|}}}
| succeeding = {{{succeeding1|}}}
| successor = {{{successor1|}}}
| taoiseach = {{{taoiseach1|}}}
| termlabel = {{{term_label1|{{{termlabel1|In office}}}}}}
| termend = {{#if:{{{termend1|}}}|{{{termend1}}}|{{{term_end1|}}}}}
| termstart = {{#if:{{{termstart1|}}}|{{{termstart1}}}|{{{term_start1|}}}}}
| term = {{{term1|}}}
| title = {{{title1|}}}
| vicegovernor = {{{vicegovernor1|}}}
| vicepresident = {{{vicepresident1|}}}
| vicepremier = {{{vicepremier1|}}}
| viceprimeminister = {{{viceprimeminister1|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term1|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{#if:{{{speaker|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname2|}}}
| 1namedata = {{{1namedata2|}}}
| 2blankname = {{{2blankname2|}}}
| 2namedata = {{{2namedata2|}}}
| 3blankname = {{{3blankname2|}}}
| 3namedata = {{{3namedata2|}}}
| 4blankname = {{{4blankname2|}}}
| 4namedata = {{{4namedata2|}}}
| 5blankname = {{{5blankname2|}}}
| 5namedata = {{{5namedata2|}}}
| alongside = {{{alongside2|}}}
| ambassador_from = {{{ambassador_from2|}}}
| appointer = {{#if: {{{appointer2|}}} | {{{appointer2}}} | {{{appointed2|}}} }}
| assembly = {{{assembly2|}}}
| assuming = {{{assuming2|}}}
| chancellor = {{{chancellor2|}}}
| co-leader = {{{co-leader2|}}}
| constituency_{{#if:{{{constituency_AM2|}}}|AM|MP}} = {{#if: {{{constituency_AM2|}}} | {{{constituency_AM2}}} | {{{constituency_MP2|}}} }}
| constituency = {{{constituency2|}}}
| convocation = {{{convocation2|}}}
| country = {{{country2|}}}
| deputy = {{{deputy2|}}}
| district = {{{district2|}}}
| firstminister = {{{firstminister2|}}}
| governor-general = {{{governor-general2|}}}
| governor_general = {{{governor_general2|}}}
| governor = {{{governor2|}}}
| jr/sr = {{{jr/sr2|}}}
| jr/sr and state = {{{jr/sr and state2|}}}
| leader = {{{leader2|}}}
| legislature = {{{legislature2|}}}
| lieutenant_governor = {{{lieutenant_governor2|}}}
| lieutenant = {{{lieutenant2|}}}
| majority_leader = {{#if: {{{majorityleader2|}}} | {{{majorityleader2}}} | {{{majority_leader2|}}} }}
| minister_from = {{{minister_from2|}}}
| minority_floor_leader = {{{minority_floor_leader2|}}}
| majority_floor_leader = {{{majority_floor_leader2|}}}
| majority = {{{majority2|}}}
| minister = {{{minister2|}}}
| minority_leader = {{#if: {{{minorityleader2|}}} | {{{minorityleader2}}} | {{{minority_leader2|}}} }}
| monarch = {{{monarch2|}}}
| nominator = {{{nominator2|}}}
| office = {{{office2|}}}
| order = {{{order2|}}}
| parliament = {{{parliament2|}}}
| parliamentarygroup = {{{parliamentarygroup2|}}}
| predecessor = {{{predecessor2|}}}
| preceding = {{{preceding2|}}}
| preceded = {{{preceded2|}}}
| premier = {{{premier2|}}}
| president = {{{president2|}}}
| primeminister = {{{primeminister2|}}}
| riding = {{{riding2|}}}
| state_assembly = {{{state_assembly2|}}}
| state_delegate = {{{state_delegate2|}}}
| state_house = {{{state_house2|}}}
| state_legislature = {{{state_legislature2|}}}
| state_senate = {{{state_senate2|}}}
| state = {{{state2|}}}
| status = {{{status2|}}}
| subterm = {{nobold|{{{subterm2|}}}}}
| suboffice = {{{suboffice2|}}}
| succeeded = {{{succeeded2|}}}
| succeeding = {{{succeeding2|}}}
| successor = {{{successor2|}}}
| taoiseach = {{{taoiseach2|}}}
| termlabel = {{{term_label2|{{{termlabel2|In office}}}}}}
| termend = {{#if:{{{termend2|}}}|{{{termend2}}}|{{{term_end2|}}}}}
| termstart = {{#if:{{{termstart2|}}}|{{{termstart2}}}|{{{term_start2|}}}}}
| term = {{{term2|}}}
| title = {{{title2|}}}
| vicegovernor = {{{vicegovernor2|}}}
| vicepresident = {{{vicepresident2|}}}
| vicepremier = {{{vicepremier2|}}}
| viceprimeminister = {{{viceprimeminister2|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term2|}}}
}}}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname3|}}}
| 1namedata = {{{1namedata3|}}}
| 2blankname = {{{2blankname3|}}}
| 2namedata = {{{2namedata3|}}}
| 3blankname = {{{3blankname3|}}}
| 3namedata = {{{3namedata3|}}}
| 4blankname = {{{4blankname3|}}}
| 4namedata = {{{4namedata3|}}}
| 5blankname = {{{5blankname3|}}}
| 5namedata = {{{5namedata3|}}}
| alongside = {{{alongside3|}}}
| ambassador_from = {{{ambassador_from3|}}}
| appointer = {{#if: {{{appointer3|}}} | {{{appointer3}}} | {{{appointed3|}}} }}
| assembly = {{{assembly3|}}}
| assuming = {{{assuming3|}}}
| chancellor = {{{chancellor3|}}}
| co-leader = {{{co-leader3|}}}
| constituency_{{#if:{{{constituency_AM3|}}}|AM|MP}} = {{#if: {{{constituency_AM3|}}} | {{{constituency_AM3}}} | {{{constituency_MP3|}}} }}
| constituency = {{{constituency3|}}}
| convocation = {{{convocation3|}}}
| country = {{{country3|}}}
| deputy = {{{deputy3|}}}
| district = {{{district3|}}}
| firstminister = {{{firstminister3|}}}
| governor-general = {{{governor-general3|}}}
| governor_general = {{{governor_general3|}}}
| governor = {{{governor3|}}}
| jr/sr = {{{jr/sr3|}}}
| jr/sr and state = {{{jr/sr and state3|}}}
| leader = {{{leader3|}}}
| legislature = {{{legislature3|}}}
| lieutenant_governor = {{{lieutenant_governor3|}}}
| lieutenant = {{{lieutenant3|}}}
| minority_floor_leader = {{{minority_floor_leader3|}}}
| minister_from = {{{minister_from3|}}}
| majority_floor_leader = {{{majority_floor_leader3|}}}
| majority_leader = {{#if: {{{majorityleader3|}}} | {{{majorityleader3}}} | {{{majority_leader3|}}} }}
| majority = {{{majority3|}}}
| minister = {{{minister3|}}}
| minority_leader = {{#if: {{{minorityleader3|}}} | {{{minorityleader3}}} | {{{minority_leader3|}}} }}
| monarch = {{{monarch3|}}}
| nominator = {{{nominator3|}}}
| office = {{{office3|}}}
| order = {{{order3|}}}
| parliament = {{{parliament3|}}}
| parliamentarygroup = {{{parliamentarygroup3|}}}
| predecessor = {{{predecessor3|}}}
| preceding = {{{preceding3|}}}
| preceded = {{{preceded3|}}}
| premier = {{{premier3|}}}
| president = {{{president3|}}}
| primeminister = {{{primeminister3|}}}
| riding = {{{riding3|}}}
| state_assembly = {{{state_assembly3|}}}
| state_delegate = {{{state_delegate3|}}}
| state_house = {{{state_house3|}}}
| state_legislature = {{{state_legislature3|}}}
| state_senate = {{{state_senate3|}}}
| state = {{{state3|}}}
| status = {{{status3|}}}
| subterm = {{nobold|{{{subterm3|}}}}}
| suboffice = {{{suboffice3|}}}
| succeeded = {{{succeeded3|}}}
| succeeding = {{{succeeding3|}}}
| successor = {{{successor3|}}}
| taoiseach = {{{taoiseach3|}}}
| termlabel = {{{term_label3|{{{termlabel3|In office}}}}}}
| termend = {{#if:{{{termend3|}}}|{{{termend3}}}|{{{term_end3|}}}}}
| termstart = {{#if:{{{termstart3|}}}|{{{termstart3}}}|{{{term_start3|}}}}}
| term = {{{term3|}}}
| title = {{{title3|}}}
| vicegovernor = {{{vicegovernor3|}}}
| vicepresident = {{{vicepresident3|}}}
| vicepremier = {{{vicepremier3|}}}
| viceprimeminister = {{{viceprimeminister3|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term3|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname4|}}}
| 1namedata = {{{1namedata4|}}}
| 2blankname = {{{2blankname4|}}}
| 2namedata = {{{2namedata4|}}}
| 3blankname = {{{3blankname4|}}}
| 3namedata = {{{3namedata4|}}}
| 4blankname = {{{4blankname4|}}}
| 4namedata = {{{4namedata4|}}}
| 5blankname = {{{5blankname4|}}}
| 5namedata = {{{5namedata4|}}}
| alongside = {{{alongside4|}}}
| ambassador_from = {{{ambassador_from4|}}}
| appointer = {{#if: {{{appointer4|}}} | {{{appointer4}}} | {{{appointed4|}}} }}
| assembly = {{{assembly4|}}}
| assuming = {{{assuming4|}}}
| chancellor = {{{chancellor4|}}}
| co-leader = {{{co-leader4|}}}
| constituency_{{#if:{{{constituency_AM4|}}}|AM|MP}} = {{#if: {{{constituency_AM4|}}} | {{{constituency_AM4}}} | {{{constituency_MP4|}}} }}
| constituency = {{{constituency4|}}}
| convocation = {{{convocation4|}}}
| country = {{{country4|}}}
| deputy = {{{deputy4|}}}
| district = {{{district4|}}}
| firstminister = {{{firstminister4|}}}
| governor-general = {{{governor-general4|}}}
| governor_general = {{{governor_general4|}}}
| governor = {{{governor4|}}}
| jr/sr = {{{jr/sr4|}}}
| jr/sr and state = {{{jr/sr and state4|}}}
| leader = {{{leader4|}}}
| legislature = {{{legislature4|}}}
| lieutenant_governor = {{{lieutenant_governor4|}}}
| lieutenant = {{{lieutenant4|}}}
| minister_from = {{{minister_from4|}}}
| minority_floor_leader = {{{minority_floor_leader4|}}}
| majority_floor_leader = {{{majority_floor_leader4|}}}
| majority_leader = {{#if: {{{majorityleader4|}}} | {{{majorityleader4}}} | {{{majority_leader4|}}} }}
| majority = {{{majority4|}}}
| minister = {{{minister4|}}}
| minority_leader = {{#if: {{{minorityleader4|}}} | {{{minorityleader4}}} | {{{minority_leader4|}}} }}
| monarch = {{{monarch4|}}}
| nominator = {{{nominator4|}}}
| office = {{{office4|}}}
| order = {{{order4|}}}
| parliament = {{{parliament4|}}}
| parliamentarygroup = {{{parliamentarygroup4|}}}
| predecessor = {{{predecessor4|}}}
| preceding = {{{preceding4|}}}
| preceded = {{{preceded4|}}}
| premier = {{{premier4|}}}
| president = {{{president4|}}}
| primeminister = {{{primeminister4|}}}
| riding = {{{riding4|}}}
| state_assembly = {{{state_assembly4|}}}
| state_delegate = {{{state_delegate4|}}}
| state_house = {{{state_house4|}}}
| state_legislature = {{{state_legislature4|}}}
| state_senate = {{{state_senate4|}}}
| state = {{{state4|}}}
| status = {{{status4|}}}
| subterm = {{nobold|{{{subterm4|}}}}}
| suboffice = {{{suboffice4|}}}
| succeeded = {{{succeeded4|}}}
| succeeding = {{{succeeding4|}}}
| successor = {{{successor4|}}}
| taoiseach = {{{taoiseach4|}}}
| termlabel = {{{term_label4|{{{termlabel4|In office}}}}}}
| termend = {{#if:{{{termend4|}}}|{{{termend4}}}|{{{term_end4|}}}}}
| termstart = {{#if:{{{termstart4|}}}|{{{termstart4}}}|{{{term_start4|}}}}}
| term = {{{term4|}}}
| title = {{{title4|}}}
| vicegovernor = {{{vicegovernor4|}}}
| vicepresident = {{{vicepresident4|}}}
| vicepremier = {{{vicepremier4|}}}
| viceprimeminister = {{{viceprimeminister4|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term4|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname5|}}}
| 1namedata = {{{1namedata5|}}}
| 2blankname = {{{2blankname5|}}}
| 2namedata = {{{2namedata5|}}}
| 3blankname = {{{3blankname5|}}}
| 3namedata = {{{3namedata5|}}}
| 4blankname = {{{4blankname5|}}}
| 4namedata = {{{4namedata5|}}}
| 5blankname = {{{5blankname5|}}}
| 5namedata = {{{5namedata5|}}}
| alongside = {{{alongside5|}}}
| ambassador_from = {{{ambassador_from5|}}}
| appointer = {{#if: {{{appointer5|}}} | {{{appointer5}}} | {{{appointed5|}}} }}
| assembly = {{{assembly5|}}}
| assuming = {{{assuming5|}}}
| chancellor = {{{chancellor5|}}}
| co-leader = {{{co-leader5|}}}
| constituency_{{#if:{{{constituency_AM5|}}}|AM|MP}} = {{#if: {{{constituency_AM5|}}} | {{{constituency_AM5}}} | {{{constituency_MP5|}}} }}
| constituency = {{{constituency5|}}}
| convocation = {{{convocation5|}}}
| country = {{{country5|}}}
| deputy = {{{deputy5|}}}
| district = {{{district5|}}}
| firstminister = {{{firstminister5|}}}
| governor-general = {{{governor-general5|}}}
| governor_general = {{{governor_general5|}}}
| governor = {{{governor5|}}}
| jr/sr = {{{jr/sr5|}}}
| jr/sr and state = {{{jr/sr and state5|}}}
| leader = {{{leader5|}}}
| legislature = {{{legislature5|}}}
| lieutenant_governor = {{{lieutenant_governor5|}}}
| lieutenant = {{{lieutenant5|}}}
| minister_from = {{{minister_from5|}}}
| minority_floor_leader = {{{minority_floor_leader5|}}}
| majority_floor_leader = {{{majority_floor_leader5|}}}
| majority_leader = {{#if: {{{majorityleader5|}}} | {{{majorityleader5}}} | {{{majority_leader5|}}} }}
| majority = {{{majority5|}}}
| minister = {{{minister5|}}}
| minority_leader = {{#if: {{{minorityleader5|}}} | {{{minorityleader5}}} | {{{minority_leader5|}}} }}
| monarch = {{{monarch5|}}}
| nominator = {{{nominator5|}}}
| office = {{{office5|}}}
| order = {{{order5|}}}
| parliament = {{{parliament5|}}}
| parliamentarygroup = {{{parliamentarygroup5|}}}
| predecessor = {{{predecessor5|}}}
| preceding = {{{preceding5|}}}
| preceded = {{{preceded5|}}}
| premier = {{{premier5|}}}
| president = {{{president5|}}}
| primeminister = {{{primeminister5|}}}
| riding = {{{riding5|}}}
| state_assembly = {{{state_assembly5|}}}
| state_delegate = {{{state_delegate5|}}}
| state_house = {{{state_house5|}}}
| state_legislature = {{{state_legislature5|}}}
| state_senate = {{{state_senate5|}}}
| state = {{{state5|}}}
| status = {{{status5|}}}
| subterm = {{nobold|{{{subterm5|}}}}}
| suboffice = {{{suboffice5|}}}
| succeeded = {{{succeeded5|}}}
| succeeding = {{{succeeding5|}}}
| successor = {{{successor5|}}}
| taoiseach = {{{taoiseach5|}}}
| termlabel = {{{term_label5|{{{termlabel5|In office}}}}}}
| termend = {{#if:{{{termend5|}}}|{{{termend5}}}|{{{term_end5|}}}}}
| termstart = {{#if:{{{termstart5|}}}|{{{termstart5}}}|{{{term_start5|}}}}}
| term = {{{term5|}}}
| title = {{{title5|}}}
| vicegovernor = {{{vicegovernor5|}}}
| vicepresident = {{{vicepresident5|}}}
| vicepremier = {{{vicepremier5|}}}
| viceprimeminister = {{{viceprimeminister5|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term5|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname6|}}}
| 1namedata = {{{1namedata6|}}}
| 2blankname = {{{2blankname6|}}}
| 2namedata = {{{2namedata6|}}}
| 3blankname = {{{3blankname6|}}}
| 3namedata = {{{3namedata6|}}}
| 4blankname = {{{4blankname6|}}}
| 4namedata = {{{4namedata6|}}}
| 5blankname = {{{5blankname6|}}}
| 5namedata = {{{5namedata6|}}}
| alongside = {{{alongside6|}}}
| ambassador_from = {{{ambassador_from6|}}}
| appointer = {{#if: {{{appointer6|}}} | {{{appointer6}}} | {{{appointed6|}}} }}
| assembly = {{{assembly6|}}}
| assuming = {{{assuming6|}}}
| chancellor = {{{chancellor6|}}}
| co-leader = {{{co-leader6|}}}
| constituency_{{#if:{{{constituency_AM6|}}}|AM|MP}} = {{#if: {{{constituency_AM6|}}} | {{{constituency_AM6}}} | {{{constituency_MP6|}}} }}
| constituency = {{{constituency6|}}}
| convocation = {{{convocation6|}}}
| country = {{{country6|}}}
| deputy = {{{deputy6|}}}
| district = {{{district6|}}}
| firstminister = {{{firstminister6|}}}
| governor-general = {{{governor-general6|}}}
| governor_general = {{{governor_general6|}}}
| governor = {{{governor6|}}}
| jr/sr = {{{jr/sr6|}}}
| jr/sr and state = {{{jr/sr and state6|}}}
| leader = {{{leader6|}}}
| legislature = {{{legislature6|}}}
| lieutenant_governor = {{{lieutenant_governor6|}}}
| lieutenant = {{{lieutenant6|}}}
| minority_floor_leader = {{{minority_floor_leader6|}}}
| minister_from = {{{minister_from6|}}}
| majority_floor_leader = {{{majority_floor_leader6|}}}
| majority_leader = {{#if: {{{majorityleader6|}}} | {{{majorityleader6}}} | {{{majority_leader6|}}} }}
| majority = {{{majority6|}}}
| minister = {{{minister6|}}}
| minority_leader = {{#if: {{{minorityleader6|}}} | {{{minorityleader6}}} | {{{minority_leader6|}}} }}
| monarch = {{{monarch6|}}}
| nominator = {{{nominator6|}}}
| office = {{{office6|}}}
| order = {{{order6|}}}
| parliament = {{{parliament6|}}}
| parliamentarygroup = {{{parliamentarygroup6|}}}
| predecessor = {{{predecessor6|}}}
| preceding = {{{preceding6|}}}
| preceded = {{{preceded6|}}}
| premier = {{{premier6|}}}
| president = {{{president6|}}}
| primeminister = {{{primeminister6|}}}
| riding = {{{riding6|}}}
| state_assembly = {{{state_assembly6|}}}
| state_delegate = {{{state_delegate6|}}}
| state_house = {{{state_house6|}}}
| state_legislature = {{{state_legislature6|}}}
| state_senate = {{{state_senate6|}}}
| state = {{{state6|}}}
| status = {{{status6|}}}
| subterm = {{nobold|{{{subterm6|}}}}}
| suboffice = {{{suboffice6|}}}
| succeeded = {{{succeeded6|}}}
| succeeding = {{{succeeding6|}}}
| successor = {{{successor6|}}}
| taoiseach = {{{taoiseach6|}}}
| termlabel = {{{term_label6|{{{termlabel6|In office}}}}}}
| termend = {{#if:{{{termend6|}}}|{{{termend6}}}|{{{term_end6|}}}}}
| termstart = {{#if:{{{termstart6|}}}|{{{termstart6}}}|{{{term_start6|}}}}}
| term = {{{term6|}}}
| title = {{{title6|}}}
| vicegovernor = {{{vicegovernor6|}}}
| vicepresident = {{{vicepresident6|}}}
| vicepremier = {{{vicepremier6|}}}
| viceprimeminister = {{{viceprimeminister6|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term6|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname7|}}}
| 1namedata = {{{1namedata7|}}}
| 2blankname = {{{2blankname7|}}}
| 2namedata = {{{2namedata7|}}}
| 3blankname = {{{3blankname7|}}}
| 3namedata = {{{3namedata7|}}}
| 4blankname = {{{4blankname7|}}}
| 4namedata = {{{4namedata7|}}}
| 5blankname = {{{5blankname7|}}}
| 5namedata = {{{5namedata7|}}}
| alongside = {{{alongside7|}}}
| ambassador_from = {{{ambassador_from7|}}}
| appointer = {{#if: {{{appointer7|}}} | {{{appointer7}}} | {{{appointed7|}}} }}
| assembly = {{{assembly7|}}}
| assuming = {{{assuming7|}}}
| chancellor = {{{chancellor7|}}}
| co-leader = {{{co-leader7|}}}
| constituency_{{#if:{{{constituency_AM7|}}}|AM|MP}} = {{#if: {{{constituency_AM7|}}} | {{{constituency_AM7}}} | {{{constituency_MP7|}}} }}
| constituency = {{{constituency7|}}}
| convocation = {{{convocation7|}}}
| country = {{{country7|}}}
| deputy = {{{deputy7|}}}
| district = {{{district7|}}}
| firstminister = {{{firstminister7|}}}
| governor-general = {{{governor-general7|}}}
| governor_general = {{{governor_general7|}}}
| governor = {{{governor7|}}}
| jr/sr = {{{jr/sr7|}}}
| jr/sr and state = {{{jr/sr and state7|}}}
| leader = {{{leader7|}}}
| legislature = {{{legislature7|}}}
| lieutenant_governor = {{{lieutenant_governor7|}}}
| lieutenant = {{{lieutenant7|}}}
| minister_from = {{{minister_from7|}}}
| minority_floor_leader = {{{minority_floor_leader7|}}}
| majority_floor_leader = {{{majority_floor_leader7|}}}
| majority_leader = {{#if: {{{majorityleader7|}}} | {{{majorityleader7}}} | {{{majority_leader7|}}} }}
| majority = {{{majority7|}}}
| minister = {{{minister7|}}}
| minority_leader = {{#if: {{{minorityleader7|}}} | {{{minorityleader7}}} | {{{minority_leader7|}}} }}
| monarch = {{{monarch7|}}}
| nominator = {{{nominator7|}}}
| office = {{{office7|}}}
| order = {{{order7|}}}
| parliament = {{{parliament7|}}}
| parliamentarygroup = {{{parliamentarygroup7|}}}
| predecessor = {{{predecessor7|}}}
| preceding = {{{preceding7|}}}
| preceded = {{{preceded7|}}}
| premier = {{{premier7|}}}
| president = {{{president7|}}}
| primeminister = {{{primeminister7|}}}
| riding = {{{riding7|}}}
| state_assembly = {{{state_assembly7|}}}
| state_delegate = {{{state_delegate7|}}}
| state_house = {{{state_house7|}}}
| state_legislature = {{{state_legislature7|}}}
| state_senate = {{{state_senate7|}}}
| state = {{{state7|}}}
| status = {{{status7|}}}
| subterm = {{nobold|{{{subterm7|}}}}}
| suboffice = {{{suboffice7|}}}
| succeeded = {{{succeeded7|}}}
| succeeding = {{{succeeding7|}}}
| successor = {{{successor7|}}}
| taoiseach = {{{taoiseach7|}}}
| termlabel = {{{term_label7|{{{termlabel7|In office}}}}}}
| termend = {{#if:{{{termend7|}}}|{{{termend7}}}|{{{term_end7|}}}}}
| termstart = {{#if:{{{termstart7|}}}|{{{termstart7}}}|{{{term_start7|}}}}}
| term = {{{term7|}}}
| title = {{{title7|}}}
| vicegovernor = {{{vicegovernor7|}}}
| vicepresident = {{{vicepresident7|}}}
| vicepremier = {{{vicepremier7|}}}
| viceprimeminister = {{{viceprimeminister7|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term7|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname8|}}}
| 1namedata = {{{1namedata8|}}}
| 2blankname = {{{2blankname8|}}}
| 2namedata = {{{2namedata8|}}}
| 3blankname = {{{3blankname8|}}}
| 3namedata = {{{3namedata8|}}}
| 4blankname = {{{4blankname8|}}}
| 4namedata = {{{4namedata8|}}}
| 5blankname = {{{5blankname8|}}}
| 5namedata = {{{5namedata8|}}}
| alongside = {{{alongside8|}}}
| ambassador_from = {{{ambassador_from8|}}}
| appointer = {{#if: {{{appointer8|}}} | {{{appointer8}}} | {{{appointed8|}}} }}
| assembly = {{{assembly8|}}}
| assuming = {{{assuming8|}}}
| chancellor = {{{chancellor8|}}}
| co-leader = {{{co-leader8|}}}
| constituency_{{#if:{{{constituency_AM8|}}}|AM|MP}} = {{#if: {{{constituency_AM8|}}} | {{{constituency_AM8}}} | {{{constituency_MP8|}}} }}
| constituency = {{{constituency8|}}}
| convocation = {{{convocation8|}}}
| country = {{{country8|}}}
| deputy = {{{deputy8|}}}
| district = {{{district8|}}}
| firstminister = {{{firstminister8|}}}
| governor-general = {{{governor-general8|}}}
| governor_general = {{{governor_general8|}}}
| governor = {{{governor8|}}}
| jr/sr = {{{jr/sr8|}}}
| jr/sr and state = {{{jr/sr and state8|}}}
| leader = {{{leader8|}}}
| legislature = {{{legislature8|}}}
| lieutenant_governor = {{{lieutenant_governor8|}}}
| lieutenant = {{{lieutenant8|}}}
| minister_from = {{{minister_from8|}}}
| minority_floor_leader = {{{minority_floor_leader8|}}}
| majority_floor_leader = {{{majority_floor_leader8|}}}
| majority_leader = {{#if: {{{majorityleader8|}}} | {{{majorityleader8}}} | {{{majority_leader8|}}} }}
| majority = {{{majority8|}}}
| minister = {{{minister8|}}}
| minority_leader = {{#if: {{{minorityleader8|}}} | {{{minorityleader8}}} | {{{minority_leader8|}}} }}
| monarch = {{{monarch8|}}}
| nominator = {{{nominator8|}}}
| office = {{{office8|}}}
| order = {{{order8|}}}
| parliament = {{{parliament8|}}}
| parliamentarygroup = {{{parliamentarygroup8|}}}
| predecessor = {{{predecessor8|}}}
| preceding = {{{preceding8|}}}
| preceded = {{{preceded8|}}}
| premier = {{{premier8|}}}
| president = {{{president8|}}}
| primeminister = {{{primeminister8|}}}
| riding = {{{riding8|}}}
| state_assembly = {{{state_assembly8|}}}
| state_delegate = {{{state_delegate8|}}}
| state_house = {{{state_house8|}}}
| state_legislature = {{{state_legislature8|}}}
| state_senate = {{{state_senate8|}}}
| state = {{{state8|}}}
| status = {{{status8|}}}
| subterm = {{nobold|{{{subterm8|}}}}}
| suboffice = {{{suboffice8|}}}
| succeeded = {{{succeeded8|}}}
| succeeding = {{{succeeding8|}}}
| successor = {{{successor8|}}}
| taoiseach = {{{taoiseach8|}}}
| termlabel = {{{term_label8|{{{termlabel8|In office}}}}}}
| termend = {{#if:{{{termend8|}}}|{{{termend8}}}|{{{term_end8|}}}}}
| termstart = {{#if:{{{termstart8|}}}|{{{termstart8}}}|{{{term_start8|}}}}}
| term = {{{term8|}}}
| title = {{{title8|}}}
| vicegovernor = {{{vicegovernor8|}}}
| vicepresident = {{{vicepresident8|}}}
| vicepremier = {{{vicepremier8|}}}
| viceprimeminister = {{{viceprimeminister8|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term8|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname9|}}}
| 1namedata = {{{1namedata9|}}}
| 2blankname = {{{2blankname9|}}}
| 2namedata = {{{2namedata9|}}}
| 3blankname = {{{3blankname9|}}}
| 3namedata = {{{3namedata9|}}}
| 4blankname = {{{4blankname9|}}}
| 4namedata = {{{4namedata9|}}}
| 5blankname = {{{5blankname9|}}}
| 5namedata = {{{5namedata9|}}}
| alongside = {{{alongside9|}}}
| ambassador_from = {{{ambassador_from9|}}}
| appointer = {{#if: {{{appointer9|}}} | {{{appointer9}}} | {{{appointed9|}}} }}
| assembly = {{{assembly9|}}}
| assuming = {{{assuming9|}}}
| chancellor = {{{chancellor9|}}}
| co-leader = {{{co-leader9|}}}
| constituency_{{#if:{{{constituency_AM9|}}}|AM|MP}} = {{#if: {{{constituency_AM9|}}} | {{{constituency_AM9}}} | {{{constituency_MP9|}}} }}
| constituency = {{{constituency9|}}}
| convocation = {{{convocation9|}}}
| country = {{{country9|}}}
| deputy = {{{deputy9|}}}
| district = {{{district9|}}}
| firstminister = {{{firstminister9|}}}
| governor-general = {{{governor-general9|}}}
| governor_general = {{{governor_general9|}}}
| governor = {{{governor9|}}}
| jr/sr = {{{jr/sr9|}}}
| jr/sr and state = {{{jr/sr and state9|}}}
| leader = {{{leader9|}}}
| legislature = {{{legislature9|}}}
| lieutenant_governor = {{{lieutenant_governor9|}}}
| lieutenant = {{{lieutenant9|}}}
| minister_from = {{{minister_from9|}}}
| minority_floor_leader = {{{minority_floor_leader9|}}}
| majority_floor_leader = {{{majority_floor_leader9|}}}
| majority_leader = {{#if: {{{majorityleader9|}}} | {{{majorityleader9}}} | {{{majority_leader9|}}} }}
| majority = {{{majority9|}}}
| minister = {{{minister9|}}}
| minority_leader = {{#if: {{{minorityleader9|}}} | {{{minorityleader9}}} | {{{minority_leader9|}}} }}
| monarch = {{{monarch9|}}}
| nominator = {{{nominator9|}}}
| office = {{{office9|}}}
| order = {{{order9|}}}
| parliament = {{{parliament9|}}}
| parliamentarygroup = {{{parliamentarygroup9|}}}
| predecessor = {{{predecessor9|}}}
| preceding = {{{preceding9|}}}
| preceded = {{{preceded9|}}}
| premier = {{{premier9|}}}
| president = {{{president9|}}}
| primeminister = {{{primeminister9|}}}
| riding = {{{riding9|}}}
| state_assembly = {{{state_assembly9|}}}
| state_delegate = {{{state_delegate9|}}}
| state_house = {{{state_house9|}}}
| state_legislature = {{{state_legislature9|}}}
| state_senate = {{{state_senate9|}}}
| state = {{{state9|}}}
| status = {{{status9|}}}
| subterm = {{nobold|{{{subterm9|}}}}}
| suboffice = {{{suboffice9|}}}
| succeeded = {{{succeeded9|}}}
| succeeding = {{{succeeding9|}}}
| successor = {{{successor9|}}}
| taoiseach = {{{taoiseach9|}}}
| termlabel = {{{term_label9|{{{termlabel9|In office}}}}}}
| termend = {{#if:{{{termend9|}}}|{{{termend9}}}|{{{term_end9|}}}}}
| termstart = {{#if:{{{termstart9|}}}|{{{termstart9}}}|{{{term_start9|}}}}}
| term = {{{term9|}}}
| title = {{{title9|}}}
| vicegovernor = {{{vicegovernor9|}}}
| vicepresident = {{{vicepresident9|}}}
| vicepremier = {{{vicepremier9|}}}
| viceprimeminister = {{{viceprimeminister9|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term9|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname10|}}}
| 1namedata = {{{1namedata10|}}}
| 2blankname = {{{2blankname10|}}}
| 2namedata = {{{2namedata10|}}}
| 3blankname = {{{3blankname10|}}}
| 3namedata = {{{3namedata10|}}}
| 4blankname = {{{4blankname10|}}}
| 4namedata = {{{4namedata10|}}}
| 5blankname = {{{5blankname10|}}}
| 5namedata = {{{5namedata10|}}}
| alongside = {{{alongside10|}}}
| ambassador_from = {{{ambassador_from10|}}}
| appointer = {{#if: {{{appointer10|}}} | {{{appointer10}}} | {{{appointed10|}}} }}
| assembly = {{{assembly10|}}}
| assuming = {{{assuming10|}}}
| chancellor = {{{chancellor10|}}}
| co-leader = {{{co-leader10|}}}
| constituency_{{#if:{{{constituency_AM10|}}}|AM|MP}} = {{#if: {{{constituency_AM10|}}} | {{{constituency_AM10}}} | {{{constituency_MP10|}}} }}
| constituency = {{{constituency10|}}}
| convocation = {{{convocation10|}}}
| country = {{{country10|}}}
| deputy = {{{deputy10|}}}
| district = {{{district10|}}}
| firstminister = {{{firstminister10|}}}
| governor-general = {{{governor-general10|}}}
| governor_general = {{{governor_general10|}}}
| governor = {{{governor10|}}}
| jr/sr = {{{jr/sr10|}}}
| jr/sr and state = {{{jr/sr and state10|}}}
| leader = {{{leader10|}}}
| legislature = {{{legislature10|}}}
| lieutenant_governor = {{{lieutenant_governor10|}}}
| lieutenant = {{{lieutenant10|}}}
| minister_from = {{{minister_from10|}}}
| minority_floor_leader = {{{minority_floor_leader10|}}}
| majority_floor_leader = {{{majority_floor_leader10|}}}
| majority_leader = {{#if: {{{majorityleader10|}}} | {{{majorityleader10}}} | {{{majority_leader10|}}} }}
| majority = {{{majority10|}}}
| minister = {{{minister10|}}}
| minority_leader = {{#if: {{{minorityleader10|}}} | {{{minorityleader10}}} | {{{minority_leader10|}}} }}
| monarch = {{{monarch10|}}}
| nominator = {{{nominator10|}}}
| office = {{{office10|}}}
| order = {{{order10|}}}
| parliament = {{{parliament10|}}}
| parliamentarygroup = {{{parliamentarygroup10|}}}
| predecessor = {{{predecessor10|}}}
| preceding = {{{preceding10|}}}
| preceded = {{{preceded10|}}}
| premier = {{{premier10|}}}
| president = {{{president10|}}}
| primeminister = {{{primeminister10|}}}
| riding = {{{riding10|}}}
| state_assembly = {{{state_assembly10|}}}
| state_delegate = {{{state_delegate10|}}}
| state_house = {{{state_house10|}}}
| state_legislature = {{{state_legislature10|}}}
| state_senate = {{{state_senate10|}}}
| state = {{{state10|}}}
| status = {{{status10|}}}
| subterm = {{nobold|{{{subterm10|}}}}}
| suboffice = {{{suboffice10|}}}
| succeeded = {{{succeeded10|}}}
| succeeding = {{{succeeding10|}}}
| successor = {{{successor10|}}}
| taoiseach = {{{taoiseach10|}}}
| termlabel = {{{term_label10|{{{termlabel10|In office}}}}}}
| termend = {{#if:{{{termend10|}}}|{{{termend10}}}|{{{term_end10|}}}}}
| termstart = {{#if:{{{termstart10|}}}|{{{termstart10}}}|{{{term_start10|}}}}}
| term = {{{term10|}}}
| title = {{{title10|}}}
| vicegovernor = {{{vicegovernor10|}}}
| vicepresident = {{{vicepresident10|}}}
| vicepremier = {{{vicepremier10|}}}
| viceprimeminister = {{{viceprimeminister10|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term10|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname11|}}}
| 1namedata = {{{1namedata11|}}}
| 2blankname = {{{2blankname11|}}}
| 2namedata = {{{2namedata11|}}}
| 3blankname = {{{3blankname11|}}}
| 3namedata = {{{3namedata11|}}}
| 4blankname = {{{4blankname11|}}}
| 4namedata = {{{4namedata11|}}}
| 5blankname = {{{5blankname11|}}}
| 5namedata = {{{5namedata11|}}}
| alongside = {{{alongside11|}}}
| ambassador_from = {{{ambassador_from11|}}}
| appointer = {{#if: {{{appointer11|}}} | {{{appointer11}}} | {{{appointed11|}}} }}
| assembly = {{{assembly11|}}}
| assuming = {{{assuming11|}}}
| chancellor = {{{chancellor11|}}}
| co-leader = {{{co-leader11|}}}
| constituency_{{#if:{{{constituency_AM11|}}}|AM|MP}} = {{#if: {{{constituency_AM11|}}} | {{{constituency_AM11}}} | {{{constituency_MP11|}}} }}
| constituency = {{{constituency11|}}}
| convocation = {{{convocation11|}}}
| country = {{{country11|}}}
| deputy = {{{deputy11|}}}
| district = {{{district11|}}}
| firstminister = {{{firstminister11|}}}
| governor-general = {{{governor-general11|}}}
| governor_general = {{{governor_general11|}}}
| governor = {{{governor11|}}}
| jr/sr = {{{jr/sr11|}}}
| jr/sr and state = {{{jr/sr and state11|}}}
| leader = {{{leader11|}}}
| legislature = {{{legislature11|}}}
| lieutenant_governor = {{{lieutenant_governor11|}}}
| lieutenant = {{{lieutenant11|}}}
| minister_from = {{{minister_from11|}}}
| minority_floor_leader = {{{minority_floor_leader11|}}}
| majority_floor_leader = {{{majority_floor_leader11|}}}
| majority_leader = {{#if: {{{majorityleader11|}}} | {{{majorityleader11}}} | {{{majority_leader11|}}} }}
| majority = {{{majority11|}}}
| minister = {{{minister11|}}}
| minority_leader = {{#if: {{{minorityleader11|}}} | {{{minorityleader11}}} | {{{minority_leader11|}}} }}
| monarch = {{{monarch11|}}}
| nominator = {{{nominator11|}}}
| office = {{{office11|}}}
| order = {{{order11|}}}
| parliament = {{{parliament11|}}}
| parliamentarygroup = {{{parliamentarygroup11|}}}
| predecessor = {{{predecessor11|}}}
| preceding = {{{preceding11|}}}
| preceded = {{{preceded11|}}}
| premier = {{{premier11|}}}
| president = {{{president11|}}}
| primeminister = {{{primeminister11|}}}
| riding = {{{riding11|}}}
| state_assembly = {{{state_assembly11|}}}
| state_delegate = {{{state_delegate11|}}}
| state_house = {{{state_house11|}}}
| state_legislature = {{{state_legislature11|}}}
| state_senate = {{{state_senate11|}}}
| state = {{{state11|}}}
| status = {{{status11|}}}
| subterm = {{nobold|{{{subterm11|}}}}}
| suboffice = {{{suboffice11|}}}
| succeeded = {{{succeeded11|}}}
| succeeding = {{{succeeding11|}}}
| successor = {{{successor11|}}}
| taoiseach = {{{taoiseach11|}}}
| termlabel = {{{term_label11|{{{termlabel11|In office}}}}}}
| termend = {{#if:{{{termend11|}}}|{{{termend11}}}|{{{term_end11|}}}}}
| termstart = {{#if:{{{termstart11|}}}|{{{termstart11}}}|{{{term_start11|}}}}}
| term = {{{term11|}}}
| title = {{{title11|}}}
| vicegovernor = {{{vicegovernor11|}}}
| vicepresident = {{{vicepresident11|}}}
| vicepremier = {{{vicepremier11|}}}
| viceprimeminister = {{{viceprimeminister11|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term11|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname12|}}}
| 1namedata = {{{1namedata12|}}}
| 2blankname = {{{2blankname12|}}}
| 2namedata = {{{2namedata12|}}}
| 3blankname = {{{3blankname12|}}}
| 3namedata = {{{3namedata12|}}}
| 4blankname = {{{4blankname12|}}}
| 4namedata = {{{4namedata12|}}}
| 5blankname = {{{5blankname12|}}}
| 5namedata = {{{5namedata12|}}}
| alongside = {{{alongside12|}}}
| ambassador_from = {{{ambassador_from12|}}}
| appointer = {{#if: {{{appointer12|}}} | {{{appointer12}}} | {{{appointed12|}}} }}
| assembly = {{{assembly12|}}}
| assuming = {{{assuming12|}}}
| chancellor = {{{chancellor12|}}}
| co-leader = {{{co-leader12|}}}
| constituency_{{#if:{{{constituency_AM12|}}}|AM|MP}} = {{#if: {{{constituency_AM12|}}} | {{{constituency_AM12}}} | {{{constituency_MP12|}}} }}
| constituency = {{{constituency12|}}}
| convocation = {{{convocation12|}}}
| country = {{{country12|}}}
| deputy = {{{deputy12|}}}
| district = {{{district12|}}}
| firstminister = {{{firstminister12|}}}
| governor-general = {{{governor-general12|}}}
| governor_general = {{{governor_general12|}}}
| governor = {{{governor12|}}}
| jr/sr = {{{jr/sr12|}}}
| jr/sr and state = {{{jr/sr and state12|}}}
| leader = {{{leader12|}}}
| legislature = {{{legislature12|}}}
| lieutenant_governor = {{{lieutenant_governor12|}}}
| lieutenant = {{{lieutenant12|}}}
| minister_from = {{{minister_from12|}}}
| minority_floor_leader = {{{minority_floor_leader12|}}}
| majority_floor_leader = {{{majority_floor_leader12|}}}
| majority_leader = {{#if: {{{majorityleader12|}}} | {{{majorityleader12}}} | {{{majority_leader12|}}} }}
| majority = {{{majority12|}}}
| minister = {{{minister12|}}}
| minority_leader = {{#if: {{{minorityleader12|}}} | {{{minorityleader12}}} | {{{minority_leader12|}}} }}
| monarch = {{{monarch12|}}}
| nominator = {{{nominator12|}}}
| office = {{{office12|}}}
| order = {{{order12|}}}
| parliament = {{{parliament12|}}}
| parliamentarygroup = {{{parliamentarygroup12|}}}
| predecessor = {{{predecessor12|}}}
| preceding = {{{preceding12|}}}
| preceded = {{{preceded12|}}}
| premier = {{{premier12|}}}
| president = {{{president12|}}}
| primeminister = {{{primeminister12|}}}
| riding = {{{riding12|}}}
| state_assembly = {{{state_assembly12|}}}
| state_delegate = {{{state_delegate12|}}}
| state_house = {{{state_house12|}}}
| state_legislature = {{{state_legislature12|}}}
| state_senate = {{{state_senate12|}}}
| state = {{{state12|}}}
| status = {{{status12|}}}
| subterm = {{nobold|{{{subterm12|}}}}}
| suboffice = {{{suboffice12|}}}
| succeeded = {{{succeeded12|}}}
| succeeding = {{{succeeding12|}}}
| successor = {{{successor12|}}}
| taoiseach = {{{taoiseach12|}}}
| termlabel = {{{term_label12|{{{termlabel12|In office}}}}}}
| termend = {{#if:{{{termend12|}}}|{{{termend12}}}|{{{term_end12|}}}}}
| termstart = {{#if:{{{termstart12|}}}|{{{termstart12}}}|{{{term_start12|}}}}}
| term = {{{term12|}}}
| title = {{{title12|}}}
| vicegovernor = {{{vicegovernor12|}}}
| vicepresident = {{{vicepresident12|}}}
| vicepremier = {{{vicepremier12|}}}
| viceprimeminister = {{{viceprimeminister12|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term12|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname13|}}}
| 1namedata = {{{1namedata13|}}}
| 2blankname = {{{2blankname13|}}}
| 2namedata = {{{2namedata13|}}}
| 3blankname = {{{3blankname13|}}}
| 3namedata = {{{3namedata13|}}}
| 4blankname = {{{4blankname13|}}}
| 4namedata = {{{4namedata13|}}}
| 5blankname = {{{5blankname13|}}}
| 5namedata = {{{5namedata13|}}}
| alongside = {{{alongside13|}}}
| ambassador_from = {{{ambassador_from13|}}}
| appointer = {{#if: {{{appointer13|}}} | {{{appointer13}}} | {{{appointed13|}}} }}
| assembly = {{{assembly13|}}}
| assuming = {{{assuming13|}}}
| chancellor = {{{chancellor13|}}}
| co-leader = {{{co-leader13|}}}
| constituency_{{#if:{{{constituency_AM13|}}}|AM|MP}} = {{#if: {{{constituency_AM13|}}} | {{{constituency_AM13}}} | {{{constituency_MP13|}}} }}
| constituency = {{{constituency13|}}}
| convocation = {{{convocation13|}}}
| country = {{{country13|}}}
| deputy = {{{deputy13|}}}
| district = {{{district13|}}}
| firstminister = {{{firstminister13|}}}
| governor-general = {{{governor-general13|}}}
| governor_general = {{{governor_general13|}}}
| governor = {{{governor13|}}}
| jr/sr = {{{jr/sr13|}}}
| jr/sr and state = {{{jr/sr and state13|}}}
| leader = {{{leader13|}}}
| legislature = {{{legislature13|}}}
| lieutenant_governor = {{{lieutenant_governor13|}}}
| lieutenant = {{{lieutenant13|}}}
| minister_from = {{{minister_from13|}}}
| minority_floor_leader = {{{minority_floor_leader13|}}}
| majority_floor_leader = {{{majority_floor_leader13|}}}
| majority_leader = {{#if: {{{majorityleader13|}}} | {{{majorityleader13}}} | {{{majority_leader13|}}} }}
| majority = {{{majority13|}}}
| minister = {{{minister13|}}}
| minority_leader = {{#if: {{{minorityleader13|}}} | {{{minorityleader13}}} | {{{minority_leader13|}}} }}
| monarch = {{{monarch13|}}}
| nominator = {{{nominator13|}}}
| office = {{{office13|}}}
| order = {{{order13|}}}
| parliament = {{{parliament13|}}}
| parliamentarygroup = {{{parliamentarygroup13|}}}
| predecessor = {{{predecessor13|}}}
| preceding = {{{preceding13|}}}
| preceded = {{{preceded13|}}}
| premier = {{{premier13|}}}
| president = {{{president13|}}}
| primeminister = {{{primeminister13|}}}
| riding = {{{riding13|}}}
| state_assembly = {{{state_assembly13|}}}
| state_delegate = {{{state_delegate13|}}}
| state_house = {{{state_house13|}}}
| state_legislature = {{{state_legislature13|}}}
| state_senate = {{{state_senate13|}}}
| state = {{{state13|}}}
| status = {{{status13|}}}
| subterm = {{nobold|{{{subterm13|}}}}}
| suboffice = {{{suboffice13|}}}
| succeeded = {{{succeeded13|}}}
| succeeding = {{{succeeding13|}}}
| successor = {{{successor13|}}}
| taoiseach = {{{taoiseach13|}}}
| termlabel = {{{term_label13|{{{termlabel13|In office}}}}}}
| termend = {{#if:{{{termend13|}}}|{{{termend13}}}|{{{term_end13|}}}}}
| termstart = {{#if:{{{termstart13|}}}|{{{termstart13}}}|{{{term_start13|}}}}}
| term = {{{term13|}}}
| title = {{{title13|}}}
| vicegovernor = {{{vicegovernor13|}}}
| vicepresident = {{{vicepresident13|}}}
| vicepremier = {{{vicepremier13|}}}
| viceprimeminister = {{{viceprimeminister13|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term13|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname14|}}}
| 1namedata = {{{1namedata14|}}}
| 2blankname = {{{2blankname14|}}}
| 2namedata = {{{2namedata14|}}}
| 3blankname = {{{3blankname14|}}}
| 3namedata = {{{3namedata14|}}}
| 4blankname = {{{4blankname14|}}}
| 4namedata = {{{4namedata14|}}}
| 5blankname = {{{5blankname14|}}}
| 5namedata = {{{5namedata14|}}}
| alongside = {{{alongside14|}}}
| ambassador_from = {{{ambassador_from14|}}}
| appointer = {{#if: {{{appointer14|}}} | {{{appointer14}}} | {{{appointed14|}}} }}
| assembly = {{{assembly14|}}}
| assuming = {{{assuming14|}}}
| chancellor = {{{chancellor14|}}}
| co-leader = {{{co-leader14|}}}
| constituency_{{#if:{{{constituency_AM14|}}}|AM|MP}} = {{#if: {{{constituency_AM14|}}} | {{{constituency_AM14}}} | {{{constituency_MP14|}}} }}
| constituency = {{{constituency14|}}}
| convocation = {{{convocation14|}}}
| country = {{{country14|}}}
| deputy = {{{deputy14|}}}
| district = {{{district14|}}}
| firstminister = {{{firstminister14|}}}
| governor-general = {{{governor-general14|}}}
| governor_general = {{{governor_general14|}}}
| governor = {{{governor14|}}}
| jr/sr = {{{jr/sr14|}}}
| jr/sr and state = {{{jr/sr and state14|}}}
| leader = {{{leader14|}}}
| legislature = {{{legislature14|}}}
| lieutenant_governor = {{{lieutenant_governor14|}}}
| lieutenant = {{{lieutenant14|}}}
| minister_from = {{{minister_from14|}}}
| minority_floor_leader = {{{minority_floor_leader14|}}}
| majority_floor_leader = {{{majority_floor_leader14|}}}
| majority_leader = {{#if: {{{majorityleader14|}}} | {{{majorityleader14}}} | {{{majority_leader14|}}} }}
| majority = {{{majority14|}}}
| minister = {{{minister14|}}}
| minority_leader = {{#if: {{{minorityleader14|}}} | {{{minorityleader14}}} | {{{minority_leader14|}}} }}
| monarch = {{{monarch14|}}}
| nominator = {{{nominator14|}}}
| office = {{{office14|}}}
| order = {{{order14|}}}
| parliament = {{{parliament14|}}}
| parliamentarygroup = {{{parliamentarygroup14|}}}
| predecessor = {{{predecessor14|}}}
| preceding = {{{preceding14|}}}
| preceded = {{{preceded14|}}}
| premier = {{{premier14|}}}
| president = {{{president14|}}}
| primeminister = {{{primeminister14|}}}
| riding = {{{riding14|}}}
| state_assembly = {{{state_assembly14|}}}
| state_delegate = {{{state_delegate14|}}}
| state_house = {{{state_house14|}}}
| state_legislature = {{{state_legislature14|}}}
| state_senate = {{{state_senate14|}}}
| state = {{{state14|}}}
| status = {{{status14|}}}
| subterm = {{nobold|{{{subterm14|}}}}}
| suboffice = {{{suboffice14|}}}
| succeeded = {{{succeeded14|}}}
| succeeding = {{{succeeding14|}}}
| successor = {{{successor14|}}}
| taoiseach = {{{taoiseach14|}}}
| termlabel = {{{term_label14|{{{termlabel14|In office}}}}}}
| termend = {{#if:{{{termend14|}}}|{{{termend14}}}|{{{term_end14|}}}}}
| termstart = {{#if:{{{termstart14|}}}|{{{termstart14}}}|{{{term_start14|}}}}}
| term = {{{term14|}}}
| title = {{{title14|}}}
| vicegovernor = {{{vicegovernor14|}}}
| vicepresident = {{{vicepresident14|}}}
| vicepremier = {{{vicepremier14|}}}
| viceprimeminister = {{{viceprimeminister14|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term14|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname15|}}}
| 1namedata = {{{1namedata15|}}}
| 2blankname = {{{2blankname15|}}}
| 2namedata = {{{2namedata15|}}}
| 3blankname = {{{3blankname15|}}}
| 3namedata = {{{3namedata15|}}}
| 4blankname = {{{4blankname15|}}}
| 4namedata = {{{4namedata15|}}}
| 5blankname = {{{5blankname15|}}}
| 5namedata = {{{5namedata15|}}}
| alongside = {{{alongside15|}}}
| ambassador_from = {{{ambassador_from15|}}}
| appointer = {{#if: {{{appointer15|}}} | {{{appointer15}}} | {{{appointed15|}}} }}
| assembly = {{{assembly15|}}}
| assuming = {{{assuming15|}}}
| chancellor = {{{chancellor15|}}}
| co-leader = {{{co-leader15|}}}
| constituency_{{#if:{{{constituency_AM15|}}}|AM|MP}} = {{#if: {{{constituency_AM15|}}} | {{{constituency_AM15}}} | {{{constituency_MP15|}}} }}
| constituency = {{{constituency15|}}}
| convocation = {{{convocation15|}}}
| country = {{{country15|}}}
| deputy = {{{deputy15|}}}
| district = {{{district15|}}}
| firstminister = {{{firstminister15|}}}
| governor-general = {{{governor-general15|}}}
| governor_general = {{{governor_general15|}}}
| governor = {{{governor15|}}}
| jr/sr = {{{jr/sr15|}}}
| jr/sr and state = {{{jr/sr and state15|}}}
| leader = {{{leader15|}}}
| legislature = {{{legislature15|}}}
| lieutenant_governor = {{{lieutenant_governor15|}}}
| lieutenant = {{{lieutenant15|}}}
| minister_from = {{{minister_from15|}}}
| minority_floor_leader = {{{minority_floor_leader15|}}}
| majority_floor_leader = {{{majority_floor_leader15|}}}
| majority_leader = {{#if: {{{majorityleader15|}}} | {{{majorityleader15}}} | {{{majority_leader15|}}} }}
| majority = {{{majority15|}}}
| minister = {{{minister15|}}}
| minority_leader = {{#if: {{{minorityleader15|}}} | {{{minorityleader15}}} | {{{minority_leader15|}}} }}
| monarch = {{{monarch15|}}}
| nominator = {{{nominator15|}}}
| office = {{{office15|}}}
| order = {{{order15|}}}
| parliament = {{{parliament15|}}}
| parliamentarygroup = {{{parliamentarygroup15|}}}
| predecessor = {{{predecessor15|}}}
| preceding = {{{preceding15|}}}
| preceded = {{{preceded15|}}}
| premier = {{{premier15|}}}
| president = {{{president15|}}}
| primeminister = {{{primeminister15|}}}
| riding = {{{riding15|}}}
| state_assembly = {{{state_assembly15|}}}
| state_delegate = {{{state_delegate15|}}}
| state_house = {{{state_house15|}}}
| state_legislature = {{{state_legislature15|}}}
| state_senate = {{{state_senate15|}}}
| state = {{{state15|}}}
| status = {{{status15|}}}
| subterm = {{nobold|{{{subterm15|}}}}}
| suboffice = {{{suboffice15|}}}
| succeeded = {{{succeeded15|}}}
| succeeding = {{{succeeding15|}}}
| successor = {{{successor15|}}}
| taoiseach = {{{taoiseach15|}}}
| termlabel = {{{term_label15|{{{termlabel15|In office}}}}}}
| termend = {{#if:{{{termend15|}}}|{{{termend15}}}|{{{term_end15|}}}}}
| termstart = {{#if:{{{termstart15|}}}|{{{termstart15}}}|{{{term_start15|}}}}}
| term = {{{term15|}}}
| title = {{{title15|}}}
| vicegovernor = {{{vicegovernor15|}}}
| vicepresident = {{{vicepresident15|}}}
| vicepremier = {{{vicepremier15|}}}
| viceprimeminister = {{{viceprimeminister15|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term15|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname16|}}}
| 1namedata = {{{1namedata16|}}}
| 2blankname = {{{2blankname16|}}}
| 2namedata = {{{2namedata16|}}}
| 3blankname = {{{3blankname16|}}}
| 3namedata = {{{3namedata16|}}}
| 4blankname = {{{4blankname16|}}}
| 4namedata = {{{4namedata16|}}}
| 5blankname = {{{5blankname16|}}}
| 5namedata = {{{5namedata16|}}}
| alongside = {{{alongside16|}}}
| ambassador_from = {{{ambassador_from16|}}}
| appointer = {{#if: {{{appointer16|}}} | {{{appointer16}}} | {{{appointed16|}}} }}
| assembly = {{{assembly16|}}}
| assuming = {{{assuming16|}}}
| chancellor = {{{chancellor16|}}}
| co-leader = {{{co-leader16|}}}
| constituency_{{#if:{{{constituency_AM16|}}}|AM|MP}} = {{#if: {{{constituency_AM16|}}} | {{{constituency_AM16}}} | {{{constituency_MP16|}}} }}
| constituency = {{{constituency16|}}}
| convocation = {{{convocation16|}}}
| country = {{{country16|}}}
| deputy = {{{deputy16|}}}
| district = {{{district16|}}}
| firstminister = {{{firstminister16|}}}
| governor-general = {{{governor-general16|}}}
| governor_general = {{{governor_general16|}}}
| governor = {{{governor16|}}}
| jr/sr = {{{jr/sr16|}}}
| jr/sr and state = {{{jr/sr and state16|}}}
| leader = {{{leader16|}}}
| legislature = {{{legislature16|}}}
| lieutenant_governor = {{{lieutenant_governor16|}}}
| lieutenant = {{{lieutenant16|}}}
| minister_from = {{{minister_from16|}}}
| minority_floor_leader = {{{minority_floor_leader16|}}}
| majority_floor_leader = {{{majority_floor_leader16|}}}
| majority_leader = {{#if: {{{majorityleader16|}}} | {{{majorityleader16}}} | {{{majority_leader16|}}} }}
| majority = {{{majority16|}}}
| minister = {{{minister16|}}}
| minority_leader = {{#if: {{{minorityleader16|}}} | {{{minorityleader16}}} | {{{minority_leader16|}}} }}
| monarch = {{{monarch16|}}}
| nominator = {{{nominator16|}}}
| office = {{{office16|}}}
| order = {{{order16|}}}
| parliament = {{{parliament16|}}}
| parliamentarygroup = {{{parliamentarygroup16|}}}
| predecessor = {{{predecessor16|}}}
| preceding = {{{preceding16|}}}
| preceded = {{{preceded16|}}}
| premier = {{{premier16|}}}
| president = {{{president16|}}}
| primeminister = {{{primeminister16|}}}
| riding = {{{riding16|}}}
| state_assembly = {{{state_assembly16|}}}
| state_delegate = {{{state_delegate16|}}}
| state_house = {{{state_house16|}}}
| state_legislature = {{{state_legislature16|}}}
| state_senate = {{{state_senate16|}}}
| state = {{{state16|}}}
| status = {{{status16|}}}
| subterm = {{nobold|{{{subterm16|}}}}}
| suboffice = {{{suboffice16|}}}
| succeeded = {{{succeeded16|}}}
| succeeding = {{{succeeding16|}}}
| successor = {{{successor16|}}}
| taoiseach = {{{taoiseach16|}}}
| termlabel = {{{term_label16|{{{termlabel16|In office}}}}}}
| termend = {{#if:{{{termend16|}}}|{{{termend16}}}|{{{term_end16|}}}}}
| termstart = {{#if:{{{termstart16|}}}|{{{termstart16}}}|{{{term_start16|}}}}}
| term = {{{term16|}}}
| title = {{{title16|}}}
| vicegovernor = {{{vicegovernor16|}}}
| vicepresident = {{{vicepresident16|}}}
| vicepremier = {{{vicepremier16|}}}
| viceprimeminister = {{{viceprimeminister16|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term16|}}}
}}}}
| data2 = {{{module0|}}}
<!----------Personal data---------->
| header3 = {{#if:{{{pronunciation|}}}{{{birth_name|{{{birthname|}}}}}}{{{birth_date|}}}{{{birth_place|}}}{{{death_date|}}}{{{death_place|}}}{{{resting_place|{{{restingplace|}}}}}}{{{resting_place_coordinates|{{{restingplacecoordinates|}}}}}}{{{citizenship|}}}{{{nationality|}}}{{{party|}}}{{{otherparty|}}}{{{spouse|}}}{{{spouses|}}}{{{partner|}}}{{{relations|}}}{{{children|}}}{{{parents|}}}{{{mother|}}}{{{father|}}}{{{relatives|}}}{{{residence|}}}{{{education|}}}{{{alma_mater|}}}{{{occupation|}}}{{{profession|}}}{{{known_for|}}}{{{salary|}}}{{{cabinet|}}}{{{committees|}}}{{{portfolio|}}}{{{awards|}}}{{{data1|}}}{{{data2|}}}{{{data3|}}}{{{data4|}}}{{{data5|}}}|Personal details}}
| label4 = Pronunciation
| data4 = {{{pronunciation|}}}
| label5 = Born
| data5 = {{#invoke:Separated entries|br
|1 = {{#if:{{{birth_name|{{{birthname|}}}}}}|<div style="display:inline" class="nickname">{{{birth_name|{{{birthname}}}}}}</div>}}
|2 = {{{birth_date|}}}
|3 = {{{birth_place|}}}
}}
| label6 = Died
| data6 = {{#invoke:Separated entries|br|{{{death_date|}}}|{{{death_place|}}}}}
| label7 = {{#ifexpr: {{strfind short|
{{{death_cause|}}}|Assassination}}
| Manner |{{#if:{{{death_manner|}}}|Manner|Cause}} }} of death
| data7 = {{#if:{{{death_manner|}}}|{{{death_manner|}}}|{{{death_cause|}}}}}
| label8 = Resting place
| class8 = label
| data8 = {{#invoke:Separated entries|br|{{{resting_place|{{{restingplace|}}}}}}|{{{resting_place_coordinates|{{{restingplacecoordinates|}}}}}}}}
| label9 = Citizenship
| data9 = {{{citizenship|}}}
| label10 = Nationality
| data10 = {{#switch:{{#invoke:delink|delink|{{{nationality|}}}}}
| {{#ifeq:{{Country2nationality|{{Find country|{{#invoke:delink|delink|{{{birth_place|}}}}}}}}}|{{#invoke:delink|delink|{{{nationality|}}}}}|{{#invoke:delink|delink|{{{nationality|}}}}}}} = <!-- not displayed -->
| {{#ifeq:{{Find country|{{{birth_place|}}}}}|England|British}} = <!-- not displayed -->
| #default = {{{nationality|}}} }}
| label11 = Political party
| data11 = {{#switch:{{{party|}}}
| =
| [[United States Democratic Party|Democrat]]
| [[Democratic Party (United States)|Democratic]]
| [[Democratic Party (United States)|Democrat]] = [[Democratic Party (United States)|Democratic]]
| [[Republican Party (United States)|Republican]]
| [[United States Republican Party]]
| [[United States Republican Party|Republican]]
| [[Republican Party (United States)|Republican Party]] = [[Republican Party (United States)|Republican]]
| [[Conservative Party (UK)|Conservative Party]]
| [[Conservative Party (UK)|Conservative]] = [[Conservative Party (UK)|Conservative]]
| [[Labour Party (UK)|Labour Party]]
| [[Labour Party (UK)|Labour]] = [[Labour Party (UK)|Labour]]
| [[Conservative Party of Canada|Conservative Party]]
| [[Conservative Party of Canada|Conservative]] = [[Conservative Party of Canada|Conservative]]
| [[Liberal Party of Canada|Liberal Party]]
| [[Liberal Party of Canada|Liberal]] = [[Liberal Party of Canada|Liberal]]
| KMT
| Kuomintang
| [[KMT]]
| [[Kuomintang|KMT]]
| [[Kuomintang]]
| Kuomintang (KMT)
| [[Kuomintang]] (KMT) = [[Kuomintang]]
| DPP
| [[Democratic Progressive Party|DPP]]
| [[Democratic Progressive Party]] = [[Democratic Progressive Party]]
| #default = {{{party|}}} }}
| label12 = Other political<br />affiliations
| data12 = {{{otherparty|}}}
| label13 = Height
| data13 = {{#if:{{{height|}}}|{{Infobox person/height|{{{height|}}}}}}}
| label14 = Spouse{{#if:{{{spouses|}}}|s|{{#invoke:Detect singular|pluralize|{{{spouse|{{{spouse(s)|}}}}}}|likely=(s)|plural=s}}}}
| data14 = {{{spouse|{{{spouses|{{{spouse(s)|}}}}}}}}}
| label15 = Domestic partner{{#invoke:Detect singular|pluralize|{{{partner|}}}|likely=(s)|plural=s}}
| data15 = {{{partner|}}}
| label16 = Relations
| data16 = {{{relations|}}}
| label17 = Children
| data17 = {{{children|}}}
| label18 = Parent{{#if:{{{parents|}}}|{{#invoke:Detect singular|pluralize|{{{parents|}}}|likely=(s)|plural=s}}|<!--
-->{{#ifexpr:{{count|{{{father|}}}|{{{mother|}}}}} > 1|s}}}}
| data18 = {{#if:{{{parents|}}}|{{{parents}}}|{{#invoke:list|unbulleted|{{#if:{{{father|}}}|{{{father}}} (father)}}|{{#if:{{{mother|}}}|{{{mother}}} (mother)}}}}}}
| label19 = Relatives
| data19 = {{{relatives|}}}
| label20 = Residence{{#invoke:Detect singular|pluralize|{{{residence|}}}|likely=(s)|plural=s}}
| class20 = {{#if:{{{death_date|}}}{{{death_place|}}}||label}}
| data20 = {{{residence|}}}
| label21 = Education
| data21 = {{{education|}}}
| label22 = [[Alma mater]]
| data22 = {{{alma_mater|}}}
| label23 = Occupation
| data23 = {{{occupation|}}}
| label24 = Profession
| data24 = {{{profession|}}}
| label25 = Known for
| data25 = {{{known_for|}}}
| label26 = Salary
| data26 = {{{salary|}}}
| label27 = Cabinet
| data27 = {{{cabinet|}}}
| label28 = Committees
| data28 = {{{committees|}}}
| label29 = Portfolio
| data29 = {{{portfolio|}}}
| label30 = {{#if:{{{mawards|}}}|Civilian awards|Awards}}
| data30 = {{{awards|}}}
| label31 = {{{blank1}}}
| data31 = {{{data1|}}}
| label32 = {{{blank2}}}
| data32 = {{{data2|}}}
| label33 = {{{blank3}}}
| data33 = {{{data3|}}}
| label34 = {{{blank4}}}
| data34 = {{{data4|}}}
| label35 = {{{blank5}}}
| data35 = {{{data5|}}}
| label36 = Signature
| data36 = {{#if:{{{signature|}}}|[[File:{{{signature}}}|{{#if:{{{signature_size|}}}|{{{signature_size}}}|128x80px}}|alt={{{signature_alt|}}}|{{PAGENAME}}'s signature]]}}
| label37 = Website
| data37 = {{{website|}}}
| label38 = Nickname{{#invoke:Detect singular|pluralize|{{{nickname|}}}|likely=(s)|plural=s}}
| data38 = {{{nickname|}}}
| header39 = {{#if:{{{allegiance|}}}{{{branch|}}}{{{serviceyears|}}}{{{rank|}}}{{{unit|}}}{{{commands|}}}{{{battles|}}}{{{military_blank1|}}}|Military service}}
| label40 = Allegiance
| data40 = {{{allegiance|}}}
| label41 = {{#if:{{{branch_label|}}}|{{{branch_label|}}}|Branch/service}}
| data41 = {{{branch|}}}
| label42 = {{#if:{{{serviceyears_label|}}}|{{{serviceyears_label|}}}|Years of service}}
| data42 = {{{serviceyears|}}}
| label43 = {{#if:{{{rank_label|}}}|{{{rank_label|}}}|Rank}}
| data43 = {{{rank|}}}
| label44 = {{#if:{{{unit_label|}}}|{{{unit_label|}}}|Unit}}
| data44 = {{{unit|}}}
| label45 = Commands
| data45 = {{{commands|}}}
| label46 = {{#if:{{{battles_label|}}}|{{{battles_label|}}}|Battles/wars}}
| data46 = {{{battles|}}}
| label47 = {{#if:{{{awards|}}}|Military awards|Awards}}
| data47 = {{{mawards|}}}
| label48 = {{{military_blank1}}}
| data48 = {{{military_data1|}}}
| label49 = {{{military_blank2}}}
| data49 = {{{military_data2|}}}
| label50 = {{{military_blank3}}}
| data50 = {{{military_data3|}}}
| label51 = {{{military_blank4}}}
| data51 = {{{military_data4|}}}
| label52 = {{{military_blank5}}}
| data52 = {{{military_data5|}}}
| data53 = {{{module|}}}
| data54 = {{{module2|}}}
| data55 = {{{module3|}}}
| data56 = {{{module4|}}}
| data57 = {{{module5|}}}
| data58 = {{{footnotes|}}}
| belowstyle = border-top: 1px solid right;
| below = <div>{{#if:{{{date|}}}| As of {{{date}}}{{#if:{{{year|}}}|, {{{year}}}}}}}</div>{{#if:{{{source|}}}|Source: [{{{source}}}]}}
}}{{#if:{{{pronunciation|}}}|{{#ifeq:{{{nocat|{{{demo|{{#ifeq:{{{categories|}}}|no|yes}}}}}}}}|yes||[[Category:Biography template using pronunciation]]}}
}}{{#if:{{{1blankname0|}}}{{{1namedata0|}}}{{{2blankname0|}}}{{{2namedata0|}}}{{{3blankname0|}}}{{{3namedata0|}}}{{{4blankname0|}}}{{{4namedata0|}}}{{{5blankname0|}}}{{{5namedata0|}}}{{{alongside0|}}}{{{ambassador_from0|}}}{{{appointer0|}}}{{{assembly0|}}}{{{assuming0|}}}{{{chancellor0|}}}{{{co-leader0|}}}{{{constituency_AM0|}}}{{{constituency0|}}}{{{country0|}}}{{{deputy0|}}}{{{district0|}}}{{{firstminister0|}}}{{{governor-general0|}}}{{{governor0|}}}{{{jr/sr0|}}}{{{jr/sr and state0|}}}{{{leader0|}}}{{{legislature0|}}}{{{lieutenant_governor0|}}}{{{lieutenant0|}}}{{{minister_from0|}}}{{{minority_floor_leader0|}}}{{{majority_floor_leader0|}}}{{{majorityleader0|}}}{{{majority0|}}}{{{minister0|}}}{{{minorityleader0|}}}{{{monarch0|}}}{{{nominator0|}}}{{{office0|}}}{{{order0|}}}{{{parliament0|}}}{{{predecessor0|}}}{{{preceding0|}}}{{{preceded0|}}}{{{premier0|}}}{{{president0|}}}{{{primeminister0|}}}{{{riding0|}}}{{{state_assembly0|}}}{{{state_delegate0|}}}{{{state_house0|}}}{{{state_legislature0|}}}{{{state_senate0|}}}{{{state0|}}}{{{suboffice0|}}}{{{subterm0|}}}{{{succeeded0|}}}{{{succeeding0|}}}{{{successor0|}}}{{{taoiseach0|}}}{{{termend0|}}}{{{termstart0|}}}{{{term0|}}}{{{title0|}}}{{{vicegovernor0|}}}{{{vicepresident0|}}}{{{vicepremier0|}}}{{{viceprimeminister0|}}}{{{prior_term0|}}}{{{appointe0|}}}{{{constituency_0|}}}|{{#ifeq:{{{nocat|{{{demo|{{#ifeq:{{{categories|}}}|no|yes}}}}}}}}|yes||[[Category:Pages using infobox officeholder with office0]]}}
}}{{#if:{{{speaker|}}}|{{#if:{{{nominee|}}}{{{candidate|}}}||{{#ifeq:{{{nocat|{{{demo|{{#ifeq:{{{categories|}}}|no|yes}}}}}}}}|yes||[[Category:Pages using infobox officeholder with speaker]]}}}}
}}{{#invoke:Check for unknown parameters|check|unknown={{main other|{{#ifeq:{{{nocat|{{{demo|{{#ifeq:{{{categories|}}}|no|yes}}}}}}}}|yes||[[Category:Pages using infobox officeholder with unknown parameters|_VALUE_{{PAGENAME}}]]}}}}|preview=Page using [[Template:Infobox officeholder]] with unknown parameter "_VALUE_"|ignoreblank=y| regexp1 = 1blankname[%d]* | regexp2 = 1namedata[%d]* | regexp3 = 2blankname[%d]* | regexp4 = 2namedata[%d]* | regexp5 = 3blankname[%d]* | regexp6 = 3namedata[%d]* | regexp7 = 4blankname[%d]* | regexp8 = 4namedata[%d]* | regexp9 = 5blankname[%d]* | regexp10 = 5namedata[%d]* | allegiance | alma_mater | regexp11 = alongside[%d]* | alt | regexp12 = ambassador_from[%d]* | regexp13 = appointed[%d]* | regexp14 = appointer[%d]* | regexp15 = assembly[%d]* | awards | battles | battles_label | birth_date | birth_name | birth_place | birthname | regexp16 = blank[%d]* | bodyclass | branch | branch_label | cabinet | candidate | caption | categories | regexp17 = chancellor[%d]* | children | citizenship | regexp18 = co%-leader[%d]* | commands | committees | regexp19 = constituency[%d]* | regexp20 = constituency_AM[%d]* | regexp21 = constituency_MP[%d]* | regexp22 = convocation[%d]* | regexp23 = country[%d]* | regexp24 = data[%d]* | date | death_cause | death_date | death_manner | death_place | demo | regexp25 = deputy[%d]* | regexp26 = district[%d]* | education | election_date | embed | father | regexp28 = firstminister[%d]* | footnotes | regexp29 = governor[%d]* | regexp30 = governor_general[%d]* | regexp31 = governor%-general[%d]* | height | honorific_prefix | honorific-prefix | honorific_suffix | honorific-suffix | image | image name | image_name_alt | image_size | imagesize | image_upright | incumbent | regexp32 = jr/sr[%d]* | regexp33 = jr/sr and state[%d]* | known_for | regexp34 = leader[%d]* | regexp35 = legislature[%d]* | regexp36 = lieutenant[%d]* | regexp37 = lieutenant_governor[%d]* | mainwidth | regexp38 = majority[%d]* | regexp39 = majority_floor_leader[%d]* | regexp40 = majority_leader[%d]* | regexp41 = majorityleader[%d]* | mawards | regexp42 = military_blank[%d]* | regexp43 = military_data[%d]* | regexp44 = minister[%d]* | regexp45 = minister_from[%d]* | regexp46 = minority_floor_leader[%d]* | regexp47 = minority_leader[%d]* | regexp48 = minorityleader[%d]* | regexp49 = module[%d]* | regexp50 = monarch[%d]* | mother | name | nationality | native_name | native_name_lang | nickname | nocat | regexp51 = nominator[%d]* | nominee | occupation | regexp52 = office[%d]* | opponent | regexp53 = order[%d]* | otherparty | parents | regexp54 = parliament[%d]* | regexp55 = parliamentarygroup[%d]* | partner | party | party_election | portfolio | regexp56 = preceded[%d]* | regexp57 = preceding[%d]* | regexp58 = predecessor[%d]* | regexp59 = premier[%d]* | regexp60 = president[%d]* | regexp61 = primeminister[%d]* | regexp62 = prior_term[%d]* | profession | pronunciation | rank | rank_label | relations | relatives | residence | resting_place | resting_place_coordinates | restingplace | restingplacecoordinates | regexp63 = riding[%d]* | runningmate | salary | serviceyears | serviceyears_label | signature | signature_alt | signature_size | smallimage | smallimage_alt | source | speaker | speaker_office | spouse | spouses | regexp64 = state[%d]* | regexp65 = state_assembly[%d]* | regexp66 = state_delegate[%d]* | regexp67 = state_house[%d]* | regexp68 = state_legislature[%d]* | regexp69 = state_senate[%d]* | regexp70 = status[%d]* | regexp71 = suboffice[%d]* | regexp72 = subterm[%d]* | regexp73 = succeeded[%d]* | regexp74 = succeeding[%d]* | regexp75 = successor[%d]* | regexp76 = taoiseach[%d]* | regexp77 = term[%d]* | regexp78 = term_end[%d]* | regexp79 = term_label[%d]* | regexp80 = term_start[%d]* | regexp81 = termend[%d]* | regexp82 = termlabel[%d]* | regexp83 = termstart[%d]* | regexp84 = title[%d]* | unit | unit_label | regexp85 = vicegovernor[%d]* | regexp86 = vicepremier[%d]* | regexp87 = vicepresident[%d]* | regexp88 = viceprimeminister[%d]* | regexp89 = assuming[%d]* | website | width | year }}<noinclude>
{{Documentation}}
</noinclude>
7154c31bda4e74e6aa002e72637816c1e0b41834
Template:TemplateData header
10
125
241
2023-12-01T11:27:04Z
wikipedia>Gonnym
0
fix website link if |1= is used
wikitext
text/x-wiki
<div class="templatedata-header">{{#if:{{{noheader|}}}|<!--
noheader:
-->{{Template parameter usage|{{{1|{{BASEPAGENAME}}}}}|based=y}}|<!--
+header:
-->This is the {{#if:{{{nolink|}}}|<!--
+header, nolink TD
-->TemplateData|<!--
+header, +link [[TD]]; DEFAULT:
-->[[Wikipedia:TemplateData|TemplateData]]}}<!--
e.o. #if:nolink; DEFAULT:
--> for this template used by [[mw:Extension:TemplateWizard|TemplateWizard]], [[Wikipedia:VisualEditor|VisualEditor]] and other tools. {{Template parameter usage|{{{1|{{BASEPAGENAME}}}}}|based=y}}<!--
e.o. #if:noheader
-->}}
'''TemplateData for {{{1|{{BASEPAGENAME}}}}}'''
</div><includeonly><!--
check parameters
-->{{#invoke:Check for unknown parameters|check
|unknown={{template other|1=[[Category:Pages using TemplateData header with unknown parameters|_VALUE_]]}}
|template=Template:TemplateData header
|1 |nolink |noheader
|preview=<div class="error" style="font-weight:normal">Unknown parameter '_VALUE_' in [[Template:TemplateData header]].</div>
}}<!--
-->{{template other|{{sandbox other||
[[Category:Templates using TemplateData]]
}}}}</includeonly><!--
--><noinclude>{{Documentation}}</noinclude>
748b89c815a11e78b365c5617460ea569f3f96cb
Template:Infobox officeholder/office
10
145
281
2023-12-10T04:36:36Z
wikipedia>Neveselbert
0
adjust conditional for certain cases, e.g. [[Bob Albright]]
wikitext
text/x-wiki
{{#if:{{{speaker|}}}{{{state_legislature|}}}{{{state_assembly|}}}{{{speaker_office|}}}{{{state_delegate|}}}{{{state_house|}}}{{{prior_term|}}}{{{nominee|}}}{{{candidate|}}}{{{termstart|}}}{{{election_date|}}}{{{majority_leader|}}}{{{minority_floor_leader|}}}{{{minority_leader|}}}{{{majority_floor_leader|}}}{{{jr/sr|}}}{{{succeeding|}}}{{{assuming|}}}{{{state|}}}{{{jr/sr and state|}}}{{{state_senate|}}}{{{district|}}}{{{ambassador_from|}}}{{{minister_from|}}}{{{order|}}}{{{office|}}}{{{title|}}}{{{country|}}}{{{constituency_AM|}}}{{{constituency_MP|}}}{{{parliament|}}}{{{assembly|}}}{{{constituency_|}}}{{{riding|}}}{{{term|}}}{{{termend|}}}{{{alongside|}}}{{{co-leader|}}}
|{{#invoke:infobox|infoboxTemplate|child=yes|decat=yes
| headerstyle = background:{{{color|lavender}}};line-height:normal;padding:0.2em;
| datastyle = border-bottom:none
<!--------Speaker of the House--------->
| header1 = {{#if:{{{speaker|}}}|
{{{speaker}}} {{#if:{{{state_legislature|}}}
|[[Speaker of the {{{state_legislature}}} Legislature]]
|{{#if:{{{state_assembly|}}}
|[[Speaker of the {{{state_assembly|}}} {{#ifeq:{{{state_assembly|}}}|Nevada||{{#ifeq:{{{state_assembly|}}}|New Jersey|General|State}}}} Assembly]]
|{{#if:{{{speaker_office|}}}|{{{speaker_office}}}|[[Speaker of the {{#if:{{{state_delegate|}}} |{{{state_delegate}}}|{{#if:{{{state_house|}}} |{{{state_house}}}|United States}}}} House of {{#if:{{{state_delegate|}}}|Delegates|Representatives}}|Speaker of the {{#if:{{{state_delegate|}}} |{{{state_delegate}}}|{{#if:{{{state_house|}}} |{{{state_house}}}|U.S.}}}} House of {{#if:{{{state_delegate|}}}|Delegates|Representatives}}]]}}
}}
}}{{#if:{{{prior_term|}}}|
<br />{{{prior_term}}}}}
}}
<!--------Office--------->
| header2 = {{#if:{{{nominee|}}}{{{candidate|}}}|
{{#if:{{{party_election|}}}{{{party|}}}
|{{#if:{{{party_election|}}}|{{{party_election}}}|{{{party}}}}} {{#if:{{{nominee|}}}|nominee for<br />{{{nominee}}}|candidate for<br />{{{candidate}}}}}
|{{#if:{{{nominee|}}}|Nominee for<br />{{{nominee}}}|Candidate for<br />{{{candidate}}}}}
}} }}
| data3 = {{#if:{{{nominee|}}}{{{candidate|}}}|
{{#if:{{{termstart|}}}{{{election_date|}}} | <span class="nowrap">'''Election date'''</span><br />{{#if:{{{election_date|}}}|{{{election_date}}}|{{{termstart}}}}}
}} }}
| header4 = {{#if:{{{majority_leader|}}}{{{minority_floor_leader|}}}{{{minority_leader|}}}{{{majority_floor_leader|}}}||
{{#if:{{{jr/sr|}}}|[[United States Senate|<!--Changed code to eliminate "Junior/Senior" distinction for U.S. Senators per [[Template talk:Infobox Officeholder/Archive 9#Senior/Junior U.S. Senators]]{{{jr/sr}}}-->United States Senator{{#if:{{{succeeding|}}}{{{assuming|}}}|-elect}}]]<br />from {{{state}}}
}} }}
| header5 = {{#if:{{{majority_leader|}}}{{{minority_floor_leader|}}}{{{minority_leader|}}}{{{majority_floor_leader|}}}||
{{{jr/sr and state|}}}
}}
| header6 = {{#if:{{{majority_leader|}}}{{{minority_floor_leader|}}}{{{minority_leader|}}}{{{majority_floor_leader|}}}||
{{#if:{{{state_senate|}}}|Member{{#if:{{{succeeding|}}}{{{assuming|}}}|-elect}} of the <span style="display: inline-block;">[[{{{state_senate}}} Senate]]</span>{{#if:{{{district|}}}|<br />from the {{{district}}} district}}{{#if:{{{prior_term|}}}|
<br />{{{prior_term}}}}}
}} }}
| header7 = {{#if:{{{majority_leader|}}}{{{minority_floor_leader|}}}{{{minority_leader|}}}{{{majority_floor_leader|}}}||
{{#if:{{{state_legislature|}}}|Member{{#if:{{{succeeding|}}}{{{assuming|}}}|-elect}} of the <span style="display: inline-block;">[[{{{state_legislature}}} Legislature]]</span><br />from the {{{district}}} district
}} }}
| header8 = {{#if:{{{ambassador_from|}}}{{{minister_from|}}}||
{{#if:{{{order|}}}
|{{{order}}}{{#if:{{{office|}}} | [[{{{office}}}]]}}{{#if:{{{state|}}} | [[{{{state}}}]]}}{{#if:{{{title|}}} | {{{title}}}}}
|{{{office|}}}
}} }}
| header9 = {{#if:{{{ambassador_from|}}}{{{minister_from|}}}||
{{#if:{{{order|}}}
||{{{title|}}}
}} }}
<!--------Ambassador--------->
| header10 = {{#if:{{both|{{{ambassador_from|}}}{{{minister_from|}}}|{{{country|}}}}}
|{{#if:{{{order|}}}|{{{order}}}}} {{#if:{{{minister_from|}}}
|[[{{{minister_from}}} Ambassador to {{CountryPrefixThe|{{{country}}}}}|{{{minister_from}}} Minister to <span class="nowrap">{{CountryPrefixThe|{{{country}}}}}</span>]]
|[[{{{ambassador_from}}} Ambassador to {{CountryPrefixThe|{{{country}}}}}|{{{ambassador_from}}} Ambassador to <span class="nowrap">{{CountryPrefixThe|{{{country}}}}}</span>]]
}} [[Category:Pages using infobox officeholder with ambassador from or minister from]]
}}
<!--------MP--------->
| header11 = {{#if:{{{constituency_AM|}}}{{{constituency_MP|}}}|
{{#switch:{{{parliament|}}}
|Australian = Member of the <span style="display: inline-block;">[[Australian House of Representatives|Australian Parliament]]</span>
|European = [[Member of the European Parliament]]
|Scottish = [[Member of the Scottish Parliament]]
|Sri Lanka|Sri Lankan = [[Member of Parliament (Sri Lanka)|Member of Parliament]]
|United Kingdom|UK = [[Member of Parliament (United Kingdom)|Member of Parliament]]
|#default = {{#if:{{{constituency_AM|}}}|{{#if:{{{assembly|}}}|Member of the <span style="display: inline-block;">[[{{{assembly}}} Assembly]]</span>|Assembly Member}}|Member of {{#if:{{{parliament|}}}|the <span style="display: inline-block;">[[{{{parliament}}} Parliament]]</span>|Parliament}}}}}}<br />for {{#ifeq:{{Title disambig text|{{{constituency_MP|}}}}}|UK Parliament constituency
|{{{constituency_MP|}}}
|{{#if:{{#switch:{{{parliament|}}} |United Kingdom|UK| = {{Linkless exists|{{#invoke:delink|delink|{{{constituency_MP|}}}}} (UK Parliament constituency)}} }}
|{{#if:{{Constlk|{{#invoke:delink|delink|{{{constituency_MP|}}}}}}}
|{{Constlk|{{#invoke:delink|delink|{{{constituency_MP|}}}}}}}
|{{{constituency_{{#if:{{{constituency_AM|}}}|AM|MP}}}}}}}
|{{{constituency_{{#if:{{{constituency_AM|}}}|AM|MP}}}}}}}
}}{{#if:{{{prior_term|}}}|
<div style="font-weight:normal;">{{{prior_term}}}</div>}}
}}
| header12 = {{#if:{{{riding|}}}|{{#if:{{{constituency_AM|}}}|{{#if:{{{assembly|}}}|Member of the <span style="display: inline-block;">[[{{{assembly}}} Assembly]]</span>|Assembly Member}}|
{{#switch:{{{parliament|}}}
|Canadian = [[Member of Parliament (Canada)|Member of Parliament]]
|#default = Member of {{#if:{{{parliament|}}}|the <span style="display: inline-block;">[[{{{parliament}}} Parliament]]</span>|Parliament}}}}}}<br />for {{{riding}}}
}}
<!--------Majority Leader (State Senate)--------->
| header13 = {{#if:{{{majority_leader|}}}|{{{majority_leader}}} {{#if:{{{state_senate|}}}|[[Majority Leader of the {{{state_senate}}} Senate]]|[[United States Senate Majority Leader]]}}
}}
<!--------Majority Floor Leader (State Senate)--------->
| header14 = {{#if:{{{majority_floor_leader|}}}|{{{majority_floor_leader}}} [[Majority Floor Leader of the {{{state_senate}}} Senate]]
}}
<!--------Minority Leader (State Senate)--------->
| header15 = {{#if:{{{minority_leader|}}}|{{{minority_leader}}} [[Minority Leader of the {{{state_senate}}} Senate]]
}}
<!--------Minority Floor Leader (State Senate)--------->
| header16 = {{#if:{{{minority_floor_leader|}}}|{{{minority_floor_leader}}} [[Minority Floor Leader of the {{{state_senate}}} Senate]]
}}
<!--------Congressman--------->
| header17 = {{#if:{{{state_legislature|}}}{{{state_senate|}}}{{{jr/sr|}}}{{{jr/sr and state|}}}||
{{#if:{{#if:{{{state|}}}|{{{constituency|}}}}}{{{district|}}}{{{state_house|}}}|{{#if:{{{state_assembly|}}}
|Member{{#if:{{{succeeding|}}}{{{assuming|}}}|-elect}} of the <span style="display: inline-block;">[[{{{state_assembly|}}} {{#ifeq:{{{state_assembly|}}}|Nevada||{{#ifeq:{{{state_assembly|}}}|New Jersey|General|State}}}} Assembly]]</span><br />from the
|Member{{#if:{{{succeeding|}}}{{{assuming|}}}|-elect}} of the <span style="display: inline-block;">[[{{#if:{{{state_house|}}} |{{{state_house}}}|{{#if:{{{state_delegate|}}}|{{{state_delegate}}}|United States }}}} {{#if:{{{state_delegate|}}}|House of Delegates|House of Representatives}}|{{#if:{{{state_house|}}} |{{{state_house}}}|{{#if:{{{state_delegate|}}}|{{{state_delegate}}}|U.S.}}}} {{#if:{{{state_delegate|}}}|House of Delegates|{{#if:{{{state_house|}}}| }}House of Representatives}}]]</span>{{#if:{{{district|}}}{{{state|}}}{{{state_delegate|}}}|<br />from {{#if:{{{state_delegate|}}}|the |{{#if:{{{state_house|}}}|{{#if:{{{district|}}}|the|{{{state|}}}}}|{{{state|}}}{{#if:{{{district|}}}|'s}}}}}}
}}}} {{#if:{{{district|}}}|{{{district}}} district|{{#if:{{{state_house|}}}|{{{constituency|}}}}}}}{{#if:{{{prior_term|}}}|
<br />{{{prior_term}}}}}
}}
}}
<!--------Convocation--------->
| header18 = {{#if:{{{convocation|}}}|{{{convocation}}}}}
<!--------Term--------->
| data19 = {{#if:{{{termend|}}}{{{succeeding|}}}{{{assuming|}}}|
{{#if:{{{status|}}}
| <div style="width:100%; margin:0; background-color: {{{color|lavender}}}">'''{{{status}}}'''</div>|}}|
}}
| data20 = {{#if:{{{nominee|}}}{{{candidate|}}}||
{{#if:{{{succeeding|}}}{{{assuming|}}}
| <span class="nowrap">'''Assuming office'''</span><br />{{{termstart}}}{{#if:{{{term|}}}{{{termend|}}}|[[Category:Pages using infobox officeholder with succeeding and term or termend]]}}
| {{#if: {{{term|}}} | <span class="nowrap">'''{{{termlabel|In office}}}'''</span><br />{{{term}}} }}
}} }}
| data21 = {{#if:{{{nominee|}}}{{{candidate|}}}||
{{#if:{{{succeeding|}}}{{{assuming|}}}
|
|{{#if:{{{termstart|}}}
| {{#if:{{{termend|}}}
|<!--then: term has start and end:--><span class="nowrap">'''{{{termlabel|In office}}}'''</span><br />{{en dash range|{{{termstart}}}|{{{termend}}}}}{{#if:{{{alongside|}}}{{{co-leader|}}}|<div style="line-height:normal; padding-top:0.2em; padding-bottom:0.1em">{{#if:{{{alongside|}}}|Serving|Co-leading}} with {{#if:{{{alongside|}}}|{{{alongside}}}|{{{co-leader}}}}}</div>}}
|{{#if:{{{status|}}}|<div style="width:100%; margin:0; background-color: {{{color|lavender}}}">'''{{{status}}}'''</div>|<!--else: term is ongoing--><div style="width:100%; margin:0; background-color: {{{color|lavender}}}">'''[[Incumbent]]'''</div>}}
}}
}}
}} }}
| data22 = {{#if:{{{nominee|}}}{{{candidate|}}}||
{{#if:{{{succeeding|}}}{{{assuming|}}}
|
|{{#if:{{{termstart|}}}
|{{#if:{{{termend|}}}
|<!--then nothing else; term has ended-->
|<!--else term is ongoing:--><span class="nowrap">'''{{#if:{{{termlabel|}}}|{{#invoke:String|replace|source={{{termlabel}}}|In office|Assumed office}}|Assumed office}}'''</span> <br />{{{termstart}}}{{#if:{{{alongside|}}}{{{co-leader|}}}|<div style="line-height:normal; padding-top:0.2em; padding-bottom:0.1em">{{#if:{{{alongside|}}}|Serving|Co-leader}} with {{#if:{{{alongside|}}}|{{{alongside}}}|{{{co-leader}}}}}</div>}}
}}
}}
}} }}
}} }}<!--
end infobox1 / start infobox2
-->{{#if:{{{monarch|}}}{{{president|}}}{{{governor-general|}}}{{{governor_general|}}}{{{primeminister|}}}{{{chancellor|}}}{{{minister|}}}{{{taoiseach|}}}{{{firstminister|}}}{{{chiefminister|}}}{{{premier|}}}{{{governor|}}}{{{lieutenant_governor|}}}{{{vicepresident|}}}{{{vicegovernor|}}}{{{viceprimeminister|}}}{{{vicepremier|}}}{{{deputy|}}}{{{leader|}}}{{{lieutenant|}}}{{{nominator|}}}{{{appointer|}}}{{{opponent|}}}{{{incumbent|}}}{{{succeeding|}}}{{{assuming|}}}{{{preceding|}}}{{{predecessor|}}}{{{preceded|}}}{{{successor|}}}{{{succeeded|}}}{{{parliamentarygroup|}}}{{{constituency|}}}{{{majority|}}}{{{suboffice|}}}{{{1namedata|}}}{{{2namedata|}}}{{{3namedata|}}}{{{4namedata|}}}{{{5namedata|}}}{{{runningmate|}}}|
{{#invoke:infobox|infoboxTemplate|child=yes
| labelstyle = text-align:left
| label1 = <span class="nowrap">Nominated by</span>
| data1 = {{{nominator|}}}
| label2 = <span class="nowrap">Appointed by</span>
| data2 = {{{appointer|}}}
<!--------President, Prime Minister, Governor--------->
| label3 = Monarch{{#if:{{detect singular|{{{monarch|}}}}}||s}}
| data3 = {{{monarch|}}}
| label4 = President
| data4 = {{{president|}}}
| label5 = {{#if:{{{governor_general|}}}|Governor{{#if:{{detect singular|{{{governor_general}}}}}||s}} General|Governor{{#if:{{detect singular|{{{governor-general}}}}}||s}}-General}}
| data5 = {{#if:{{{governor_general|}}}|{{{governor_general}}}|{{{governor-general|}}}}}
| label6 = <span class="nowrap">Prime Minister</span>
| data6 = {{{primeminister|}}}
| label7 = Chancellor
| data7 = {{{chancellor|}}}
| label8 = Minister
| data8 = {{{minister|}}}
| label9 = Taoiseach
| data9 = {{{taoiseach|}}}
| label10 = <span class="nowrap">First Minister</span>
| data10 = {{{firstminister|}}}
| label11 = <span class="nowrap">Chief Minister</span>
| data11 = {{{chiefminister|}}}
| label12 = Premier
| data12 = {{{premier|}}}
| label13 = Governor
| data13 = {{{governor|}}}
| label14 = Lieutenant Governor
| data14 = {{{lieutenant_governor|}}}
<!--------Vice president/s, Vice Prime Minister/s, Deputy/ies, Lieutenant/s--------->
| label15 = <span class="nowrap">{{#if:{{{vicepresident|}}}|{{#ifeq:{{Linkless exists|Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}|{{#ifeq:{{#invoke:Redirect|main|fulltext=1|{{#ifeq:Vice|Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}||Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}}}|{{#invoke:Redirect|main|fulltext=1|{{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}||{{#if:{{#invoke:Disambiguation|isDisambiguationPage|Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}||true}} }}|[[Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}|Vice President]]|Vice President}}|Vice President}}</span>
| data15 = {{{vicepresident|}}}
| label16 = <span class="nowrap">{{#if:{{{vicegovernor|}}}|{{#ifeq:{{Linkless exists|Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}|{{#ifeq:{{#invoke:Redirect|main|fulltext=1|{{#ifeq:Vice|Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}||Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}}}|{{#invoke:Redirect|main|fulltext=1|{{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}||{{#if:{{#invoke:Disambiguation|isDisambiguationPage|Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}||true}} }}|[[Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}|Vice Governor]]|Vice Governor}}|Vice Governor}}</span>
| data16 = {{{vicegovernor|}}}
| label17 = <span class="nowrap">{{#if:{{{viceprimeminister|}}}|[[Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}|Vice PM]]|Vice [[Prime Minister|PM]]}}</span>
| data17 = {{{viceprimeminister|}}}
| label18 = <span class="nowrap">{{#if:{{{vicepremier|}}}|{{#ifeq:{{Linkless exists|Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}|{{#ifeq:{{#invoke:Redirect|main|fulltext=1|{{#ifeq:Vice|Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}||Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}}}|{{#invoke:Redirect|main|fulltext=1|{{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}||{{#if:{{#invoke:Disambiguation|isDisambiguationPage|Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}||true}} }}|[[Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}|Vice Premier]]|Vice Premier}}|Vice Premier}}</span>
| data18 = {{{vicepremier|}}}
| label19 = {{#if:{{{deputy|}}}|{{#ifeq:{{Linkless exists|Deputy {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}|{{#ifeq:{{#invoke:Redirect|main|fulltext=1|{{#ifeq:Deputy|Deputy {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}||Deputy {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}}}|{{#invoke:Redirect|main|fulltext=1|{{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}||{{#if:{{#invoke:Disambiguation|isDisambiguationPage|Deputy {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}||true}} }}|[[Deputy {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}|Deputy]]|Deputy}}|Deputy}}
| data19 = {{{deputy|}}}
| label20 = Leader
| data20 = {{{leader|}}}
| label21 = {{#if:{{{office|}}}|[[Lieutenant {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}|Lieutenant]]|Lieutenant}}
| data21 = {{{lieutenant|}}}
| label22 = {{nowrap|{{{subterm|}}}}}
| data22 = {{{suboffice|}}}
<!--------Blank fields--------->
| label23 = {{{1blankname|}}}
| data23 = {{{1namedata|}}}
| label24 = {{{2blankname|}}}
| data24 = {{{2namedata|}}}
| label25 = {{{3blankname|}}}
| data25 = {{{3namedata|}}}
| label26 = {{{4blankname|}}}
| data26 = {{{4namedata|}}}
| label27 = {{{5blankname|}}}
| data27 = {{{5namedata|}}}
<!--------Predecessor/successor--------->
| label28 = <span class="nowrap">Running mate</span>
| data28 = {{{runningmate|}}}
| label29 = Opponent{{#invoke:Detect singular|pluralize|{{{opponent|}}}|likely=(s)|plural=s}}
| data29 = {{{opponent|}}}
| label30 = Incumbent
| data30 = {{{incumbent|}}}
| label31 = {{#if:{{{succeeding|}}}|Succeeding|Preceding}}
| data31 = {{#if:{{{succeeding|}}}|{{{succeeding|}}}|{{{preceding|}}}}}
| label32 = <span class="nowrap">Preceded by</span>
| data32 = {{#if:{{{succeeding|}}}||{{#if:{{{predecessor|}}}|{{{predecessor}}}|{{{preceded|}}}}}}}
| label33 = <span class="nowrap">Succeeded by</span>
| data33 = {{#if:{{{succeeding|}}}||{{#switch:{{#if:{{{successor|}}}|{{{successor}}}|{{{succeeded|}}}}}
| Incumbent
| '''Incumbent'''
| ''Incumbent''
| [[Incumbent]]
| incumbent
| '''incumbent'''
| ''incumbent''
| [[incumbent]] =
| #default = {{#if:{{{successor|}}}|{{{successor}}}|{{{succeeded|}}}}}
}}}}
<!--------Constituency/Majority--------->
| label34 = [[Parliamentary group]]
| data34 = {{{parliamentarygroup|}}}
| label35 = Constituency
| data35 = {{#if:{{{state_house|}}}||{{{constituency|}}}}}
| label36 = Majority
| data36 = {{{majority|}}}
}} }}<noinclude>{{documentation}}</noinclude>
ab8bb519ec87eb4f25661e4d9e114ae8d99ea500
Module:Citation/CS1/Configuration
828
17
29
2023-12-15T17:18:43Z
wikipedia>Trappist the monk
0
bump pmc;
Scribunto
text/plain
local lang_obj = mw.language.getContentLanguage(); -- make a language object for the local language; used here for languages and dates
--[[--------------------------< S E T T I N G S >--------------------------------------------------------------
boolean settings used to control various things. these setting located here to make them easy to find
]]
-- these settings local to this module only
local local_digits_from_mediawiki = false; -- for i18n; when true, module fills date_names['local_digits'] from MediaWiki; manual fill required else; always false at en.wiki
local local_date_names_from_mediawiki = false; -- for i18n; when true, module fills date_names['local']['long'] and date_names['local']['short'] from MediaWiki;
-- manual translation required else; ; always false at en.wiki
-- these settings exported to other modules
local use_identifier_redirects = true; -- when true use redirect name for identifier label links; always true at en.wiki
local local_lang_cat_enable = false; -- when true categorizes pages where |language=<local wiki's language>; always false at en.wiki
local date_name_auto_xlate_enable = false; -- when true translates English month-names to the local-wiki's language month names; always false at en.wiki
local date_digit_auto_xlate_enable = false; -- when true translates Western date digit to the local-wiki's language digits (date_names['local_digits']); always false at en.wiki
local enable_sort_keys = true; -- when true module adds namespace sort keys to error and maintenance category links
--[[--------------------------< U N C A T E G O R I Z E D _ N A M E S P A C E S >------------------------------
List of namespaces identifiers for namespaces that will not be included in citation error categories.
Same as setting notracking = true by default.
For wikis that have a current version of Module:cs1 documentation support, this #invoke will return an unordered
list of namespace names and their associated identifiers:
{{#invoke:cs1 documentation support|uncategorized_namespace_lister|all=<anything>}}
]]
uncategorized_namespaces_t = {[2]=true}; -- init with user namespace id
for k, _ in pairs (mw.site.talkNamespaces) do -- add all talk namespace ids
uncategorized_namespaces_t[k] = true;
end
local uncategorized_subpages = {'/[Ss]andbox', '/[Tt]estcases', '/[^/]*[Ll]og', '/[Aa]rchive'}; -- list of Lua patterns found in page names of pages we should not categorize
--[[
at en.wiki Greek characters are used as sort keys for certain items in a category so that those items are
placed at the end of a category page. See Wikipedia:Categorization#Sort_keys. That works well for en.wiki
because English is written using the Latn script. This may not work well for other languages. At en.wiki it
is desireable to place content from certain namespaces at the end of a category listing so the module adds sort
keys to error and maintenance category links when rendering a cs1|2 template on a page in that namespace.
i18n: if this does not work well for your language, set <enable_sort_keys> to false.
]]
local name_space_sort_keys = { -- sort keys to be used with these namespaces:
[4] = 'ω', -- wikipedia; omega
[10] = 'τ', -- template; tau
[118] = 'Δ', -- draft; delta
['other'] = 'ο', -- all other non-talk namespaces except main (article); omicron
}
--[[--------------------------< M E S S A G E S >--------------------------------------------------------------
Translation table
The following contains fixed text that may be output as part of a citation.
This is separated from the main body to aid in future translations of this
module.
]]
local messages = {
['agency'] = '$1 $2', -- $1 is sepc, $2 is agency
['archived-dead'] = 'Archived from $1 on $2',
['archived-live'] = '$1 from the original on $2',
['archived-unfit'] = 'Archived from the original on ',
['archived'] = 'Archived',
['by'] = 'By', -- contributions to authored works: introduction, foreword, afterword
['cartography'] = 'Cartography by $1',
['editor'] = 'ed.',
['editors'] = 'eds.',
['edition'] = '($1 ed.)',
['episode'] = 'Episode $1',
['et al'] = 'et al.',
['in'] = 'In', -- edited works
['inactive'] = 'inactive',
['inset'] = '$1 inset',
['interview'] = 'Interviewed by $1',
['mismatch'] = '<code class="cs1-code">|$1=</code> / <code class="cs1-code">|$2=</code> mismatch', -- $1 is year param name; $2 is date param name
['newsgroup'] = '[[Usenet newsgroup|Newsgroup]]: $1',
['notitle'] = 'No title', -- for |title=(()) and (in the future) |title=none
['original'] = 'the original',
['origdate'] = ' [$1]',
['published'] = ' (published $1)',
['retrieved'] = 'Retrieved $1',
['season'] = 'Season $1',
['section'] = '§ $1',
['sections'] = '§§ $1',
['series'] = '$1 $2', -- $1 is sepc, $2 is series
['seriesnum'] = 'Series $1',
['translated'] = 'Translated by $1',
['type'] = ' ($1)', -- for titletype
['written'] = 'Written at $1',
['vol'] = '$1 Vol. $2', -- $1 is sepc; bold journal style volume is in presentation{}
['vol-no'] = '$1 Vol. $2, no. $3', -- sepc, volume, issue (alternatively insert $1 after $2, but then we'd also have to change capitalization)
['issue'] = '$1 No. $2', -- $1 is sepc
['art'] = '$1 Art. $2', -- $1 is sepc; for {{cite conference}} only
['vol-art'] = '$1 Vol. $2, art. $3', -- sepc, volume, article-number; for {{cite conference}} only
['j-vol'] = '$1 $2', -- sepc, volume; bold journal volume is in presentation{}
['j-issue'] = ' ($1)',
['j-article-num'] = ' $1', -- TODO: any punctuation here? static text?
['nopp'] = '$1 $2'; -- page(s) without prefix; $1 is sepc
['p-prefix'] = "$1 p. $2", -- $1 is sepc
['pp-prefix'] = "$1 pp. $2", -- $1 is sepc
['j-page(s)'] = ': $1', -- same for page and pages
['sheet'] = '$1 Sheet $2', -- $1 is sepc
['sheets'] = '$1 Sheets $2', -- $1 is sepc
['j-sheet'] = ': Sheet $1',
['j-sheets'] = ': Sheets $1',
['language'] = '(in $1)',
['via'] = " – via $1",
['event'] = 'Event occurs at',
['minutes'] = 'minutes in',
-- Determines the location of the help page
['help page link'] = 'Help:CS1 errors',
['help page label'] = 'help',
-- categories
['cat wikilink'] = '[[Category:$1]]', -- $1 is the category name
['cat wikilink sk'] = '[[Category:$1|$2]]', -- $1 is the category name; $2 is namespace sort key
[':cat wikilink'] = '[[:Category:$1|link]]', -- category name as maintenance message wikilink; $1 is the category name
-- Internal errors (should only occur if configuration is bad)
['undefined_error'] = 'Called with an undefined error condition',
['unknown_ID_key'] = 'Unrecognized ID key: ', -- an ID key in id_handlers not found in ~/Identifiers func_map{}
['unknown_ID_access'] = 'Unrecognized ID access keyword: ', -- an ID access keyword in id_handlers not found in keywords_lists['id-access']{}
['unknown_argument_map'] = 'Argument map not defined for this variable',
['bare_url_no_origin'] = 'Bare URL found but origin indicator is nil or empty',
['warning_msg_e'] = '<span style="color:#d33">One or more <code style="color: inherit; background: inherit; border: none; padding: inherit;">{{$1}}</code> templates have errors</span>; messages may be hidden ([[Help:CS1_errors#Controlling_error_message_display|help]]).'; -- $1 is template link
['warning_msg_m'] = '<span style="color:#3a3">One or more <code style="color: inherit; background: inherit; border: none; padding: inherit;">{{$1}}</code> templates have maintenance messages</span>; messages may be hidden ([[Help:CS1_errors#Controlling_error_message_display|help]]).'; -- $1 is template link
}
--[[--------------------------< C I T A T I O N _ C L A S S _ M A P >------------------------------------------
this table maps the value assigned to |CitationClass= in the cs1|2 templates to the canonical template name when
the value assigned to |CitationClass= is different from the canonical template name. |CitationClass= values are
used as class attributes in the <cite> tag that encloses the citation so these names may not contain spaces while
the canonical template name may. These names are used in warning_msg_e and warning_msg_m to create links to the
template's documentation when an article is displayed in preview mode.
Most cs1|2 template |CitationClass= values at en.wiki match their canonical template names so are not listed here.
]]
local citation_class_map_t = { -- TODO: if kept, these and all other config.CitationClass 'names' require some sort of i18n
['arxiv'] = 'arXiv',
['audio-visual'] = 'AV media',
['AV-media-notes'] = 'AV media notes',
['biorxiv'] = 'bioRxiv',
['citeseerx'] = 'CiteSeerX',
['encyclopaedia'] = 'encyclopedia',
['mailinglist'] = 'mailing list',
['medrxiv'] = 'medRxiv',
['pressrelease'] = 'press release',
['ssrn'] = 'SSRN',
['techreport'] = 'tech report',
}
--[=[-------------------------< E T _ A L _ P A T T E R N S >--------------------------------------------------
This table provides Lua patterns for the phrase "et al" and variants in name text
(author, editor, etc.). The main module uses these to identify and emit the 'etal' message.
]=]
local et_al_patterns = {
"[;,]? *[\"']*%f[%a][Ee][Tt]%.? *[Aa][Ll][%.;,\"']*$", -- variations on the 'et al' theme
"[;,]? *[\"']*%f[%a][Ee][Tt]%.? *[Aa][Ll][Ii][AaIi][Ee]?[%.;,\"']*$", -- variations on the 'et alia', 'et alii' and 'et aliae' themes (false positive 'et aliie' unlikely to match)
"[;,]? *%f[%a]and [Oo]thers", -- an alternative to et al.
"%[%[ *[Ee][Tt]%.? *[Aa][Ll]%.? *%]%]", -- a wikilinked form
"%(%( *[Ee][Tt]%.? *[Aa][Ll]%.? *%)%)", -- a double-bracketed form (to counter partial removal of ((...)) syntax)
"[%(%[] *[Ee][Tt]%.? *[Aa][Ll]%.? *[%)%]]", -- a bracketed form
}
--[[--------------------------< P R E S E N T A T I O N >------------------------
Fixed presentation markup. Originally part of citation_config.messages it has
been moved into its own, more semantically correct place.
]]
local presentation =
{
-- .citation-comment class is specified at Help:CS1_errors#Controlling_error_message_display
['hidden-error'] = '<span class="cs1-hidden-error citation-comment">$1</span>',
['visible-error'] = '<span class="cs1-visible-error citation-comment">$1</span>',
['hidden-maint'] = '<span class="cs1-maint citation-comment">$1</span>',
['accessdate'] = '<span class="reference-accessdate">$1$2</span>', -- to allow editors to hide accessdate using personal CSS
['bdi'] = '<bdi$1>$2</bdi>', -- bidirectional isolation used with |script-title= and the like
['cite'] = '<cite class="$1">$2</cite>'; -- for use when citation does not have a namelist and |ref= not set so no id="..." attribute
['cite-id'] = '<cite id="$1" class="$2">$3</cite>'; -- for use when when |ref= is set or when citation has a namelist
['format'] = ' <span class="cs1-format">($1)</span>', -- for |format=, |chapter-format=, etc.
['interwiki'] = ' <span class="cs1-format">[in $1]</span>', -- for interwiki-language-linked author, editor, etc
['interproj'] = ' <span class="cs1-format">[at $1]</span>', -- for interwiki-project-linked author, editor, etc (:d: and :s: supported; :w: ignored)
-- various access levels, for |access=, |doi-access=, |arxiv=, ...
-- narrow no-break space   may work better than nowrap CSS. Or not? Browser support?
['ext-link-access-signal'] = '<span class="$1" title="$2">$3</span>', -- external link with appropriate lock icon
['free'] = {class='cs1-lock-free', title='Freely accessible'}, -- classes defined in Module:Citation/CS1/styles.css
['registration'] = {class='cs1-lock-registration', title='Free registration required'},
['limited'] = {class='cs1-lock-limited', title='Free access subject to limited trial, subscription normally required'},
['subscription'] = {class='cs1-lock-subscription', title='Paid subscription required'},
['interwiki-icon'] = '<span class="$1" title="$2">$3</span>',
['class-wikisource'] = 'cs1-ws-icon',
['italic-title'] = "''$1''",
['kern-left'] = '<span class="cs1-kern-left"></span>$1', -- spacing to use when title contains leading single or double quote mark
['kern-right'] = '$1<span class="cs1-kern-right"></span>', -- spacing to use when title contains trailing single or double quote mark
['nowrap1'] = '<span class="nowrap">$1</span>', -- for nowrapping an item: <span ...>yyyy-mm-dd</span>
['nowrap2'] = '<span class="nowrap">$1</span> $2', -- for nowrapping portions of an item: <span ...>dd mmmm</span> yyyy (note white space)
['ocins'] = '<span title="$1" class="Z3988"></span>',
['parameter'] = '<code class="cs1-code">|$1=</code>',
['ps_cs1'] = '.'; -- CS1 style postscript (terminal) character
['ps_cs2'] = ''; -- CS2 style postscript (terminal) character (empty string)
['quoted-text'] = '<q>$1</q>', -- for wrapping |quote= content
['quoted-title'] = '"$1"',
['sep_cs1'] = '.', -- CS1 element separator
['sep_cs2'] = ',', -- CS2 separator
['sep_nl'] = ';', -- CS1|2 style name-list separator between names is a semicolon
['sep_nl_and'] = ' and ', -- used as last nl sep when |name-list-style=and and list has 2 items
['sep_nl_end'] = '; and ', -- used as last nl sep when |name-list-style=and and list has 3+ names
['sep_name'] = ', ', -- CS1|2 style last/first separator is <comma><space>
['sep_nl_vanc'] = ',', -- Vancouver style name-list separator between authors is a comma
['sep_name_vanc'] = ' ', -- Vancouver style last/first separator is a space
['sep_list'] = ', ', -- used for |language= when list has 3+ items except for last sep which uses sep_list_end
['sep_list_pair'] = ' and ', -- used for |language= when list has 2 items
['sep_list_end'] = ', and ', -- used as last list sep for |language= when list has 3+ items
['trans-italic-title'] = "[''$1'']",
['trans-quoted-title'] = "[$1]", -- for |trans-title= and |trans-quote=
['vol-bold'] = '$1 <b>$2</b>', -- sepc, volume; for bold journal cites; for other cites ['vol'] in messages{}
}
--[[--------------------------< A L I A S E S >---------------------------------
Aliases table for commonly passed parameters.
Parameter names on the right side in the assignments in this table must have been
defined in the Whitelist before they will be recognized as valid parameter names
]]
local aliases = {
['AccessDate'] = {'access-date', 'accessdate'}, -- Used by InternetArchiveBot
['Agency'] = 'agency',
['ArchiveDate'] = {'archive-date', 'archivedate'}, -- Used by InternetArchiveBot
['ArchiveFormat'] = 'archive-format',
['ArchiveURL'] = {'archive-url', 'archiveurl'}, -- Used by InternetArchiveBot
['ArticleNumber'] = 'article-number',
['ASINTLD'] = 'asin-tld',
['At'] = 'at', -- Used by InternetArchiveBot
['Authors'] = {'people', 'credits'},
['BookTitle'] = {'book-title', 'booktitle'},
['Cartography'] = 'cartography',
['Chapter'] = {'chapter', 'contribution', 'entry', 'article', 'section'},
['ChapterFormat'] = {'chapter-format', 'contribution-format', 'entry-format',
'article-format', 'section-format'};
['ChapterURL'] = {'chapter-url', 'contribution-url', 'entry-url', 'article-url', 'section-url'}, -- Used by InternetArchiveBot
['ChapterUrlAccess'] = {'chapter-url-access', 'contribution-url-access',
'entry-url-access', 'article-url-access', 'section-url-access'}, -- Used by InternetArchiveBot
['Class'] = 'class', -- cite arxiv and arxiv identifier
['Collaboration'] = 'collaboration',
['Conference'] = {'conference', 'event'},
['ConferenceFormat'] = 'conference-format',
['ConferenceURL'] = 'conference-url', -- Used by InternetArchiveBot
['Date'] = {'date', 'air-date', 'airdate'}, -- air-date and airdate for cite episode and cite serial only
['Degree'] = 'degree',
['DF'] = 'df',
['DisplayAuthors'] = {'display-authors', 'display-subjects'},
['DisplayContributors'] = 'display-contributors',
['DisplayEditors'] = 'display-editors',
['DisplayInterviewers'] = 'display-interviewers',
['DisplayTranslators'] = 'display-translators',
['Docket'] = 'docket',
['DoiBroken'] = 'doi-broken-date',
['Edition'] = 'edition',
['Embargo'] = 'pmc-embargo-date',
['Encyclopedia'] = {'encyclopedia', 'encyclopaedia', 'dictionary'}, -- cite encyclopedia only
['Episode'] = 'episode', -- cite serial only TODO: make available to cite episode?
['Format'] = 'format',
['ID'] = {'id', 'ID'},
['Inset'] = 'inset',
['Issue'] = {'issue', 'number'},
['Language'] = {'language', 'lang'},
['MailingList'] = {'mailing-list', 'mailinglist'}, -- cite mailing list only
['Map'] = 'map', -- cite map only
['MapFormat'] = 'map-format', -- cite map only
['MapURL'] = {'map-url', 'mapurl'}, -- cite map only -- Used by InternetArchiveBot
['MapUrlAccess'] = 'map-url-access', -- cite map only -- Used by InternetArchiveBot
['Minutes'] = 'minutes',
['Mode'] = 'mode',
['NameListStyle'] = 'name-list-style',
['Network'] = 'network',
['Newsgroup'] = 'newsgroup', -- cite newsgroup only
['NoPP'] = {'no-pp', 'nopp'},
['NoTracking'] = {'no-tracking', 'template-doc-demo'},
['Number'] = 'number', -- this case only for cite techreport
['OrigDate'] = {'orig-date', 'orig-year', 'origyear'},
['Others'] = 'others',
['Page'] = {'page', 'p'}, -- Used by InternetArchiveBot
['Pages'] = {'pages', 'pp'}, -- Used by InternetArchiveBot
['Periodical'] = {'journal', 'magazine', 'newspaper', 'periodical', 'website', 'work'},
['Place'] = {'place', 'location'},
['PostScript'] = 'postscript',
['PublicationDate'] = {'publication-date', 'publicationdate'},
['PublicationPlace'] = {'publication-place', 'publicationplace'},
['PublisherName'] = {'publisher', 'institution'},
['Quote'] = {'quote', 'quotation'},
['QuotePage'] = 'quote-page',
['QuotePages'] = 'quote-pages',
['Ref'] = 'ref',
['Scale'] = 'scale',
['ScriptChapter'] = {'script-chapter', 'script-contribution', 'script-entry',
'script-article', 'script-section'},
['ScriptMap'] = 'script-map',
['ScriptPeriodical'] = {'script-journal', 'script-magazine', 'script-newspaper',
'script-periodical', 'script-website', 'script-work'},
['ScriptQuote'] = 'script-quote',
['ScriptTitle'] = 'script-title', -- Used by InternetArchiveBot
['Season'] = 'season',
['Sections'] = 'sections', -- cite map only
['Series'] = {'series', 'version'},
['SeriesLink'] = {'series-link', 'serieslink'},
['SeriesNumber'] = {'series-number', 'series-no'},
['Sheet'] = 'sheet', -- cite map only
['Sheets'] = 'sheets', -- cite map only
['Station'] = 'station',
['Time'] = 'time',
['TimeCaption'] = 'time-caption',
['Title'] = 'title', -- Used by InternetArchiveBot
['TitleLink'] = {'title-link', 'episode-link', 'episodelink'}, -- Used by InternetArchiveBot
['TitleNote'] = {'title-note', 'department'},
['TitleType'] = {'type', 'medium'},
['TransChapter'] = {'trans-article', 'trans-chapter', 'trans-contribution',
'trans-entry', 'trans-section'},
['Transcript'] = 'transcript',
['TranscriptFormat'] = 'transcript-format',
['TranscriptURL'] = 'transcript-url', -- Used by InternetArchiveBot
['TransMap'] = 'trans-map', -- cite map only
['TransPeriodical'] = {'trans-journal', 'trans-magazine', 'trans-newspaper',
'trans-periodical', 'trans-website', 'trans-work'},
['TransQuote'] = 'trans-quote',
['TransTitle'] = 'trans-title', -- Used by InternetArchiveBot
['URL'] = {'url', 'URL'}, -- Used by InternetArchiveBot
['UrlAccess'] = 'url-access', -- Used by InternetArchiveBot
['UrlStatus'] = 'url-status', -- Used by InternetArchiveBot
['Vauthors'] = 'vauthors',
['Veditors'] = 'veditors',
['Via'] = 'via',
['Volume'] = 'volume',
['Year'] = 'year',
['AuthorList-First'] = {"first#", "author-first#", "author#-first", "author-given#", "author#-given",
"subject-first#", "subject#-first", "subject-given#", "subject#-given",
"given#"},
['AuthorList-Last'] = {"last#", "author-last#", "author#-last", "author-surname#", "author#-surname",
"subject-last#", "subject#-last", "subject-surname#", "subject#-surname",
"author#", 'host#', "subject#", "surname#"},
['AuthorList-Link'] = {"author-link#", "author#-link", "subject-link#",
"subject#-link", "authorlink#", "author#link"},
['AuthorList-Mask'] = {"author-mask#", "author#-mask", "subject-mask#", "subject#-mask"},
['ContributorList-First'] = {'contributor-first#', 'contributor#-first',
'contributor-given#', 'contributor#-given'},
['ContributorList-Last'] = {'contributor-last#', 'contributor#-last',
'contributor-surname#', 'contributor#-surname', 'contributor#'},
['ContributorList-Link'] = {'contributor-link#', 'contributor#-link'},
['ContributorList-Mask'] = {'contributor-mask#', 'contributor#-mask'},
['EditorList-First'] = {"editor-first#", "editor#-first", "editor-given#", "editor#-given"},
['EditorList-Last'] = {"editor-last#", "editor#-last", "editor-surname#",
"editor#-surname", "editor#"},
['EditorList-Link'] = {"editor-link#", "editor#-link"},
['EditorList-Mask'] = {"editor-mask#", "editor#-mask"},
['InterviewerList-First'] = {'interviewer-first#', 'interviewer#-first',
'interviewer-given#', 'interviewer#-given'},
['InterviewerList-Last'] = {'interviewer-last#', 'interviewer#-last',
'interviewer-surname#', 'interviewer#-surname', 'interviewer#'},
['InterviewerList-Link'] = {'interviewer-link#', 'interviewer#-link'},
['InterviewerList-Mask'] = {'interviewer-mask#', 'interviewer#-mask'},
['TranslatorList-First'] = {'translator-first#', 'translator#-first',
'translator-given#', 'translator#-given'},
['TranslatorList-Last'] = {'translator-last#', 'translator#-last',
'translator-surname#', 'translator#-surname', 'translator#'},
['TranslatorList-Link'] = {'translator-link#', 'translator#-link'},
['TranslatorList-Mask'] = {'translator-mask#', 'translator#-mask'},
}
--[[--------------------------< P U N C T _ S K I P >---------------------------
builds a table of parameter names that the extraneous terminal punctuation check should not check.
]]
local punct_meta_params = { -- table of aliases[] keys (meta parameters); each key has a table of parameter names for a value
'BookTitle', 'Chapter', 'ScriptChapter', 'ScriptTitle', 'Title', 'TransChapter', 'Transcript', 'TransMap', 'TransTitle', -- title-holding parameters
'AuthorList-Mask', 'ContributorList-Mask', 'EditorList-Mask', 'InterviewerList-Mask', 'TranslatorList-Mask', -- name-list mask may have name separators
'PostScript', 'Quote', 'ScriptQuote', 'TransQuote', 'Ref', -- miscellaneous
'ArchiveURL', 'ChapterURL', 'ConferenceURL', 'MapURL', 'TranscriptURL', 'URL', -- URL-holding parameters
}
local url_meta_params = { -- table of aliases[] keys (meta parameters); each key has a table of parameter names for a value
'ArchiveURL', 'ChapterURL', 'ConferenceURL', 'ID', 'MapURL', 'TranscriptURL', 'URL', -- parameters allowed to hold urls
'Page', 'Pages', 'At', 'QuotePage', 'QuotePages', -- insource locators allowed to hold urls
}
local function build_skip_table (skip_t, meta_params)
for _, meta_param in ipairs (meta_params) do -- for each meta parameter key
local params = aliases[meta_param]; -- get the parameter or the table of parameters associated with the meta parameter name
if 'string' == type (params) then
skip_t[params] = 1; -- just a single parameter
else
for _, param in ipairs (params) do -- get the parameter name
skip_t[param] = 1; -- add the parameter name to the skip table
local count;
param, count = param:gsub ('#', ''); -- remove enumerator marker from enumerated parameters
if 0 ~= count then -- if removed
skip_t[param] = 1; -- add param name without enumerator marker
end
end
end
end
return skip_t;
end
local punct_skip = {};
local url_skip = {};
--[[--------------------------< S I N G L E - L E T T E R S E C O N D - L E V E L D O M A I N S >----------
this is a list of tlds that are known to have single-letter second-level domain names. This list does not include
ccTLDs which are accepted in is_domain_name().
]]
local single_letter_2nd_lvl_domains_t = {'cash', 'company', 'foundation', 'media', 'org', 'today'};
--[[-----------< S P E C I A L C A S E T R A N S L A T I O N S >------------
This table is primarily here to support internationalization. Translations in
this table are used, for example, when an error message, category name, etc.,
is extracted from the English alias key. There may be other cases where
this translation table may be useful.
]]
local is_Latn = 'A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143';
local special_case_translation = {
['AuthorList'] = 'authors list', -- used to assemble maintenance category names
['ContributorList'] = 'contributors list', -- translation of these names plus translation of the base maintenance category names in maint_cats{} table below
['EditorList'] = 'editors list', -- must match the names of the actual categories
['InterviewerList'] = 'interviewers list', -- this group or translations used by name_has_ed_markup() and name_has_mult_names()
['TranslatorList'] = 'translators list',
-- Lua patterns to match pseudo-titles used by InternetArchiveBot and others as placeholder for unknown |title= value
['archived_copy'] = { -- used with CS1 maint: Archive[d] copy as title
['en'] = '^archived?%s+copy$', -- for English; translators: keep this because templates imported from en.wiki
['local'] = nil, -- translators: replace ['local'] = nil with lowercase translation only when bots or tools create generic titles in your language
},
-- Lua patterns to match generic titles; usually created by bots or reference filling tools
-- translators: replace ['local'] = nil with lowercase translation only when bots or tools create generic titles in your language
-- generic titles and patterns in this table should be lowercase only
-- leave ['local'] nil except when there is a matching generic title in your language
-- boolean 'true' for plain-text searches; 'false' for pattern searches
['generic_titles'] = {
['accept'] = {
},
['reject'] = {
{['en'] = {'^wayback%s+machine$', false}, ['local'] = nil},
{['en'] = {'are you a robot', true}, ['local'] = nil},
{['en'] = {'hugedomains.com', true}, ['local'] = nil},
{['en'] = {'^[%(%[{<]?no +title[>}%]%)]?$', false}, ['local'] = nil},
{['en'] = {'page not found', true}, ['local'] = nil},
{['en'] = {'subscribe to read', true}, ['local'] = nil},
{['en'] = {'^[%(%[{<]?unknown[>}%]%)]?$', false}, ['local'] = nil},
{['en'] = {'website is for sale', true}, ['local'] = nil},
{['en'] = {'^404', false}, ['local'] = nil},
{['en'] = {'internet archive wayback machine', true}, ['local'] = nil},
{['en'] = {'log into facebook', true}, ['local'] = nil},
{['en'] = {'login • instagram', true}, ['local'] = nil},
{['en'] = {'redirecting...', true}, ['local'] = nil},
{['en'] = {'usurped title', true}, ['local'] = nil}, -- added by a GreenC bot
{['en'] = {'webcite query result', true}, ['local'] = nil},
{['en'] = {'wikiwix\'s cache', true}, ['local'] = nil},
}
},
-- boolean 'true' for plain-text searches, search string must be lowercase only
-- boolean 'false' for pattern searches
-- leave ['local'] nil except when there is a matching generic name in your language
['generic_names'] = {
['accept'] = {
{['en'] = {'%[%[[^|]*%(author%) *|[^%]]*%]%]', false}, ['local'] = nil},
},
['reject'] = {
{['en'] = {'about us', true}, ['local'] = nil},
{['en'] = {'%f[%a][Aa]dvisor%f[%A]', false}, ['local'] = nil},
{['en'] = {'allmusic', true}, ['local'] = nil},
{['en'] = {'%f[%a][Aa]uthor%f[%A]', false}, ['local'] = nil},
{['en'] = {'business', true}, ['local'] = nil},
{['en'] = {'cnn', true}, ['local'] = nil},
{['en'] = {'collaborator', true}, ['local'] = nil},
{['en'] = {'contributor', true}, ['local'] = nil},
{['en'] = {'contact us', true}, ['local'] = nil},
{['en'] = {'directory', true}, ['local'] = nil},
{['en'] = {'%f[%(%[][%(%[]%s*eds?%.?%s*[%)%]]?$', false}, ['local'] = nil},
{['en'] = {'[,%.%s]%f[e]eds?%.?$', false}, ['local'] = nil},
{['en'] = {'^eds?[%.,;]', false}, ['local'] = nil},
{['en'] = {'^[%(%[]%s*[Ee][Dd][Ss]?%.?%s*[%)%]]', false}, ['local'] = nil},
{['en'] = {'%f[%a][Ee]dited%f[%A]', false}, ['local'] = nil},
{['en'] = {'%f[%a][Ee]ditors?%f[%A]', false}, ['local'] = nil},
{['en'] = {'%f[%a]]Ee]mail%f[%A]', false}, ['local'] = nil},
{['en'] = {'facebook', true}, ['local'] = nil},
{['en'] = {'google', true}, ['local'] = nil},
{['en'] = {'home page', true}, ['local'] = nil},
{['en'] = {'^[Ii]nc%.?$', false}, ['local'] = nil},
{['en'] = {'instagram', true}, ['local'] = nil},
{['en'] = {'interviewer', true}, ['local'] = nil},
{['en'] = {'linkedIn', true}, ['local'] = nil},
{['en'] = {'^[Nn]ews$', false}, ['local'] = nil},
{['en'] = {'pinterest', true}, ['local'] = nil},
{['en'] = {'policy', true}, ['local'] = nil},
{['en'] = {'privacy', true}, ['local'] = nil},
{['en'] = {'reuters', true}, ['local'] = nil},
{['en'] = {'translator', true}, ['local'] = nil},
{['en'] = {'tumblr', true}, ['local'] = nil},
{['en'] = {'twitter', true}, ['local'] = nil},
{['en'] = {'site name', true}, ['local'] = nil},
{['en'] = {'statement', true}, ['local'] = nil},
{['en'] = {'submitted', true}, ['local'] = nil},
{['en'] = {'super.?user', false}, ['local'] = nil},
{['en'] = {'%f['..is_Latn..'][Uu]ser%f[^'..is_Latn..']', false}, ['local'] = nil},
{['en'] = {'verfasser', true}, ['local'] = nil},
}
}
}
--[[--------------------------< D A T E _ N A M E S >----------------------------------------------------------
This table of tables lists local language date names and fallback English date names.
The code in Date_validation will look first in the local table for valid date names.
If date names are not found in the local table, the code will look in the English table.
Because citations can be copied to the local wiki from en.wiki, the English is
required when the date-name translation function date_name_xlate() is used.
In these tables, season numbering is defined by
Extended Date/Time Format (EDTF) Specification (https://www.loc.gov/standards/datetime/)
which became part of ISO 8601 in 2019. See '§Sub-year groupings'. The standard
defines various divisions using numbers 21-41. CS1|2 only supports generic seasons.
EDTF does support the distinction between north and south hemisphere seasons
but CS1|2 has no way to make that distinction.
33-36 = Quarter 1, Quarter 2, Quarter 3, Quarter 4 (3 months each)
The standard does not address 'named' dates so, for the purposes of CS1|2,
Easter and Christmas are defined here as 98 and 99, which should be out of the
ISO 8601 (EDTF) range of uses for a while.
local_date_names_from_mediawiki is a boolean. When set to:
true – module will fetch local month names from MediaWiki for both date_names['local']['long'] and date_names['local']['short']
false – module will *not* fetch local month names from MediaWiki
Caveat lector: There is no guarantee that MediaWiki will provide short month names. At your wiki you can test
the results of the MediaWiki fetch in the debug console with this command (the result is alpha sorted):
=mw.dumpObject (p.date_names['local'])
While the module can fetch month names from MediaWiki, it cannot fetch the quarter, season, and named date names
from MediaWiki. Those must be translated manually.
]]
local local_date_names_from_mediawiki = true; -- when false, manual translation required for date_names['local']['long'] and date_names['local']['short']
-- when true, module fetches long and short month names from MediaWiki
local date_names = {
['en'] = { -- English
['long'] = {['January'] = 1, ['February'] = 2, ['March'] = 3, ['April'] = 4, ['May'] = 5, ['June'] = 6, ['July'] = 7, ['August'] = 8, ['September'] = 9, ['October'] = 10, ['November'] = 11, ['December'] = 12},
['short'] = {['Jan'] = 1, ['Feb'] = 2, ['Mar'] = 3, ['Apr'] = 4, ['May'] = 5, ['Jun'] = 6, ['Jul'] = 7, ['Aug'] = 8, ['Sep'] = 9, ['Oct'] = 10, ['Nov'] = 11, ['Dec'] = 12},
['quarter'] = {['First Quarter'] = 33, ['Second Quarter'] = 34, ['Third Quarter'] = 35, ['Fourth Quarter'] = 36},
['season'] = {['Winter'] = 24, ['Spring'] = 21, ['Summer'] = 22, ['Fall'] = 23, ['Autumn'] = 23},
['named'] = {['Easter'] = 98, ['Christmas'] = 99},
},
-- when local_date_names_from_mediawiki = false
['local'] = { -- replace these English date names with the local language equivalents
['long'] = {['January'] = 1, ['February'] = 2, ['March'] = 3, ['April'] = 4, ['May'] = 5, ['June'] = 6, ['July'] = 7, ['August'] = 8, ['September'] = 9, ['October'] = 10, ['November'] = 11, ['December'] = 12},
['short'] = {['Jan'] = 1, ['Feb'] = 2, ['Mar'] = 3, ['Apr'] = 4, ['May'] = 5, ['Jun'] = 6, ['Jul'] = 7, ['Aug'] = 8, ['Sep'] = 9, ['Oct'] = 10, ['Nov'] = 11, ['Dec'] = 12},
['quarter'] = {['First Quarter'] = 33, ['Second Quarter'] = 34, ['Third Quarter'] = 35, ['Fourth Quarter'] = 36},
['season'] = {['Winter'] = 24, ['Spring'] = 21, ['Summer'] = 22, ['Fall'] = 23, ['Autumn'] = 23},
['named'] = {['Easter'] = 98, ['Christmas'] = 99},
},
['inv_local_long'] = {}, -- used in date reformatting & translation; copy of date_names['local'].long where k/v are inverted: [1]='<local name>' etc.
['inv_local_short'] = {}, -- used in date reformatting & translation; copy of date_names['local'].short where k/v are inverted: [1]='<local name>' etc.
['inv_local_quarter'] = {}, -- used in date translation; copy of date_names['local'].quarter where k/v are inverted: [1]='<local name>' etc.
['inv_local_season'] = {}, -- used in date translation; copy of date_names['local'].season where k/v are inverted: [1]='<local name>' etc.
['inv_local_named'] = {}, -- used in date translation; copy of date_names['local'].named where k/v are inverted: [1]='<local name>' etc.
['local_digits'] = {['0'] = '0', ['1'] = '1', ['2'] = '2', ['3'] = '3', ['4'] = '4', ['5'] = '5', ['6'] = '6', ['7'] = '7', ['8'] = '8', ['9'] = '9'}, -- used to convert local language digits to Western 0-9
['xlate_digits'] = {},
}
if local_date_names_from_mediawiki then -- if fetching local month names from MediaWiki is enabled
local long_t = {};
local short_t = {};
for i=1, 12 do -- loop 12x and
local name = lang_obj:formatDate('F', '2022-' .. i .. '-1'); -- get long month name for each i
long_t[name] = i; -- save it
name = lang_obj:formatDate('M', '2022-' .. i .. '-1'); -- get short month name for each i
short_t[name] = i; -- save it
end
date_names['local']['long'] = long_t; -- write the long table – overwrites manual translation
date_names['local']['short'] = short_t; -- write the short table – overwrites manual translation
end
-- create inverted date-name tables for reformatting and/or translation
for _, invert_t in pairs {{'long', 'inv_local_long'}, {'short', 'inv_local_short'}, {'quarter', 'inv_local_quarter'}, {'season', 'inv_local_season'}, {'named', 'inv_local_named'}} do
for name, i in pairs (date_names['local'][invert_t[1]]) do -- this table is ['name'] = i
date_names[invert_t[2]][i] = name; -- invert to get [i] = 'name' for conversions from ymd
end
end
if local_digits_from_mediawiki then -- if fetching local digits from MediaWiki is enabled
local digits_t = {};
for i=0, 9 do -- loop 10x and
digits_t [lang_obj:formatNum (i)] = tostring (i); -- format the loop indexer as local lang table index and assign loop indexer (a string) as the value
end
date_names['local_digits'] = digits_t;
end
for ld, ed in pairs (date_names.local_digits) do -- make a digit translation table for simple date translation from en to local language using local_digits table
date_names.xlate_digits [ed] = ld; -- en digit becomes index with local digit as the value
end
local df_template_patterns = { -- table of redirects to {{Use dmy dates}} and {{Use mdy dates}}
'{{ *[Uu]se +(dmy) +dates *[|}]', -- 1159k -- sorted by approximate transclusion count
'{{ *[Uu]se +(mdy) +dates *[|}]', -- 212k
'{{ *[Uu]se +(MDY) +dates *[|}]', -- 788
'{{ *[Uu]se +(DMY) +dates *[|}]', -- 343
'{{ *([Mm]dy) *[|}]', -- 176
'{{ *[Uu]se *(dmy) *[|}]', -- 156 + 18
'{{ *[Uu]se *(mdy) *[|}]', -- 149 + 11
'{{ *([Dd]my) *[|}]', -- 56
'{{ *[Uu]se +(MDY) *[|}]', -- 5
'{{ *([Dd]MY) *[|}]', -- 3
'{{ *[Uu]se(mdy)dates *[|}]', -- 1
'{{ *[Uu]se +(DMY) *[|}]', -- 0
'{{ *([Mm]DY) *[|}]', -- 0
}
local title_object = mw.title.getCurrentTitle();
local content; -- done this way so that unused templates appear in unused-template-reports; self-transcluded makes them look like they are used
if 10 ~= title_object.namespace then -- all namespaces except Template
content = title_object:getContent() or ''; -- get the content of the article or ''; new pages edited w/ve do not have 'content' until saved; ve does not preview; phab:T221625
end
local function get_date_format ()
if not content then -- nil content when we're in template
return nil; -- auto-formatting does not work in Template space so don't set global_df
end
for _, pattern in ipairs (df_template_patterns) do -- loop through the patterns looking for {{Use dmy dates}} or {{Use mdy dates}} or any of their redirects
local start, _, match = content:find(pattern); -- match is the three letters indicating desired date format
if match then
local use_dates_template = content:match ('%b{}', start); -- get the whole template
if use_dates_template:match ('| *cs1%-dates *= *[lsy][sy]?') then -- look for |cs1-dates=publication date length access-/archive-date length
return match:lower() .. '-' .. use_dates_template:match ('| *cs1%-dates *= *([lsy][sy]?)');
else
return match:lower() .. '-all'; -- no |cs1-dates= k/v pair; return value appropriate for use in |df=
end
end
end
end
local global_df; -- TODO: add this to <global_cs1_config_t>?
--[[-----------------< V O L U M E , I S S U E , P A G E S >------------------
These tables hold cite class values (from the template invocation) and identify those templates that support
|volume=, |issue=, and |page(s)= parameters. Cite conference and cite map require further qualification which
is handled in the main module.
]]
local templates_using_volume = {'citation', 'audio-visual', 'book', 'conference', 'encyclopaedia', 'interview', 'journal', 'magazine', 'map', 'news', 'report', 'techreport', 'thesis'}
local templates_using_issue = {'citation', 'conference', 'episode', 'interview', 'journal', 'magazine', 'map', 'news', 'podcast'}
local templates_not_using_page = {'audio-visual', 'episode', 'mailinglist', 'newsgroup', 'podcast', 'serial', 'sign', 'speech'}
--[[
These tables control when it is appropriate for {{citation}} to render |volume= and/or |issue=. The parameter
names in the tables constrain {{citation}} so that its renderings match the renderings of the equivalent cs1
templates. For example, {{cite web}} does not support |volume= so the equivalent {{citation |website=...}} must
not support |volume=.
]]
local citation_no_volume_t = { -- {{citation}} does not render |volume= when these parameters are used
'website', 'mailinglist', 'script-website',
}
local citation_issue_t = { -- {{citation}} may render |issue= when these parameters are used
'journal', 'magazine', 'newspaper', 'periodical', 'work',
'script-journal', 'script-magazine', 'script-newspaper', 'script-periodical', 'script-work',
}
--[[
Patterns for finding extra text in |volume=, |issue=, |page=, |pages=
]]
local vol_iss_pg_patterns = {
good_ppattern = '^P[^%.PpGg]', -- OK to begin with uppercase P: P7 (page 7 of section P), but not p123 (page 123); TODO: this allows 'Pages' which it should not
bad_ppatterns = { -- patterns for |page= and |pages=
'^[Pp][PpGg]?%.?[ %d]',
'^[Pp][Pp]?%. ', -- from {{p.}} and {{pp.}} templates
'^[Pp]ages?',
'^[Pp]gs.?',
},
vpatterns = { -- patterns for |volume=
'^volumes?',
'^vols?[%.:=]?'
},
ipatterns = { -- patterns for |issue=
'^issues?',
'^iss[%.:=]?',
'^numbers?',
'^nos?%A', -- don't match 'november' or 'nostradamus'
'^nr[%.:=]?',
'^n[%.:= ]' -- might be a valid issue without separator (space char is sep char here)
}
}
--[[--------------------------< K E Y W O R D S >-------------------------------
These tables hold keywords for those parameters that have defined sets of acceptable keywords.
]]
--[[-------------------< K E Y W O R D S T A B L E >--------------------------
this is a list of keywords; each key in the list is associated with a table of
synonymous keywords possibly from different languages.
for I18N: add local-language keywords to value table; do not change the key.
For example, adding the German keyword 'ja':
['affirmative'] = {'yes', 'true', 'y', 'ja'},
Because CS1|2 templates from en.wiki articles are often copied to other local wikis,
it is recommended that the English keywords remain in these tables.
]]
local keywords = {
['amp'] = {'&', 'amp', 'ampersand'}, -- |name-list-style=
['and'] = {'and', 'serial'}, -- |name-list-style=
['affirmative'] = {'yes', 'true', 'y'}, -- |no-tracking=, |no-pp= -- Used by InternetArchiveBot
['afterword'] = {'afterword'}, -- |contribution=
['bot: unknown'] = {'bot: unknown'}, -- |url-status= -- Used by InternetArchiveBot
['cs1'] = {'cs1'}, -- |mode=
['cs2'] = {'cs2'}, -- |mode=
['dead'] = {'dead', 'deviated'}, -- |url-status= -- Used by InternetArchiveBot
['dmy'] = {'dmy'}, -- |df=
['dmy-all'] = {'dmy-all'}, -- |df=
['foreword'] = {'foreword'}, -- |contribution=
['free'] = {'free'}, -- |<id>-access= -- Used by InternetArchiveBot
['harv'] = {'harv'}, -- |ref=; this no longer supported; is_valid_parameter_value() called with <invert> = true
['introduction'] = {'introduction'}, -- |contribution=
['limited'] = {'limited'}, -- |url-access= -- Used by InternetArchiveBot
['live'] = {'live'}, -- |url-status= -- Used by InternetArchiveBot
['mdy'] = {'mdy'}, -- |df=
['mdy-all'] = {'mdy-all'}, -- |df=
['none'] = {'none'}, -- |postscript=, |ref=, |title=, |type= -- Used by InternetArchiveBot
['off'] = {'off'}, -- |title= (potentially also: |title-link=, |postscript=, |ref=, |type=)
['preface'] = {'preface'}, -- |contribution=
['registration'] = {'registration'}, -- |url-access= -- Used by InternetArchiveBot
['subscription'] = {'subscription'}, -- |url-access= -- Used by InternetArchiveBot
['unfit'] = {'unfit'}, -- |url-status= -- Used by InternetArchiveBot
['usurped'] = {'usurped'}, -- |url-status= -- Used by InternetArchiveBot
['vanc'] = {'vanc'}, -- |name-list-style=
['ymd'] = {'ymd'}, -- |df=
['ymd-all'] = {'ymd-all'}, -- |df=
-- ['yMd'] = {'yMd'}, -- |df=; not supported at en.wiki
-- ['yMd-all'] = {'yMd-all'}, -- |df=; not supported at en.wiki
}
--[[------------------------< X L A T E _ K E Y W O R D S >---------------------
this function builds a list, keywords_xlate{}, of the keywords found in keywords{} where the values from keywords{}
become the keys in keywords_xlate{} and the keys from keywords{} become the values in keywords_xlate{}:
['affirmative'] = {'yes', 'true', 'y'}, -- in keywords{}
becomes
['yes'] = 'affirmative', -- in keywords_xlate{}
['true'] = 'affirmative',
['y'] = 'affirmative',
the purpose of this function is to act as a translator between a non-English keyword and its English equivalent
that may be used in other modules of this suite
]]
local function xlate_keywords ()
local out_table = {}; -- output goes here
for k, keywords_t in pairs (keywords) do -- spin through the keywords table
for _, keyword in ipairs (keywords_t) do -- for each keyword
out_table[keyword] = k; -- create an entry in the output table where keyword is the key
end
end
return out_table;
end
local keywords_xlate = xlate_keywords (); -- the list of translated keywords
--[[----------------< M A K E _ K E Y W O R D S _ L I S T >---------------------
this function assembles, for parameter-value validation, the list of keywords appropriate to that parameter.
keywords_lists{}, is a table of tables from keywords{}
]]
local function make_keywords_list (keywords_lists)
local out_table = {}; -- output goes here
for _, keyword_list in ipairs (keywords_lists) do -- spin through keywords_lists{} and get a table of keywords
for _, keyword in ipairs (keyword_list) do -- spin through keyword_list{} and add each keyword, ...
table.insert (out_table, keyword); -- ... as plain text, to the output list
end
end
return out_table;
end
--[[----------------< K E Y W O R D S _ L I S T S >-----------------------------
this is a list of lists of valid keywords for the various parameters in [key].
Generally the keys in this table are the canonical en.wiki parameter names though
some are contrived because of use in multiple differently named parameters:
['yes_true_y'], ['id-access'].
The function make_keywords_list() extracts the individual keywords from the
appropriate list in keywords{}.
The lists in this table are used to validate the keyword assignment for the
parameters named in this table's keys.
]]
local keywords_lists = {
['yes_true_y'] = make_keywords_list ({keywords.affirmative}),
['contribution'] = make_keywords_list ({keywords.afterword, keywords.foreword, keywords.introduction, keywords.preface}),
['df'] = make_keywords_list ({keywords.dmy, keywords['dmy-all'], keywords.mdy, keywords['mdy-all'], keywords.ymd, keywords['ymd-all']}),
-- ['df'] = make_keywords_list ({keywords.dmy, keywords['dmy-all'], keywords.mdy, keywords['mdy-all'], keywords.ymd, keywords['ymd-all'], keywords.yMd, keywords['yMd-all']}), -- not supported at en.wiki
['mode'] = make_keywords_list ({keywords.cs1, keywords.cs2}),
['name-list-style'] = make_keywords_list ({keywords.amp, keywords['and'], keywords.vanc}),
['ref'] = make_keywords_list ({keywords.harv}), -- inverted check; |ref=harv no longer supported
['url-access'] = make_keywords_list ({keywords.subscription, keywords.limited, keywords.registration}),
['url-status'] = make_keywords_list ({keywords.dead, keywords.live, keywords.unfit, keywords.usurped, keywords['bot: unknown']}),
['id-access'] = make_keywords_list ({keywords.free}),
}
--[[--------------------------< C S 1 _ C O N F I G _ G E T >--------------------------------------------------
fetch and validate values from {{cs1 config}} template to fill <global_cs1_config_t>
no error messages; when errors are detected, the parameter value from {{cs1 config}} is blanked.
Supports all parameters and aliases associated with the metaparameters: DisplayAuthors, DisplayContributors,
DisplayEditors, DisplayInterviewers, DisplayTranslators, NameListStyle, and Mode. The DisplayWhatever metaparameters
accept numeric values only (|display-authors=etal and the like is not supported).
]]
local global_cs1_config_t = {}; -- TODO: add value returned from get_date_format() to this table?
local function get_cs1_config ()
if not content then -- nil content when we're in template
return nil; -- auto-formatting does not work in Template space so don't set global_df
end
local start = content:find('{{ *[Cc][Ss]1 config *[|}]'); -- <start> is offset into <content> when {{cs1 config}} found; nil else
if start then
local cs1_config_template = content:match ('%b{}', start); -- get the whole template
if not cs1_config_template then
return nil;
end
local params_t = mw.text.split (cs1_config_template:gsub ('^{{%s*', ''):gsub ('%s*}}$', ''), '%s*|%s*'); -- remove '{{' and '}}'; make a sequence of parameter/value pairs (split on the pipe)
table.remove (params_t, 1); -- remove the template name because it isn't a parameter/value pair
local config_meta_params_t = {'DisplayAuthors', 'DisplayContributors', 'DisplayEditors', 'DisplayInterviewers', 'DisplayTranslators', 'NameListStyle', 'Mode'};
local meta_param_map_t = {}; -- list of accepted parameter names usable in {{cs1 config}} goes here
for _, meta_param in ipairs (config_meta_params_t) do -- for i18n using <config_meta_params_t>, map template parameter names to their metaparameter equivalents
if 'table' == type (aliases[meta_param]) then -- if <meta_param> is a sequence,
for _, param in ipairs (aliases[meta_param]) do -- extract its contents
meta_param_map_t[param] = meta_param; -- and add to <meta_param_map_t>
end
else
meta_param_map_t[aliases[meta_param]] = meta_param; -- not a sequence so just add the parameter to <meta_param_map_t>
end
end
local keywords_t = {}; -- map valid keywords to their associate metaparameter; reverse form of <keyword_lists[key] for these metaparameters
for _, metaparam_t in ipairs ({{'NameListStyle', 'name-list-style'}, {'Mode', 'mode'}}) do -- only these metaparameter / keywords_lists key pairs
for _, keyword in ipairs (keywords_lists[metaparam_t[2]]) do -- spin through the list of keywords
keywords_t[keyword] = metaparam_t[1]; -- add [keyword] = metaparameter to the map
end
end
for _, param in ipairs (params_t) do -- spin through the {{cs1 config}} parameters and fill <global_cs1_config_t>
local k, v = param:match ('([^=]-)%s*=%s*(.+)'); -- <k> is the parameter name; <v> is parameter's assigned value
if k then
if k:find ('^display') then -- if <k> is one of the |display-<namelist>= parameters
if v:match ('%d+') then -- the assigned value must be digits; doesn't accept 'etal'
global_cs1_config_t[meta_param_map_t[k]]=v; -- add the display param and its value to globals table
end
else
if keywords_t[v] == meta_param_map_t[k] then -- keywords_t[v] returns nil or the metaparam name; these must be the same
global_cs1_config_t[meta_param_map_t[k]]=v; -- add the parameter and its value to globals table
end
end
end
end
end
end
get_cs1_config (); -- fill <global_cs1_config_t>
--[[---------------------< S T R I P M A R K E R S >----------------------------
Common pattern definition location for stripmarkers so that we don't have to go
hunting for them if (when) MediaWiki changes their form.
]]
local stripmarkers = {
['any'] = '\127[^\127]*UNIQ%-%-(%a+)%-[%a%d]+%-QINU[^\127]*\127', -- capture returns name of stripmarker
['math'] = '\127[^\127]*UNIQ%-%-math%-[%a%d]+%-QINU[^\127]*\127' -- math stripmarkers used in coins_cleanup() and coins_replace_math_stripmarker()
}
--[[------------< I N V I S I B L E _ C H A R A C T E R S >---------------------
This table holds non-printing or invisible characters indexed either by name or
by Unicode group. Values are decimal representations of UTF-8 codes. The table
is organized as a table of tables because the Lua pairs keyword returns table
data in an arbitrary order. Here, we want to process the table from top to bottom
because the entries at the top of the table are also found in the ranges specified
by the entries at the bottom of the table.
Also here is a pattern that recognizes stripmarkers that begin and end with the
delete characters. The nowiki stripmarker is not an error but some others are
because the parameter values that include them become part of the template's
metadata before stripmarker replacement.
]]
local invisible_defs = {
del = '\127', -- used to distinguish between stripmarker and del char
zwj = '\226\128\141', -- used with capture because zwj may be allowed
}
local invisible_chars = {
{'replacement', '\239\191\189'}, -- U+FFFD, EF BF BD
{'zero width joiner', '('.. invisible_defs.zwj .. ')'}, -- U+200D, E2 80 8D; capture because zwj may be allowed
{'zero width space', '\226\128\139'}, -- U+200B, E2 80 8B
{'hair space', '\226\128\138'}, -- U+200A, E2 80 8A
{'soft hyphen', '\194\173'}, -- U+00AD, C2 AD
{'horizontal tab', '\009'}, -- U+0009 (HT), 09
{'line feed', '\010'}, -- U+000A (LF), 0A
{'no-break space', '\194\160'}, -- U+00A0 (NBSP), C2 A0
{'carriage return', '\013'}, -- U+000D (CR), 0D
{'stripmarker', stripmarkers.any}, -- stripmarker; may or may not be an error; capture returns the stripmaker type
{'delete', '('.. invisible_defs.del .. ')'}, -- U+007F (DEL), 7F; must be done after stripmarker test; capture to distinguish isolated del chars not part of stripmarker
{'C0 control', '[\000-\008\011\012\014-\031]'}, -- U+0000–U+001F (NULL–US), 00–1F (except HT, LF, CR (09, 0A, 0D))
{'C1 control', '[\194\128-\194\159]'}, -- U+0080–U+009F (XXX–APC), C2 80 – C2 9F
-- {'Specials', '[\239\191\185-\239\191\191]'}, -- U+FFF9-U+FFFF, EF BF B9 – EF BF BF
-- {'Private use area', '[\238\128\128-\239\163\191]'}, -- U+E000–U+F8FF, EE 80 80 – EF A3 BF
-- {'Supplementary Private Use Area-A', '[\243\176\128\128-\243\191\191\189]'}, -- U+F0000–U+FFFFD, F3 B0 80 80 – F3 BF BF BD
-- {'Supplementary Private Use Area-B', '[\244\128\128\128-\244\143\191\189]'}, -- U+100000–U+10FFFD, F4 80 80 80 – F4 8F BF BD
}
--[[
Indic script makes use of zero width joiner as a character modifier so zwj
characters must be left in. This pattern covers all of the unicode characters
for these languages:
Devanagari 0900–097F – https://unicode.org/charts/PDF/U0900.pdf
Devanagari extended A8E0–A8FF – https://unicode.org/charts/PDF/UA8E0.pdf
Bengali 0980–09FF – https://unicode.org/charts/PDF/U0980.pdf
Gurmukhi 0A00–0A7F – https://unicode.org/charts/PDF/U0A00.pdf
Gujarati 0A80–0AFF – https://unicode.org/charts/PDF/U0A80.pdf
Oriya 0B00–0B7F – https://unicode.org/charts/PDF/U0B00.pdf
Tamil 0B80–0BFF – https://unicode.org/charts/PDF/U0B80.pdf
Telugu 0C00–0C7F – https://unicode.org/charts/PDF/U0C00.pdf
Kannada 0C80–0CFF – https://unicode.org/charts/PDF/U0C80.pdf
Malayalam 0D00–0D7F – https://unicode.org/charts/PDF/U0D00.pdf
plus the not-necessarily Indic scripts for Sinhala and Burmese:
Sinhala 0D80-0DFF - https://unicode.org/charts/PDF/U0D80.pdf
Myanmar 1000-109F - https://unicode.org/charts/PDF/U1000.pdf
Myanmar extended A AA60-AA7F - https://unicode.org/charts/PDF/UAA60.pdf
Myanmar extended B A9E0-A9FF - https://unicode.org/charts/PDF/UA9E0.pdf
the pattern is used by has_invisible_chars() and coins_cleanup()
]]
local indic_script = '[\224\164\128-\224\181\191\224\163\160-\224\183\191\225\128\128-\225\130\159\234\167\160-\234\167\191\234\169\160-\234\169\191]';
-- list of emoji that use a zwj character (U+200D) to combine with another emoji
-- from: https://unicode.org/Public/emoji/15.1/emoji-zwj-sequences.txt; version: 15.1; 2023-06-05
-- table created by: [[:en:Module:Make emoji zwj table]]
local emoji_t = { -- indexes are decimal forms of the hex values in U+xxxx
[8596] = true, -- U+2194 ↔ left right arrow
[8597] = true, -- U+2195 ↕ up down arrow
[9760] = true, -- U+2620 ☠ skull and crossbones
[9792] = true, -- U+2640 ♀ female sign
[9794] = true, -- U+2642 ♂ male sign
[9877] = true, -- U+2695 ⚕ staff of aesculapius
[9878] = true, -- U+2696 ⚖ scales
[9895] = true, -- U+26A7 ⚧ male with stroke and male and female sign
[9992] = true, -- U+2708 ✈ airplane
[10052] = true, -- U+2744 ❄ snowflake
[10084] = true, -- U+2764 ❤ heavy black heart
[10145] = true, -- U+27A1 ➡ black rightwards arrow
[11035] = true, -- U+2B1B ⬛ black large square
[127752] = true, -- U+1F308 🌈 rainbow
[127787] = true, -- U+1F32B 🌫 fog
[127806] = true, -- U+1F33E 🌾 ear of rice
[127859] = true, -- U+1F373 🍳 cooking
[127868] = true, -- U+1F37C 🍼 baby bottle
[127876] = true, -- U+1F384 🎄 christmas tree
[127891] = true, -- U+1F393 🎓 graduation cap
[127908] = true, -- U+1F3A4 🎤 microphone
[127912] = true, -- U+1F3A8 🎨 artist palette
[127979] = true, -- U+1F3EB 🏫 school
[127981] = true, -- U+1F3ED 🏭 factory
[128102] = true, -- U+1F466 👦 boy
[128103] = true, -- U+1F467 👧 girl
[128104] = true, -- U+1F468 👨 man
[128105] = true, -- U+1F469 👩 woman
[128139] = true, -- U+1F48B 💋 kiss mark
[128165] = true, -- U+1F4A5 💥 collision symbol
[128168] = true, -- U+1F4A8 💨 dash symbol
[128171] = true, -- U+1F4AB 💫 dizzy symbol
[128187] = true, -- U+1F4BB 💻 personal computer
[128188] = true, -- U+1F4BC 💼 brief case
[128293] = true, -- U+1F525 🔥 fire
[128295] = true, -- U+1F527 🔧 wrench
[128300] = true, -- U+1F52C 🔬 microscope
[128488] = true, -- U+1F5E8 🗨 left speech bubble
[128640] = true, -- U+1F680 🚀 rocket
[128658] = true, -- U+1F692 🚒 fire engine
[129001] = true, -- U+1F7E9 🟩 large green square
[129003] = true, -- U+1F7EB 🟫 large brown square
[129309] = true, -- U+1F91D 🤝 handshake
[129455] = true, -- U+1F9AF 🦯 probing cane
[129456] = true, -- U+1F9B0 🦰 emoji component red hair
[129457] = true, -- U+1F9B1 🦱 emoji component curly hair
[129458] = true, -- U+1F9B2 🦲 emoji component bald
[129459] = true, -- U+1F9B3 🦳 emoji component white hair
[129466] = true, -- U+1F9BA 🦺 safety vest
[129468] = true, -- U+1F9BC 🦼 motorized wheelchair
[129469] = true, -- U+1F9BD 🦽 manual wheelchair
[129489] = true, -- U+1F9D1 🧑 adult
[129490] = true, -- U+1F9D2 🧒 child
[129657] = true, -- U+1FA79 🩹 adhesive bandage
[129778] = true, -- U+1FAF2 🫲 leftwards hand
}
--[[----------------------< L A N G U A G E S U P P O R T >-------------------
These tables and constants support various language-specific functionality.
]]
--local this_wiki_code = mw.getContentLanguage():getCode(); -- get this wiki's language code
local this_wiki_code = lang_obj:getCode(); -- get this wiki's language code
if string.match (mw.site.server, 'wikidata') then
this_wiki_code = mw.getCurrentFrame():callParserFunction('int', {'lang'}); -- on Wikidata so use interface language setting instead
end
local mw_languages_by_tag_t = mw.language.fetchLanguageNames (this_wiki_code, 'all'); -- get a table of language tag/name pairs known to Wikimedia; used for interwiki tests
local mw_languages_by_name_t = {};
for k, v in pairs (mw_languages_by_tag_t) do -- build a 'reversed' table name/tag language pairs know to MediaWiki; used for |language=
v = mw.ustring.lower (v); -- lowercase for tag fetch; get name's proper case from mw_languages_by_tag_t[<tag>]
if mw_languages_by_name_t[v] then -- when name already in the table
if 2 == #k or 3 == #k then -- if tag does not have subtags
mw_languages_by_name_t[v] = k; -- prefer the shortest tag for this name
end
else -- here when name not in the table
mw_languages_by_name_t[v] = k; -- so add name and matching tag
end
end
local inter_wiki_map = {}; -- map of interwiki prefixes that are language-code prefixes
for k, v in pairs (mw.site.interwikiMap ('local')) do -- spin through the base interwiki map (limited to local)
if mw_languages_by_tag_t[v["prefix"]] then -- if the prefix matches a known language tag
inter_wiki_map[v["prefix"]] = true; -- add it to our local map
end
end
--[[--------------------< S C R I P T _ L A N G _ C O D E S >-------------------
This table is used to hold ISO 639-1 two-character and ISO 639-3 three-character
language codes that apply only to |script-title= and |script-chapter=
]]
local script_lang_codes = {
'ab', 'am', 'ar', 'be', 'bg', 'bn', 'bo', 'bs', 'dv', 'dz', 'el', 'fa', 'gu', 'he',
'hi', 'hy', 'ja', 'ka', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'lo', 'mk', 'ml', 'mn',
'mni', 'mr', 'my', 'ne', 'or', 'ota', 'pa', 'ps', 'ru', 'sd', 'si', 'sr', 'syc', 'ta',
'te', 'tg', 'th', 'ti', 'tt', 'ug', 'uk', 'ur', 'uz', 'yi', 'yue', 'zh'
};
--[[---------------< L A N G U A G E R E M A P P I N G >----------------------
These tables hold language information that is different (correct) from MediaWiki's definitions
For each ['<tag>'] = 'language name' in lang_code_remap{} there must be a matching ['language name'] = {'language name', '<tag>'} in lang_name_remap{}
lang_tag_remap{}:
key is always lowercase ISO 639-1, -2, -3 language tag or a valid lowercase IETF language tag
value is properly spelled and capitalized language name associated with <tag>
only one language name per <tag>;
key/value pair must have matching entry in lang_name_remap{}
lang_name_remap{}:
key is always lowercase language name
value is a table the holds correctly spelled and capitalized language name [1] and associated tag [2] (tag must match a tag key in lang_tag_remap{})
may have multiple keys referring to a common preferred name and tag; For example:
['kolsch'] and ['kölsch'] both refer to 'Kölsch' and 'ksh'
]]
local lang_tag_remap = { -- used for |language= and |script-title= / |script-chapter=
['als'] = 'Tosk Albanian', -- MediaWiki returns Alemannisch
['bh'] = 'Bihari', -- MediaWiki uses 'bh' as a subdomain name for Bhojpuri Wikipedia: bh.wikipedia.org
['bla'] = 'Blackfoot', -- MediaWiki/IANA/ISO 639: Siksika; use en.wiki preferred name
['bn'] = 'Bengali', -- MediaWiki returns Bangla
['ca-valencia'] = 'Valencian', -- IETF variant of Catalan
['fkv'] = 'Kven', -- MediaWiki returns Kvensk
['gsw'] = 'Swiss German',
['ilo'] = 'Ilocano', -- MediaWiki/IANA/ISO 639: Iloko; use en.wiki preferred name
['ksh'] = 'Kölsch', -- MediaWiki: Colognian; use IANA/ISO 639 preferred name
['ksh-x-colog'] = 'Colognian', -- override MediaWiki ksh; no IANA/ISO 639 code for Colognian; IETF private code created at Module:Lang/data
['mis-x-ripuar'] = 'Ripuarian', -- override MediaWiki ksh; no IANA/ISO 639 code for Ripuarian; IETF private code created at Module:Lang/data
['nan-tw'] = 'Taiwanese Hokkien', -- make room for MediaWiki/IANA/ISO 639 nan: Min Nan Chinese and support en.wiki preferred name
['sr-ec'] = 'Serbian (Cyrillic script)', -- MediaWiki returns српски (ћирилица)
['sr-el'] = 'Serbian (Latin script)', -- MediaWiki returns srpski (latinica)
}
local lang_name_remap = { -- used for |language=; names require proper capitalization; tags must be lowercase
['alemannic'] = {'Swiss German', 'gsw'}, -- ISO 639-2, -3 alternate for Swiss German; MediaWiki mediawiki returns Alemannic for gsw; en.wiki preferred name
['alemannisch'] = {'Swiss German', 'gsw'}, -- not an ISO or IANA language name; MediaWiki uses 'als' as a subdomain name for Alemannic Wikipedia: als.wikipedia.org
['bangla'] = {'Bengali', 'bn'}, -- MediaWiki returns Bangla (the endonym) but we want Bengali (the exonym); here we remap
['bengali'] = {'Bengali', 'bn'}, -- MediaWiki doesn't use exonym so here we provide correct language name and 639-1 code
['bhojpuri'] = {'Bhojpuri', 'bho'}, -- MediaWiki uses 'bh' as a subdomain name for Bhojpuri Wikipedia: bh.wikipedia.org
['bihari'] = {'Bihari', 'bh'}, -- MediaWiki replaces 'Bihari' with 'Bhojpuri' so 'Bihari' cannot be found
['blackfoot'] = {'Blackfoot', 'bla'}, -- MediaWiki/IANA/ISO 639: Siksika; use en.wiki preferred name
['colognian'] = {'Colognian', 'ksh-x-colog'}, -- MediaWiki preferred name for ksh
['ilocano'] = {'Ilocano', 'ilo'}, -- MediaWiki/IANA/ISO 639: Iloko; use en.wiki preferred name
['kolsch'] = {'Kölsch', 'ksh'}, -- use IANA/ISO 639 preferred name (use non-diacritical o instead of umlaut ö)
['kölsch'] = {'Kölsch', 'ksh'}, -- use IANA/ISO 639 preferred name
['kven'] = {'Kven', 'fkv'}, -- Unicode CLDR have decided not to support English language name for these two...
['kvensk'] = {'Kven', 'fkv'}, -- ...they say to refer to IANA registry for English names
['ripuarian'] = {'Ripuarian', 'mis-x-ripuar'}, -- group of dialects; no code in MediaWiki or in IANA/ISO 639
['serbian (cyrillic script)'] = {'Serbian (Cyrillic script)', 'sr-cyrl'}, -- special case to get correct tag when |language=sr-ec
['serbian (latin script)'] = {'Serbian (Latin script)', 'sr-latn'}, -- special case to get correct tag when |language=sr-el
['swiss german'] = {'Swiss German', 'gsw'},
['taiwanese hokkien'] = {'Taiwanese Hokkien', 'nan-tw'}, -- make room for MediaWiki/IANA/ISO 639 nan: Min Nan Chinese
['tosk albanian'] = {'Tosk Albanian', 'als'}, -- MediaWiki replaces 'Tosk Albanian' with 'Alemannisch' so 'Tosk Albanian' cannot be found
['valencian'] = {'Valencian', 'ca-valencia'}, -- variant of Catalan; categorizes as Valencian
}
--[[---------------< P R O P E R T I E S _ C A T E G O R I E S >----------------
Properties categories. These are used for investigating qualities of citations.
]]
local prop_cats = {
['foreign-lang-source'] = 'CS1 $1-language sources ($2)', -- |language= categories; $1 is foreign-language name, $2 is ISO639-1 code
['foreign-lang-source-2'] = 'CS1 foreign language sources (ISO 639-2)|$1', -- |language= category; a cat for ISO639-2 languages; $1 is the ISO 639-2 code used as a sort key
['jul-greg-uncertainty'] = 'CS1: Julian–Gregorian uncertainty', -- probably temporary cat to identify scope of template with dates 1 October 1582 – 1 January 1926
['local-lang-source'] = 'CS1 $1-language sources ($2)', -- |language= categories; $1 is local-language name, $2 is ISO639-1 code; not emitted when local_lang_cat_enable is false
['location-test'] = 'CS1 location test',
['long-vol'] = 'CS1: long volume value', -- probably temporary cat to identify scope of |volume= values longer than 4 characters
['script'] = 'CS1 uses $1-language script ($2)', -- |script-title=xx: has matching category; $1 is language name, $2 is ISO639-1 code
['tracked-param'] = 'CS1 tracked parameter: $1', -- $1 is base (enumerators removed) parameter name
['year-range-abbreviated'] = 'CS1: abbreviated year range', -- probably temporary cat to identify scope of |date=, |year= values using YYYY–YY form
}
--[[-------------------< T I T L E _ T Y P E S >--------------------------------
Here we map a template's CitationClass to TitleType (default values for |type= parameter)
]]
local title_types = {
['AV-media-notes'] = 'Media notes',
['document'] = 'Document',
['interview'] = 'Interview',
['mailinglist'] = 'Mailing list',
['map'] = 'Map',
['podcast'] = 'Podcast',
['pressrelease'] = 'Press release',
['report'] = 'Report',
['speech'] = 'Speech',
['techreport'] = 'Technical report',
['thesis'] = 'Thesis',
}
--[[--------------------------< B U I L D _ K N O W N _ F R E E _ D O I _ R E G I S T R A N T S _ T A B L E >--
build a table of doi registrants known to be free-to-read In a doi, the registrant ID is the series of digits
between the '10.' and the first '/': in doi 10.1100/sommat, 1100 is the registrant ID
]]
local function build_free_doi_registrants_table()
local registrants_t = {};
for _, v in ipairs ({
'1100', '1155', '1186', '1371', '1629', '1989', '1999', '2147', '2196', '3285', '3389', '3390', '3410',
'3748', '3814', '3847', '3897', '4061', '4089', '4103', '4172', '4175', '4236', '4239', '4240', '4251',
'4252', '4253', '4254', '4291', '4292', '4329', '4330', '4331', '5194', '5306', '5312', '5313', '5314',
'5315', '5316', '5317', '5318', '5319', '5320', '5321', '5334', '5402', '5409', '5410', '5411', '5412',
'5492', '5493', '5494', '5495', '5496', '5497', '5498', '5499', '5500', '5501', '5527', '5528', '5662',
'6064', '6219', '7167', '7217', '7287', '7482', '7490', '7554', '7717', '7766', '11131', '11569', '11647',
'11648', '12688', '12703', '12715', '12998', '13105', '14293', '14303', '15215', '15412', '15560', '16995',
'17645', '19080', '19173', '20944', '21037', '21468', '21767', '22261', '22459', '24105', '24196', '24966',
'26775', '30845', '32545', '35711', '35712', '35713', '35995', '36648', '37126', '37532', '37871', '47128',
'47622', '47959', '52437', '52975', '53288', '54081', '54947', '55667', '55914', '57009', '58647', '59081',
}) do
registrants_t[v] = true; -- build a k/v table of known free-to-read doi registrants
end
return registrants_t;
end
--[[===================<< E R R O R M E S S A G I N G >>======================
]]
--[[----------< E R R O R M E S S A G E S U P P L I M E N T S >-------------
I18N for those messages that are supplemented with additional specific text that
describes the reason for the error
TODO: merge this with special_case_translations{}?
]]
local err_msg_supl = {
['char'] = 'invalid character', -- |isbn=, |sbn=
['check'] = 'checksum', -- |isbn=, |sbn=
['flag'] = 'flag', -- |archive-url=
['form'] = 'invalid form', -- |isbn=, |sbn=
['group'] = 'invalid group id', -- |isbn=
['initials'] = 'initials', -- Vancouver
['invalid language code'] = 'invalid language code', -- |script-<param>=
['journal'] = 'journal', -- |bibcode=
['length'] = 'length', -- |isbn=, |bibcode=, |sbn=
['liveweb'] = 'liveweb', -- |archive-url=
['missing comma'] = 'missing comma', -- Vancouver
['missing prefix'] = 'missing prefix', -- |script-<param>=
['missing title part'] = 'missing title part', -- |script-<param>=
['name'] = 'name', -- Vancouver
['non-Latin char'] = 'non-Latin character', -- Vancouver
['path'] = 'path', -- |archive-url=
['prefix'] = 'invalid prefix', -- |isbn=
['punctuation'] = 'punctuation', -- Vancouver
['save'] = 'save command', -- |archive-url=
['suffix'] = 'suffix', -- Vancouver
['timestamp'] = 'timestamp', -- |archive-url=
['unknown language code'] = 'unknown language code', -- |script-<param>=
['value'] = 'value', -- |bibcode=
['year'] = 'year', -- |bibcode=
}
--[[--------------< E R R O R _ C O N D I T I O N S >---------------------------
Error condition table. This table has two sections: errors at the top, maintenance
at the bottom. Maint 'messaging' does not have a 'message' (message=nil)
The following contains a list of IDs for various error conditions defined in the
code. For each ID, we specify a text message to display, an error category to
include, and whether the error message should be wrapped as a hidden comment.
Anchor changes require identical changes to matching anchor in Help:CS1 errors
TODO: rename error_conditions{} to something more generic; create separate error
and maint tables inside that?
]]
local error_conditions = {
err_accessdate_missing_url = {
message = '<code class="cs1-code">|access-date=</code> requires <code class="cs1-code">|url=</code>',
anchor = 'accessdate_missing_url',
category = 'CS1 errors: access-date without URL',
hidden = false
},
err_apostrophe_markup = {
message = 'Italic or bold markup not allowed in: <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'apostrophe_markup',
category = 'CS1 errors: markup',
hidden = false
},
err_archive_date_missing_url = {
message = '<code class="cs1-code">|archive-date=</code> requires <code class="cs1-code">|archive-url=</code>',
anchor = 'archive_date_missing_url',
category = 'CS1 errors: archive-url',
hidden = false
},
err_archive_date_url_ts_mismatch = {
message = '<code class="cs1-code">|archive-date=</code> / <code class="cs1-code">|archive-url=</code> timestamp mismatch; $1 suggested',
anchor = 'archive_date_url_ts_mismatch',
category = 'CS1 errors: archive-url',
hidden = false
},
err_archive_missing_date = {
message = '<code class="cs1-code">|archive-url=</code> requires <code class="cs1-code">|archive-date=</code>',
anchor = 'archive_missing_date',
category = 'CS1 errors: archive-url',
hidden = false
},
err_archive_missing_url = {
message = '<code class="cs1-code">|archive-url=</code> requires <code class="cs1-code">|url=</code>',
anchor = 'archive_missing_url',
category = 'CS1 errors: archive-url',
hidden = false
},
err_archive_url = {
message = '<code class="cs1-code">|archive-url=</code> is malformed: $1', -- $1 is error message detail
anchor = 'archive_url',
category = 'CS1 errors: archive-url',
hidden = false
},
err_arxiv_missing = {
message = '<code class="cs1-code">|arxiv=</code> required',
anchor = 'arxiv_missing',
category = 'CS1 errors: arXiv', -- same as bad arxiv
hidden = false
},
err_asintld_missing_asin = {
message = '<code class="cs1-code">|$1=</code> requires <code class="cs1-code">|asin=</code>', -- $1 is parameter name
anchor = 'asintld_missing_asin',
category = 'CS1 errors: ASIN TLD',
hidden = false
},
err_bad_arxiv = {
message = 'Check <code class="cs1-code">|arxiv=</code> value',
anchor = 'bad_arxiv',
category = 'CS1 errors: arXiv',
hidden = false
},
err_bad_asin = {
message = 'Check <code class="cs1-code">|asin=</code> value',
anchor = 'bad_asin',
category ='CS1 errors: ASIN',
hidden = false
},
err_bad_asin_tld = {
message = 'Check <code class="cs1-code">|asin-tld=</code> value',
anchor = 'bad_asin_tld',
category ='CS1 errors: ASIN TLD',
hidden = false
},
err_bad_bibcode = {
message = 'Check <code class="cs1-code">|bibcode=</code> $1', -- $1 is error message detail
anchor = 'bad_bibcode',
category = 'CS1 errors: bibcode',
hidden = false
},
err_bad_biorxiv = {
message = 'Check <code class="cs1-code">|biorxiv=</code> value',
anchor = 'bad_biorxiv',
category = 'CS1 errors: bioRxiv',
hidden = false
},
err_bad_citeseerx = {
message = 'Check <code class="cs1-code">|citeseerx=</code> value',
anchor = 'bad_citeseerx',
category = 'CS1 errors: citeseerx',
hidden = false
},
err_bad_date = {
message = 'Check date values in: $1', -- $1 is a parameter name list
anchor = 'bad_date',
category = 'CS1 errors: dates',
hidden = false
},
err_bad_doi = {
message = 'Check <code class="cs1-code">|doi=</code> value',
anchor = 'bad_doi',
category = 'CS1 errors: DOI',
hidden = false
},
err_bad_hdl = {
message = 'Check <code class="cs1-code">|hdl=</code> value',
anchor = 'bad_hdl',
category = 'CS1 errors: HDL',
hidden = false
},
err_bad_isbn = {
message = 'Check <code class="cs1-code">|isbn=</code> value: $1', -- $1 is error message detail
anchor = 'bad_isbn',
category = 'CS1 errors: ISBN',
hidden = false
},
err_bad_ismn = {
message = 'Check <code class="cs1-code">|ismn=</code> value',
anchor = 'bad_ismn',
category = 'CS1 errors: ISMN',
hidden = false
},
err_bad_issn = {
message = 'Check <code class="cs1-code">|$1issn=</code> value', -- $1 is 'e' or '' for eissn or issn
anchor = 'bad_issn',
category = 'CS1 errors: ISSN',
hidden = false
},
err_bad_jfm = {
message = 'Check <code class="cs1-code">|jfm=</code> value',
anchor = 'bad_jfm',
category = 'CS1 errors: JFM',
hidden = false
},
err_bad_jstor = {
message = 'Check <code class="cs1-code">|jstor=</code> value',
anchor = 'bad_jstor',
category = 'CS1 errors: JSTOR',
hidden = false
},
err_bad_lccn = {
message = 'Check <code class="cs1-code">|lccn=</code> value',
anchor = 'bad_lccn',
category = 'CS1 errors: LCCN',
hidden = false
},
err_bad_medrxiv = {
message = 'Check <code class="cs1-code">|medrxiv=</code> value',
anchor = 'bad_medrxiv',
category = 'CS1 errors: medRxiv',
hidden = false
},
err_bad_mr = {
message = 'Check <code class="cs1-code">|mr=</code> value',
anchor = 'bad_mr',
category = 'CS1 errors: MR',
hidden = false
},
err_bad_oclc = {
message = 'Check <code class="cs1-code">|oclc=</code> value',
anchor = 'bad_oclc',
category = 'CS1 errors: OCLC',
hidden = false
},
err_bad_ol = {
message = 'Check <code class="cs1-code">|ol=</code> value',
anchor = 'bad_ol',
category = 'CS1 errors: OL',
hidden = false
},
err_bad_osti = {
message = 'Check <code class="cs1-code">|osti=</code> value',
anchor = 'bad_osti',
category = 'CS1 errors: OSTI',
hidden = false
},
err_bad_paramlink = { -- for |title-link=, |author/editor/translator-link=, |series-link=, |episode-link=
message = 'Check <code class="cs1-code">|$1=</code> value', -- $1 is parameter name
anchor = 'bad_paramlink',
category = 'CS1 errors: parameter link',
hidden = false
},
err_bad_pmc = {
message = 'Check <code class="cs1-code">|pmc=</code> value',
anchor = 'bad_pmc',
category = 'CS1 errors: PMC',
hidden = false
},
err_bad_pmid = {
message = 'Check <code class="cs1-code">|pmid=</code> value',
anchor = 'bad_pmid',
category = 'CS1 errors: PMID',
hidden = false
},
err_bad_rfc = {
message = 'Check <code class="cs1-code">|rfc=</code> value',
anchor = 'bad_rfc',
category = 'CS1 errors: RFC',
hidden = false
},
err_bad_s2cid = {
message = 'Check <code class="cs1-code">|s2cid=</code> value',
anchor = 'bad_s2cid',
category = 'CS1 errors: S2CID',
hidden = false
},
err_bad_sbn = {
message = 'Check <code class="cs1-code">|sbn=</code> value: $1', -- $1 is error message detail
anchor = 'bad_sbn',
category = 'CS1 errors: SBN',
hidden = false
},
err_bad_ssrn = {
message = 'Check <code class="cs1-code">|ssrn=</code> value',
anchor = 'bad_ssrn',
category = 'CS1 errors: SSRN',
hidden = false
},
err_bad_url = {
message = 'Check $1 value', -- $1 is parameter name
anchor = 'bad_url',
category = 'CS1 errors: URL',
hidden = false
},
err_bad_usenet_id = {
message = 'Check <code class="cs1-code">|message-id=</code> value',
anchor = 'bad_message_id',
category = 'CS1 errors: message-id',
hidden = false
},
err_bad_zbl = {
message = 'Check <code class="cs1-code">|zbl=</code> value',
anchor = 'bad_zbl',
category = 'CS1 errors: Zbl',
hidden = false
},
err_bare_url_missing_title = {
message = '$1 missing title', -- $1 is parameter name
anchor = 'bare_url_missing_title',
category = 'CS1 errors: bare URL',
hidden = false
},
err_biorxiv_missing = {
message = '<code class="cs1-code">|biorxiv=</code> required',
anchor = 'biorxiv_missing',
category = 'CS1 errors: bioRxiv', -- same as bad bioRxiv
hidden = false
},
err_chapter_ignored = {
message = '<code class="cs1-code">|$1=</code> ignored', -- $1 is parameter name
anchor = 'chapter_ignored',
category = 'CS1 errors: chapter ignored',
hidden = false
},
err_citation_missing_title = {
message = 'Missing or empty <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'citation_missing_title',
category = 'CS1 errors: missing title',
hidden = false
},
err_citeseerx_missing = {
message = '<code class="cs1-code">|citeseerx=</code> required',
anchor = 'citeseerx_missing',
category = 'CS1 errors: citeseerx', -- same as bad citeseerx
hidden = false
},
err_cite_web_url = { -- this error applies to cite web and to cite podcast
message = 'Missing or empty <code class="cs1-code">|url=</code>',
anchor = 'cite_web_url',
category = 'CS1 errors: requires URL',
hidden = false
},
err_class_ignored = {
message = '<code class="cs1-code">|class=</code> ignored',
anchor = 'class_ignored',
category = 'CS1 errors: class',
hidden = false
},
err_contributor_ignored = {
message = '<code class="cs1-code">|contributor=</code> ignored',
anchor = 'contributor_ignored',
category = 'CS1 errors: contributor',
hidden = false
},
err_contributor_missing_required_param = {
message = '<code class="cs1-code">|contributor=</code> requires <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'contributor_missing_required_param',
category = 'CS1 errors: contributor',
hidden = false
},
err_deprecated_params = {
message = 'Cite uses deprecated parameter <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'deprecated_params',
category = 'CS1 errors: deprecated parameters',
hidden = false
},
err_disp_name = {
message = 'Invalid <code class="cs1-code">|$1=$2</code>', -- $1 is parameter name; $2 is the assigned value
anchor = 'disp_name',
category = 'CS1 errors: display-names',
hidden = false,
},
err_doibroken_missing_doi = {
message = '<code class="cs1-code">|$1=</code> requires <code class="cs1-code">|doi=</code>', -- $1 is parameter name
anchor = 'doibroken_missing_doi',
category = 'CS1 errors: DOI',
hidden = false
},
err_embargo_missing_pmc = {
message = '<code class="cs1-code">|$1=</code> requires <code class="cs1-code">|pmc=</code>', -- $1 is parameter name
anchor = 'embargo_missing_pmc',
category = 'CS1 errors: PMC embargo',
hidden = false
},
err_empty_citation = {
message = 'Empty citation',
anchor = 'empty_citation',
category = 'CS1 errors: empty citation',
hidden = false
},
err_etal = {
message = 'Explicit use of et al. in: <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'explicit_et_al',
category = 'CS1 errors: explicit use of et al.',
hidden = false
},
err_extra_text_edition = {
message = '<code class="cs1-code">|edition=</code> has extra text',
anchor = 'extra_text_edition',
category = 'CS1 errors: extra text: edition',
hidden = false,
},
err_extra_text_issue = {
message = '<code class="cs1-code">|$1=</code> has extra text', -- $1 is parameter name
anchor = 'extra_text_issue',
category = 'CS1 errors: extra text: issue',
hidden = false,
},
err_extra_text_pages = {
message = '<code class="cs1-code">|$1=</code> has extra text', -- $1 is parameter name
anchor = 'extra_text_pages',
category = 'CS1 errors: extra text: pages',
hidden = false,
},
err_extra_text_volume = {
message = '<code class="cs1-code">|$1=</code> has extra text', -- $1 is parameter name
anchor = 'extra_text_volume',
category = 'CS1 errors: extra text: volume',
hidden = false,
},
err_first_missing_last = {
message = '<code class="cs1-code">|$1=</code> missing <code class="cs1-code">|$2=</code>', -- $1 is first alias, $2 is matching last alias
anchor = 'first_missing_last',
category = 'CS1 errors: missing name', -- author, contributor, editor, interviewer, translator
hidden = false
},
err_format_missing_url = {
message = '<code class="cs1-code">|$1=</code> requires <code class="cs1-code">|$2=</code>', -- $1 is format parameter $2 is url parameter
anchor = 'format_missing_url',
category = 'CS1 errors: format without URL',
hidden = false
},
err_generic_name = {
message = '<code class="cs1-code">|$1=</code> has generic name', -- $1 is parameter name
anchor = 'generic_name',
category = 'CS1 errors: generic name',
hidden = false,
},
err_generic_title = {
message = 'Cite uses generic title',
anchor = 'generic_title',
category = 'CS1 errors: generic title',
hidden = false,
},
err_invalid_param_val = {
message = 'Invalid <code class="cs1-code">|$1=$2</code>', -- $1 is parameter name $2 is parameter value
anchor = 'invalid_param_val',
category = 'CS1 errors: invalid parameter value',
hidden = false
},
err_invisible_char = {
message = '$1 in $2 at position $3', -- $1 is invisible char $2 is parameter name $3 is position number
anchor = 'invisible_char',
category = 'CS1 errors: invisible characters',
hidden = false
},
err_medrxiv_missing = {
message = '<code class="cs1-code">|medrxiv=</code> required',
anchor = 'medrxiv_missing',
category = 'CS1 errors: medRxiv', -- same as bad medRxiv
hidden = false
},
err_missing_name = {
message = 'Missing <code class="cs1-code">|$1$2=</code>', -- $1 is modified NameList; $2 is enumerator
anchor = 'missing_name',
category = 'CS1 errors: missing name', -- author, contributor, editor, interviewer, translator
hidden = false
},
err_missing_periodical = {
message = 'Cite $1 requires <code class="cs1-code">|$2=</code>', -- $1 is cs1 template name; $2 is canonical periodical parameter name for cite $1
anchor = 'missing_periodical',
category = 'CS1 errors: missing periodical',
hidden = false
},
err_missing_pipe = {
message = 'Missing pipe in: <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'missing_pipe',
category = 'CS1 errors: missing pipe',
hidden = false
},
err_missing_publisher = {
message = 'Cite $1 requires <code class="cs1-code">|$2=</code>', -- $1 is cs1 template name; $2 is canonical publisher parameter name for cite $1
anchor = 'missing_publisher',
category = 'CS1 errors: missing publisher',
hidden = false
},
err_numeric_names = {
message = '<code class="cs1-code">|$1=</code> has numeric name', -- $1 is parameter name',
anchor = 'numeric_names',
category = 'CS1 errors: numeric name',
hidden = false,
},
err_param_access_requires_param = {
message = '<code class="cs1-code">|$1-access=</code> requires <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'param_access_requires_param',
category = 'CS1 errors: param-access',
hidden = false
},
err_param_has_ext_link = {
message = 'External link in <code class="cs1-code">$1</code>', -- $1 is parameter name
anchor = 'param_has_ext_link',
category = 'CS1 errors: external links',
hidden = false
},
err_parameter_ignored = {
message = 'Unknown parameter <code class="cs1-code">|$1=</code> ignored', -- $1 is parameter name
anchor = 'parameter_ignored',
category = 'CS1 errors: unsupported parameter',
hidden = false
},
err_parameter_ignored_suggest = {
message = 'Unknown parameter <code class="cs1-code">|$1=</code> ignored (<code class="cs1-code">|$2=</code> suggested)', -- $1 is unknown parameter $2 is suggested parameter name
anchor = 'parameter_ignored_suggest',
category = 'CS1 errors: unsupported parameter',
hidden = false
},
err_periodical_ignored = {
message = '<code class="cs1-code">|$1=</code> ignored', -- $1 is parameter name
anchor = 'periodical_ignored',
category = 'CS1 errors: periodical ignored',
hidden = false
},
err_redundant_parameters = {
message = 'More than one of $1 specified', -- $1 is error message detail
anchor = 'redundant_parameters',
category = 'CS1 errors: redundant parameter',
hidden = false
},
err_script_parameter = {
message = 'Invalid <code class="cs1-code">|$1=</code>: $2', -- $1 is parameter name $2 is script language code or error detail
anchor = 'script_parameter',
category = 'CS1 errors: script parameters',
hidden = false
},
err_ssrn_missing = {
message = '<code class="cs1-code">|ssrn=</code> required',
anchor = 'ssrn_missing',
category = 'CS1 errors: SSRN',
hidden = false
},
err_text_ignored = {
message = 'Text "$1" ignored', -- $1 is ignored text
anchor = 'text_ignored',
category = 'CS1 errors: unrecognized parameter',
hidden = false
},
err_trans_missing_title = {
message = '<code class="cs1-code">|trans-$1=</code> requires <code class="cs1-code">|$1=</code> or <code class="cs1-code">|script-$1=</code>', -- $1 is base parameter name
anchor = 'trans_missing_title',
category = 'CS1 errors: translated title',
hidden = false
},
err_param_unknown_empty = {
message = 'Cite has empty unknown parameter$1: $2', -- $1 is 's' or empty space; $2 is emty unknown param list
anchor = 'param_unknown_empty',
category = 'CS1 errors: empty unknown parameters',
hidden = false
},
err_vancouver = {
message = 'Vancouver style error: $1 in name $2', -- $1 is error detail, $2 is the nth name
anchor = 'vancouver',
category = 'CS1 errors: Vancouver style',
hidden = false
},
err_wikilink_in_url = {
message = 'URL–wikilink conflict', -- uses ndash
anchor = 'wikilink_in_url',
category = 'CS1 errors: URL–wikilink conflict', -- uses ndash
hidden = false
},
--[[--------------------------< M A I N T >-------------------------------------
maint messages do not have a message (message = nil); otherwise the structure
is the same as error messages
]]
maint_archived_copy = {
message = nil,
anchor = 'archived_copy',
category = 'CS1 maint: archived copy as title',
hidden = true,
},
maint_bibcode = {
message = nil,
anchor = 'bibcode',
category = 'CS1 maint: bibcode',
hidden = true,
},
maint_location_no_publisher = { -- cite book, conference, encyclopedia; citation as book cite or encyclopedia cite
message = nil,
anchor = 'location_no_publisher',
category = 'CS1 maint: location missing publisher',
hidden = true,
},
maint_bot_unknown = {
message = nil,
anchor = 'bot:_unknown',
category = 'CS1 maint: bot: original URL status unknown',
hidden = true,
},
maint_date_auto_xlated = { -- date auto-translation not supported by en.wiki
message = nil,
anchor = 'date_auto_xlated',
category = 'CS1 maint: date auto-translated',
hidden = true,
},
maint_date_format = {
message = nil,
anchor = 'date_format',
category = 'CS1 maint: date format',
hidden = true,
},
maint_date_year = {
message = nil,
anchor = 'date_year',
category = 'CS1 maint: date and year',
hidden = true,
},
maint_doi_ignore = {
message = nil,
anchor = 'doi_ignore',
category = 'CS1 maint: ignored DOI errors',
hidden = true,
},
maint_doi_inactive = {
message = nil,
anchor = 'doi_inactive',
category = 'CS1 maint: DOI inactive',
hidden = true,
},
maint_doi_inactive_dated = {
message = nil,
anchor = 'doi_inactive_dated',
category = 'CS1 maint: DOI inactive as of $2$3$1', -- $1 is year, $2 is month-name or empty string, $3 is space or empty string
hidden = true,
},
maint_doi_unflagged_free = {
message = nil,
anchor = 'doi_unflagged_free',
category = 'CS1 maint: unflagged free DOI',
hidden = true,
},
maint_extra_punct = {
message = nil,
anchor = 'extra_punct',
category = 'CS1 maint: extra punctuation',
hidden = true,
},
maint_isbn_ignore = {
message = nil,
anchor = 'ignore_isbn_err',
category = 'CS1 maint: ignored ISBN errors',
hidden = true,
},
maint_issn_ignore = {
message = nil,
anchor = 'ignore_issn',
category = 'CS1 maint: ignored ISSN errors',
hidden = true,
},
maint_jfm_format = {
message = nil,
anchor = 'jfm_format',
category = 'CS1 maint: JFM format',
hidden = true,
},
maint_location = {
message = nil,
anchor = 'location',
category = 'CS1 maint: location',
hidden = true,
},
maint_mr_format = {
message = nil,
anchor = 'mr_format',
category = 'CS1 maint: MR format',
hidden = true,
},
maint_mult_names = {
message = nil,
anchor = 'mult_names',
category = 'CS1 maint: multiple names: $1', -- $1 is '<name>s list'; gets value from special_case_translation table
hidden = true,
},
maint_numeric_names = {
message = nil,
anchor = 'numeric_names',
category = 'CS1 maint: numeric names: $1', -- $1 is '<name>s list'; gets value from special_case_translation table
hidden = true,
},
maint_others = {
message = nil,
anchor = 'others',
category = 'CS1 maint: others',
hidden = true,
},
maint_others_avm = {
message = nil,
anchor = 'others_avm',
category = 'CS1 maint: others in cite AV media (notes)',
hidden = true,
},
maint_overridden_setting = {
message = nil,
anchor = 'overridden',
category = 'CS1 maint: overridden setting',
hidden = true,
},
maint_pmc_embargo = {
message = nil,
anchor = 'embargo',
category = 'CS1 maint: PMC embargo expired',
hidden = true,
},
maint_pmc_format = {
message = nil,
anchor = 'pmc_format',
category = 'CS1 maint: PMC format',
hidden = true,
},
maint_postscript = {
message = nil,
anchor = 'postscript',
category = 'CS1 maint: postscript',
hidden = true,
},
maint_ref_duplicates_default = {
message = nil,
anchor = 'ref_default',
category = 'CS1 maint: ref duplicates default',
hidden = true,
},
maint_unfit = {
message = nil,
anchor = 'unfit',
category = 'CS1 maint: unfit URL',
hidden = true,
},
maint_unknown_lang = {
message = nil,
anchor = 'unknown_lang',
category = 'CS1 maint: unrecognized language',
hidden = true,
},
maint_untitled = {
message = nil,
anchor = 'untitled',
category = 'CS1 maint: untitled periodical',
hidden = true,
},
maint_url_status = {
message = nil,
anchor = 'url_status',
category = 'CS1 maint: url-status',
hidden = true,
},
maint_zbl = {
message = nil,
anchor = 'zbl',
category = 'CS1 maint: Zbl',
hidden = true,
},
}
--[[--------------------------< I D _ H A N D L E R S >--------------------------------------------------------
The following contains a list of values for various defined identifiers. For each
identifier we specify a variety of information necessary to properly render the
identifier in the citation.
parameters: a list of parameter aliases for this identifier; first in the list is the canonical form
link: Wikipedia article name
redirect: a local redirect to a local Wikipedia article name; at en.wiki, 'ISBN (identifier)' is a redirect to 'International Standard Book Number'
q: Wikidata q number for the identifier
label: the label preceding the identifier; label is linked to a Wikipedia article (in this order):
redirect from id_handlers['<id>'].redirect when use_identifier_redirects is true
Wikidata-supplied article name for the local wiki from id_handlers['<id>'].q
local article name from id_handlers['<id>'].link
prefix: the first part of a URL that will be concatenated with a second part which usually contains the identifier
suffix: optional third part to be added after the identifier
encode: true if URI should be percent-encoded; otherwise false
COinS: identifier link or keyword for use in COinS:
for identifiers registered at info-uri.info use: info:.... where '...' is the appropriate identifier label
for identifiers that have COinS keywords, use the keyword: rft.isbn, rft.issn, rft.eissn
for |asin= and |ol=, which require assembly, use the keyword: url
for others make a URL using the value in prefix/suffix and #label, use the keyword: pre (not checked; any text other than 'info', 'rft', or 'url' works here)
set to nil to leave the identifier out of the COinS
separator: character or text between label and the identifier in the rendered citation
id_limit: for those identifiers with established limits, this property holds the upper limit
access: use this parameter to set the access level for all instances of this identifier.
the value must be a valid access level for an identifier (see ['id-access'] in this file).
custom_access: to enable custom access level for an identifier, set this parameter
to the parameter that should control it (normally 'id-access')
]]
local id_handlers = {
['ARXIV'] = {
parameters = {'arxiv', 'eprint'},
link = 'arXiv',
redirect = 'arXiv (identifier)',
q = 'Q118398',
label = 'arXiv',
prefix = 'https://arxiv.org/abs/',
encode = false,
COinS = 'info:arxiv',
separator = ':',
access = 'free', -- free to read
},
['ASIN'] = {
parameters = { 'asin', 'ASIN' },
link = 'Amazon Standard Identification Number',
redirect = 'ASIN (identifier)',
q = 'Q1753278',
label = 'ASIN',
prefix = 'https://www.amazon.',
COinS = 'url',
separator = ' ',
encode = false;
},
['BIBCODE'] = {
parameters = {'bibcode'},
link = 'Bibcode',
redirect = 'Bibcode (identifier)',
q = 'Q25754',
label = 'Bibcode',
prefix = 'https://ui.adsabs.harvard.edu/abs/',
encode = false,
COinS = 'info:bibcode',
separator = ':',
custom_access = 'bibcode-access',
},
['BIORXIV'] = {
parameters = {'biorxiv'},
link = 'bioRxiv',
redirect = 'bioRxiv (identifier)',
q = 'Q19835482',
label = 'bioRxiv',
prefix = 'https://doi.org/',
COinS = 'pre', -- use prefix value
access = 'free', -- free to read
encode = true,
separator = ' ',
},
['CITESEERX'] = {
parameters = {'citeseerx'},
link = 'CiteSeerX',
redirect = 'CiteSeerX (identifier)',
q = 'Q2715061',
label = 'CiteSeerX',
prefix = 'https://citeseerx.ist.psu.edu/viewdoc/summary?doi=',
COinS = 'pre', -- use prefix value
access = 'free', -- free to read
encode = true,
separator = ' ',
},
['DOI'] = { -- Used by InternetArchiveBot
parameters = { 'doi', 'DOI'},
link = 'Digital object identifier',
redirect = 'doi (identifier)',
q = 'Q25670',
label = 'doi',
prefix = 'https://doi.org/',
COinS = 'info:doi',
separator = ':',
encode = true,
custom_access = 'doi-access',
},
['EISSN'] = {
parameters = {'eissn', 'EISSN'},
link = 'International Standard Serial Number#Electronic ISSN',
redirect = 'eISSN (identifier)',
q = 'Q46339674',
label = 'eISSN',
prefix = 'https://www.worldcat.org/issn/',
COinS = 'rft.eissn',
encode = false,
separator = ' ',
},
['HDL'] = {
parameters = { 'hdl', 'HDL' },
link = 'Handle System',
redirect = 'hdl (identifier)',
q = 'Q3126718',
label = 'hdl',
prefix = 'https://hdl.handle.net/',
COinS = 'info:hdl',
separator = ':',
encode = true,
custom_access = 'hdl-access',
},
['ISBN'] = { -- Used by InternetArchiveBot
parameters = {'isbn', 'ISBN'},
link = 'International Standard Book Number',
redirect = 'ISBN (identifier)',
q = 'Q33057',
label = 'ISBN',
prefix = 'Special:BookSources/',
COinS = 'rft.isbn',
separator = ' ',
},
['ISMN'] = {
parameters = {'ismn', 'ISMN'},
link = 'International Standard Music Number',
redirect = 'ISMN (identifier)',
q = 'Q1666938',
label = 'ISMN',
prefix = '', -- not currently used;
COinS = nil, -- nil because we can't use pre or rft or info:
separator = ' ',
},
['ISSN'] = {
parameters = {'issn', 'ISSN'},
link = 'International Standard Serial Number',
redirect = 'ISSN (identifier)',
q = 'Q131276',
label = 'ISSN',
prefix = 'https://www.worldcat.org/issn/',
COinS = 'rft.issn',
encode = false,
separator = ' ',
},
['JFM'] = {
parameters = {'jfm', 'JFM'},
link = 'Jahrbuch über die Fortschritte der Mathematik',
redirect = 'JFM (identifier)',
q = '',
label = 'JFM',
prefix = 'https://zbmath.org/?format=complete&q=an:',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
},
['JSTOR'] = {
parameters = {'jstor', 'JSTOR'},
link = 'JSTOR',
redirect = 'JSTOR (identifier)',
q = 'Q1420342',
label = 'JSTOR',
prefix = 'https://www.jstor.org/stable/',
COinS = 'pre', -- use prefix value
encode = false,
separator = ' ',
custom_access = 'jstor-access',
},
['LCCN'] = {
parameters = {'lccn', 'LCCN'},
link = 'Library of Congress Control Number',
redirect = 'LCCN (identifier)',
q = 'Q620946',
label = 'LCCN',
prefix = 'https://lccn.loc.gov/',
COinS = 'info:lccn',
encode = false,
separator = ' ',
},
['MEDRXIV'] = {
parameters = {'medrxiv'},
link = 'medRxiv',
redirect = 'medRxiv (identifier)',
q = 'Q58465838',
label = 'medRxiv',
prefix = 'https://www.medrxiv.org/content/',
COinS = 'pre', -- use prefix value
access = 'free', -- free to read
encode = false,
separator = ' ',
},
['MR'] = {
parameters = {'mr', 'MR'},
link = 'Mathematical Reviews',
redirect = 'MR (identifier)',
q = 'Q211172',
label = 'MR',
prefix = 'https://mathscinet.ams.org/mathscinet-getitem?mr=',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
},
['OCLC'] = {
parameters = {'oclc', 'OCLC'},
link = 'OCLC',
redirect = 'OCLC (identifier)',
q = 'Q190593',
label = 'OCLC',
prefix = 'https://www.worldcat.org/oclc/',
COinS = 'info:oclcnum',
encode = true,
separator = ' ',
id_limit = 10100000000,
},
['OL'] = {
parameters = { 'ol', 'OL' },
link = 'Open Library',
redirect = 'OL (identifier)',
q = 'Q1201876',
label = 'OL',
prefix = 'https://openlibrary.org/',
COinS = 'url',
separator = ' ',
encode = true,
custom_access = 'ol-access',
},
['OSTI'] = {
parameters = {'osti', 'OSTI'},
link = 'Office of Scientific and Technical Information',
redirect = 'OSTI (identifier)',
q = 'Q2015776',
label = 'OSTI',
prefix = 'https://www.osti.gov/biblio/',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
id_limit = 23010000,
custom_access = 'osti-access',
},
['PMC'] = {
parameters = {'pmc', 'PMC'},
link = 'PubMed Central',
redirect = 'PMC (identifier)',
q = 'Q229883',
label = 'PMC',
prefix = 'https://www.ncbi.nlm.nih.gov/pmc/articles/PMC',
suffix = '',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
id_limit = 10900000,
access = 'free', -- free to read
},
['PMID'] = {
parameters = {'pmid', 'PMID'},
link = 'PubMed Identifier',
redirect = 'PMID (identifier)',
q = 'Q2082879',
label = 'PMID',
prefix = 'https://pubmed.ncbi.nlm.nih.gov/',
COinS = 'info:pmid',
encode = false,
separator = ' ',
id_limit = 38400000,
},
['RFC'] = {
parameters = {'rfc', 'RFC'},
link = 'Request for Comments',
redirect = 'RFC (identifier)',
q = 'Q212971',
label = 'RFC',
prefix = 'https://tools.ietf.org/html/rfc',
COinS = 'pre', -- use prefix value
encode = false,
separator = ' ',
id_limit = 9300,
access = 'free', -- free to read
},
['SBN'] = {
parameters = {'sbn', 'SBN'},
link = 'Standard Book Number', -- redirect to International_Standard_Book_Number#History
redirect = 'SBN (identifier)',
label = 'SBN',
prefix = 'Special:BookSources/0-', -- prefix has leading zero necessary to make 9-digit sbn a 10-digit isbn
COinS = nil, -- nil because we can't use pre or rft or info:
separator = ' ',
},
['SSRN'] = {
parameters = {'ssrn', 'SSRN'},
link = 'Social Science Research Network',
redirect = 'SSRN (identifier)',
q = 'Q7550801',
label = 'SSRN',
prefix = 'https://papers.ssrn.com/sol3/papers.cfm?abstract_id=',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
id_limit = 4700000,
custom_access = 'ssrn-access',
},
['S2CID'] = {
parameters = {'s2cid', 'S2CID'},
link = 'Semantic Scholar',
redirect = 'S2CID (identifier)',
q = 'Q22908627',
label = 'S2CID',
prefix = 'https://api.semanticscholar.org/CorpusID:',
COinS = 'pre', -- use prefix value
encode = false,
separator = ' ',
id_limit = 268000000,
custom_access = 's2cid-access',
},
['USENETID'] = {
parameters = {'message-id'},
link = 'Usenet',
redirect = 'Usenet (identifier)',
q = 'Q193162',
label = 'Usenet:',
prefix = 'news:',
encode = false,
COinS = 'pre', -- use prefix value
separator = ' ',
},
['ZBL'] = {
parameters = {'zbl', 'ZBL' },
link = 'Zentralblatt MATH',
redirect = 'Zbl (identifier)',
q = 'Q190269',
label = 'Zbl',
prefix = 'https://zbmath.org/?format=complete&q=an:',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
},
}
--[[--------------------------< E X P O R T S >---------------------------------
]]
return {
use_identifier_redirects = use_identifier_redirects, -- booleans defined in the settings at the top of this module
local_lang_cat_enable = local_lang_cat_enable,
date_name_auto_xlate_enable = date_name_auto_xlate_enable,
date_digit_auto_xlate_enable = date_digit_auto_xlate_enable,
enable_sort_keys = enable_sort_keys,
-- tables and variables created when this module is loaded
global_df = get_date_format (), -- this line can be replaced with "global_df = 'dmy-all'," to have all dates auto translated to dmy format.
global_cs1_config_t = global_cs1_config_t, -- global settings from {{cs1 config}}
punct_skip = build_skip_table (punct_skip, punct_meta_params),
url_skip = build_skip_table (url_skip, url_meta_params),
known_free_doi_registrants_t = build_free_doi_registrants_table(),
name_space_sort_keys = name_space_sort_keys,
aliases = aliases,
special_case_translation = special_case_translation,
date_names = date_names,
err_msg_supl = err_msg_supl,
error_conditions = error_conditions,
editor_markup_patterns = editor_markup_patterns,
et_al_patterns = et_al_patterns,
id_handlers = id_handlers,
keywords_lists = keywords_lists,
keywords_xlate = keywords_xlate,
stripmarkers = stripmarkers,
invisible_chars = invisible_chars,
invisible_defs = invisible_defs,
indic_script = indic_script,
emoji_t = emoji_t,
maint_cats = maint_cats,
messages = messages,
presentation = presentation,
prop_cats = prop_cats,
script_lang_codes = script_lang_codes,
lang_tag_remap = lang_tag_remap,
lang_name_remap = lang_name_remap,
this_wiki_code = this_wiki_code,
title_types = title_types,
uncategorized_namespaces = uncategorized_namespaces_t,
uncategorized_subpages = uncategorized_subpages,
templates_using_volume = templates_using_volume,
templates_using_issue = templates_using_issue,
templates_not_using_page = templates_not_using_page,
vol_iss_pg_patterns = vol_iss_pg_patterns,
single_letter_2nd_lvl_domains_t = single_letter_2nd_lvl_domains_t,
inter_wiki_map = inter_wiki_map,
mw_languages_by_tag_t = mw_languages_by_tag_t,
mw_languages_by_name_t = mw_languages_by_name_t,
citation_class_map_t = citation_class_map_t,
citation_issue_t = citation_issue_t,
citation_no_volume_t = citation_no_volume_t,
}
3956dfb46c5ef5d8df0c4e2c2f1bd2a4dfffc666
30
29
2023-12-24T02:01:03Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Citation/CS1/Configuration]]
Scribunto
text/plain
local lang_obj = mw.language.getContentLanguage(); -- make a language object for the local language; used here for languages and dates
--[[--------------------------< S E T T I N G S >--------------------------------------------------------------
boolean settings used to control various things. these setting located here to make them easy to find
]]
-- these settings local to this module only
local local_digits_from_mediawiki = false; -- for i18n; when true, module fills date_names['local_digits'] from MediaWiki; manual fill required else; always false at en.wiki
local local_date_names_from_mediawiki = false; -- for i18n; when true, module fills date_names['local']['long'] and date_names['local']['short'] from MediaWiki;
-- manual translation required else; ; always false at en.wiki
-- these settings exported to other modules
local use_identifier_redirects = true; -- when true use redirect name for identifier label links; always true at en.wiki
local local_lang_cat_enable = false; -- when true categorizes pages where |language=<local wiki's language>; always false at en.wiki
local date_name_auto_xlate_enable = false; -- when true translates English month-names to the local-wiki's language month names; always false at en.wiki
local date_digit_auto_xlate_enable = false; -- when true translates Western date digit to the local-wiki's language digits (date_names['local_digits']); always false at en.wiki
local enable_sort_keys = true; -- when true module adds namespace sort keys to error and maintenance category links
--[[--------------------------< U N C A T E G O R I Z E D _ N A M E S P A C E S >------------------------------
List of namespaces identifiers for namespaces that will not be included in citation error categories.
Same as setting notracking = true by default.
For wikis that have a current version of Module:cs1 documentation support, this #invoke will return an unordered
list of namespace names and their associated identifiers:
{{#invoke:cs1 documentation support|uncategorized_namespace_lister|all=<anything>}}
]]
uncategorized_namespaces_t = {[2]=true}; -- init with user namespace id
for k, _ in pairs (mw.site.talkNamespaces) do -- add all talk namespace ids
uncategorized_namespaces_t[k] = true;
end
local uncategorized_subpages = {'/[Ss]andbox', '/[Tt]estcases', '/[^/]*[Ll]og', '/[Aa]rchive'}; -- list of Lua patterns found in page names of pages we should not categorize
--[[
at en.wiki Greek characters are used as sort keys for certain items in a category so that those items are
placed at the end of a category page. See Wikipedia:Categorization#Sort_keys. That works well for en.wiki
because English is written using the Latn script. This may not work well for other languages. At en.wiki it
is desireable to place content from certain namespaces at the end of a category listing so the module adds sort
keys to error and maintenance category links when rendering a cs1|2 template on a page in that namespace.
i18n: if this does not work well for your language, set <enable_sort_keys> to false.
]]
local name_space_sort_keys = { -- sort keys to be used with these namespaces:
[4] = 'ω', -- wikipedia; omega
[10] = 'τ', -- template; tau
[118] = 'Δ', -- draft; delta
['other'] = 'ο', -- all other non-talk namespaces except main (article); omicron
}
--[[--------------------------< M E S S A G E S >--------------------------------------------------------------
Translation table
The following contains fixed text that may be output as part of a citation.
This is separated from the main body to aid in future translations of this
module.
]]
local messages = {
['agency'] = '$1 $2', -- $1 is sepc, $2 is agency
['archived-dead'] = 'Archived from $1 on $2',
['archived-live'] = '$1 from the original on $2',
['archived-unfit'] = 'Archived from the original on ',
['archived'] = 'Archived',
['by'] = 'By', -- contributions to authored works: introduction, foreword, afterword
['cartography'] = 'Cartography by $1',
['editor'] = 'ed.',
['editors'] = 'eds.',
['edition'] = '($1 ed.)',
['episode'] = 'Episode $1',
['et al'] = 'et al.',
['in'] = 'In', -- edited works
['inactive'] = 'inactive',
['inset'] = '$1 inset',
['interview'] = 'Interviewed by $1',
['mismatch'] = '<code class="cs1-code">|$1=</code> / <code class="cs1-code">|$2=</code> mismatch', -- $1 is year param name; $2 is date param name
['newsgroup'] = '[[Usenet newsgroup|Newsgroup]]: $1',
['notitle'] = 'No title', -- for |title=(()) and (in the future) |title=none
['original'] = 'the original',
['origdate'] = ' [$1]',
['published'] = ' (published $1)',
['retrieved'] = 'Retrieved $1',
['season'] = 'Season $1',
['section'] = '§ $1',
['sections'] = '§§ $1',
['series'] = '$1 $2', -- $1 is sepc, $2 is series
['seriesnum'] = 'Series $1',
['translated'] = 'Translated by $1',
['type'] = ' ($1)', -- for titletype
['written'] = 'Written at $1',
['vol'] = '$1 Vol. $2', -- $1 is sepc; bold journal style volume is in presentation{}
['vol-no'] = '$1 Vol. $2, no. $3', -- sepc, volume, issue (alternatively insert $1 after $2, but then we'd also have to change capitalization)
['issue'] = '$1 No. $2', -- $1 is sepc
['art'] = '$1 Art. $2', -- $1 is sepc; for {{cite conference}} only
['vol-art'] = '$1 Vol. $2, art. $3', -- sepc, volume, article-number; for {{cite conference}} only
['j-vol'] = '$1 $2', -- sepc, volume; bold journal volume is in presentation{}
['j-issue'] = ' ($1)',
['j-article-num'] = ' $1', -- TODO: any punctuation here? static text?
['nopp'] = '$1 $2'; -- page(s) without prefix; $1 is sepc
['p-prefix'] = "$1 p. $2", -- $1 is sepc
['pp-prefix'] = "$1 pp. $2", -- $1 is sepc
['j-page(s)'] = ': $1', -- same for page and pages
['sheet'] = '$1 Sheet $2', -- $1 is sepc
['sheets'] = '$1 Sheets $2', -- $1 is sepc
['j-sheet'] = ': Sheet $1',
['j-sheets'] = ': Sheets $1',
['language'] = '(in $1)',
['via'] = " – via $1",
['event'] = 'Event occurs at',
['minutes'] = 'minutes in',
-- Determines the location of the help page
['help page link'] = 'Help:CS1 errors',
['help page label'] = 'help',
-- categories
['cat wikilink'] = '[[Category:$1]]', -- $1 is the category name
['cat wikilink sk'] = '[[Category:$1|$2]]', -- $1 is the category name; $2 is namespace sort key
[':cat wikilink'] = '[[:Category:$1|link]]', -- category name as maintenance message wikilink; $1 is the category name
-- Internal errors (should only occur if configuration is bad)
['undefined_error'] = 'Called with an undefined error condition',
['unknown_ID_key'] = 'Unrecognized ID key: ', -- an ID key in id_handlers not found in ~/Identifiers func_map{}
['unknown_ID_access'] = 'Unrecognized ID access keyword: ', -- an ID access keyword in id_handlers not found in keywords_lists['id-access']{}
['unknown_argument_map'] = 'Argument map not defined for this variable',
['bare_url_no_origin'] = 'Bare URL found but origin indicator is nil or empty',
['warning_msg_e'] = '<span style="color:#d33">One or more <code style="color: inherit; background: inherit; border: none; padding: inherit;">{{$1}}</code> templates have errors</span>; messages may be hidden ([[Help:CS1_errors#Controlling_error_message_display|help]]).'; -- $1 is template link
['warning_msg_m'] = '<span style="color:#3a3">One or more <code style="color: inherit; background: inherit; border: none; padding: inherit;">{{$1}}</code> templates have maintenance messages</span>; messages may be hidden ([[Help:CS1_errors#Controlling_error_message_display|help]]).'; -- $1 is template link
}
--[[--------------------------< C I T A T I O N _ C L A S S _ M A P >------------------------------------------
this table maps the value assigned to |CitationClass= in the cs1|2 templates to the canonical template name when
the value assigned to |CitationClass= is different from the canonical template name. |CitationClass= values are
used as class attributes in the <cite> tag that encloses the citation so these names may not contain spaces while
the canonical template name may. These names are used in warning_msg_e and warning_msg_m to create links to the
template's documentation when an article is displayed in preview mode.
Most cs1|2 template |CitationClass= values at en.wiki match their canonical template names so are not listed here.
]]
local citation_class_map_t = { -- TODO: if kept, these and all other config.CitationClass 'names' require some sort of i18n
['arxiv'] = 'arXiv',
['audio-visual'] = 'AV media',
['AV-media-notes'] = 'AV media notes',
['biorxiv'] = 'bioRxiv',
['citeseerx'] = 'CiteSeerX',
['encyclopaedia'] = 'encyclopedia',
['mailinglist'] = 'mailing list',
['medrxiv'] = 'medRxiv',
['pressrelease'] = 'press release',
['ssrn'] = 'SSRN',
['techreport'] = 'tech report',
}
--[=[-------------------------< E T _ A L _ P A T T E R N S >--------------------------------------------------
This table provides Lua patterns for the phrase "et al" and variants in name text
(author, editor, etc.). The main module uses these to identify and emit the 'etal' message.
]=]
local et_al_patterns = {
"[;,]? *[\"']*%f[%a][Ee][Tt]%.? *[Aa][Ll][%.;,\"']*$", -- variations on the 'et al' theme
"[;,]? *[\"']*%f[%a][Ee][Tt]%.? *[Aa][Ll][Ii][AaIi][Ee]?[%.;,\"']*$", -- variations on the 'et alia', 'et alii' and 'et aliae' themes (false positive 'et aliie' unlikely to match)
"[;,]? *%f[%a]and [Oo]thers", -- an alternative to et al.
"%[%[ *[Ee][Tt]%.? *[Aa][Ll]%.? *%]%]", -- a wikilinked form
"%(%( *[Ee][Tt]%.? *[Aa][Ll]%.? *%)%)", -- a double-bracketed form (to counter partial removal of ((...)) syntax)
"[%(%[] *[Ee][Tt]%.? *[Aa][Ll]%.? *[%)%]]", -- a bracketed form
}
--[[--------------------------< P R E S E N T A T I O N >------------------------
Fixed presentation markup. Originally part of citation_config.messages it has
been moved into its own, more semantically correct place.
]]
local presentation =
{
-- .citation-comment class is specified at Help:CS1_errors#Controlling_error_message_display
['hidden-error'] = '<span class="cs1-hidden-error citation-comment">$1</span>',
['visible-error'] = '<span class="cs1-visible-error citation-comment">$1</span>',
['hidden-maint'] = '<span class="cs1-maint citation-comment">$1</span>',
['accessdate'] = '<span class="reference-accessdate">$1$2</span>', -- to allow editors to hide accessdate using personal CSS
['bdi'] = '<bdi$1>$2</bdi>', -- bidirectional isolation used with |script-title= and the like
['cite'] = '<cite class="$1">$2</cite>'; -- for use when citation does not have a namelist and |ref= not set so no id="..." attribute
['cite-id'] = '<cite id="$1" class="$2">$3</cite>'; -- for use when when |ref= is set or when citation has a namelist
['format'] = ' <span class="cs1-format">($1)</span>', -- for |format=, |chapter-format=, etc.
['interwiki'] = ' <span class="cs1-format">[in $1]</span>', -- for interwiki-language-linked author, editor, etc
['interproj'] = ' <span class="cs1-format">[at $1]</span>', -- for interwiki-project-linked author, editor, etc (:d: and :s: supported; :w: ignored)
-- various access levels, for |access=, |doi-access=, |arxiv=, ...
-- narrow no-break space   may work better than nowrap CSS. Or not? Browser support?
['ext-link-access-signal'] = '<span class="$1" title="$2">$3</span>', -- external link with appropriate lock icon
['free'] = {class='cs1-lock-free', title='Freely accessible'}, -- classes defined in Module:Citation/CS1/styles.css
['registration'] = {class='cs1-lock-registration', title='Free registration required'},
['limited'] = {class='cs1-lock-limited', title='Free access subject to limited trial, subscription normally required'},
['subscription'] = {class='cs1-lock-subscription', title='Paid subscription required'},
['interwiki-icon'] = '<span class="$1" title="$2">$3</span>',
['class-wikisource'] = 'cs1-ws-icon',
['italic-title'] = "''$1''",
['kern-left'] = '<span class="cs1-kern-left"></span>$1', -- spacing to use when title contains leading single or double quote mark
['kern-right'] = '$1<span class="cs1-kern-right"></span>', -- spacing to use when title contains trailing single or double quote mark
['nowrap1'] = '<span class="nowrap">$1</span>', -- for nowrapping an item: <span ...>yyyy-mm-dd</span>
['nowrap2'] = '<span class="nowrap">$1</span> $2', -- for nowrapping portions of an item: <span ...>dd mmmm</span> yyyy (note white space)
['ocins'] = '<span title="$1" class="Z3988"></span>',
['parameter'] = '<code class="cs1-code">|$1=</code>',
['ps_cs1'] = '.'; -- CS1 style postscript (terminal) character
['ps_cs2'] = ''; -- CS2 style postscript (terminal) character (empty string)
['quoted-text'] = '<q>$1</q>', -- for wrapping |quote= content
['quoted-title'] = '"$1"',
['sep_cs1'] = '.', -- CS1 element separator
['sep_cs2'] = ',', -- CS2 separator
['sep_nl'] = ';', -- CS1|2 style name-list separator between names is a semicolon
['sep_nl_and'] = ' and ', -- used as last nl sep when |name-list-style=and and list has 2 items
['sep_nl_end'] = '; and ', -- used as last nl sep when |name-list-style=and and list has 3+ names
['sep_name'] = ', ', -- CS1|2 style last/first separator is <comma><space>
['sep_nl_vanc'] = ',', -- Vancouver style name-list separator between authors is a comma
['sep_name_vanc'] = ' ', -- Vancouver style last/first separator is a space
['sep_list'] = ', ', -- used for |language= when list has 3+ items except for last sep which uses sep_list_end
['sep_list_pair'] = ' and ', -- used for |language= when list has 2 items
['sep_list_end'] = ', and ', -- used as last list sep for |language= when list has 3+ items
['trans-italic-title'] = "[''$1'']",
['trans-quoted-title'] = "[$1]", -- for |trans-title= and |trans-quote=
['vol-bold'] = '$1 <b>$2</b>', -- sepc, volume; for bold journal cites; for other cites ['vol'] in messages{}
}
--[[--------------------------< A L I A S E S >---------------------------------
Aliases table for commonly passed parameters.
Parameter names on the right side in the assignments in this table must have been
defined in the Whitelist before they will be recognized as valid parameter names
]]
local aliases = {
['AccessDate'] = {'access-date', 'accessdate'}, -- Used by InternetArchiveBot
['Agency'] = 'agency',
['ArchiveDate'] = {'archive-date', 'archivedate'}, -- Used by InternetArchiveBot
['ArchiveFormat'] = 'archive-format',
['ArchiveURL'] = {'archive-url', 'archiveurl'}, -- Used by InternetArchiveBot
['ArticleNumber'] = 'article-number',
['ASINTLD'] = 'asin-tld',
['At'] = 'at', -- Used by InternetArchiveBot
['Authors'] = {'people', 'credits'},
['BookTitle'] = {'book-title', 'booktitle'},
['Cartography'] = 'cartography',
['Chapter'] = {'chapter', 'contribution', 'entry', 'article', 'section'},
['ChapterFormat'] = {'chapter-format', 'contribution-format', 'entry-format',
'article-format', 'section-format'};
['ChapterURL'] = {'chapter-url', 'contribution-url', 'entry-url', 'article-url', 'section-url'}, -- Used by InternetArchiveBot
['ChapterUrlAccess'] = {'chapter-url-access', 'contribution-url-access',
'entry-url-access', 'article-url-access', 'section-url-access'}, -- Used by InternetArchiveBot
['Class'] = 'class', -- cite arxiv and arxiv identifier
['Collaboration'] = 'collaboration',
['Conference'] = {'conference', 'event'},
['ConferenceFormat'] = 'conference-format',
['ConferenceURL'] = 'conference-url', -- Used by InternetArchiveBot
['Date'] = {'date', 'air-date', 'airdate'}, -- air-date and airdate for cite episode and cite serial only
['Degree'] = 'degree',
['DF'] = 'df',
['DisplayAuthors'] = {'display-authors', 'display-subjects'},
['DisplayContributors'] = 'display-contributors',
['DisplayEditors'] = 'display-editors',
['DisplayInterviewers'] = 'display-interviewers',
['DisplayTranslators'] = 'display-translators',
['Docket'] = 'docket',
['DoiBroken'] = 'doi-broken-date',
['Edition'] = 'edition',
['Embargo'] = 'pmc-embargo-date',
['Encyclopedia'] = {'encyclopedia', 'encyclopaedia', 'dictionary'}, -- cite encyclopedia only
['Episode'] = 'episode', -- cite serial only TODO: make available to cite episode?
['Format'] = 'format',
['ID'] = {'id', 'ID'},
['Inset'] = 'inset',
['Issue'] = {'issue', 'number'},
['Language'] = {'language', 'lang'},
['MailingList'] = {'mailing-list', 'mailinglist'}, -- cite mailing list only
['Map'] = 'map', -- cite map only
['MapFormat'] = 'map-format', -- cite map only
['MapURL'] = {'map-url', 'mapurl'}, -- cite map only -- Used by InternetArchiveBot
['MapUrlAccess'] = 'map-url-access', -- cite map only -- Used by InternetArchiveBot
['Minutes'] = 'minutes',
['Mode'] = 'mode',
['NameListStyle'] = 'name-list-style',
['Network'] = 'network',
['Newsgroup'] = 'newsgroup', -- cite newsgroup only
['NoPP'] = {'no-pp', 'nopp'},
['NoTracking'] = {'no-tracking', 'template-doc-demo'},
['Number'] = 'number', -- this case only for cite techreport
['OrigDate'] = {'orig-date', 'orig-year', 'origyear'},
['Others'] = 'others',
['Page'] = {'page', 'p'}, -- Used by InternetArchiveBot
['Pages'] = {'pages', 'pp'}, -- Used by InternetArchiveBot
['Periodical'] = {'journal', 'magazine', 'newspaper', 'periodical', 'website', 'work'},
['Place'] = {'place', 'location'},
['PostScript'] = 'postscript',
['PublicationDate'] = {'publication-date', 'publicationdate'},
['PublicationPlace'] = {'publication-place', 'publicationplace'},
['PublisherName'] = {'publisher', 'institution'},
['Quote'] = {'quote', 'quotation'},
['QuotePage'] = 'quote-page',
['QuotePages'] = 'quote-pages',
['Ref'] = 'ref',
['Scale'] = 'scale',
['ScriptChapter'] = {'script-chapter', 'script-contribution', 'script-entry',
'script-article', 'script-section'},
['ScriptMap'] = 'script-map',
['ScriptPeriodical'] = {'script-journal', 'script-magazine', 'script-newspaper',
'script-periodical', 'script-website', 'script-work'},
['ScriptQuote'] = 'script-quote',
['ScriptTitle'] = 'script-title', -- Used by InternetArchiveBot
['Season'] = 'season',
['Sections'] = 'sections', -- cite map only
['Series'] = {'series', 'version'},
['SeriesLink'] = {'series-link', 'serieslink'},
['SeriesNumber'] = {'series-number', 'series-no'},
['Sheet'] = 'sheet', -- cite map only
['Sheets'] = 'sheets', -- cite map only
['Station'] = 'station',
['Time'] = 'time',
['TimeCaption'] = 'time-caption',
['Title'] = 'title', -- Used by InternetArchiveBot
['TitleLink'] = {'title-link', 'episode-link', 'episodelink'}, -- Used by InternetArchiveBot
['TitleNote'] = {'title-note', 'department'},
['TitleType'] = {'type', 'medium'},
['TransChapter'] = {'trans-article', 'trans-chapter', 'trans-contribution',
'trans-entry', 'trans-section'},
['Transcript'] = 'transcript',
['TranscriptFormat'] = 'transcript-format',
['TranscriptURL'] = 'transcript-url', -- Used by InternetArchiveBot
['TransMap'] = 'trans-map', -- cite map only
['TransPeriodical'] = {'trans-journal', 'trans-magazine', 'trans-newspaper',
'trans-periodical', 'trans-website', 'trans-work'},
['TransQuote'] = 'trans-quote',
['TransTitle'] = 'trans-title', -- Used by InternetArchiveBot
['URL'] = {'url', 'URL'}, -- Used by InternetArchiveBot
['UrlAccess'] = 'url-access', -- Used by InternetArchiveBot
['UrlStatus'] = 'url-status', -- Used by InternetArchiveBot
['Vauthors'] = 'vauthors',
['Veditors'] = 'veditors',
['Via'] = 'via',
['Volume'] = 'volume',
['Year'] = 'year',
['AuthorList-First'] = {"first#", "author-first#", "author#-first", "author-given#", "author#-given",
"subject-first#", "subject#-first", "subject-given#", "subject#-given",
"given#"},
['AuthorList-Last'] = {"last#", "author-last#", "author#-last", "author-surname#", "author#-surname",
"subject-last#", "subject#-last", "subject-surname#", "subject#-surname",
"author#", 'host#', "subject#", "surname#"},
['AuthorList-Link'] = {"author-link#", "author#-link", "subject-link#",
"subject#-link", "authorlink#", "author#link"},
['AuthorList-Mask'] = {"author-mask#", "author#-mask", "subject-mask#", "subject#-mask"},
['ContributorList-First'] = {'contributor-first#', 'contributor#-first',
'contributor-given#', 'contributor#-given'},
['ContributorList-Last'] = {'contributor-last#', 'contributor#-last',
'contributor-surname#', 'contributor#-surname', 'contributor#'},
['ContributorList-Link'] = {'contributor-link#', 'contributor#-link'},
['ContributorList-Mask'] = {'contributor-mask#', 'contributor#-mask'},
['EditorList-First'] = {"editor-first#", "editor#-first", "editor-given#", "editor#-given"},
['EditorList-Last'] = {"editor-last#", "editor#-last", "editor-surname#",
"editor#-surname", "editor#"},
['EditorList-Link'] = {"editor-link#", "editor#-link"},
['EditorList-Mask'] = {"editor-mask#", "editor#-mask"},
['InterviewerList-First'] = {'interviewer-first#', 'interviewer#-first',
'interviewer-given#', 'interviewer#-given'},
['InterviewerList-Last'] = {'interviewer-last#', 'interviewer#-last',
'interviewer-surname#', 'interviewer#-surname', 'interviewer#'},
['InterviewerList-Link'] = {'interviewer-link#', 'interviewer#-link'},
['InterviewerList-Mask'] = {'interviewer-mask#', 'interviewer#-mask'},
['TranslatorList-First'] = {'translator-first#', 'translator#-first',
'translator-given#', 'translator#-given'},
['TranslatorList-Last'] = {'translator-last#', 'translator#-last',
'translator-surname#', 'translator#-surname', 'translator#'},
['TranslatorList-Link'] = {'translator-link#', 'translator#-link'},
['TranslatorList-Mask'] = {'translator-mask#', 'translator#-mask'},
}
--[[--------------------------< P U N C T _ S K I P >---------------------------
builds a table of parameter names that the extraneous terminal punctuation check should not check.
]]
local punct_meta_params = { -- table of aliases[] keys (meta parameters); each key has a table of parameter names for a value
'BookTitle', 'Chapter', 'ScriptChapter', 'ScriptTitle', 'Title', 'TransChapter', 'Transcript', 'TransMap', 'TransTitle', -- title-holding parameters
'AuthorList-Mask', 'ContributorList-Mask', 'EditorList-Mask', 'InterviewerList-Mask', 'TranslatorList-Mask', -- name-list mask may have name separators
'PostScript', 'Quote', 'ScriptQuote', 'TransQuote', 'Ref', -- miscellaneous
'ArchiveURL', 'ChapterURL', 'ConferenceURL', 'MapURL', 'TranscriptURL', 'URL', -- URL-holding parameters
}
local url_meta_params = { -- table of aliases[] keys (meta parameters); each key has a table of parameter names for a value
'ArchiveURL', 'ChapterURL', 'ConferenceURL', 'ID', 'MapURL', 'TranscriptURL', 'URL', -- parameters allowed to hold urls
'Page', 'Pages', 'At', 'QuotePage', 'QuotePages', -- insource locators allowed to hold urls
}
local function build_skip_table (skip_t, meta_params)
for _, meta_param in ipairs (meta_params) do -- for each meta parameter key
local params = aliases[meta_param]; -- get the parameter or the table of parameters associated with the meta parameter name
if 'string' == type (params) then
skip_t[params] = 1; -- just a single parameter
else
for _, param in ipairs (params) do -- get the parameter name
skip_t[param] = 1; -- add the parameter name to the skip table
local count;
param, count = param:gsub ('#', ''); -- remove enumerator marker from enumerated parameters
if 0 ~= count then -- if removed
skip_t[param] = 1; -- add param name without enumerator marker
end
end
end
end
return skip_t;
end
local punct_skip = {};
local url_skip = {};
--[[--------------------------< S I N G L E - L E T T E R S E C O N D - L E V E L D O M A I N S >----------
this is a list of tlds that are known to have single-letter second-level domain names. This list does not include
ccTLDs which are accepted in is_domain_name().
]]
local single_letter_2nd_lvl_domains_t = {'cash', 'company', 'foundation', 'media', 'org', 'today'};
--[[-----------< S P E C I A L C A S E T R A N S L A T I O N S >------------
This table is primarily here to support internationalization. Translations in
this table are used, for example, when an error message, category name, etc.,
is extracted from the English alias key. There may be other cases where
this translation table may be useful.
]]
local is_Latn = 'A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143';
local special_case_translation = {
['AuthorList'] = 'authors list', -- used to assemble maintenance category names
['ContributorList'] = 'contributors list', -- translation of these names plus translation of the base maintenance category names in maint_cats{} table below
['EditorList'] = 'editors list', -- must match the names of the actual categories
['InterviewerList'] = 'interviewers list', -- this group or translations used by name_has_ed_markup() and name_has_mult_names()
['TranslatorList'] = 'translators list',
-- Lua patterns to match pseudo-titles used by InternetArchiveBot and others as placeholder for unknown |title= value
['archived_copy'] = { -- used with CS1 maint: Archive[d] copy as title
['en'] = '^archived?%s+copy$', -- for English; translators: keep this because templates imported from en.wiki
['local'] = nil, -- translators: replace ['local'] = nil with lowercase translation only when bots or tools create generic titles in your language
},
-- Lua patterns to match generic titles; usually created by bots or reference filling tools
-- translators: replace ['local'] = nil with lowercase translation only when bots or tools create generic titles in your language
-- generic titles and patterns in this table should be lowercase only
-- leave ['local'] nil except when there is a matching generic title in your language
-- boolean 'true' for plain-text searches; 'false' for pattern searches
['generic_titles'] = {
['accept'] = {
},
['reject'] = {
{['en'] = {'^wayback%s+machine$', false}, ['local'] = nil},
{['en'] = {'are you a robot', true}, ['local'] = nil},
{['en'] = {'hugedomains.com', true}, ['local'] = nil},
{['en'] = {'^[%(%[{<]?no +title[>}%]%)]?$', false}, ['local'] = nil},
{['en'] = {'page not found', true}, ['local'] = nil},
{['en'] = {'subscribe to read', true}, ['local'] = nil},
{['en'] = {'^[%(%[{<]?unknown[>}%]%)]?$', false}, ['local'] = nil},
{['en'] = {'website is for sale', true}, ['local'] = nil},
{['en'] = {'^404', false}, ['local'] = nil},
{['en'] = {'internet archive wayback machine', true}, ['local'] = nil},
{['en'] = {'log into facebook', true}, ['local'] = nil},
{['en'] = {'login • instagram', true}, ['local'] = nil},
{['en'] = {'redirecting...', true}, ['local'] = nil},
{['en'] = {'usurped title', true}, ['local'] = nil}, -- added by a GreenC bot
{['en'] = {'webcite query result', true}, ['local'] = nil},
{['en'] = {'wikiwix\'s cache', true}, ['local'] = nil},
}
},
-- boolean 'true' for plain-text searches, search string must be lowercase only
-- boolean 'false' for pattern searches
-- leave ['local'] nil except when there is a matching generic name in your language
['generic_names'] = {
['accept'] = {
{['en'] = {'%[%[[^|]*%(author%) *|[^%]]*%]%]', false}, ['local'] = nil},
},
['reject'] = {
{['en'] = {'about us', true}, ['local'] = nil},
{['en'] = {'%f[%a][Aa]dvisor%f[%A]', false}, ['local'] = nil},
{['en'] = {'allmusic', true}, ['local'] = nil},
{['en'] = {'%f[%a][Aa]uthor%f[%A]', false}, ['local'] = nil},
{['en'] = {'business', true}, ['local'] = nil},
{['en'] = {'cnn', true}, ['local'] = nil},
{['en'] = {'collaborator', true}, ['local'] = nil},
{['en'] = {'contributor', true}, ['local'] = nil},
{['en'] = {'contact us', true}, ['local'] = nil},
{['en'] = {'directory', true}, ['local'] = nil},
{['en'] = {'%f[%(%[][%(%[]%s*eds?%.?%s*[%)%]]?$', false}, ['local'] = nil},
{['en'] = {'[,%.%s]%f[e]eds?%.?$', false}, ['local'] = nil},
{['en'] = {'^eds?[%.,;]', false}, ['local'] = nil},
{['en'] = {'^[%(%[]%s*[Ee][Dd][Ss]?%.?%s*[%)%]]', false}, ['local'] = nil},
{['en'] = {'%f[%a][Ee]dited%f[%A]', false}, ['local'] = nil},
{['en'] = {'%f[%a][Ee]ditors?%f[%A]', false}, ['local'] = nil},
{['en'] = {'%f[%a]]Ee]mail%f[%A]', false}, ['local'] = nil},
{['en'] = {'facebook', true}, ['local'] = nil},
{['en'] = {'google', true}, ['local'] = nil},
{['en'] = {'home page', true}, ['local'] = nil},
{['en'] = {'^[Ii]nc%.?$', false}, ['local'] = nil},
{['en'] = {'instagram', true}, ['local'] = nil},
{['en'] = {'interviewer', true}, ['local'] = nil},
{['en'] = {'linkedIn', true}, ['local'] = nil},
{['en'] = {'^[Nn]ews$', false}, ['local'] = nil},
{['en'] = {'pinterest', true}, ['local'] = nil},
{['en'] = {'policy', true}, ['local'] = nil},
{['en'] = {'privacy', true}, ['local'] = nil},
{['en'] = {'reuters', true}, ['local'] = nil},
{['en'] = {'translator', true}, ['local'] = nil},
{['en'] = {'tumblr', true}, ['local'] = nil},
{['en'] = {'twitter', true}, ['local'] = nil},
{['en'] = {'site name', true}, ['local'] = nil},
{['en'] = {'statement', true}, ['local'] = nil},
{['en'] = {'submitted', true}, ['local'] = nil},
{['en'] = {'super.?user', false}, ['local'] = nil},
{['en'] = {'%f['..is_Latn..'][Uu]ser%f[^'..is_Latn..']', false}, ['local'] = nil},
{['en'] = {'verfasser', true}, ['local'] = nil},
}
}
}
--[[--------------------------< D A T E _ N A M E S >----------------------------------------------------------
This table of tables lists local language date names and fallback English date names.
The code in Date_validation will look first in the local table for valid date names.
If date names are not found in the local table, the code will look in the English table.
Because citations can be copied to the local wiki from en.wiki, the English is
required when the date-name translation function date_name_xlate() is used.
In these tables, season numbering is defined by
Extended Date/Time Format (EDTF) Specification (https://www.loc.gov/standards/datetime/)
which became part of ISO 8601 in 2019. See '§Sub-year groupings'. The standard
defines various divisions using numbers 21-41. CS1|2 only supports generic seasons.
EDTF does support the distinction between north and south hemisphere seasons
but CS1|2 has no way to make that distinction.
33-36 = Quarter 1, Quarter 2, Quarter 3, Quarter 4 (3 months each)
The standard does not address 'named' dates so, for the purposes of CS1|2,
Easter and Christmas are defined here as 98 and 99, which should be out of the
ISO 8601 (EDTF) range of uses for a while.
local_date_names_from_mediawiki is a boolean. When set to:
true – module will fetch local month names from MediaWiki for both date_names['local']['long'] and date_names['local']['short']
false – module will *not* fetch local month names from MediaWiki
Caveat lector: There is no guarantee that MediaWiki will provide short month names. At your wiki you can test
the results of the MediaWiki fetch in the debug console with this command (the result is alpha sorted):
=mw.dumpObject (p.date_names['local'])
While the module can fetch month names from MediaWiki, it cannot fetch the quarter, season, and named date names
from MediaWiki. Those must be translated manually.
]]
local local_date_names_from_mediawiki = true; -- when false, manual translation required for date_names['local']['long'] and date_names['local']['short']
-- when true, module fetches long and short month names from MediaWiki
local date_names = {
['en'] = { -- English
['long'] = {['January'] = 1, ['February'] = 2, ['March'] = 3, ['April'] = 4, ['May'] = 5, ['June'] = 6, ['July'] = 7, ['August'] = 8, ['September'] = 9, ['October'] = 10, ['November'] = 11, ['December'] = 12},
['short'] = {['Jan'] = 1, ['Feb'] = 2, ['Mar'] = 3, ['Apr'] = 4, ['May'] = 5, ['Jun'] = 6, ['Jul'] = 7, ['Aug'] = 8, ['Sep'] = 9, ['Oct'] = 10, ['Nov'] = 11, ['Dec'] = 12},
['quarter'] = {['First Quarter'] = 33, ['Second Quarter'] = 34, ['Third Quarter'] = 35, ['Fourth Quarter'] = 36},
['season'] = {['Winter'] = 24, ['Spring'] = 21, ['Summer'] = 22, ['Fall'] = 23, ['Autumn'] = 23},
['named'] = {['Easter'] = 98, ['Christmas'] = 99},
},
-- when local_date_names_from_mediawiki = false
['local'] = { -- replace these English date names with the local language equivalents
['long'] = {['January'] = 1, ['February'] = 2, ['March'] = 3, ['April'] = 4, ['May'] = 5, ['June'] = 6, ['July'] = 7, ['August'] = 8, ['September'] = 9, ['October'] = 10, ['November'] = 11, ['December'] = 12},
['short'] = {['Jan'] = 1, ['Feb'] = 2, ['Mar'] = 3, ['Apr'] = 4, ['May'] = 5, ['Jun'] = 6, ['Jul'] = 7, ['Aug'] = 8, ['Sep'] = 9, ['Oct'] = 10, ['Nov'] = 11, ['Dec'] = 12},
['quarter'] = {['First Quarter'] = 33, ['Second Quarter'] = 34, ['Third Quarter'] = 35, ['Fourth Quarter'] = 36},
['season'] = {['Winter'] = 24, ['Spring'] = 21, ['Summer'] = 22, ['Fall'] = 23, ['Autumn'] = 23},
['named'] = {['Easter'] = 98, ['Christmas'] = 99},
},
['inv_local_long'] = {}, -- used in date reformatting & translation; copy of date_names['local'].long where k/v are inverted: [1]='<local name>' etc.
['inv_local_short'] = {}, -- used in date reformatting & translation; copy of date_names['local'].short where k/v are inverted: [1]='<local name>' etc.
['inv_local_quarter'] = {}, -- used in date translation; copy of date_names['local'].quarter where k/v are inverted: [1]='<local name>' etc.
['inv_local_season'] = {}, -- used in date translation; copy of date_names['local'].season where k/v are inverted: [1]='<local name>' etc.
['inv_local_named'] = {}, -- used in date translation; copy of date_names['local'].named where k/v are inverted: [1]='<local name>' etc.
['local_digits'] = {['0'] = '0', ['1'] = '1', ['2'] = '2', ['3'] = '3', ['4'] = '4', ['5'] = '5', ['6'] = '6', ['7'] = '7', ['8'] = '8', ['9'] = '9'}, -- used to convert local language digits to Western 0-9
['xlate_digits'] = {},
}
if local_date_names_from_mediawiki then -- if fetching local month names from MediaWiki is enabled
local long_t = {};
local short_t = {};
for i=1, 12 do -- loop 12x and
local name = lang_obj:formatDate('F', '2022-' .. i .. '-1'); -- get long month name for each i
long_t[name] = i; -- save it
name = lang_obj:formatDate('M', '2022-' .. i .. '-1'); -- get short month name for each i
short_t[name] = i; -- save it
end
date_names['local']['long'] = long_t; -- write the long table – overwrites manual translation
date_names['local']['short'] = short_t; -- write the short table – overwrites manual translation
end
-- create inverted date-name tables for reformatting and/or translation
for _, invert_t in pairs {{'long', 'inv_local_long'}, {'short', 'inv_local_short'}, {'quarter', 'inv_local_quarter'}, {'season', 'inv_local_season'}, {'named', 'inv_local_named'}} do
for name, i in pairs (date_names['local'][invert_t[1]]) do -- this table is ['name'] = i
date_names[invert_t[2]][i] = name; -- invert to get [i] = 'name' for conversions from ymd
end
end
if local_digits_from_mediawiki then -- if fetching local digits from MediaWiki is enabled
local digits_t = {};
for i=0, 9 do -- loop 10x and
digits_t [lang_obj:formatNum (i)] = tostring (i); -- format the loop indexer as local lang table index and assign loop indexer (a string) as the value
end
date_names['local_digits'] = digits_t;
end
for ld, ed in pairs (date_names.local_digits) do -- make a digit translation table for simple date translation from en to local language using local_digits table
date_names.xlate_digits [ed] = ld; -- en digit becomes index with local digit as the value
end
local df_template_patterns = { -- table of redirects to {{Use dmy dates}} and {{Use mdy dates}}
'{{ *[Uu]se +(dmy) +dates *[|}]', -- 1159k -- sorted by approximate transclusion count
'{{ *[Uu]se +(mdy) +dates *[|}]', -- 212k
'{{ *[Uu]se +(MDY) +dates *[|}]', -- 788
'{{ *[Uu]se +(DMY) +dates *[|}]', -- 343
'{{ *([Mm]dy) *[|}]', -- 176
'{{ *[Uu]se *(dmy) *[|}]', -- 156 + 18
'{{ *[Uu]se *(mdy) *[|}]', -- 149 + 11
'{{ *([Dd]my) *[|}]', -- 56
'{{ *[Uu]se +(MDY) *[|}]', -- 5
'{{ *([Dd]MY) *[|}]', -- 3
'{{ *[Uu]se(mdy)dates *[|}]', -- 1
'{{ *[Uu]se +(DMY) *[|}]', -- 0
'{{ *([Mm]DY) *[|}]', -- 0
}
local title_object = mw.title.getCurrentTitle();
local content; -- done this way so that unused templates appear in unused-template-reports; self-transcluded makes them look like they are used
if 10 ~= title_object.namespace then -- all namespaces except Template
content = title_object:getContent() or ''; -- get the content of the article or ''; new pages edited w/ve do not have 'content' until saved; ve does not preview; phab:T221625
end
local function get_date_format ()
if not content then -- nil content when we're in template
return nil; -- auto-formatting does not work in Template space so don't set global_df
end
for _, pattern in ipairs (df_template_patterns) do -- loop through the patterns looking for {{Use dmy dates}} or {{Use mdy dates}} or any of their redirects
local start, _, match = content:find(pattern); -- match is the three letters indicating desired date format
if match then
local use_dates_template = content:match ('%b{}', start); -- get the whole template
if use_dates_template:match ('| *cs1%-dates *= *[lsy][sy]?') then -- look for |cs1-dates=publication date length access-/archive-date length
return match:lower() .. '-' .. use_dates_template:match ('| *cs1%-dates *= *([lsy][sy]?)');
else
return match:lower() .. '-all'; -- no |cs1-dates= k/v pair; return value appropriate for use in |df=
end
end
end
end
local global_df; -- TODO: add this to <global_cs1_config_t>?
--[[-----------------< V O L U M E , I S S U E , P A G E S >------------------
These tables hold cite class values (from the template invocation) and identify those templates that support
|volume=, |issue=, and |page(s)= parameters. Cite conference and cite map require further qualification which
is handled in the main module.
]]
local templates_using_volume = {'citation', 'audio-visual', 'book', 'conference', 'encyclopaedia', 'interview', 'journal', 'magazine', 'map', 'news', 'report', 'techreport', 'thesis'}
local templates_using_issue = {'citation', 'conference', 'episode', 'interview', 'journal', 'magazine', 'map', 'news', 'podcast'}
local templates_not_using_page = {'audio-visual', 'episode', 'mailinglist', 'newsgroup', 'podcast', 'serial', 'sign', 'speech'}
--[[
These tables control when it is appropriate for {{citation}} to render |volume= and/or |issue=. The parameter
names in the tables constrain {{citation}} so that its renderings match the renderings of the equivalent cs1
templates. For example, {{cite web}} does not support |volume= so the equivalent {{citation |website=...}} must
not support |volume=.
]]
local citation_no_volume_t = { -- {{citation}} does not render |volume= when these parameters are used
'website', 'mailinglist', 'script-website',
}
local citation_issue_t = { -- {{citation}} may render |issue= when these parameters are used
'journal', 'magazine', 'newspaper', 'periodical', 'work',
'script-journal', 'script-magazine', 'script-newspaper', 'script-periodical', 'script-work',
}
--[[
Patterns for finding extra text in |volume=, |issue=, |page=, |pages=
]]
local vol_iss_pg_patterns = {
good_ppattern = '^P[^%.PpGg]', -- OK to begin with uppercase P: P7 (page 7 of section P), but not p123 (page 123); TODO: this allows 'Pages' which it should not
bad_ppatterns = { -- patterns for |page= and |pages=
'^[Pp][PpGg]?%.?[ %d]',
'^[Pp][Pp]?%. ', -- from {{p.}} and {{pp.}} templates
'^[Pp]ages?',
'^[Pp]gs.?',
},
vpatterns = { -- patterns for |volume=
'^volumes?',
'^vols?[%.:=]?'
},
ipatterns = { -- patterns for |issue=
'^issues?',
'^iss[%.:=]?',
'^numbers?',
'^nos?%A', -- don't match 'november' or 'nostradamus'
'^nr[%.:=]?',
'^n[%.:= ]' -- might be a valid issue without separator (space char is sep char here)
}
}
--[[--------------------------< K E Y W O R D S >-------------------------------
These tables hold keywords for those parameters that have defined sets of acceptable keywords.
]]
--[[-------------------< K E Y W O R D S T A B L E >--------------------------
this is a list of keywords; each key in the list is associated with a table of
synonymous keywords possibly from different languages.
for I18N: add local-language keywords to value table; do not change the key.
For example, adding the German keyword 'ja':
['affirmative'] = {'yes', 'true', 'y', 'ja'},
Because CS1|2 templates from en.wiki articles are often copied to other local wikis,
it is recommended that the English keywords remain in these tables.
]]
local keywords = {
['amp'] = {'&', 'amp', 'ampersand'}, -- |name-list-style=
['and'] = {'and', 'serial'}, -- |name-list-style=
['affirmative'] = {'yes', 'true', 'y'}, -- |no-tracking=, |no-pp= -- Used by InternetArchiveBot
['afterword'] = {'afterword'}, -- |contribution=
['bot: unknown'] = {'bot: unknown'}, -- |url-status= -- Used by InternetArchiveBot
['cs1'] = {'cs1'}, -- |mode=
['cs2'] = {'cs2'}, -- |mode=
['dead'] = {'dead', 'deviated'}, -- |url-status= -- Used by InternetArchiveBot
['dmy'] = {'dmy'}, -- |df=
['dmy-all'] = {'dmy-all'}, -- |df=
['foreword'] = {'foreword'}, -- |contribution=
['free'] = {'free'}, -- |<id>-access= -- Used by InternetArchiveBot
['harv'] = {'harv'}, -- |ref=; this no longer supported; is_valid_parameter_value() called with <invert> = true
['introduction'] = {'introduction'}, -- |contribution=
['limited'] = {'limited'}, -- |url-access= -- Used by InternetArchiveBot
['live'] = {'live'}, -- |url-status= -- Used by InternetArchiveBot
['mdy'] = {'mdy'}, -- |df=
['mdy-all'] = {'mdy-all'}, -- |df=
['none'] = {'none'}, -- |postscript=, |ref=, |title=, |type= -- Used by InternetArchiveBot
['off'] = {'off'}, -- |title= (potentially also: |title-link=, |postscript=, |ref=, |type=)
['preface'] = {'preface'}, -- |contribution=
['registration'] = {'registration'}, -- |url-access= -- Used by InternetArchiveBot
['subscription'] = {'subscription'}, -- |url-access= -- Used by InternetArchiveBot
['unfit'] = {'unfit'}, -- |url-status= -- Used by InternetArchiveBot
['usurped'] = {'usurped'}, -- |url-status= -- Used by InternetArchiveBot
['vanc'] = {'vanc'}, -- |name-list-style=
['ymd'] = {'ymd'}, -- |df=
['ymd-all'] = {'ymd-all'}, -- |df=
-- ['yMd'] = {'yMd'}, -- |df=; not supported at en.wiki
-- ['yMd-all'] = {'yMd-all'}, -- |df=; not supported at en.wiki
}
--[[------------------------< X L A T E _ K E Y W O R D S >---------------------
this function builds a list, keywords_xlate{}, of the keywords found in keywords{} where the values from keywords{}
become the keys in keywords_xlate{} and the keys from keywords{} become the values in keywords_xlate{}:
['affirmative'] = {'yes', 'true', 'y'}, -- in keywords{}
becomes
['yes'] = 'affirmative', -- in keywords_xlate{}
['true'] = 'affirmative',
['y'] = 'affirmative',
the purpose of this function is to act as a translator between a non-English keyword and its English equivalent
that may be used in other modules of this suite
]]
local function xlate_keywords ()
local out_table = {}; -- output goes here
for k, keywords_t in pairs (keywords) do -- spin through the keywords table
for _, keyword in ipairs (keywords_t) do -- for each keyword
out_table[keyword] = k; -- create an entry in the output table where keyword is the key
end
end
return out_table;
end
local keywords_xlate = xlate_keywords (); -- the list of translated keywords
--[[----------------< M A K E _ K E Y W O R D S _ L I S T >---------------------
this function assembles, for parameter-value validation, the list of keywords appropriate to that parameter.
keywords_lists{}, is a table of tables from keywords{}
]]
local function make_keywords_list (keywords_lists)
local out_table = {}; -- output goes here
for _, keyword_list in ipairs (keywords_lists) do -- spin through keywords_lists{} and get a table of keywords
for _, keyword in ipairs (keyword_list) do -- spin through keyword_list{} and add each keyword, ...
table.insert (out_table, keyword); -- ... as plain text, to the output list
end
end
return out_table;
end
--[[----------------< K E Y W O R D S _ L I S T S >-----------------------------
this is a list of lists of valid keywords for the various parameters in [key].
Generally the keys in this table are the canonical en.wiki parameter names though
some are contrived because of use in multiple differently named parameters:
['yes_true_y'], ['id-access'].
The function make_keywords_list() extracts the individual keywords from the
appropriate list in keywords{}.
The lists in this table are used to validate the keyword assignment for the
parameters named in this table's keys.
]]
local keywords_lists = {
['yes_true_y'] = make_keywords_list ({keywords.affirmative}),
['contribution'] = make_keywords_list ({keywords.afterword, keywords.foreword, keywords.introduction, keywords.preface}),
['df'] = make_keywords_list ({keywords.dmy, keywords['dmy-all'], keywords.mdy, keywords['mdy-all'], keywords.ymd, keywords['ymd-all']}),
-- ['df'] = make_keywords_list ({keywords.dmy, keywords['dmy-all'], keywords.mdy, keywords['mdy-all'], keywords.ymd, keywords['ymd-all'], keywords.yMd, keywords['yMd-all']}), -- not supported at en.wiki
['mode'] = make_keywords_list ({keywords.cs1, keywords.cs2}),
['name-list-style'] = make_keywords_list ({keywords.amp, keywords['and'], keywords.vanc}),
['ref'] = make_keywords_list ({keywords.harv}), -- inverted check; |ref=harv no longer supported
['url-access'] = make_keywords_list ({keywords.subscription, keywords.limited, keywords.registration}),
['url-status'] = make_keywords_list ({keywords.dead, keywords.live, keywords.unfit, keywords.usurped, keywords['bot: unknown']}),
['id-access'] = make_keywords_list ({keywords.free}),
}
--[[--------------------------< C S 1 _ C O N F I G _ G E T >--------------------------------------------------
fetch and validate values from {{cs1 config}} template to fill <global_cs1_config_t>
no error messages; when errors are detected, the parameter value from {{cs1 config}} is blanked.
Supports all parameters and aliases associated with the metaparameters: DisplayAuthors, DisplayContributors,
DisplayEditors, DisplayInterviewers, DisplayTranslators, NameListStyle, and Mode. The DisplayWhatever metaparameters
accept numeric values only (|display-authors=etal and the like is not supported).
]]
local global_cs1_config_t = {}; -- TODO: add value returned from get_date_format() to this table?
local function get_cs1_config ()
if not content then -- nil content when we're in template
return nil; -- auto-formatting does not work in Template space so don't set global_df
end
local start = content:find('{{ *[Cc][Ss]1 config *[|}]'); -- <start> is offset into <content> when {{cs1 config}} found; nil else
if start then
local cs1_config_template = content:match ('%b{}', start); -- get the whole template
if not cs1_config_template then
return nil;
end
local params_t = mw.text.split (cs1_config_template:gsub ('^{{%s*', ''):gsub ('%s*}}$', ''), '%s*|%s*'); -- remove '{{' and '}}'; make a sequence of parameter/value pairs (split on the pipe)
table.remove (params_t, 1); -- remove the template name because it isn't a parameter/value pair
local config_meta_params_t = {'DisplayAuthors', 'DisplayContributors', 'DisplayEditors', 'DisplayInterviewers', 'DisplayTranslators', 'NameListStyle', 'Mode'};
local meta_param_map_t = {}; -- list of accepted parameter names usable in {{cs1 config}} goes here
for _, meta_param in ipairs (config_meta_params_t) do -- for i18n using <config_meta_params_t>, map template parameter names to their metaparameter equivalents
if 'table' == type (aliases[meta_param]) then -- if <meta_param> is a sequence,
for _, param in ipairs (aliases[meta_param]) do -- extract its contents
meta_param_map_t[param] = meta_param; -- and add to <meta_param_map_t>
end
else
meta_param_map_t[aliases[meta_param]] = meta_param; -- not a sequence so just add the parameter to <meta_param_map_t>
end
end
local keywords_t = {}; -- map valid keywords to their associate metaparameter; reverse form of <keyword_lists[key] for these metaparameters
for _, metaparam_t in ipairs ({{'NameListStyle', 'name-list-style'}, {'Mode', 'mode'}}) do -- only these metaparameter / keywords_lists key pairs
for _, keyword in ipairs (keywords_lists[metaparam_t[2]]) do -- spin through the list of keywords
keywords_t[keyword] = metaparam_t[1]; -- add [keyword] = metaparameter to the map
end
end
for _, param in ipairs (params_t) do -- spin through the {{cs1 config}} parameters and fill <global_cs1_config_t>
local k, v = param:match ('([^=]-)%s*=%s*(.+)'); -- <k> is the parameter name; <v> is parameter's assigned value
if k then
if k:find ('^display') then -- if <k> is one of the |display-<namelist>= parameters
if v:match ('%d+') then -- the assigned value must be digits; doesn't accept 'etal'
global_cs1_config_t[meta_param_map_t[k]]=v; -- add the display param and its value to globals table
end
else
if keywords_t[v] == meta_param_map_t[k] then -- keywords_t[v] returns nil or the metaparam name; these must be the same
global_cs1_config_t[meta_param_map_t[k]]=v; -- add the parameter and its value to globals table
end
end
end
end
end
end
get_cs1_config (); -- fill <global_cs1_config_t>
--[[---------------------< S T R I P M A R K E R S >----------------------------
Common pattern definition location for stripmarkers so that we don't have to go
hunting for them if (when) MediaWiki changes their form.
]]
local stripmarkers = {
['any'] = '\127[^\127]*UNIQ%-%-(%a+)%-[%a%d]+%-QINU[^\127]*\127', -- capture returns name of stripmarker
['math'] = '\127[^\127]*UNIQ%-%-math%-[%a%d]+%-QINU[^\127]*\127' -- math stripmarkers used in coins_cleanup() and coins_replace_math_stripmarker()
}
--[[------------< I N V I S I B L E _ C H A R A C T E R S >---------------------
This table holds non-printing or invisible characters indexed either by name or
by Unicode group. Values are decimal representations of UTF-8 codes. The table
is organized as a table of tables because the Lua pairs keyword returns table
data in an arbitrary order. Here, we want to process the table from top to bottom
because the entries at the top of the table are also found in the ranges specified
by the entries at the bottom of the table.
Also here is a pattern that recognizes stripmarkers that begin and end with the
delete characters. The nowiki stripmarker is not an error but some others are
because the parameter values that include them become part of the template's
metadata before stripmarker replacement.
]]
local invisible_defs = {
del = '\127', -- used to distinguish between stripmarker and del char
zwj = '\226\128\141', -- used with capture because zwj may be allowed
}
local invisible_chars = {
{'replacement', '\239\191\189'}, -- U+FFFD, EF BF BD
{'zero width joiner', '('.. invisible_defs.zwj .. ')'}, -- U+200D, E2 80 8D; capture because zwj may be allowed
{'zero width space', '\226\128\139'}, -- U+200B, E2 80 8B
{'hair space', '\226\128\138'}, -- U+200A, E2 80 8A
{'soft hyphen', '\194\173'}, -- U+00AD, C2 AD
{'horizontal tab', '\009'}, -- U+0009 (HT), 09
{'line feed', '\010'}, -- U+000A (LF), 0A
{'no-break space', '\194\160'}, -- U+00A0 (NBSP), C2 A0
{'carriage return', '\013'}, -- U+000D (CR), 0D
{'stripmarker', stripmarkers.any}, -- stripmarker; may or may not be an error; capture returns the stripmaker type
{'delete', '('.. invisible_defs.del .. ')'}, -- U+007F (DEL), 7F; must be done after stripmarker test; capture to distinguish isolated del chars not part of stripmarker
{'C0 control', '[\000-\008\011\012\014-\031]'}, -- U+0000–U+001F (NULL–US), 00–1F (except HT, LF, CR (09, 0A, 0D))
{'C1 control', '[\194\128-\194\159]'}, -- U+0080–U+009F (XXX–APC), C2 80 – C2 9F
-- {'Specials', '[\239\191\185-\239\191\191]'}, -- U+FFF9-U+FFFF, EF BF B9 – EF BF BF
-- {'Private use area', '[\238\128\128-\239\163\191]'}, -- U+E000–U+F8FF, EE 80 80 – EF A3 BF
-- {'Supplementary Private Use Area-A', '[\243\176\128\128-\243\191\191\189]'}, -- U+F0000–U+FFFFD, F3 B0 80 80 – F3 BF BF BD
-- {'Supplementary Private Use Area-B', '[\244\128\128\128-\244\143\191\189]'}, -- U+100000–U+10FFFD, F4 80 80 80 – F4 8F BF BD
}
--[[
Indic script makes use of zero width joiner as a character modifier so zwj
characters must be left in. This pattern covers all of the unicode characters
for these languages:
Devanagari 0900–097F – https://unicode.org/charts/PDF/U0900.pdf
Devanagari extended A8E0–A8FF – https://unicode.org/charts/PDF/UA8E0.pdf
Bengali 0980–09FF – https://unicode.org/charts/PDF/U0980.pdf
Gurmukhi 0A00–0A7F – https://unicode.org/charts/PDF/U0A00.pdf
Gujarati 0A80–0AFF – https://unicode.org/charts/PDF/U0A80.pdf
Oriya 0B00–0B7F – https://unicode.org/charts/PDF/U0B00.pdf
Tamil 0B80–0BFF – https://unicode.org/charts/PDF/U0B80.pdf
Telugu 0C00–0C7F – https://unicode.org/charts/PDF/U0C00.pdf
Kannada 0C80–0CFF – https://unicode.org/charts/PDF/U0C80.pdf
Malayalam 0D00–0D7F – https://unicode.org/charts/PDF/U0D00.pdf
plus the not-necessarily Indic scripts for Sinhala and Burmese:
Sinhala 0D80-0DFF - https://unicode.org/charts/PDF/U0D80.pdf
Myanmar 1000-109F - https://unicode.org/charts/PDF/U1000.pdf
Myanmar extended A AA60-AA7F - https://unicode.org/charts/PDF/UAA60.pdf
Myanmar extended B A9E0-A9FF - https://unicode.org/charts/PDF/UA9E0.pdf
the pattern is used by has_invisible_chars() and coins_cleanup()
]]
local indic_script = '[\224\164\128-\224\181\191\224\163\160-\224\183\191\225\128\128-\225\130\159\234\167\160-\234\167\191\234\169\160-\234\169\191]';
-- list of emoji that use a zwj character (U+200D) to combine with another emoji
-- from: https://unicode.org/Public/emoji/15.1/emoji-zwj-sequences.txt; version: 15.1; 2023-06-05
-- table created by: [[:en:Module:Make emoji zwj table]]
local emoji_t = { -- indexes are decimal forms of the hex values in U+xxxx
[8596] = true, -- U+2194 ↔ left right arrow
[8597] = true, -- U+2195 ↕ up down arrow
[9760] = true, -- U+2620 ☠ skull and crossbones
[9792] = true, -- U+2640 ♀ female sign
[9794] = true, -- U+2642 ♂ male sign
[9877] = true, -- U+2695 ⚕ staff of aesculapius
[9878] = true, -- U+2696 ⚖ scales
[9895] = true, -- U+26A7 ⚧ male with stroke and male and female sign
[9992] = true, -- U+2708 ✈ airplane
[10052] = true, -- U+2744 ❄ snowflake
[10084] = true, -- U+2764 ❤ heavy black heart
[10145] = true, -- U+27A1 ➡ black rightwards arrow
[11035] = true, -- U+2B1B ⬛ black large square
[127752] = true, -- U+1F308 🌈 rainbow
[127787] = true, -- U+1F32B 🌫 fog
[127806] = true, -- U+1F33E 🌾 ear of rice
[127859] = true, -- U+1F373 🍳 cooking
[127868] = true, -- U+1F37C 🍼 baby bottle
[127876] = true, -- U+1F384 🎄 christmas tree
[127891] = true, -- U+1F393 🎓 graduation cap
[127908] = true, -- U+1F3A4 🎤 microphone
[127912] = true, -- U+1F3A8 🎨 artist palette
[127979] = true, -- U+1F3EB 🏫 school
[127981] = true, -- U+1F3ED 🏭 factory
[128102] = true, -- U+1F466 👦 boy
[128103] = true, -- U+1F467 👧 girl
[128104] = true, -- U+1F468 👨 man
[128105] = true, -- U+1F469 👩 woman
[128139] = true, -- U+1F48B 💋 kiss mark
[128165] = true, -- U+1F4A5 💥 collision symbol
[128168] = true, -- U+1F4A8 💨 dash symbol
[128171] = true, -- U+1F4AB 💫 dizzy symbol
[128187] = true, -- U+1F4BB 💻 personal computer
[128188] = true, -- U+1F4BC 💼 brief case
[128293] = true, -- U+1F525 🔥 fire
[128295] = true, -- U+1F527 🔧 wrench
[128300] = true, -- U+1F52C 🔬 microscope
[128488] = true, -- U+1F5E8 🗨 left speech bubble
[128640] = true, -- U+1F680 🚀 rocket
[128658] = true, -- U+1F692 🚒 fire engine
[129001] = true, -- U+1F7E9 🟩 large green square
[129003] = true, -- U+1F7EB 🟫 large brown square
[129309] = true, -- U+1F91D 🤝 handshake
[129455] = true, -- U+1F9AF 🦯 probing cane
[129456] = true, -- U+1F9B0 🦰 emoji component red hair
[129457] = true, -- U+1F9B1 🦱 emoji component curly hair
[129458] = true, -- U+1F9B2 🦲 emoji component bald
[129459] = true, -- U+1F9B3 🦳 emoji component white hair
[129466] = true, -- U+1F9BA 🦺 safety vest
[129468] = true, -- U+1F9BC 🦼 motorized wheelchair
[129469] = true, -- U+1F9BD 🦽 manual wheelchair
[129489] = true, -- U+1F9D1 🧑 adult
[129490] = true, -- U+1F9D2 🧒 child
[129657] = true, -- U+1FA79 🩹 adhesive bandage
[129778] = true, -- U+1FAF2 🫲 leftwards hand
}
--[[----------------------< L A N G U A G E S U P P O R T >-------------------
These tables and constants support various language-specific functionality.
]]
--local this_wiki_code = mw.getContentLanguage():getCode(); -- get this wiki's language code
local this_wiki_code = lang_obj:getCode(); -- get this wiki's language code
if string.match (mw.site.server, 'wikidata') then
this_wiki_code = mw.getCurrentFrame():callParserFunction('int', {'lang'}); -- on Wikidata so use interface language setting instead
end
local mw_languages_by_tag_t = mw.language.fetchLanguageNames (this_wiki_code, 'all'); -- get a table of language tag/name pairs known to Wikimedia; used for interwiki tests
local mw_languages_by_name_t = {};
for k, v in pairs (mw_languages_by_tag_t) do -- build a 'reversed' table name/tag language pairs know to MediaWiki; used for |language=
v = mw.ustring.lower (v); -- lowercase for tag fetch; get name's proper case from mw_languages_by_tag_t[<tag>]
if mw_languages_by_name_t[v] then -- when name already in the table
if 2 == #k or 3 == #k then -- if tag does not have subtags
mw_languages_by_name_t[v] = k; -- prefer the shortest tag for this name
end
else -- here when name not in the table
mw_languages_by_name_t[v] = k; -- so add name and matching tag
end
end
local inter_wiki_map = {}; -- map of interwiki prefixes that are language-code prefixes
for k, v in pairs (mw.site.interwikiMap ('local')) do -- spin through the base interwiki map (limited to local)
if mw_languages_by_tag_t[v["prefix"]] then -- if the prefix matches a known language tag
inter_wiki_map[v["prefix"]] = true; -- add it to our local map
end
end
--[[--------------------< S C R I P T _ L A N G _ C O D E S >-------------------
This table is used to hold ISO 639-1 two-character and ISO 639-3 three-character
language codes that apply only to |script-title= and |script-chapter=
]]
local script_lang_codes = {
'ab', 'am', 'ar', 'be', 'bg', 'bn', 'bo', 'bs', 'dv', 'dz', 'el', 'fa', 'gu', 'he',
'hi', 'hy', 'ja', 'ka', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'lo', 'mk', 'ml', 'mn',
'mni', 'mr', 'my', 'ne', 'or', 'ota', 'pa', 'ps', 'ru', 'sd', 'si', 'sr', 'syc', 'ta',
'te', 'tg', 'th', 'ti', 'tt', 'ug', 'uk', 'ur', 'uz', 'yi', 'yue', 'zh'
};
--[[---------------< L A N G U A G E R E M A P P I N G >----------------------
These tables hold language information that is different (correct) from MediaWiki's definitions
For each ['<tag>'] = 'language name' in lang_code_remap{} there must be a matching ['language name'] = {'language name', '<tag>'} in lang_name_remap{}
lang_tag_remap{}:
key is always lowercase ISO 639-1, -2, -3 language tag or a valid lowercase IETF language tag
value is properly spelled and capitalized language name associated with <tag>
only one language name per <tag>;
key/value pair must have matching entry in lang_name_remap{}
lang_name_remap{}:
key is always lowercase language name
value is a table the holds correctly spelled and capitalized language name [1] and associated tag [2] (tag must match a tag key in lang_tag_remap{})
may have multiple keys referring to a common preferred name and tag; For example:
['kolsch'] and ['kölsch'] both refer to 'Kölsch' and 'ksh'
]]
local lang_tag_remap = { -- used for |language= and |script-title= / |script-chapter=
['als'] = 'Tosk Albanian', -- MediaWiki returns Alemannisch
['bh'] = 'Bihari', -- MediaWiki uses 'bh' as a subdomain name for Bhojpuri Wikipedia: bh.wikipedia.org
['bla'] = 'Blackfoot', -- MediaWiki/IANA/ISO 639: Siksika; use en.wiki preferred name
['bn'] = 'Bengali', -- MediaWiki returns Bangla
['ca-valencia'] = 'Valencian', -- IETF variant of Catalan
['fkv'] = 'Kven', -- MediaWiki returns Kvensk
['gsw'] = 'Swiss German',
['ilo'] = 'Ilocano', -- MediaWiki/IANA/ISO 639: Iloko; use en.wiki preferred name
['ksh'] = 'Kölsch', -- MediaWiki: Colognian; use IANA/ISO 639 preferred name
['ksh-x-colog'] = 'Colognian', -- override MediaWiki ksh; no IANA/ISO 639 code for Colognian; IETF private code created at Module:Lang/data
['mis-x-ripuar'] = 'Ripuarian', -- override MediaWiki ksh; no IANA/ISO 639 code for Ripuarian; IETF private code created at Module:Lang/data
['nan-tw'] = 'Taiwanese Hokkien', -- make room for MediaWiki/IANA/ISO 639 nan: Min Nan Chinese and support en.wiki preferred name
['sr-ec'] = 'Serbian (Cyrillic script)', -- MediaWiki returns српски (ћирилица)
['sr-el'] = 'Serbian (Latin script)', -- MediaWiki returns srpski (latinica)
}
local lang_name_remap = { -- used for |language=; names require proper capitalization; tags must be lowercase
['alemannic'] = {'Swiss German', 'gsw'}, -- ISO 639-2, -3 alternate for Swiss German; MediaWiki mediawiki returns Alemannic for gsw; en.wiki preferred name
['alemannisch'] = {'Swiss German', 'gsw'}, -- not an ISO or IANA language name; MediaWiki uses 'als' as a subdomain name for Alemannic Wikipedia: als.wikipedia.org
['bangla'] = {'Bengali', 'bn'}, -- MediaWiki returns Bangla (the endonym) but we want Bengali (the exonym); here we remap
['bengali'] = {'Bengali', 'bn'}, -- MediaWiki doesn't use exonym so here we provide correct language name and 639-1 code
['bhojpuri'] = {'Bhojpuri', 'bho'}, -- MediaWiki uses 'bh' as a subdomain name for Bhojpuri Wikipedia: bh.wikipedia.org
['bihari'] = {'Bihari', 'bh'}, -- MediaWiki replaces 'Bihari' with 'Bhojpuri' so 'Bihari' cannot be found
['blackfoot'] = {'Blackfoot', 'bla'}, -- MediaWiki/IANA/ISO 639: Siksika; use en.wiki preferred name
['colognian'] = {'Colognian', 'ksh-x-colog'}, -- MediaWiki preferred name for ksh
['ilocano'] = {'Ilocano', 'ilo'}, -- MediaWiki/IANA/ISO 639: Iloko; use en.wiki preferred name
['kolsch'] = {'Kölsch', 'ksh'}, -- use IANA/ISO 639 preferred name (use non-diacritical o instead of umlaut ö)
['kölsch'] = {'Kölsch', 'ksh'}, -- use IANA/ISO 639 preferred name
['kven'] = {'Kven', 'fkv'}, -- Unicode CLDR have decided not to support English language name for these two...
['kvensk'] = {'Kven', 'fkv'}, -- ...they say to refer to IANA registry for English names
['ripuarian'] = {'Ripuarian', 'mis-x-ripuar'}, -- group of dialects; no code in MediaWiki or in IANA/ISO 639
['serbian (cyrillic script)'] = {'Serbian (Cyrillic script)', 'sr-cyrl'}, -- special case to get correct tag when |language=sr-ec
['serbian (latin script)'] = {'Serbian (Latin script)', 'sr-latn'}, -- special case to get correct tag when |language=sr-el
['swiss german'] = {'Swiss German', 'gsw'},
['taiwanese hokkien'] = {'Taiwanese Hokkien', 'nan-tw'}, -- make room for MediaWiki/IANA/ISO 639 nan: Min Nan Chinese
['tosk albanian'] = {'Tosk Albanian', 'als'}, -- MediaWiki replaces 'Tosk Albanian' with 'Alemannisch' so 'Tosk Albanian' cannot be found
['valencian'] = {'Valencian', 'ca-valencia'}, -- variant of Catalan; categorizes as Valencian
}
--[[---------------< P R O P E R T I E S _ C A T E G O R I E S >----------------
Properties categories. These are used for investigating qualities of citations.
]]
local prop_cats = {
['foreign-lang-source'] = 'CS1 $1-language sources ($2)', -- |language= categories; $1 is foreign-language name, $2 is ISO639-1 code
['foreign-lang-source-2'] = 'CS1 foreign language sources (ISO 639-2)|$1', -- |language= category; a cat for ISO639-2 languages; $1 is the ISO 639-2 code used as a sort key
['jul-greg-uncertainty'] = 'CS1: Julian–Gregorian uncertainty', -- probably temporary cat to identify scope of template with dates 1 October 1582 – 1 January 1926
['local-lang-source'] = 'CS1 $1-language sources ($2)', -- |language= categories; $1 is local-language name, $2 is ISO639-1 code; not emitted when local_lang_cat_enable is false
['location-test'] = 'CS1 location test',
['long-vol'] = 'CS1: long volume value', -- probably temporary cat to identify scope of |volume= values longer than 4 characters
['script'] = 'CS1 uses $1-language script ($2)', -- |script-title=xx: has matching category; $1 is language name, $2 is ISO639-1 code
['tracked-param'] = 'CS1 tracked parameter: $1', -- $1 is base (enumerators removed) parameter name
['year-range-abbreviated'] = 'CS1: abbreviated year range', -- probably temporary cat to identify scope of |date=, |year= values using YYYY–YY form
}
--[[-------------------< T I T L E _ T Y P E S >--------------------------------
Here we map a template's CitationClass to TitleType (default values for |type= parameter)
]]
local title_types = {
['AV-media-notes'] = 'Media notes',
['document'] = 'Document',
['interview'] = 'Interview',
['mailinglist'] = 'Mailing list',
['map'] = 'Map',
['podcast'] = 'Podcast',
['pressrelease'] = 'Press release',
['report'] = 'Report',
['speech'] = 'Speech',
['techreport'] = 'Technical report',
['thesis'] = 'Thesis',
}
--[[--------------------------< B U I L D _ K N O W N _ F R E E _ D O I _ R E G I S T R A N T S _ T A B L E >--
build a table of doi registrants known to be free-to-read In a doi, the registrant ID is the series of digits
between the '10.' and the first '/': in doi 10.1100/sommat, 1100 is the registrant ID
]]
local function build_free_doi_registrants_table()
local registrants_t = {};
for _, v in ipairs ({
'1100', '1155', '1186', '1371', '1629', '1989', '1999', '2147', '2196', '3285', '3389', '3390', '3410',
'3748', '3814', '3847', '3897', '4061', '4089', '4103', '4172', '4175', '4236', '4239', '4240', '4251',
'4252', '4253', '4254', '4291', '4292', '4329', '4330', '4331', '5194', '5306', '5312', '5313', '5314',
'5315', '5316', '5317', '5318', '5319', '5320', '5321', '5334', '5402', '5409', '5410', '5411', '5412',
'5492', '5493', '5494', '5495', '5496', '5497', '5498', '5499', '5500', '5501', '5527', '5528', '5662',
'6064', '6219', '7167', '7217', '7287', '7482', '7490', '7554', '7717', '7766', '11131', '11569', '11647',
'11648', '12688', '12703', '12715', '12998', '13105', '14293', '14303', '15215', '15412', '15560', '16995',
'17645', '19080', '19173', '20944', '21037', '21468', '21767', '22261', '22459', '24105', '24196', '24966',
'26775', '30845', '32545', '35711', '35712', '35713', '35995', '36648', '37126', '37532', '37871', '47128',
'47622', '47959', '52437', '52975', '53288', '54081', '54947', '55667', '55914', '57009', '58647', '59081',
}) do
registrants_t[v] = true; -- build a k/v table of known free-to-read doi registrants
end
return registrants_t;
end
--[[===================<< E R R O R M E S S A G I N G >>======================
]]
--[[----------< E R R O R M E S S A G E S U P P L I M E N T S >-------------
I18N for those messages that are supplemented with additional specific text that
describes the reason for the error
TODO: merge this with special_case_translations{}?
]]
local err_msg_supl = {
['char'] = 'invalid character', -- |isbn=, |sbn=
['check'] = 'checksum', -- |isbn=, |sbn=
['flag'] = 'flag', -- |archive-url=
['form'] = 'invalid form', -- |isbn=, |sbn=
['group'] = 'invalid group id', -- |isbn=
['initials'] = 'initials', -- Vancouver
['invalid language code'] = 'invalid language code', -- |script-<param>=
['journal'] = 'journal', -- |bibcode=
['length'] = 'length', -- |isbn=, |bibcode=, |sbn=
['liveweb'] = 'liveweb', -- |archive-url=
['missing comma'] = 'missing comma', -- Vancouver
['missing prefix'] = 'missing prefix', -- |script-<param>=
['missing title part'] = 'missing title part', -- |script-<param>=
['name'] = 'name', -- Vancouver
['non-Latin char'] = 'non-Latin character', -- Vancouver
['path'] = 'path', -- |archive-url=
['prefix'] = 'invalid prefix', -- |isbn=
['punctuation'] = 'punctuation', -- Vancouver
['save'] = 'save command', -- |archive-url=
['suffix'] = 'suffix', -- Vancouver
['timestamp'] = 'timestamp', -- |archive-url=
['unknown language code'] = 'unknown language code', -- |script-<param>=
['value'] = 'value', -- |bibcode=
['year'] = 'year', -- |bibcode=
}
--[[--------------< E R R O R _ C O N D I T I O N S >---------------------------
Error condition table. This table has two sections: errors at the top, maintenance
at the bottom. Maint 'messaging' does not have a 'message' (message=nil)
The following contains a list of IDs for various error conditions defined in the
code. For each ID, we specify a text message to display, an error category to
include, and whether the error message should be wrapped as a hidden comment.
Anchor changes require identical changes to matching anchor in Help:CS1 errors
TODO: rename error_conditions{} to something more generic; create separate error
and maint tables inside that?
]]
local error_conditions = {
err_accessdate_missing_url = {
message = '<code class="cs1-code">|access-date=</code> requires <code class="cs1-code">|url=</code>',
anchor = 'accessdate_missing_url',
category = 'CS1 errors: access-date without URL',
hidden = false
},
err_apostrophe_markup = {
message = 'Italic or bold markup not allowed in: <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'apostrophe_markup',
category = 'CS1 errors: markup',
hidden = false
},
err_archive_date_missing_url = {
message = '<code class="cs1-code">|archive-date=</code> requires <code class="cs1-code">|archive-url=</code>',
anchor = 'archive_date_missing_url',
category = 'CS1 errors: archive-url',
hidden = false
},
err_archive_date_url_ts_mismatch = {
message = '<code class="cs1-code">|archive-date=</code> / <code class="cs1-code">|archive-url=</code> timestamp mismatch; $1 suggested',
anchor = 'archive_date_url_ts_mismatch',
category = 'CS1 errors: archive-url',
hidden = false
},
err_archive_missing_date = {
message = '<code class="cs1-code">|archive-url=</code> requires <code class="cs1-code">|archive-date=</code>',
anchor = 'archive_missing_date',
category = 'CS1 errors: archive-url',
hidden = false
},
err_archive_missing_url = {
message = '<code class="cs1-code">|archive-url=</code> requires <code class="cs1-code">|url=</code>',
anchor = 'archive_missing_url',
category = 'CS1 errors: archive-url',
hidden = false
},
err_archive_url = {
message = '<code class="cs1-code">|archive-url=</code> is malformed: $1', -- $1 is error message detail
anchor = 'archive_url',
category = 'CS1 errors: archive-url',
hidden = false
},
err_arxiv_missing = {
message = '<code class="cs1-code">|arxiv=</code> required',
anchor = 'arxiv_missing',
category = 'CS1 errors: arXiv', -- same as bad arxiv
hidden = false
},
err_asintld_missing_asin = {
message = '<code class="cs1-code">|$1=</code> requires <code class="cs1-code">|asin=</code>', -- $1 is parameter name
anchor = 'asintld_missing_asin',
category = 'CS1 errors: ASIN TLD',
hidden = false
},
err_bad_arxiv = {
message = 'Check <code class="cs1-code">|arxiv=</code> value',
anchor = 'bad_arxiv',
category = 'CS1 errors: arXiv',
hidden = false
},
err_bad_asin = {
message = 'Check <code class="cs1-code">|asin=</code> value',
anchor = 'bad_asin',
category ='CS1 errors: ASIN',
hidden = false
},
err_bad_asin_tld = {
message = 'Check <code class="cs1-code">|asin-tld=</code> value',
anchor = 'bad_asin_tld',
category ='CS1 errors: ASIN TLD',
hidden = false
},
err_bad_bibcode = {
message = 'Check <code class="cs1-code">|bibcode=</code> $1', -- $1 is error message detail
anchor = 'bad_bibcode',
category = 'CS1 errors: bibcode',
hidden = false
},
err_bad_biorxiv = {
message = 'Check <code class="cs1-code">|biorxiv=</code> value',
anchor = 'bad_biorxiv',
category = 'CS1 errors: bioRxiv',
hidden = false
},
err_bad_citeseerx = {
message = 'Check <code class="cs1-code">|citeseerx=</code> value',
anchor = 'bad_citeseerx',
category = 'CS1 errors: citeseerx',
hidden = false
},
err_bad_date = {
message = 'Check date values in: $1', -- $1 is a parameter name list
anchor = 'bad_date',
category = 'CS1 errors: dates',
hidden = false
},
err_bad_doi = {
message = 'Check <code class="cs1-code">|doi=</code> value',
anchor = 'bad_doi',
category = 'CS1 errors: DOI',
hidden = false
},
err_bad_hdl = {
message = 'Check <code class="cs1-code">|hdl=</code> value',
anchor = 'bad_hdl',
category = 'CS1 errors: HDL',
hidden = false
},
err_bad_isbn = {
message = 'Check <code class="cs1-code">|isbn=</code> value: $1', -- $1 is error message detail
anchor = 'bad_isbn',
category = 'CS1 errors: ISBN',
hidden = false
},
err_bad_ismn = {
message = 'Check <code class="cs1-code">|ismn=</code> value',
anchor = 'bad_ismn',
category = 'CS1 errors: ISMN',
hidden = false
},
err_bad_issn = {
message = 'Check <code class="cs1-code">|$1issn=</code> value', -- $1 is 'e' or '' for eissn or issn
anchor = 'bad_issn',
category = 'CS1 errors: ISSN',
hidden = false
},
err_bad_jfm = {
message = 'Check <code class="cs1-code">|jfm=</code> value',
anchor = 'bad_jfm',
category = 'CS1 errors: JFM',
hidden = false
},
err_bad_jstor = {
message = 'Check <code class="cs1-code">|jstor=</code> value',
anchor = 'bad_jstor',
category = 'CS1 errors: JSTOR',
hidden = false
},
err_bad_lccn = {
message = 'Check <code class="cs1-code">|lccn=</code> value',
anchor = 'bad_lccn',
category = 'CS1 errors: LCCN',
hidden = false
},
err_bad_medrxiv = {
message = 'Check <code class="cs1-code">|medrxiv=</code> value',
anchor = 'bad_medrxiv',
category = 'CS1 errors: medRxiv',
hidden = false
},
err_bad_mr = {
message = 'Check <code class="cs1-code">|mr=</code> value',
anchor = 'bad_mr',
category = 'CS1 errors: MR',
hidden = false
},
err_bad_oclc = {
message = 'Check <code class="cs1-code">|oclc=</code> value',
anchor = 'bad_oclc',
category = 'CS1 errors: OCLC',
hidden = false
},
err_bad_ol = {
message = 'Check <code class="cs1-code">|ol=</code> value',
anchor = 'bad_ol',
category = 'CS1 errors: OL',
hidden = false
},
err_bad_osti = {
message = 'Check <code class="cs1-code">|osti=</code> value',
anchor = 'bad_osti',
category = 'CS1 errors: OSTI',
hidden = false
},
err_bad_paramlink = { -- for |title-link=, |author/editor/translator-link=, |series-link=, |episode-link=
message = 'Check <code class="cs1-code">|$1=</code> value', -- $1 is parameter name
anchor = 'bad_paramlink',
category = 'CS1 errors: parameter link',
hidden = false
},
err_bad_pmc = {
message = 'Check <code class="cs1-code">|pmc=</code> value',
anchor = 'bad_pmc',
category = 'CS1 errors: PMC',
hidden = false
},
err_bad_pmid = {
message = 'Check <code class="cs1-code">|pmid=</code> value',
anchor = 'bad_pmid',
category = 'CS1 errors: PMID',
hidden = false
},
err_bad_rfc = {
message = 'Check <code class="cs1-code">|rfc=</code> value',
anchor = 'bad_rfc',
category = 'CS1 errors: RFC',
hidden = false
},
err_bad_s2cid = {
message = 'Check <code class="cs1-code">|s2cid=</code> value',
anchor = 'bad_s2cid',
category = 'CS1 errors: S2CID',
hidden = false
},
err_bad_sbn = {
message = 'Check <code class="cs1-code">|sbn=</code> value: $1', -- $1 is error message detail
anchor = 'bad_sbn',
category = 'CS1 errors: SBN',
hidden = false
},
err_bad_ssrn = {
message = 'Check <code class="cs1-code">|ssrn=</code> value',
anchor = 'bad_ssrn',
category = 'CS1 errors: SSRN',
hidden = false
},
err_bad_url = {
message = 'Check $1 value', -- $1 is parameter name
anchor = 'bad_url',
category = 'CS1 errors: URL',
hidden = false
},
err_bad_usenet_id = {
message = 'Check <code class="cs1-code">|message-id=</code> value',
anchor = 'bad_message_id',
category = 'CS1 errors: message-id',
hidden = false
},
err_bad_zbl = {
message = 'Check <code class="cs1-code">|zbl=</code> value',
anchor = 'bad_zbl',
category = 'CS1 errors: Zbl',
hidden = false
},
err_bare_url_missing_title = {
message = '$1 missing title', -- $1 is parameter name
anchor = 'bare_url_missing_title',
category = 'CS1 errors: bare URL',
hidden = false
},
err_biorxiv_missing = {
message = '<code class="cs1-code">|biorxiv=</code> required',
anchor = 'biorxiv_missing',
category = 'CS1 errors: bioRxiv', -- same as bad bioRxiv
hidden = false
},
err_chapter_ignored = {
message = '<code class="cs1-code">|$1=</code> ignored', -- $1 is parameter name
anchor = 'chapter_ignored',
category = 'CS1 errors: chapter ignored',
hidden = false
},
err_citation_missing_title = {
message = 'Missing or empty <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'citation_missing_title',
category = 'CS1 errors: missing title',
hidden = false
},
err_citeseerx_missing = {
message = '<code class="cs1-code">|citeseerx=</code> required',
anchor = 'citeseerx_missing',
category = 'CS1 errors: citeseerx', -- same as bad citeseerx
hidden = false
},
err_cite_web_url = { -- this error applies to cite web and to cite podcast
message = 'Missing or empty <code class="cs1-code">|url=</code>',
anchor = 'cite_web_url',
category = 'CS1 errors: requires URL',
hidden = false
},
err_class_ignored = {
message = '<code class="cs1-code">|class=</code> ignored',
anchor = 'class_ignored',
category = 'CS1 errors: class',
hidden = false
},
err_contributor_ignored = {
message = '<code class="cs1-code">|contributor=</code> ignored',
anchor = 'contributor_ignored',
category = 'CS1 errors: contributor',
hidden = false
},
err_contributor_missing_required_param = {
message = '<code class="cs1-code">|contributor=</code> requires <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'contributor_missing_required_param',
category = 'CS1 errors: contributor',
hidden = false
},
err_deprecated_params = {
message = 'Cite uses deprecated parameter <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'deprecated_params',
category = 'CS1 errors: deprecated parameters',
hidden = false
},
err_disp_name = {
message = 'Invalid <code class="cs1-code">|$1=$2</code>', -- $1 is parameter name; $2 is the assigned value
anchor = 'disp_name',
category = 'CS1 errors: display-names',
hidden = false,
},
err_doibroken_missing_doi = {
message = '<code class="cs1-code">|$1=</code> requires <code class="cs1-code">|doi=</code>', -- $1 is parameter name
anchor = 'doibroken_missing_doi',
category = 'CS1 errors: DOI',
hidden = false
},
err_embargo_missing_pmc = {
message = '<code class="cs1-code">|$1=</code> requires <code class="cs1-code">|pmc=</code>', -- $1 is parameter name
anchor = 'embargo_missing_pmc',
category = 'CS1 errors: PMC embargo',
hidden = false
},
err_empty_citation = {
message = 'Empty citation',
anchor = 'empty_citation',
category = 'CS1 errors: empty citation',
hidden = false
},
err_etal = {
message = 'Explicit use of et al. in: <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'explicit_et_al',
category = 'CS1 errors: explicit use of et al.',
hidden = false
},
err_extra_text_edition = {
message = '<code class="cs1-code">|edition=</code> has extra text',
anchor = 'extra_text_edition',
category = 'CS1 errors: extra text: edition',
hidden = false,
},
err_extra_text_issue = {
message = '<code class="cs1-code">|$1=</code> has extra text', -- $1 is parameter name
anchor = 'extra_text_issue',
category = 'CS1 errors: extra text: issue',
hidden = false,
},
err_extra_text_pages = {
message = '<code class="cs1-code">|$1=</code> has extra text', -- $1 is parameter name
anchor = 'extra_text_pages',
category = 'CS1 errors: extra text: pages',
hidden = false,
},
err_extra_text_volume = {
message = '<code class="cs1-code">|$1=</code> has extra text', -- $1 is parameter name
anchor = 'extra_text_volume',
category = 'CS1 errors: extra text: volume',
hidden = false,
},
err_first_missing_last = {
message = '<code class="cs1-code">|$1=</code> missing <code class="cs1-code">|$2=</code>', -- $1 is first alias, $2 is matching last alias
anchor = 'first_missing_last',
category = 'CS1 errors: missing name', -- author, contributor, editor, interviewer, translator
hidden = false
},
err_format_missing_url = {
message = '<code class="cs1-code">|$1=</code> requires <code class="cs1-code">|$2=</code>', -- $1 is format parameter $2 is url parameter
anchor = 'format_missing_url',
category = 'CS1 errors: format without URL',
hidden = false
},
err_generic_name = {
message = '<code class="cs1-code">|$1=</code> has generic name', -- $1 is parameter name
anchor = 'generic_name',
category = 'CS1 errors: generic name',
hidden = false,
},
err_generic_title = {
message = 'Cite uses generic title',
anchor = 'generic_title',
category = 'CS1 errors: generic title',
hidden = false,
},
err_invalid_param_val = {
message = 'Invalid <code class="cs1-code">|$1=$2</code>', -- $1 is parameter name $2 is parameter value
anchor = 'invalid_param_val',
category = 'CS1 errors: invalid parameter value',
hidden = false
},
err_invisible_char = {
message = '$1 in $2 at position $3', -- $1 is invisible char $2 is parameter name $3 is position number
anchor = 'invisible_char',
category = 'CS1 errors: invisible characters',
hidden = false
},
err_medrxiv_missing = {
message = '<code class="cs1-code">|medrxiv=</code> required',
anchor = 'medrxiv_missing',
category = 'CS1 errors: medRxiv', -- same as bad medRxiv
hidden = false
},
err_missing_name = {
message = 'Missing <code class="cs1-code">|$1$2=</code>', -- $1 is modified NameList; $2 is enumerator
anchor = 'missing_name',
category = 'CS1 errors: missing name', -- author, contributor, editor, interviewer, translator
hidden = false
},
err_missing_periodical = {
message = 'Cite $1 requires <code class="cs1-code">|$2=</code>', -- $1 is cs1 template name; $2 is canonical periodical parameter name for cite $1
anchor = 'missing_periodical',
category = 'CS1 errors: missing periodical',
hidden = false
},
err_missing_pipe = {
message = 'Missing pipe in: <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'missing_pipe',
category = 'CS1 errors: missing pipe',
hidden = false
},
err_missing_publisher = {
message = 'Cite $1 requires <code class="cs1-code">|$2=</code>', -- $1 is cs1 template name; $2 is canonical publisher parameter name for cite $1
anchor = 'missing_publisher',
category = 'CS1 errors: missing publisher',
hidden = false
},
err_numeric_names = {
message = '<code class="cs1-code">|$1=</code> has numeric name', -- $1 is parameter name',
anchor = 'numeric_names',
category = 'CS1 errors: numeric name',
hidden = false,
},
err_param_access_requires_param = {
message = '<code class="cs1-code">|$1-access=</code> requires <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'param_access_requires_param',
category = 'CS1 errors: param-access',
hidden = false
},
err_param_has_ext_link = {
message = 'External link in <code class="cs1-code">$1</code>', -- $1 is parameter name
anchor = 'param_has_ext_link',
category = 'CS1 errors: external links',
hidden = false
},
err_parameter_ignored = {
message = 'Unknown parameter <code class="cs1-code">|$1=</code> ignored', -- $1 is parameter name
anchor = 'parameter_ignored',
category = 'CS1 errors: unsupported parameter',
hidden = false
},
err_parameter_ignored_suggest = {
message = 'Unknown parameter <code class="cs1-code">|$1=</code> ignored (<code class="cs1-code">|$2=</code> suggested)', -- $1 is unknown parameter $2 is suggested parameter name
anchor = 'parameter_ignored_suggest',
category = 'CS1 errors: unsupported parameter',
hidden = false
},
err_periodical_ignored = {
message = '<code class="cs1-code">|$1=</code> ignored', -- $1 is parameter name
anchor = 'periodical_ignored',
category = 'CS1 errors: periodical ignored',
hidden = false
},
err_redundant_parameters = {
message = 'More than one of $1 specified', -- $1 is error message detail
anchor = 'redundant_parameters',
category = 'CS1 errors: redundant parameter',
hidden = false
},
err_script_parameter = {
message = 'Invalid <code class="cs1-code">|$1=</code>: $2', -- $1 is parameter name $2 is script language code or error detail
anchor = 'script_parameter',
category = 'CS1 errors: script parameters',
hidden = false
},
err_ssrn_missing = {
message = '<code class="cs1-code">|ssrn=</code> required',
anchor = 'ssrn_missing',
category = 'CS1 errors: SSRN',
hidden = false
},
err_text_ignored = {
message = 'Text "$1" ignored', -- $1 is ignored text
anchor = 'text_ignored',
category = 'CS1 errors: unrecognized parameter',
hidden = false
},
err_trans_missing_title = {
message = '<code class="cs1-code">|trans-$1=</code> requires <code class="cs1-code">|$1=</code> or <code class="cs1-code">|script-$1=</code>', -- $1 is base parameter name
anchor = 'trans_missing_title',
category = 'CS1 errors: translated title',
hidden = false
},
err_param_unknown_empty = {
message = 'Cite has empty unknown parameter$1: $2', -- $1 is 's' or empty space; $2 is emty unknown param list
anchor = 'param_unknown_empty',
category = 'CS1 errors: empty unknown parameters',
hidden = false
},
err_vancouver = {
message = 'Vancouver style error: $1 in name $2', -- $1 is error detail, $2 is the nth name
anchor = 'vancouver',
category = 'CS1 errors: Vancouver style',
hidden = false
},
err_wikilink_in_url = {
message = 'URL–wikilink conflict', -- uses ndash
anchor = 'wikilink_in_url',
category = 'CS1 errors: URL–wikilink conflict', -- uses ndash
hidden = false
},
--[[--------------------------< M A I N T >-------------------------------------
maint messages do not have a message (message = nil); otherwise the structure
is the same as error messages
]]
maint_archived_copy = {
message = nil,
anchor = 'archived_copy',
category = 'CS1 maint: archived copy as title',
hidden = true,
},
maint_bibcode = {
message = nil,
anchor = 'bibcode',
category = 'CS1 maint: bibcode',
hidden = true,
},
maint_location_no_publisher = { -- cite book, conference, encyclopedia; citation as book cite or encyclopedia cite
message = nil,
anchor = 'location_no_publisher',
category = 'CS1 maint: location missing publisher',
hidden = true,
},
maint_bot_unknown = {
message = nil,
anchor = 'bot:_unknown',
category = 'CS1 maint: bot: original URL status unknown',
hidden = true,
},
maint_date_auto_xlated = { -- date auto-translation not supported by en.wiki
message = nil,
anchor = 'date_auto_xlated',
category = 'CS1 maint: date auto-translated',
hidden = true,
},
maint_date_format = {
message = nil,
anchor = 'date_format',
category = 'CS1 maint: date format',
hidden = true,
},
maint_date_year = {
message = nil,
anchor = 'date_year',
category = 'CS1 maint: date and year',
hidden = true,
},
maint_doi_ignore = {
message = nil,
anchor = 'doi_ignore',
category = 'CS1 maint: ignored DOI errors',
hidden = true,
},
maint_doi_inactive = {
message = nil,
anchor = 'doi_inactive',
category = 'CS1 maint: DOI inactive',
hidden = true,
},
maint_doi_inactive_dated = {
message = nil,
anchor = 'doi_inactive_dated',
category = 'CS1 maint: DOI inactive as of $2$3$1', -- $1 is year, $2 is month-name or empty string, $3 is space or empty string
hidden = true,
},
maint_doi_unflagged_free = {
message = nil,
anchor = 'doi_unflagged_free',
category = 'CS1 maint: unflagged free DOI',
hidden = true,
},
maint_extra_punct = {
message = nil,
anchor = 'extra_punct',
category = 'CS1 maint: extra punctuation',
hidden = true,
},
maint_isbn_ignore = {
message = nil,
anchor = 'ignore_isbn_err',
category = 'CS1 maint: ignored ISBN errors',
hidden = true,
},
maint_issn_ignore = {
message = nil,
anchor = 'ignore_issn',
category = 'CS1 maint: ignored ISSN errors',
hidden = true,
},
maint_jfm_format = {
message = nil,
anchor = 'jfm_format',
category = 'CS1 maint: JFM format',
hidden = true,
},
maint_location = {
message = nil,
anchor = 'location',
category = 'CS1 maint: location',
hidden = true,
},
maint_mr_format = {
message = nil,
anchor = 'mr_format',
category = 'CS1 maint: MR format',
hidden = true,
},
maint_mult_names = {
message = nil,
anchor = 'mult_names',
category = 'CS1 maint: multiple names: $1', -- $1 is '<name>s list'; gets value from special_case_translation table
hidden = true,
},
maint_numeric_names = {
message = nil,
anchor = 'numeric_names',
category = 'CS1 maint: numeric names: $1', -- $1 is '<name>s list'; gets value from special_case_translation table
hidden = true,
},
maint_others = {
message = nil,
anchor = 'others',
category = 'CS1 maint: others',
hidden = true,
},
maint_others_avm = {
message = nil,
anchor = 'others_avm',
category = 'CS1 maint: others in cite AV media (notes)',
hidden = true,
},
maint_overridden_setting = {
message = nil,
anchor = 'overridden',
category = 'CS1 maint: overridden setting',
hidden = true,
},
maint_pmc_embargo = {
message = nil,
anchor = 'embargo',
category = 'CS1 maint: PMC embargo expired',
hidden = true,
},
maint_pmc_format = {
message = nil,
anchor = 'pmc_format',
category = 'CS1 maint: PMC format',
hidden = true,
},
maint_postscript = {
message = nil,
anchor = 'postscript',
category = 'CS1 maint: postscript',
hidden = true,
},
maint_ref_duplicates_default = {
message = nil,
anchor = 'ref_default',
category = 'CS1 maint: ref duplicates default',
hidden = true,
},
maint_unfit = {
message = nil,
anchor = 'unfit',
category = 'CS1 maint: unfit URL',
hidden = true,
},
maint_unknown_lang = {
message = nil,
anchor = 'unknown_lang',
category = 'CS1 maint: unrecognized language',
hidden = true,
},
maint_untitled = {
message = nil,
anchor = 'untitled',
category = 'CS1 maint: untitled periodical',
hidden = true,
},
maint_url_status = {
message = nil,
anchor = 'url_status',
category = 'CS1 maint: url-status',
hidden = true,
},
maint_zbl = {
message = nil,
anchor = 'zbl',
category = 'CS1 maint: Zbl',
hidden = true,
},
}
--[[--------------------------< I D _ H A N D L E R S >--------------------------------------------------------
The following contains a list of values for various defined identifiers. For each
identifier we specify a variety of information necessary to properly render the
identifier in the citation.
parameters: a list of parameter aliases for this identifier; first in the list is the canonical form
link: Wikipedia article name
redirect: a local redirect to a local Wikipedia article name; at en.wiki, 'ISBN (identifier)' is a redirect to 'International Standard Book Number'
q: Wikidata q number for the identifier
label: the label preceding the identifier; label is linked to a Wikipedia article (in this order):
redirect from id_handlers['<id>'].redirect when use_identifier_redirects is true
Wikidata-supplied article name for the local wiki from id_handlers['<id>'].q
local article name from id_handlers['<id>'].link
prefix: the first part of a URL that will be concatenated with a second part which usually contains the identifier
suffix: optional third part to be added after the identifier
encode: true if URI should be percent-encoded; otherwise false
COinS: identifier link or keyword for use in COinS:
for identifiers registered at info-uri.info use: info:.... where '...' is the appropriate identifier label
for identifiers that have COinS keywords, use the keyword: rft.isbn, rft.issn, rft.eissn
for |asin= and |ol=, which require assembly, use the keyword: url
for others make a URL using the value in prefix/suffix and #label, use the keyword: pre (not checked; any text other than 'info', 'rft', or 'url' works here)
set to nil to leave the identifier out of the COinS
separator: character or text between label and the identifier in the rendered citation
id_limit: for those identifiers with established limits, this property holds the upper limit
access: use this parameter to set the access level for all instances of this identifier.
the value must be a valid access level for an identifier (see ['id-access'] in this file).
custom_access: to enable custom access level for an identifier, set this parameter
to the parameter that should control it (normally 'id-access')
]]
local id_handlers = {
['ARXIV'] = {
parameters = {'arxiv', 'eprint'},
link = 'arXiv',
redirect = 'arXiv (identifier)',
q = 'Q118398',
label = 'arXiv',
prefix = 'https://arxiv.org/abs/',
encode = false,
COinS = 'info:arxiv',
separator = ':',
access = 'free', -- free to read
},
['ASIN'] = {
parameters = { 'asin', 'ASIN' },
link = 'Amazon Standard Identification Number',
redirect = 'ASIN (identifier)',
q = 'Q1753278',
label = 'ASIN',
prefix = 'https://www.amazon.',
COinS = 'url',
separator = ' ',
encode = false;
},
['BIBCODE'] = {
parameters = {'bibcode'},
link = 'Bibcode',
redirect = 'Bibcode (identifier)',
q = 'Q25754',
label = 'Bibcode',
prefix = 'https://ui.adsabs.harvard.edu/abs/',
encode = false,
COinS = 'info:bibcode',
separator = ':',
custom_access = 'bibcode-access',
},
['BIORXIV'] = {
parameters = {'biorxiv'},
link = 'bioRxiv',
redirect = 'bioRxiv (identifier)',
q = 'Q19835482',
label = 'bioRxiv',
prefix = 'https://doi.org/',
COinS = 'pre', -- use prefix value
access = 'free', -- free to read
encode = true,
separator = ' ',
},
['CITESEERX'] = {
parameters = {'citeseerx'},
link = 'CiteSeerX',
redirect = 'CiteSeerX (identifier)',
q = 'Q2715061',
label = 'CiteSeerX',
prefix = 'https://citeseerx.ist.psu.edu/viewdoc/summary?doi=',
COinS = 'pre', -- use prefix value
access = 'free', -- free to read
encode = true,
separator = ' ',
},
['DOI'] = { -- Used by InternetArchiveBot
parameters = { 'doi', 'DOI'},
link = 'Digital object identifier',
redirect = 'doi (identifier)',
q = 'Q25670',
label = 'doi',
prefix = 'https://doi.org/',
COinS = 'info:doi',
separator = ':',
encode = true,
custom_access = 'doi-access',
},
['EISSN'] = {
parameters = {'eissn', 'EISSN'},
link = 'International Standard Serial Number#Electronic ISSN',
redirect = 'eISSN (identifier)',
q = 'Q46339674',
label = 'eISSN',
prefix = 'https://www.worldcat.org/issn/',
COinS = 'rft.eissn',
encode = false,
separator = ' ',
},
['HDL'] = {
parameters = { 'hdl', 'HDL' },
link = 'Handle System',
redirect = 'hdl (identifier)',
q = 'Q3126718',
label = 'hdl',
prefix = 'https://hdl.handle.net/',
COinS = 'info:hdl',
separator = ':',
encode = true,
custom_access = 'hdl-access',
},
['ISBN'] = { -- Used by InternetArchiveBot
parameters = {'isbn', 'ISBN'},
link = 'International Standard Book Number',
redirect = 'ISBN (identifier)',
q = 'Q33057',
label = 'ISBN',
prefix = 'Special:BookSources/',
COinS = 'rft.isbn',
separator = ' ',
},
['ISMN'] = {
parameters = {'ismn', 'ISMN'},
link = 'International Standard Music Number',
redirect = 'ISMN (identifier)',
q = 'Q1666938',
label = 'ISMN',
prefix = '', -- not currently used;
COinS = nil, -- nil because we can't use pre or rft or info:
separator = ' ',
},
['ISSN'] = {
parameters = {'issn', 'ISSN'},
link = 'International Standard Serial Number',
redirect = 'ISSN (identifier)',
q = 'Q131276',
label = 'ISSN',
prefix = 'https://www.worldcat.org/issn/',
COinS = 'rft.issn',
encode = false,
separator = ' ',
},
['JFM'] = {
parameters = {'jfm', 'JFM'},
link = 'Jahrbuch über die Fortschritte der Mathematik',
redirect = 'JFM (identifier)',
q = '',
label = 'JFM',
prefix = 'https://zbmath.org/?format=complete&q=an:',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
},
['JSTOR'] = {
parameters = {'jstor', 'JSTOR'},
link = 'JSTOR',
redirect = 'JSTOR (identifier)',
q = 'Q1420342',
label = 'JSTOR',
prefix = 'https://www.jstor.org/stable/',
COinS = 'pre', -- use prefix value
encode = false,
separator = ' ',
custom_access = 'jstor-access',
},
['LCCN'] = {
parameters = {'lccn', 'LCCN'},
link = 'Library of Congress Control Number',
redirect = 'LCCN (identifier)',
q = 'Q620946',
label = 'LCCN',
prefix = 'https://lccn.loc.gov/',
COinS = 'info:lccn',
encode = false,
separator = ' ',
},
['MEDRXIV'] = {
parameters = {'medrxiv'},
link = 'medRxiv',
redirect = 'medRxiv (identifier)',
q = 'Q58465838',
label = 'medRxiv',
prefix = 'https://www.medrxiv.org/content/',
COinS = 'pre', -- use prefix value
access = 'free', -- free to read
encode = false,
separator = ' ',
},
['MR'] = {
parameters = {'mr', 'MR'},
link = 'Mathematical Reviews',
redirect = 'MR (identifier)',
q = 'Q211172',
label = 'MR',
prefix = 'https://mathscinet.ams.org/mathscinet-getitem?mr=',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
},
['OCLC'] = {
parameters = {'oclc', 'OCLC'},
link = 'OCLC',
redirect = 'OCLC (identifier)',
q = 'Q190593',
label = 'OCLC',
prefix = 'https://www.worldcat.org/oclc/',
COinS = 'info:oclcnum',
encode = true,
separator = ' ',
id_limit = 10100000000,
},
['OL'] = {
parameters = { 'ol', 'OL' },
link = 'Open Library',
redirect = 'OL (identifier)',
q = 'Q1201876',
label = 'OL',
prefix = 'https://openlibrary.org/',
COinS = 'url',
separator = ' ',
encode = true,
custom_access = 'ol-access',
},
['OSTI'] = {
parameters = {'osti', 'OSTI'},
link = 'Office of Scientific and Technical Information',
redirect = 'OSTI (identifier)',
q = 'Q2015776',
label = 'OSTI',
prefix = 'https://www.osti.gov/biblio/',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
id_limit = 23010000,
custom_access = 'osti-access',
},
['PMC'] = {
parameters = {'pmc', 'PMC'},
link = 'PubMed Central',
redirect = 'PMC (identifier)',
q = 'Q229883',
label = 'PMC',
prefix = 'https://www.ncbi.nlm.nih.gov/pmc/articles/PMC',
suffix = '',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
id_limit = 10900000,
access = 'free', -- free to read
},
['PMID'] = {
parameters = {'pmid', 'PMID'},
link = 'PubMed Identifier',
redirect = 'PMID (identifier)',
q = 'Q2082879',
label = 'PMID',
prefix = 'https://pubmed.ncbi.nlm.nih.gov/',
COinS = 'info:pmid',
encode = false,
separator = ' ',
id_limit = 38400000,
},
['RFC'] = {
parameters = {'rfc', 'RFC'},
link = 'Request for Comments',
redirect = 'RFC (identifier)',
q = 'Q212971',
label = 'RFC',
prefix = 'https://tools.ietf.org/html/rfc',
COinS = 'pre', -- use prefix value
encode = false,
separator = ' ',
id_limit = 9300,
access = 'free', -- free to read
},
['SBN'] = {
parameters = {'sbn', 'SBN'},
link = 'Standard Book Number', -- redirect to International_Standard_Book_Number#History
redirect = 'SBN (identifier)',
label = 'SBN',
prefix = 'Special:BookSources/0-', -- prefix has leading zero necessary to make 9-digit sbn a 10-digit isbn
COinS = nil, -- nil because we can't use pre or rft or info:
separator = ' ',
},
['SSRN'] = {
parameters = {'ssrn', 'SSRN'},
link = 'Social Science Research Network',
redirect = 'SSRN (identifier)',
q = 'Q7550801',
label = 'SSRN',
prefix = 'https://papers.ssrn.com/sol3/papers.cfm?abstract_id=',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
id_limit = 4700000,
custom_access = 'ssrn-access',
},
['S2CID'] = {
parameters = {'s2cid', 'S2CID'},
link = 'Semantic Scholar',
redirect = 'S2CID (identifier)',
q = 'Q22908627',
label = 'S2CID',
prefix = 'https://api.semanticscholar.org/CorpusID:',
COinS = 'pre', -- use prefix value
encode = false,
separator = ' ',
id_limit = 268000000,
custom_access = 's2cid-access',
},
['USENETID'] = {
parameters = {'message-id'},
link = 'Usenet',
redirect = 'Usenet (identifier)',
q = 'Q193162',
label = 'Usenet:',
prefix = 'news:',
encode = false,
COinS = 'pre', -- use prefix value
separator = ' ',
},
['ZBL'] = {
parameters = {'zbl', 'ZBL' },
link = 'Zentralblatt MATH',
redirect = 'Zbl (identifier)',
q = 'Q190269',
label = 'Zbl',
prefix = 'https://zbmath.org/?format=complete&q=an:',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
},
}
--[[--------------------------< E X P O R T S >---------------------------------
]]
return {
use_identifier_redirects = use_identifier_redirects, -- booleans defined in the settings at the top of this module
local_lang_cat_enable = local_lang_cat_enable,
date_name_auto_xlate_enable = date_name_auto_xlate_enable,
date_digit_auto_xlate_enable = date_digit_auto_xlate_enable,
enable_sort_keys = enable_sort_keys,
-- tables and variables created when this module is loaded
global_df = get_date_format (), -- this line can be replaced with "global_df = 'dmy-all'," to have all dates auto translated to dmy format.
global_cs1_config_t = global_cs1_config_t, -- global settings from {{cs1 config}}
punct_skip = build_skip_table (punct_skip, punct_meta_params),
url_skip = build_skip_table (url_skip, url_meta_params),
known_free_doi_registrants_t = build_free_doi_registrants_table(),
name_space_sort_keys = name_space_sort_keys,
aliases = aliases,
special_case_translation = special_case_translation,
date_names = date_names,
err_msg_supl = err_msg_supl,
error_conditions = error_conditions,
editor_markup_patterns = editor_markup_patterns,
et_al_patterns = et_al_patterns,
id_handlers = id_handlers,
keywords_lists = keywords_lists,
keywords_xlate = keywords_xlate,
stripmarkers = stripmarkers,
invisible_chars = invisible_chars,
invisible_defs = invisible_defs,
indic_script = indic_script,
emoji_t = emoji_t,
maint_cats = maint_cats,
messages = messages,
presentation = presentation,
prop_cats = prop_cats,
script_lang_codes = script_lang_codes,
lang_tag_remap = lang_tag_remap,
lang_name_remap = lang_name_remap,
this_wiki_code = this_wiki_code,
title_types = title_types,
uncategorized_namespaces = uncategorized_namespaces_t,
uncategorized_subpages = uncategorized_subpages,
templates_using_volume = templates_using_volume,
templates_using_issue = templates_using_issue,
templates_not_using_page = templates_not_using_page,
vol_iss_pg_patterns = vol_iss_pg_patterns,
single_letter_2nd_lvl_domains_t = single_letter_2nd_lvl_domains_t,
inter_wiki_map = inter_wiki_map,
mw_languages_by_tag_t = mw_languages_by_tag_t,
mw_languages_by_name_t = mw_languages_by_name_t,
citation_class_map_t = citation_class_map_t,
citation_issue_t = citation_issue_t,
citation_no_volume_t = citation_no_volume_t,
}
3956dfb46c5ef5d8df0c4e2c2f1bd2a4dfffc666
Module:Political party/U
828
238
468
2023-12-16T16:04:58Z
wikipedia>Vacant0
0
United for Justice
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["U.S. Labor Party of the District of Columbia"] = "U.S. Labor Party",
["U.S. Taxpayers' Party"] = "Constitution Party (US)",
["UDAR"] = "Ukrainian Democratic Alliance for Reform",
["UDI"] = "Union of Democrats and Independents",
["UK National Government"] = "National Government (United Kingdom)",
["UKIP"] = "UK Independence Party",
["Ukrainian Strategy"] = "Ukrainian Strategy of Groysman",
["Ulster Conservatives and Unionists - New Force"] = "Ulster Conservatives and Unionists",
["Ulster Conservatives and Unionists – New Force"] = "Ulster Conservatives and Unionists", -- dash differences
["Ultra-royalist"] = "Legitimists",
["Unaffiliated"] = "Unaffiliated politician",
["Unconditional Unionist Party (US)"] = "Unconditional Unionist Party",
["Unidas Podemos cambiar Europa"] = "Unidas Podemos",
["Unidos Podemos"] = "Unidas Podemos",
["United Left (Greece)"] = "Communist Party of Greece",
["United Opposition (Hungary)"] = "United for Hungary",
["Unified Communist Party of Nepal (Maoist)"] = "Communist Party of Nepal (Maoist Centre)",
["Unified Socialist Party"] = "Unified Socialist Party (France)",
["Union Démocratique Bretonne"] = "Breton Democratic Union",
["Union for Democracy (Finland)"] = "Finnish People's Unity Party",
["Union for France"] = "Rally for the Republic",
["Union for French Democracy (alliance)"] = "Union for French Democracy",
["Union for Latvia"] = "For a Humane Latvia",
["Union for the Presidential Majority"] = "Union for a Popular Movement",
["Union for the Republic-Res Publica"] = "Res Publica Party",
["Union for the Republic–Res Publica"] = "Res Publica Party", -- dash differences
["Union for the Fatherland"] = "Union for the Homeland",
["Union Labor Party (California)"] = "Union Labor Party",
["Union Labor Party (United States)"] = "Union Labor Party",
["Union of Centrists of Menorca"] = "Menorcan Union",
["Union of Christian and Centre Democrats"] = "Union of the Centre (2002)",
["Union of Franchophones"] = "Union des Francophones",
["Union of the Centre (2008)"] = "Union of the Centre (2002)",
["Union of the Left (Luxembourg)"] = "Radical Socialist Party (Luxembourg)",
["Union of the Left (Poland)"] = "Freedom and Equality",
["Union of the Right (Poland)"] = "Real Politics Union",
["Union Party (United States)"] = "Union Party (US)",
["Unión por la Patria"] = "Union for the Homeland",
["Unionist Party (United States)"] = "Unionist Party (US)",
["Unionist Party"] = "Unionist Party (US)",
["United Canarian Left"] = "United Left (Spain)",
["United Citizens Association of Macau"] = "Macau United Citizens Association",
["United Country Party (Australia)"] = "National Party of Australia",
["United Democratic Party (Gambia)"] = "United Democratic Party (The Gambia)",
["United Front (Singapore)"] = "Democratic Progressive Party (Singapore)",
["United Future New Zealand"] = "United Future",
["United Galicia Party"] = "United Galicia",
["United Kingdom Independence Party"] = "UK Independence Party",
["United Kingdom Libertarian Party"] = "Libertarian Party (UK)",
["United Labour Party"] = "Unity Labour Party",
["United Land Party"] = "Sahaphum Party",
["United Left (Galicia)"] = "United Left (Spain)",
["United Left and Peasants"] = "Justice Party (Ukraine)",
["United Left Catalonia"] = "United Left (Spain)",
["United Left Extremadura"] = "United Left (Spain)",
["United Left of Aragon"] = "United Left (Spain)",
["United Left of Asturias"] = "United Left (Spain)",
["United Left of Cantabria"] = "United Left (Spain)",
["United Left of Castile and León"] = "United Left (Spain)",
["United Left of Navarre"] = "United Left (Spain)",
["United Left of the Balearic Islands"] = "United Left (Spain)",
["United Left of the Community of Madrid"] = "United Left (Spain)",
["United Left of the Valencian Country"] = "United Left (Spain)",
["United Left–Assembly for Andalusia"] = "United Left (Spain)",
["United Left–Greens of the Region of Murcia"] = "United Left (Spain)",
["United Left–Madrid"] = "United Left (Spain)",
["United National Movement"] = "United National Movement (Georgia)",
["United National South West Party"] = "United Party (South Africa)",
["United New Democratic Party"] = "Grand Unified Democratic New Party",
["United People's Party (Malaysia)"] = "Sarawak United Party",
["United States Independence Party"] = "Independence Party (US)",
["United States Marijuana Party"] = "Marijuana Party (US)",
["United States Natural Law Party"] = "Natural Law Party (US)",
["United States Whig Party"] = "Whig Party (US)",
["United Thai Nation"] = "United Thai Nation Party",
["United/Reform Coalition"] = "United–Reform Coalition",
["Units Podem Més"] = "Unidas Podemos",
["Unity (Latvian political party)"] = "Unity (Latvia)",
["Unity (political party, Latvia)"] = "Unity (Latvia)",
["Unity (Ukraine)"] = "Unity of Oleksandr Omelchenko",
["Unity For Peace And Socialism"] = "Unity for Peace and Socialism",
["Unity List (Denmark)"] = "Red–Green Alliance (Denmark)",
["Unity"] = "Unity (Northern Ireland)",
["Unrepresented People’s Party"] = "Unrepresented Peoples Party",
["Unsubmissive France"] = "La France Insoumise",
["Upper House branch of the Lantmanna Party"] = "Lantmanna Party",
["Urban Tax Reform Party"] = "Other parties",
["US Marijuana Party"] = "Marijuana Party (US)",
["US Taxpayers Party"] = "Constitution Party (US)",
["Utah Constitution Party"] = "Constitution Party (US)",
["Utah Democratic Party"] = "Democratic Party (United States)",
["Utah Republican Party"] = "Republican Party (United States)",
["Uttama Prajakeeya Party"] = "Uttama Prajaakeeya Party",
}
local full = {
["U.S. Labor Party"] = {abbrev = "", color = "#800000", shortname = "U.S. Labor",},
["U.S. Taxpayers Party"] = {abbrev = "", color = "transparent", shortname = "U.S. Taxpayers",},
["UAP/Country coalition"] = {abbrev = "", color = "#00008B", shortname = "",},
["Ubuntu Connected Front"] = {abbrev = "", color = "#EA0512", shortname = "",},
["Ubuntu Party"] = {abbrev = "", color = "Lightblue", shortname = "",},
["Udalberri"] = {abbrev = "", color = "#428E89", shortname = "",},
["UDEUR Populars for the South"] = {abbrev = "", color = "#0080FF", shortname = "",},
["UDM"] = {abbrev = "", color = "orange", shortname = "",},
["Ue-Kedadji"] = {abbrev = "", color = "#FFF700", shortname = "",},
["Uganda People's Congress"] = {abbrev = "UPC", color = "#E70000", shortname = "",},
["Ugyon Kita Capiz"] = {abbrev = "", color = "#98fb98", shortname = "",},
["Ujedinjeni"] = {abbrev = "", color = "#EC4242", shortname = "",},
["UK Community Issues Party"] = {abbrev = "", color = "#C0C0C0", shortname = "",},
["UK European Union Party"] = {abbrev = "UKEU", color = "#1A347E", shortname = "",},
["UK Independence Party"] = {abbrev = "UKIP", color = "#6D3177", shortname = "",},
["UK Unionist Party"] = {abbrev = "", color = "#660066", shortname = "UK Unionist",},
["UK Veteran's and People's Party"] = {abbrev = "UKVPP", color = "#053360", shortname = "",},
["Ukraine – Forward!"] = {abbrev = "", color = "SlateBlue", shortname = "",},
["Ukraine is Our Home"] = {abbrev = "", color = "#F4C711", shortname = "",},
["Ukrainian Conservative Republican Party"] = {abbrev = "UCRP", color = "#0C7EBD", shortname = "",},
["Ukrainian Democratic Alliance for Reform"] = {abbrev = "UDAR", color = "#C93732", shortname = "",},
["Ukrainian Galician Party"] = {abbrev = "", color = "#FCCD3F", shortname = "",},
["Ukrainian Marine Party"] = {abbrev = "UMP", color = "#3249B3", shortname = "",},
["Ukrainian National Assembly"] = {abbrev = "UNA", color = "#D80100", shortname = "",},
["Ukrainian National Assembly – Ukrainian People's Self-Defence"] = {abbrev = "UNA–UNSO", color = "#d90000", shortname = "",},
["Ukrainian National Bloc of Kostenko and Plyushch"] = {abbrev = "", color = "Blue", shortname = "Kostenko and Plyushch Bloc",},
["Ukrainian National Democratic Alliance"] = {abbrev = "UNDO", color = "#87CEEB", shortname = "",},
["Ukrainian National State Union"] = {abbrev = "", color = "#5F9EA0", shortname = "",},
["Ukrainian Peasant Democratic Party"] = {abbrev = "", color = "#d29443", shortname = "Peasant Democratic",},
["Ukrainian People's Party"] = {abbrev = "", color = "#0A4595", shortname = "",},
["Ukrainian Radical Party"] = {abbrev = "URP", color = "red", shortname = "",},
["Ukrainian Republican Party"] = {abbrev = "URP", color = "#FEBF10", shortname = "",},
["Ukrainian Republican Party (2006)"] = {abbrev = "URP", color = "#194582", shortname = "",},
["Ukrainian Social Democratic Labour Party"] = {abbrev = "", color = "#CE0000", shortname = "",},
["Ukrainian Social Democratic Party (1899)"] = {abbrev = "USDP", color = "red", shortname = "",},
["Ukrainian Strategy of Groysman"] = {abbrev = "USH", color = "#FFDD00", shortname = "",},
["UKROP"] = {abbrev = "", color = "#0B9444", shortname = "",},
["Ulster Conservatives and Unionists"] = {abbrev = "UCU-NF", color = "#9999FF", shortname = "",},
["Ulster Constitution Party"] = {abbrev = "", color = "black", shortname = "Ulster Constitution",},
["Ulster Democratic Party"] = {abbrev = "", color = "black", shortname = "Ulster Democratic",},
["Ulster Independence Movement"] = {abbrev = "", color = "darkgray", shortname = "Ulster Independence",},
["Ulster Liberal Party"] = {abbrev = "ULib", color = "#DAA520", shortname = "Ulster Liberal",},
["Ulster Popular Unionist Party"] = {abbrev = "UPUP", color = "#ffdead", shortname = "",},
["Ulster Progressive Unionist Association"] = {abbrev = "", color = "#e0afaf", shortname = "Progressive Unionist",},
["Ulster Unionist Labour Association"] = {abbrev = "", color = "#9999FF", shortname = "Labour Unionist",},
["Ulster Unionist Party"] = {abbrev = "UUP", color = "#48A5EE", shortname = "Ulster Unionist",},
["Ulster's Independent Voice"] = {abbrev = "", color = "darkorange", shortname = "Independent Voice",},
["Ultra-Tory"] = {abbrev = "", color = "#333352", shortname = "",},
["Umbrella for Democratic Change"] = {abbrev = "UDC", color = "#244197", shortname = "",},
["Umbrella for Democratic Change (2014)"] = {abbrev = "", color = "#e97810", shortname = "",},
["Ummah Party (Indonesia)"] = {abbrev = "", color = "#000000", shortname = "Ummat",},
["Umoja Party"] = {abbrev = "", color = "#000045", shortname = "Umoja",},
["Un Kòrsou Hustu"] = {abbrev = "", color = "#3F00FF", shortname = "",},
["Unaffiliated politician"] = {abbrev = "", color = "EEEEEE", shortname = "Unaffiliated",},
["Unang Sigaw ng Nueva Ecija"] = {abbrev = "", color = "#000084", shortname = "Unang Sigaw",},
["Unbought Tenants Association"] = {abbrev = "", color = "#bb00bb", shortname = "Unbought Tenants",},
["Unconditional Spanish Party"] = {abbrev = "", color = "#325688", shortname = "",},
["Unconditional Union Party"] = {abbrev = "", color = "#FFAABB", shortname = "Unconditional Union",},
["Unconditional Unionist Party"] = {abbrev = "", color = "#FFAABB", shortname = "",},
["Unendorsed Labour candidates, 1931"] = {abbrev = "", color = "#D03030", shortname = "Other unendorsed Labour",},
["Unid@s Se Puede"] = {abbrev = "", color = "#5A134B", shortname = "",},
["Unidá"] = {abbrev = "", color = "#08B610", shortname = "",},
["Unidad Popular"] = {abbrev = "", color = "#DC0C0C", shortname = "",},
["Unidas Podemos por Andalucía"] = {abbrev = "", color = "#37773E", shortname = "",},
["Unidas Podemos"] = {abbrev = "", color = "#7B4977", shortname = "",},
["Unidas por Llangreu"] = {abbrev = "", color = "#7CB742", shortname = "",},
["Unidos Móstoles"] = {abbrev = "", color = "#DC196F", shortname = "",},
["Unidos"] = {abbrev = "", color = "#333399", shortname = "",},
["Unidos (political party)"] = {abbrev = "", color = "#E32132", shortname = "",},
["Unification Party (South Korea)"] = {abbrev = "UP", color = "#008080", shortname = "Unification",},
["Unification National Party"] = {abbrev = "UNP", color = "#22B14D", shortname = "Unification National",},
["Unified – Alternative for Patriots"] = {abbrev = "JAP", color = "#FFBFF7", shortname = "",},
["Unified Armenians Party"] = {abbrev = "", color = "blue", shortname = "",},
["Unified Communist Party of Georgia"] = {abbrev = "SEKP", color = "red", shortname = "",},
["Unified Communist Party of Spain"] = {abbrev = "", color = "#D20B12", shortname = "",},
["Unified Lumumbist Party"] = {abbrev = "", color = "#b22222", shortname = "",},
["Unified Progressive Party"] = {abbrev = "", color = "#663399", shortname = "Unified Progressive",},
["Unified Socialist Party (Burkina Faso)"] = {abbrev = "", color = "red", shortname = "",},
["Unified Socialist Party (France)"] = {abbrev = "", color = "#e7471e", shortname = "Unified Socialist",},
["Unified Socialist Party (Italy)"] = {abbrev = "", color = "#E52F63", shortname = "Unified Socialist",},
["Unified Socialist Party (Morocco)"] = {abbrev = "", color = "#03377A", shortname = "",},
["Unified Socialist Party of Catalonia"] = {abbrev = "PSUC", color = "#00A58F", shortname = "",},
["Unified Socialist Party of Mexico"] = {abbrev = "PSUM", color = "red", shortname = "",},
["Unió Calvianera"] = {abbrev = "", color = "#215E02", shortname = "",},
["Unió Campanera"] = {abbrev = "", color = "#197E36", shortname = "",},
["Unió Mollera Pollencina"] = {abbrev = "", color = "#10A9B7", shortname = "",},
["Unió Pollencina Independent"] = {abbrev = "", color = "#41B7FD", shortname = "",},
["Union 55+"] = {abbrev = "U55+", color = "#C373B1", shortname = "",},
["Union for a Better Future of BiH"] = {abbrev = "SBB", color = "#213381", shortname = "",},
["Union for a Popular Movement"] = {abbrev = "UMP", color = "#0051AE", shortname = "",},
["Union for Almería"] = {abbrev = "", color = "#F4787C", shortname = "",},
["Union for Cambre"] = {abbrev = "", color = "#007B6B", shortname = "",},
["Union for Capdepera"] = {abbrev = "", color = "#528646", shortname = "",},
["Union for Central African Renewal"] = {abbrev = "", color = "#013157", shortname = "",},
["Union for Change Party"] = {abbrev = "", color = "#FFFF78", shortname = "",},
["Union for Change"] = {abbrev = "", color = "#006600", shortname = "",},
["Union for Córdoba"] = {abbrev = "", color = "#19bc9d", shortname = "",},
["Union for Democracy and Freedom"] = {abbrev = "UDL", color = "", shortname = "",},
["Union for Democracy and Peace in Ivory Coast"] = {abbrev = "UDPCI", color = "#01a0e2", shortname = "",},
["Union for Democracy and Progress"] = {abbrev = "UDP", color = "#0FAF05", shortname = "",},
["Union for Democracy and Social Integration"] = {abbrev = "UDIS", color = "#ECDA30", shortname = "",},
["Union for Democracy and Social Progress (Democratic Republic of the Congo)"] = {abbrev = "UDPS", color = "#CF1020", shortname = "",},
["Union for Democracy and the Republic (Niger)"] = {abbrev = "", color = "#D80000", shortname = "",},
["Union for Development"] = {abbrev = "UPD", color = "#FF4500", shortname = "",},
["Union for Economic Defence"] = {abbrev = "UDE", color = "#53002C", shortname = "",},
["Union for Elda Progress"] = {abbrev = "", color = "#207524", shortname = "",},
["Union for Europe"] = {abbrev = "UFE", color = "#4F6BA2", shortname = "",},
["Union for Europe of the Nations"] = {abbrev = "UEN", color = "#4F6BA2", shortname = "",},
["Union for France"] = {abbrev = "UPF", color = "", shortname = "",},
["Union for France (2022)"] = {abbrev = "UPF", color = "#0087CD", shortname = "",},
["Union for French Democracy"] = {abbrev = "UDF", color = "#00CCCC", shortname = "",},
["Union for Homeland"] = {abbrev = "UFH", color = "#1E4D2B", shortname = "",},
["Union for Hope"] = {abbrev = "", color = "#FF4500", shortname = "",},
["Union for Ivory Coast"] = {abbrev = "UPCI", color = "#ff8080", shortname = "",},
["Union for Leganés"] = {abbrev = "", color = "#528263", shortname = "",},
["Union for Liberty"] = {abbrev = "", color = "#73288B", shortname = "",},
["Union for National Progress"] = {abbrev = "UPRONA", color = "#FF0000", shortname = "",},
["Union for National Salvation"] = {abbrev = "USN", color = "#EE5C29", shortname = "",},
["Union for National Self-Determination"] = {abbrev = "UNSD", color = "black", shortname = "",},
["Union for Ordes"] = {abbrev = "", color = "#006B33", shortname = "",},
["Union for Peace and Development Party"] = {abbrev = "UPD", color = "#008000", shortname = "",},
["Union for Peru"] = {abbrev = "UPP", color = "#D8242A", shortname = "",},
["Union for Peace and Progress–Kilusang Bagong Lipunan"] = {abbrev = "UPP–KBL", color = "#FE0000", shortname = "",},
["Union for Progress and Development"] = {abbrev = "UPD", color = "#FF5A36", shortname = "",},
["Union for Progress and Reform"] = {abbrev = "", color = "#008800", shortname = "",},
["Union for Progress and Renewal (Guinea)"] = {abbrev = "", color = "#0070C0", shortname = "",},
["Union for Promoting Progress"] = {abbrev = "UNIPRO", color = "#183B7D", shortname = "",},
["Union for Rebirth / Sankarist Party"] = {abbrev = "UNIR/PS", color = "#DE144A", shortname = "",},
["Union for Renewal and Democracy"] = {abbrev = "", color = "#ff0000", shortname = "",},
["Union for the Congolese Nation"] = {abbrev = "", color = "red", shortname = "",},
["Union for the Homeland"] = {abbrev = "UP", color = "#00BEFF", shortname = "",},
["Union for the Homeland and the People"] = {abbrev = "EPAL", color = "#2200ff", shortname = "",},
["Union for the New Republic (Gabon)"] = {abbrev = "UPNR", color = "#1b429e", shortname = "",},
["Union for the New Republic"] = {abbrev = "UNR", color = "#0000C8", shortname = "",},
["Union for the Presidential Majority (Djibouti)"] = {abbrev = "UMP", color = "#5FB989", shortname = "",},
["Union for the Progress of Cantabria"] = {abbrev = "UPCA", color = "#00B0A0", shortname = "",},
["Union for the Progress of Guinea"] = {abbrev = "UPG", color = "#FFA500", shortname = "",},
["Union for the Republic (Mauritania)"] = {abbrev = "UPR", color = "#327adc", shortname = "",},
["Union for the Republic (Togo)"] = {abbrev = "UNIR", color = "#38a8e6", shortname = "",},
["Union for the Republic and Democracy"] = {abbrev = "URD", color = "#14B53A", shortname = "",},
["Union for Trentino"] = {abbrev = "", color = "#89CFF0", shortname = "",},
["Union for Victory Coalition"] = {abbrev = "BF", color = "#1F40DD", shortname = "",},
["Union Karen League"] = {abbrev = "", color = "#F7CF15", shortname = "",},
["Union Labor Party"] = {abbrev = "", color = "#6633CC", shortname = "Union Labor",},
["Union Makes the Nation"] = {abbrev = "", color = "#DA6201", shortname = "",},
["Union Monégasque"] = {abbrev = "", color = "#DD0000", shortname = "",},
["Union Movement"] = {abbrev = "", color = "#2F4F4F", shortname = "",},
["Union nationale"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Union of Armenians of Romania"] = {abbrev = "RHM", color = "black", shortname = "",},
["Union of Centrists"] = {abbrev = "EK", color = "#FF7F50", shortname = "",},
["Union of Chiefs and Peoples of the North"] = {abbrev = "", color = "#6495ED", shortname = "",},
["Union of Christian Families"] = {abbrev = "ZChR", color = "#0087BD", shortname = "",},
["Union of Citizens of Badalona"] = {abbrev = "", color = "#8AA8D5", shortname = "",},
["Union of Citizens of Georgia"] = {abbrev = "SMK", color = "#231577", shortname = "",},
["Union of Communist Parties – Communist Party of the Soviet Union"] = {abbrev = "", color = "#DE0300", shortname = "",},
["Union of Communists in Bulgaria"] = {abbrev = "", color = "red", shortname = "",},
["Union of Communists of Slovakia"] = {abbrev = "ZKS", color = "red", shortname = "",},
["Union of Croats of Romania"] = {abbrev = "ZHR", color = "#004B80", shortname = "",},
["Union of Democratic and Social Forces"] = {abbrev = "UFDS", color = "", shortname = "",},
["Union of Democratic Forces (Bulgaria)"] = {abbrev = "SDS", color = "#0A459F", shortname = "",},
["Union of Democratic Forces (Mauritania)"] = {abbrev = "UFD-EN", color = "black", shortname = "",},
["Union of Democratic Forces of Guinea"] = {abbrev = "UFDG", color = "#406626", shortname = "",},
["Union of Democrats and Ecologists"] = {abbrev = "", color = "#088A43", shortname = "",},
["Union of Democrats and Independents"] = {abbrev = "UDI", color = "#35A2EF", shortname = "",},
["Union of Democrats for Citizenship and Development"] = {abbrev = "", color = "black", shortname = "",},
["Union of Democrats for Europe"] = {abbrev = "UDEUR", color = "#FF7F00", shortname = "",},
["Union of Democrats for the Republic"] = {abbrev = "UDR", color = "#0000C8", shortname = "",},
["Union of Development"] = {abbrev = "UPD", color = "yellow", shortname = "",},
["Union of European Democrats"] = {abbrev = "", color = "#FFD403", shortname = "",},
["Union of European Federalists"] = {abbrev = "", color = "#007B3A", shortname = "",},
["Union of Everyone"] = {abbrev = "", color = "#95DC5B", shortname = "",},
["Union of Forces for Change"] = {abbrev = "UFC", color = "#FFCC00", shortname = "",},
["Union des Francophones"] = {abbrev = "UF", color = "#00a0af", shortname = "",},
["Union of Free Democrats"] = {abbrev = "", color = "blue", shortname = "",},
["Union of Georgian Traditionalists"] = {abbrev = "UGT", color = "#740144", shortname = "",},
["Union of Greens and Farmers"] = {abbrev = "ZZS", color = "#02723A", shortname = "",},
["Union of Greens of Russia"] = {abbrev = "", color = "#0B8413", shortname = "",},
["Union of Humanist Democrats-Yuki"] = {abbrev = "UDH-YUKI", color = "#36b4ff", shortname = "",},
["Union of Independent Citizens"] = {abbrev = "", color = "#119246", shortname = "",},
["Union of Independent Nigeriens"] = {abbrev = "", color = "#C0C0C0", shortname = "",},
["Union of Independent Viguese"] = {abbrev = "", color = "#AD0100", shortname = "",},
["Union of Independents of Artà"] = {abbrev = "", color = "#68A2B6", shortname = "",},
["Union of Independents of Sant Cugat"] = {abbrev = "", color = "#FFF004", shortname = "",},
["Union of Kazakhstan's Youth"] = {abbrev = "", color = "#D28095", shortname = "Union of Youth",},
["Union of Latin American Parties"] = {abbrev = "", color = "#137BC1", shortname = "",},
["Union of Liberals and Leftists"] = {abbrev = "", color = "#3FFF00", shortname = "Liberals & Leftists",},
["Union of Mobutuist Democrats"] = {abbrev = "", color = "#3AB500", shortname = "",},
["Union of Moderate Parties"] = {abbrev = "UMP", color = "#02A0E9", shortname = "",},
["Union of Myanmar Federation of National Politics"] = {abbrev = "UMFNP", color = "#FFFFFF", shortname = "",},
["Union of Nigerien Independents and Sympathisers"] = {abbrev = "", color = "blue", shortname = "",},
["Union of October 17"] = {abbrev = "", color = "#00529C", shortname = "Octobrist",},
["Union of Patriotic Forces and Militaries of the Reserve Defense"] = {abbrev = "", color = "darkgreen", shortname = "",},
["Union of People's Parties"] = {abbrev = "", color = "#007FFF", shortname = "",},
["Union of Persecutees of the Nazi Regime"] = {abbrev = "", color = "#e3001a", shortname = "",},
["Union of Poles of Romania"] = {abbrev = "", color = "#D4213D", shortname = "Dom Polski",},
["Union of Pro Patria and Res Publica"] = {abbrev = "", color = "#00AEEF", shortname = "Pro Patria and Res Publica",},
["Union of Progressive Political Forces"] = {abbrev = "SPPS", color = "#67C4CE", shortname = "",},
["Union of Puerto Rico"] = {abbrev = "", color = "#FFBBFF", shortname = "Union",},
["Union of Radicals, Centrists, Independents and Democrats"] = {abbrev = "", color = "#E2725B", shortname = "",},
["Union of Reform Forces of Yugoslavia"] = {abbrev = "SRSJ", color = "lightcoral", shortname = "",},
["Union of Republican Forces"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Union of Right Forces"] = {abbrev = "SPS", color = "#1042A5", shortname = "",},
["Union of Right-Wing Parties"] = {abbrev = "", color = "#8CC74B", shortname = "",},
["Union of Serbs of Romania"] = {abbrev = "USR", color = "#7D2124", shortname = "",},
["Union of Social Democrats of Bosnia and Herzegovina"] = {abbrev = "", color = "red", shortname = "",},
["Union of Socialist Movements"] = {abbrev = "UMS", color = "#3F3991", shortname = "",},
["Union of Talavera and Region"] = {abbrev = "", color = "#F38512", shortname = "",},
["Union of the Catalan Left"] = {abbrev = "", color = "#86A837", shortname = "",},
["Union of the Centre (1993)"] = {abbrev = "UdC", color = "#659EC7", shortname = "",},
["Union of the Centre (2002)"] = {abbrev = "UDC", color = "#87CEFA", shortname = "",},
["Union of the Centre and Christian Democracy of Catalonia"] = {abbrev = "", color = "#F8471B", shortname = "",},
["Union of the Centre of Catalonia"] = {abbrev = "", color = "#03317E", shortname = "",},
["Union of the Centrist Center"] = {abbrev = "", color = "#B22222", shortname = "",},
["Union of the Democratic Centre (Argentina)"] = {abbrev = "UCEDE", color = "#6495ED", shortname = "Union of the Democratic Centre",},
["Union of the Democratic Centre (Greece)"] = {abbrev = "EDIK", color = "#FF7F50", shortname = "Union of the Democratic Centre",},
["Union of the Democratic Centre (Spain)"] = {abbrev = "UCD", color = "#197E36", shortname = "",},
["Union of the Democratic Forces"] = {abbrev = "", color = "#DE3163", shortname = "",},
["Union of the Forces of Change (Guinea)"] = {abbrev = "", color = "#8DA15A", shortname = "",},
["Union of the Forces of Progress"] = {abbrev = "UFP", color = "#FF7F00", shortname = "",},
["Union of the Gabonese People"] = {abbrev = "UPG", color = "blue", shortname = "",},
["Union of the Left (France)"] = {abbrev = "", color = "#FFD1DC", shortname = "Union of the Left",},
["Union of the National Right"] = {abbrev = "", color = "#4A07C8", shortname = "",},
["Union of the Peoples of Cameroon"] = {abbrev = "UPC", color = "#E50101", shortname = "",},
["Union of the Peoples of Murcia"] = {abbrev = "", color = "#0D4E8E", shortname = "",},
["Union of the Right and Centre"] = {abbrev = "UDC", color = "#71BBDE", shortname = "",},
["Union of the Salamancan People"] = {abbrev = "", color = "#00009F", shortname = "",},
["Union of the Ukrainians of Romania"] = {abbrev = "SUR", color = "#0057b7", shortname = "",},
["Union of the Workers of Slovakia"] = {abbrev = "ZRS", color = "#8B0000", shortname = "",},
["Union Party (Faroe Islands)"] = {abbrev = "", color = "#006CB4", shortname = "Union",},
["Union Party (Lebanon)"] = {abbrev = "", color = "#8B8589", shortname = "Union Party",},
["Union Party (US)"] = {abbrev = "", color = "#7F3300", shortname = "Union",},
["Union Party for the People"] = {abbrev = "", color = "#FF8C00", shortname = "Party of the U",},
["Unión por San Luis"] = {abbrev = "", color = "#00ADEE", shortname = "",},
["Unión Portuense"] = {abbrev = "", color = "#6DAB3C", shortname = "",},
["Union Progressive Party (Illinois)"] = {abbrev = "", color = "#7F3300", shortname = "Union Progressive",},
["Union Solidarity and Development Party"] = {abbrev = "USDP", color = "#006B31", shortname = "",},
["Union, Progress and Democracy"] = {abbrev = "UPyD", color = "#E9008C", shortname = "",},
["Unionist Democratic Union"] = {abbrev = "UDU", color = "Maroon", shortname = "",},
["Unionist Party (Guatemala)"] = {abbrev = "", color = "#273284", shortname = "Unionist",},
["Unionist Party (Punjab)"] = {abbrev = "", color = "#0000FF", shortname = "Unionist",},
["Unionist Party (Scotland)"] = {abbrev = "", color = "#5555FF", shortname = "Unionist",},
["Unionist Party (South Africa)"] = {abbrev = "", color = "#9ACD32", shortname = "Unionist",},
["Unionist Party (UK)"] = {abbrev = "", color = "#0087DC", shortname = "Unionist",},
["Unionist Party (US)"] = {abbrev = "", color = "#FFAADD", shortname = "Unionist",},
["Unionist Party of Northern Ireland"] = {abbrev = "", color = "#ffa07a", shortname = "Unionist Party NI",},
["Unique Gorani Party"] = {abbrev = "JGP", color = "#FFCF40", shortname = "",},
["UNIR Constitutional Nationalist Party"] = {abbrev = "PNC–UNIR", color = "#004298", shortname = "UNIR Party",},
["Unir Movement"] = {abbrev = "", color = "#D60B51", shortname = "",},
["UNITA"] = {abbrev = "", color = "#006600", shortname = "",},
["Unitarian Candidacy of Workers"] = {abbrev = "", color = "#117D25", shortname = "",},
["Unitarian Socialist Party"] = {abbrev = "", color = "#8B1C62", shortname = "Unitarian Socialists",},
["Unitary Candidacy of Estella"] = {abbrev = "", color = "#C56E8B", shortname = "",},
["Unitary Democratic Coalition (2022)"] = {abbrev = "CDU", color = "#84AD15", shortname = "",},
["Unitary Democratic Coalition"] = {abbrev = "CDU", color = "#FF0000", shortname = "",},
["Unitary National Liberation Front"] = {abbrev = "JNOF", color = "#DD0000", shortname = "",},
["Unitary Party"] = {abbrev = "", color = "#ADD8E6", shortname = "",},
["Unitary Party for the Construction of Mauritania"] = {abbrev = "PUCM", color = "#F7941D", shortname = "",},
["Unitary Socialist Party (Italy, 1922)"] = {abbrev = "", color = "#E35A5A", shortname = "Unitary Socialist Party",},
["Unitary Socialist Party–Socialist Agreement"] = {abbrev = "PSU–IS", color = "#DB341E", shortname = "",},
["Unitat pel Canvi Sabadell"] = {abbrev = "", color = "#5E305B", shortname = "",},
["Unite por la Libertad y la Dignidad"] = {abbrev = "UNITE", color = "#6bc1e4", shortname = "",},
["Unite Principality"] = {abbrev = "SMP", color = "#011A5D", shortname = "",},
["United (Canarian electoral alliance)"] = {abbrev = "", color = "#26348C", shortname = "",},
["United Abkhazia"] = {abbrev = "", color = "#C92D25", shortname = "",},
["United African National Council"] = {abbrev = "UANC", color = "#808000", shortname = "",},
["United Algeciran Youth"] = {abbrev = "", color = "#34C4F9", shortname = "",},
["United Alliance Sabah"] = {abbrev = "", color = "#0AD9EF", shortname = "",},
["United and Alternative Left"] = {abbrev = "EUiA", color = "#D21145", shortname = "",},
["United and Republican Left"] = {abbrev = "", color = "#D63231", shortname = "",},
["United Ants"] = {abbrev = "", color = "#000000", shortname = "",},
["United Arab List (1977)"] = {abbrev = "", color = "#C61318", shortname = "United Arab List",},
["United Arab List"] = {abbrev = "", color = "#15793D", shortname = "Ra'am",},
["United Armenia Party (Armenia)"] = {abbrev = "", color = "#F7A921", shortname = "",},
["United Australia Party"] = {abbrev = "", color = "#00008B", shortname = "United Australia",},
["United Australia Party (2013)"] = {abbrev = "UAP", color = "#FFED00", shortname = "United Australia",},
["United Australia Party (Australian Capital Territory)"] = {abbrev = "UAP", color = "#FFED00", shortname = "United Australia"},
["United Australia Party (New South Wales)"] = {abbrev = "UAP", color = "#FFED00", shortname = "United Australia"},
["United Australia Party (Northern Territory)"] = {abbrev = "UAP", color = "#FFED00", shortname = "United Australia"},
["United Australia Party (Queensland)"] = {abbrev = "UAP", color = "#FFED00", shortname = "United Australia"},
["United Australia Party (South Australia)"] = {abbrev = "UAP", color = "#FFED00", shortname = "United Australia"},
["United Australia Party (Tasmania)"] = {abbrev = "UAP", color = "#FFED00", shortname = "United Australia"},
["United Australia Party (Victoria)"] = {abbrev = "UAP", color = "#FFED00", shortname = "United Australia"},
["United Australia Party (Western Australia)"] = {abbrev = "UAP", color = "#FFED00", shortname = "United Australia"},
["United Bahamian Party"] = {abbrev = "", color = "#02006c", shortname = "",},
["United Bangsamoro Justice Party"] = {abbrev = "UBJP", color = "#026701", shortname = "",},
["United Bermuda Party"] = {abbrev = "UBP", color = "#3366cc", shortname = "",},
["United Black Association for Development"] = {abbrev = "UBAD", color = "#000000", shortname = "",},
["United Bumiputera Heritage Party"] = {abbrev = "", color = "#F0E98B", shortname = "",},
["United Can Picafort"] = {abbrev = "", color = "#567297", shortname = "",},
["United Canarian People"] = {abbrev = "", color = "#F73431", shortname = "",},
["United Cantabrian Left Group"] = {abbrev = "", color = "#E71839", shortname = "",},
["United Centre (Chile)"] = {abbrev = "", color = "#037E3B", shortname = "",},
["United Centre"] = {abbrev = "", color = "#FFE200", shortname = "",},
["United Ceuta"] = {abbrev = "", color = "#4A4542", shortname = "",},
["United Christian Democratic Party"] = {abbrev = "", color = "#78a22c", shortname = "",},
["United Christian Democrats"] = {abbrev = "CDU", color = "lightblue", shortname = "",},
["United Christian Party (Hungary)"] = {abbrev = "", color = "#006857", shortname = "United Christian",},
["United Citizen Party"] = {abbrev = "", color = "#04B486", shortname = "",},
["United Citizens"] = {abbrev = "", color = "#B8BFFE", shortname = "",},
["United Citizens Party"] = {abbrev = "", color = "#778899", shortname = "United Citizens",},
["United Civic Alliance Party"] = {abbrev = "", color = "#253F9E", shortname = "",},
["United Civic Party"] = {abbrev = "AGP", color = "#EA1C1C", shortname = "",},
["United Civil Front"] = {abbrev = "OGF", color = "#134EA2", shortname = "",},
["United Coalition"] = {abbrev = "", color = "#1863DC", shortname = "",},
["United Communist League of Bangladesh"] = {abbrev = "UCL", color = "#EC435A", shortname = "",},
["United Communist Party of Armenia"] = {abbrev = "HMKK", color = "red", shortname = "",},
["United Communist Party of India"] = {abbrev = "UCPI", color = "red", shortname = "",},
["United Congress (South Africa)"] = {abbrev = "", color = "#50C878", shortname = "",},
["United Conservative Party (Chile)"] = {abbrev = "", color = "#0000FF", shortname = "",},
["United Conservative Party"] = {abbrev = "", color = "#0000FF", shortname = "",},
["United Cyprus Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["United Democrat Party"] = {abbrev = "", color = "black", shortname = "United Democrat",},
["United Democratic Alliance (Kenya)"] = {abbrev = "UDA", color = "#F4CB23", shortname = "",},
["United Democratic Alliance (Nagaland)"] = {abbrev = "UDA", color = "#800000", shortname = "",},
["United Democratic Alliance (Zambia)"] = {abbrev = "UDA", color = "yellow", shortname = "",},
["United Democratic Centre (El Salvador)"] = {abbrev = "CDU", color = "#FFFF00", shortname = "",},
["United Democratic Electoral Commission"] = {abbrev = "CEUD", color = "red", shortname = "",},
["United Democratic Forces"] = {abbrev = "ODS", color = "#0C4BAC", shortname = "",},
["United Democratic Forces of Belarus"] = {abbrev = "ADSB", color = "#FF0000", shortname = "",},
["United Democratic Forum Party"] = {abbrev = "UDF", color = "#FFF100", shortname = "",},
["United Democratic Front (Arunachal Pradesh)"] = {abbrev = "", color = "#800000", shortname = "",},
["United Democratic Front (India)"] = {abbrev = "UDF", color = "skyblue", shortname = "",},
["United Democratic Front (Kerala)"] = {abbrev = "UDF", color = "#0078FF", shortname = "",},
["United Democratic Front (Malawi)"] = {abbrev = "UDF", color = "#FFFF00", shortname = "",},
["United Democratic Front (Nagaland)"] = {abbrev = "", color = "#800000", shortname = "",},
["United Democratic Front (Namibia)"] = {abbrev = "UDF", color = "#314BB2", shortname = "",},
["United Democratic Front (Thailand)"] = {abbrev = "", color = "#CFECEC", shortname = "United Democratic",},
["United Democratic Front"] = {abbrev = "UDF", color = "#add8e6", shortname = "",},
["United Democratic Left"] = {abbrev = "EDA", color = "lightblue", shortname = "",},
["United Democratic Movement"] = {abbrev = "UDM", color = "#FFB300", shortname = "",},
["United Democratic Movement (Kenya)"] = {abbrev = "UDM", color = "#F6FC4F", shortname = "",},
["United Democratic Party (Belize)"] = {abbrev = "UDP", color = "#CE1126", shortname = "",},
["United Democratic Party (Malaysia)"] = {abbrev = "UDP", color = "#FF0000", shortname = "",},
["United Democratic Party (Meghalaya)"] = {abbrev = "UDP", color = "#FE0002", shortname = "",},
["United Democratic Party (Solomon Islands)"] = {abbrev = "UDP", color = "#F0E68C", shortname = "United Democratic",},
["United Democratic Party (South Korea, 1995)"] = {abbrev = "UDP", color = "red", shortname = "United Democratic",},
["United Democratic Party (South Korea, 2008)"] = {abbrev = "UDP", color = "#419639", shortname = "United Democratic",},
["United Democratic Party (Tanzania)"] = {abbrev = "UDP", color = "#437806", shortname = "",},
["United Democratic Party (The Gambia)"] = {abbrev = "UDP", color = "#FEE119", shortname = "",},
["United Democratic Sabah People's Power Party"] = {abbrev = "SETIA", color = "", shortname = "",},
["United Democratic Serbia"] = {abbrev = "", color = "#FDB515", shortname = "",},
["United Democrats (Sint Maarten)"] = {abbrev = "UD", color = "#3BB54C", shortname = "",},
["United Democrats of Hong Kong"] = {abbrev = "UDHK", color = "#136C56", shortname = "United Democrats",},
["United Democrats"] = {abbrev = "EDI", color = "#FFD700", shortname = "",},
["United Development Party"] = {abbrev = "PPP", color = "#00A100", shortname = "",},
["United Ecuadorian"] = {abbrev = "", color = "#382983", shortname = "",},
["United Ethiopian Democratic Forces"] = {abbrev = "", color = "#04A507", shortname = "",},
["United Extremadura"] = {abbrev = "EU", color = "#085500", shortname = "",},
["United Federal Party"] = {abbrev = "", color = "#0087DC", shortname = "United Party",},
["United for a New Alternative"] = {abbrev = "", color = "#3C3C3C", shortname = "",},
["United for Change"] = {abbrev = "", color = "#000000", shortname = "",},
["United for Chiclana"] = {abbrev = "", color = "#9E1831", shortname = "",},
["United for Gran Canaria"] = {abbrev = "UxGC", color = "#26348C", shortname = "",},
["United for Human Rights"] = {abbrev = "", color = "#F79CD0", shortname = "",},
["United for Justice"] = {abbrev = "UZP", color = "#749C75", shortname = "",},
["United for Lanzarote"] = {abbrev = "", color = "#0196BB", shortname = "",},
["United for Latvia"] = {abbrev = "", color = "#C7057F", shortname = "",},
["United for Macedonia"] = {abbrev = "", color = "#F7C317", shortname = "",},
["United for Paracuellos"] = {abbrev = "", color = "#4B8642", shortname = "",},
["United for the Future (Spain)"] = {abbrev = "", color = "#6E0374", shortname = "",},
["United for the Victory of Serbia"] = {abbrev = "UZPS", color = "#2578CC", shortname = "",},
["United for Valencia"] = {abbrev = "", color = "#084D84", shortname = "",},
["United Free Citizens"] = {abbrev = "", color = "#B11C05", shortname = "",},
["United Front (Ceylon)"] = {abbrev = "", color = "#0000FF", shortname = "",},
["United Front (PRC)"] = {abbrev = "", color = "#BC0101", shortname = "United Front",},
["United Front (Trinidad and Tobago)"] = {abbrev = "", color = "#faf333", shortname = "",},
["United Front for the Service of the People"] = {abbrev = "UFSP", color = "#000000", shortname = "",},
["United Front of Nagaland"] = {abbrev = "UDF", color = "#40FF40", shortname = "",},
["United Front Party (Ghana)"] = {abbrev = "", color = "black", shortname = "",},
["United Future Party"] = {abbrev = "", color = "#EF426F", shortname = "United Future",},
["United Future"] = {abbrev = "", color = "#501557", shortname = "",},
["United Galicia"] = {abbrev = "", color = "#93E4FF", shortname = "",},
["United Gipuzkoa"] = {abbrev = "", color = "#4A4961", shortname = "",},
["United Goans Democratic Party"] = {abbrev = "UGDP", color = "#5bb30e", shortname = "",},
["United Goans Party"] = {abbrev = "", color = "#CA8642", shortname = "",},
["United Guadeloupe, Socialism and Realities"] = {abbrev = "GUSR", color = "#FD3F92", shortname = "",},
["United Guadeloupe, Solidary and Responsible"] = {abbrev = "", color = "#263E7E", shortname = "",},
["United Hearts Movement"] = {abbrev = "", color = "#0B72C6", shortname = "",},
["United Homeland Party"] = {abbrev = "", color = "#203763", shortname = "",},
["United in Europe"] = {abbrev = "UiE", color = "#000080", shortname = "",},
["United in Hope"] = {abbrev = "BBY", color = "#7A4D30", shortname = "",},
["United Independent Democratic Front"] = {abbrev = "FDUI", color = "darkred", shortname = "",},
["United Independent Front"] = {abbrev = "", color = "#000000", shortname = "",},
["United Independent Movement"] = {abbrev = "", color = "silver", shortname = "",},
["United Independent Party"] = {abbrev = "", color = "#11426D", shortname = "United Independent",},
["United Independents (Chile)"] = {abbrev = "", color = "#274470", shortname = "United Independents",},
["United Independents"] = {abbrev = "", color = "#9966CC", shortname = "",},
["United Irish League"] = {abbrev = "UIL", color = "#90EE90", shortname = "United Irish League",},
["United Kingdom First Party"] = {abbrev = "", color = "#00009C", shortname = "UK First",},
["United Kyrgyzstan"] = {abbrev = "BK", color = "#DF2D13", shortname = "Butun Kyrgyzstan",},
["United Korea Party (1962)"] = {abbrev = "UK", color = "#312F2A", shortname = "United Korea",},
["United La Coruña"] = {abbrev = "", color = "#4B4A46", shortname = "",},
["United Labour Front"] = {abbrev = "ULF", color = "#aaa9ad", shortname = "",},
["United Labour Party (Armenia)"] = {abbrev = "", color = "#2A5E41", shortname = "",},
["United Labour Party (New Zealand)"] = {abbrev = "", color = "#FF4040", shortname = "United Labour",},
["United Labour Party (Northern Ireland)"] = {abbrev = "", color = "#ff0000", shortname = "United Labour",},
["United Labour Party (Papua New Guinea)"] = {abbrev = "ULP", color = "#F79122", shortname = "",},
["United Left (Bolivia)"] = {abbrev = "IU", color = "#FFE44A", shortname = "",},
["United Left (Ireland)"] = {abbrev = "UL", color = "#FF5555", shortname = "United Left",},
["United Left (Peru)"] = {abbrev = "", color = "#800000", shortname = "United Left",},
["United Left (Poland)"] = {abbrev = "", color = "#EC1C24", shortname = "",},
["United Left (San Marino)"] = {abbrev = "SU", color = "#BE1824", shortname = "",},
["United Left (Slovenia)"] = {abbrev = "ZL", color = "#ff3732", shortname = "",},
["United Left (Spain)"] = {abbrev = "IU", color = "#732021", shortname = "",},
["United Left Alliance"] = {abbrev = "", color = "#FF3300", shortname = "",},
["United Left of the Valencian Country (1978)"] = {abbrev = "", color = "#E34234", shortname = "",},
["United Left–Greens"] = {abbrev = "EB–B", color = "#D46459", shortname = "",},
["United Left–Valencian People's Union"] = {abbrev = "", color = "#FF787F", shortname = "",},
["United Left/The Greens–Assembly for Andalusia"] = {abbrev = "IULV–CA", color = "#009150", shortname = "",},
["United Liberal Democrats"] = {abbrev = "", color = "#009035", shortname = "United Liberal Democrats",},
["United Liberal Party (Chile)"] = {abbrev = "", color = "gold", shortname = "United Liberal",},
["United Liberal Party (Zambia)"] = {abbrev = "", color = "yellow", shortname = "",},
["United Linares Independent Citizens"] = {abbrev = "", color = "#8D2E23", shortname = "",},
["United List (Latvia)"] = {abbrev = "AS", color = "#FFAC01", shortname = "",},
["United Malays National Organisation"] = {abbrev = "UMNO", color = "#C00000", shortname = "",},
["United Montenegro"] = {abbrev = "UCG", color = "#2598D4", shortname = "",},
["United Motherland"] = {abbrev = "", color = "#E31E24", shortname = "United Motherland",},
["United National Congress"] = {abbrev = "UNC", color = "#FCCC08", shortname = "",},
["United National Federal Party"] = {abbrev = "", color = "#FFFF33", shortname = "",},
["United National Front (Afghanistan)"] = {abbrev = "", color = "black", shortname = "United National Front",},
["United National Front (Singapore)"] = {abbrev = "UNF", color = "", shortname = "",},
["United National Front (Sri Lanka)"] = {abbrev = "UNF", color = "#008000", shortname = "United National Front",},
["United National Front for Good Governance"] = {abbrev = "UNFGG", color = "#1CAE05", shortname = "",},
["United National Independence Party"] = {abbrev = "UNIP", color = "#177618", shortname = "",},
["United National Initiative (Armenia)"] = {abbrev = "", color = "#202C56", shortname = "",},
["United National Loktantrik Party"] = {abbrev = "UNLP", color = "#9A2EFE", shortname = "",},
["United National Movement (Georgia)"] = {abbrev = "UNM", color = "#BC0000", shortname = "",},
["United National Movement (Saint Kitts-Nevis-Anguilla)"] = {abbrev = "", color = "#4197d1", shortname = "",},
["United National Party"] = {abbrev = "UNP", color = "#1CAE05", shortname = "",},
["United National Progressive Alliance"] = {abbrev = "TF", color = "red", shortname = "",},
["United National Workers' Party"] = {abbrev = "PUNT", color = "#989898", shortname = "",},
["United Nationalist Alliance"] = {abbrev = "UNA", color = "#FE4D00", shortname = "",},
["United Nationalist Democratic Organization"] = {abbrev = "UNIDO", color = "#FFFF00", shortname = "",},
["United Nationalist Movement"] = {abbrev = "ENEK", color = "black", shortname = "",},
["United Neighbors"] = {abbrev = "", color = "#2A7F9E", shortname = "",},
["United New Zealand"] = {abbrev = "", color = "#663377", shortname = "United NZ",},
["United for Hungary"] = {abbrev = "", color = "#4CB5A2", shortname = "",},
["United Opposition (Philippines)"] = {abbrev = "UNO", color = "#0000FF", shortname = "",},
["United Opposition of Serbia"] = {abbrev = "", color = "#1982C3", shortname = "",},
["United Ossetia"] = {abbrev = "", color = "#3498DB", shortname = "",},
["United Parties"] = {abbrev = "", color = "#800080", shortname = "",},
["United Party (Gambia)"] = {abbrev = "", color = "black", shortname = "",},
["United Party (Ghana)"] = {abbrev = "", color = "#008000", shortname = "",},
["United Party (Indonesia)"] = {abbrev = "PP", color = "#00923F", shortname = "",},
["United Party (New Zealand)"] = {abbrev = "", color = "#BBFFFF", shortname = "United",},
["United Party (Papua New Guinea)"] = {abbrev = "", color = "#D25A52", shortname = "United Party",},
["United Party (South Africa)"] = {abbrev = "", color = "#318CE7", shortname = "United",},
["United Party for Development and Democracy"] = {abbrev = "PUDD", color = "#FFD700", shortname = "",},
["United Party for National Development"] = {abbrev = "UPND", color = "#D23438", shortname = "",},
["United Pasok Momogun Organisation"] = {abbrev = "UPMO", color = "blue", shortname = "",},
["United Pasok Nunukragang National Organisation"] = {abbrev = "PASOK", color = "indigo", shortname = "",},
["United Pasokmomogun Kadazan Organisation"] = {abbrev = "UPKO", color = "#ABCDFF", shortname = "",},
["United Pasokmomogun Kadazandusun Murut Organisation"] = {abbrev = "", color = "#ABCDFF", shortname = "",},
["United Pasokmomogun Kadazandusun Organisation"] = {abbrev = "", color = "#00008B", shortname = "",},
["United Patriots"] = {abbrev = "OP", color = "#009B75", shortname = "",},
["United Peasant Party"] = {abbrev = "USS", color = "#50C878", shortname = "",},
["United People (Chile)"] = {abbrev = "", color = "#E4040F", shortname = "",},
["United People (Costa Rica)"] = {abbrev = "PU", color = "#AD0430", shortname = "",},
["United People Alliance"] = {abbrev = "APU", color = "#EB3D43", shortname = "",},
["United People for Social Renovation"] = {abbrev = "", color = "#8B4513", shortname = "",},
["United People's Coalition"] = {abbrev = "", color = "#00A86B", shortname = "",},
["United People's Freedom Alliance"] = {abbrev = "UPFA", color = "#1609F7", shortname = "",},
["United People's Front"] = {abbrev = "FPU", color = "#CAB24F", shortname = "",},
["United People's Front of Nepal"] = {abbrev = "", color = "darkred", shortname = "",},
["United People's Movement (Colombia)"] = {abbrev = "", color = "#483674", shortname = "",},
["United People's Movement (Namibia)"] = {abbrev = "UPM", color = "#00A064", shortname = "",},
["United People's Party (Bulgaria)"] = {abbrev = "", color = "#0060AA", shortname = "",},
["United People's Party (Liberia)"] = {abbrev = "UPP", color = "#ff0000", shortname = "",},
["United People's Party (Poland)"] = {abbrev = "ZSL", color = "#899A41", shortname = "",},
["United People's Party (Singapore)"] = {abbrev = "UPP", color = "#0055FE", shortname = "",},
["United People's Party (Sint Maarten)"] = {abbrev = "", color = "#94D60A", shortname = "",},
["United People's Party (South Korea)"] = {abbrev = "", color = "#229875", shortname = "",},
["United People's Party (UK)"] = {abbrev = "", color = "#339900", shortname = "United People's Party",},
["United People's Party (Zimbabwe)"] = {abbrev = "UPP", color = "#40E0D0", shortname = "",},
["United People's Party Liberal"] = {abbrev = "UPPL", color = "#FAED09", shortname = "",},
["United People's Party"] = {abbrev = "", color = "#A3B847", shortname = "",},
["United People's Progressive Party"] = {abbrev = "ONPP", color = "#B87333", shortname = "",},
["United People"] = {abbrev = "", color = "#0066ff", shortname = "",},
["United Peoples Party (Fiji)"] = {abbrev = "UPP", color = "#32CD32", shortname = "",},
["United Peoples' Democratic Party"] = {abbrev = "UDUB", color = "#008000", shortname = "",},
["United Peoples' Party (Bangladesh)"] = {abbrev = "UPP", color = "#00DACA", shortname = "",},
["United Poland"] = {abbrev = "", color = "#19224e", shortname = "",},
["United Pontevedra"] = {abbrev = "", color = "#0099C6", shortname = "",},
["United Popular Front (Iraq)"] = {abbrev = "UPF", color = "yellow", shortname = "",},
["United Popular Front"] = {abbrev = "EPAM", color = "#17479D", shortname = "",},
["United Progressive Alliance (Sri Lanka)"] = {abbrev = "", color = "#FF8C00", shortname = "",},
["United Progressive Alliance"] = {abbrev = "UPA", color = "#00BFFF", shortname = "",},
["United Progressive Kinabalu Organisation"] = {abbrev = "UPKO", color = "#ABCDFF", shortname = "",},
["United Progressive Party (Antigua and Barbuda)"] = {abbrev = "UPP", color = "#010F71", shortname = "",},
["United Progressive Party (Barbados)"] = {abbrev = "UPP", color = "#F59324", shortname = "",},
["United Progressive Party (Ghana)"] = {abbrev = "", color = "blue", shortname = "",},
["United Progressive Party (Nigeria)"] = {abbrev = "", color = "#05643a", shortname = "",},
["United Progressive Party (Saint Vincent and the Grenadines)"] = {abbrev = "", color = "#0083FF", shortname = "",},
["United Reform Action"] = {abbrev = "URA", color = "#00cc55", shortname = "",},
["United Regional Front"] = {abbrev = "", color = "#EC2125", shortname = "",},
["United Regions of Serbia"] = {abbrev = "URS", color = "#3BB9FF", shortname = "",},
["United Religious Front"] = {abbrev = "", color = "#172d81", shortname = "",},
["United Republic"] = {abbrev = "RS", color = "#687CD5", shortname = "",},
["United Republican Party (Guyana)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["United Republican Party (Kenya)"] = {abbrev = "URP", color = "#FFD32C", shortname = "",},
["United Republicans"] = {abbrev = "", color = "#651F7A", shortname = "",},
["United Resources Party"] = {abbrev = "URP", color = "#F0E91A", shortname = "",},
["United Revolutionary Nationalist Movement"] = {abbrev = "MNRU", color = "#EB23BC", shortname = "",},
["United Rhodesia Party"] = {abbrev = "", color = "#0087DC", shortname = "United",},
["United Right (Poland)"] = {abbrev = "ZP", color = "#263778", shortname = "",},
["United Right Party"] = {abbrev = "", color = "#1B49DD", shortname = "",},
["United Roma Party of Kosovo"] = {abbrev = "", color = "#009933", shortname = "",},
["United Romania Party"] = {abbrev = "", color = "#213C93", shortname = "",},
["United Rotenians"] = {abbrev = "", color = "#00572E", shortname = "",},
["United Russia"] = {abbrev = "", color = "#2E4EA4", shortname = "",},
["United Sabah Alliance"] = {abbrev = "", color = "#1A1A1A", shortname = "",},
["United Sabah Assembly Party"] = {abbrev = "PUSAKA", color = "", shortname = "",},
["United Sabah National Organisation"] = {abbrev = "USNO", color = "#008000", shortname = "",},
["United Sabah National Organisation (New)"] = {abbrev = "USNO (Baru)", color = "#678F43", shortname = "",},
["United Sabah Party"] = {abbrev = "PBS", color = "#ADD8E6", shortname = "",},
["United Sarawak Party"] = {abbrev = "", color = "#FBFF94", shortname = "",},
["United Serbia"] = {abbrev = "JS", color = "#800000", shortname = "",},
["United Serbia (coalition)"] = {abbrev = "UZPS", color = "#2578CC", shortname = "",},
["United Seychelles"] = {abbrev = "", color = "#FF0D13", shortname = "",},
["United Social Democratic Party"] = {abbrev = "", color = "green", shortname = "",},
["United Socialist Alliance"] = {abbrev = "", color = "#FF0000", shortname = "",},
["United Socialist Party (Bolivia)"] = {abbrev = "", color = "#FF4500", shortname = "",},
["United Socialist Party (Sri Lanka)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["United Socialist Party (UK)"] = {abbrev = "", color = "#E32636", shortname = "United Socialist",},
["United Socialist Party of Venezuela"] = {abbrev = "PSUV", color = "#F0001C", shortname = "",},
["United Socialist Workers' Party"] = {abbrev = "PSTU", color = "#C4122D", shortname = "",},
["United Somali Congress"] = {abbrev = "USC", color = "#39944A", shortname = "",},
["United Srpska"] = {abbrev = "US", color = "#00008B", shortname = "",},
["United St. Maarten Party"] = {abbrev = "USP", color = "#71b7ff", shortname = "",},
["United States Pirate Party"] ={abbrev = "USPP", color = "#9258B0", shortname = "Pirate Party",},
["United Taxpayers Party"] = {abbrev = "", color = "#228B22", shortname = "United Taxpayers",},
["United Thai Nation Party"] = {abbrev = "UTN", color = "#273082", shortname = "United Thai Nation",},
["United Thai People's Party"] = {abbrev = "UTPP", color = "#FF0800", shortname = "",},
["United to Advance"] = {abbrev = "", color = "#F46E6E", shortname = "",},
["United to Renew"] = {abbrev = "", color = "#0E8543", shortname = "",},
["United Torah Judaism"] = {abbrev = "UTJ", color = "#003366", shortname = "",},
["United Trade Unions of Serbia Sloga"] = {abbrev = "Sloga", color = "#940F0F", shortname = "",},
["United Traditional Bumiputera Party"] = {abbrev = "", color = "#E30007", shortname = "",},
["United Transformation Movement"] = {abbrev = "UTM", color = "#D7222B", shortname = "",},
["United Tres Cantos"] = {abbrev = "", color = "#D8C018", shortname = "",},
["United Ulster Unionist Party"] = {abbrev = "UUUP", color = "#ff8c00", shortname = "",},
["United Unionist Coalition"] = {abbrev = "", color = "#888888", shortname = "",},
["United Utah Party"] = {abbrev = "", color = "#80151F", shortname = "United Utah",},
["United Valencia"] = {abbrev = "", color = "#01ADD4", shortname = "",},
["United We Can"] = {abbrev = "UP", color = "#800080", shortname = "",},
["United with Arona"] = {abbrev = "", color = "#C2116B", shortname = "",},
["United Women Front"] = {abbrev = "UWF", color = "#E1F5A9", shortname = "",},
["United Workers Party (Saint Lucia)"] = {abbrev = "UWP", color = "#FFC90E", shortname = "",},
["United Workers' Party (Dominica)"] = {abbrev = "UWP", color = "#0F52BA", shortname = "",},
["United Zamora"] = {abbrev = "", color = "#A5A6BD", shortname = "",},
["United–Reform Coalition"] = {abbrev = "", color = "#5EDDBF", shortname = "United/Reform",},
["Uniting Australia Party"] = {abbrev = "", color = "#00B2B2", shortname = "",},
["Unity (Hungary)"] = {abbrev = "", color = "#C71585", shortname = "Unity",},
["Unity (Kyrgyz political party)"] = {abbrev = "", color = "#0083BA", shortname = "Birimdik",},
["Unity (Latvia)"] = {abbrev = "", color = "#85B821", shortname = "Unity",},
["Unity (Northern Ireland)"] = {abbrev = "", color = "olive", shortname = "Unity",},
["Unity (Russian political party)"] = {abbrev = "", color = "#227FCF", shortname = "Unity",},
["Unity (Swedish political party)"] = {abbrev = "", color = "#088332", shortname = "Unity",},
["Unity (Uzbekistan)"] = {abbrev = "", color = "#3385D9", shortname = "",},
["Unity and Democracy Party of Kachin State"] = {abbrev = "", color = "#118D35", shortname = "",},
["Unity and Democracy Party"] = {abbrev = "", color = "#FBF0DC", shortname = "",},
["Unity and Liberty Party"] = {abbrev = "PUL", color = "#861F80", shortname = "",},
["Unity and Peace Party"] = {abbrev = "UPP", color = "#FFFFFF", shortname = "",},
["Unity and Progress Party"] = {abbrev = "PUP", color = "#45D35D", shortname = "",},
["Unity Centre of Communist Revolutionaries of India (Marxist-Leninist) (D.V. Rao)"] = {abbrev = "UCCRI(M-L)", color = "red", shortname = "",},
["Unity Coalition"] = {abbrev = "CU", color = "#2C93FB", shortname = "",},
["Unity Fiji Party"] = {abbrev = "", color = "#20B2AA", shortname = "",},
["Unity for Algeciras"] = {abbrev = "", color = "#0474B6", shortname = "",},
["Unity for Alguazas"] = {abbrev = "", color = "#E47747", shortname = "",},
["Unity for Change"] = {abbrev = "", color = "#3BA926", shortname = "",},
["Unity for Chile"] = {abbrev = "", color = "#F25C5D", shortname = "",},
["Unity for Human Rights Party"] = {abbrev = "PBDNJ", color = "#1D70B8", shortname = "",},
["Unity for La Línea"] = {abbrev = "", color = "#3F3BC6", shortname = "",},
["Unity for Narón"] = {abbrev = "", color = "#149511", shortname = "",},
["Unity for Peace and Socialism"] = {abbrev = "", color = "red", shortname = "",},
["Unity for the Future of Macau"] = {abbrev = "UFM", color = "blue", shortname = "",},
["Unity for the Isles"] = {abbrev = "", color = "#EEC657", shortname = "",},
["Unity Labour Party"] = {abbrev = "", color = "#e2231a", shortname = "Unity Labour",},
["Unity Movement"] = {abbrev = "", color = "#2699E4", shortname = "",},
["Unity of Aran"] = {abbrev = "", color = "#EC2923", shortname = "",},
["Unity of Oleksandr Omelchenko"] = {abbrev = "", color = "#249751", shortname = "",},
["Unity of San Hui"] = {abbrev = "", color = "#EE8487", shortname = "",},
["Unity of the People (South Ossetia)"] = {abbrev = "", color = "#C0392B", shortname = "Unity of the People",},
["Unity of the People (Trinidad and Tobago)"] = {abbrev = "UTP", color = "#8743e3", shortname = "",},
["Unity of the People"] = {abbrev = "", color = "#DB0000", shortname = "",},
["Unity Party (Australia)"] = {abbrev = "", color = "#CD5700", shortname = "Unity",},
["Unity Party (Azerbaijan)"] = {abbrev = "", color = "#B48B1F", shortname = "",},
["Unity Party (China)"] = {abbrev = "", color = "#DE2119", shortname = "Unity",},
["Unity Party (Hungary)"] = {abbrev = "", color = "#FFDB52", shortname = "Unity",},
["Unity Party (Hungary, 2009)"] = {abbrev = "ÖP", color = "#80BB3D", shortname = "",},
["Unity Party (Japan)"] = {abbrev = "", color = "#0542A0", shortname = "",},
["Unity Party (Liberia)"] = {abbrev = "UP", color = "#026536", shortname = "",},
["Unity Party (South Ossetia)"] = {abbrev = "", color = "#1C408A", shortname = "Unity Party",},
["Unity Party (Turkey)"] = {abbrev = "TBP", color = "#A91101", shortname = "",},
["Unity Party of America"] = {abbrev = "", color = "#ADD8E6", shortname = "Unity",},
["Unity Party of Kenya"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Unity Party of Nigeria"] = {abbrev = "", color = "#D82628", shortname = "",},
["Unrepresented Peoples Party"] = {abbrev = "UPP", color = "#283048", shortname = "",},
["Up-Country People's Front"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Uplands Party"] = {abbrev = "", color = "#FFFFFF", shortname = "Uplands",},
["Upper Aragon in Common"] = {abbrev = "", color = "#B222EB", shortname = "",},
["Uri Party"] = {abbrev = "", color = "#FFD700", shortname = "Uri",},
["Urquijists"] = {abbrev = "", color = "#3AA8C1", shortname = "Urquijist",},
["Uruguay Assembly"] = {abbrev = "", color = "#24397C", shortname = "",},
["Urza.cz"] = {abbrev = "", color = "#F2E500", shortname = "",},
["US Liberty Party"] = {abbrev = "", color = "#ca0008", shortname = "",},
["Us Moderates"] = {abbrev = "", color = "#2149a7", shortname = "",},
["Us of the Centre"] = {abbrev = "", color = "#0576BD", shortname = "",},
["Us with Italy"] = {abbrev = "", color = "#236186", shortname = "",},
["Us with Salvini"] = {abbrev = "", color = "#0F52BA", shortname = "",},
["USR PLUS"] = {abbrev = "", color = "#00A6FF", shortname = "",},
["Utkal Congress"] = {abbrev = "", color = "#FCEE23", shortname = "",},
["Utreran Party"] = {abbrev = "", color = "#F7DE21", shortname = "",},
["Uttama Prajaakeeya Party"] = {abbrev = "UPP", color = "#E3889D", shortname = "",},
["Uttar Pradesh Revolutionary Socialist Party"] = {abbrev = "", color = "red", shortname = "",},
["Uttar Pradesh United Democratic Front"] = {abbrev = "UPUDF", color = "#58ACFA", shortname = "",},
["Uttarakhand Kranti Dal"] = {abbrev = "UKD", color = "#336666", shortname = "",},
["UW"] = {abbrev = "", color = "blue", shortname = "",},
["Uzbekistan Liberal Democratic Party"] = {abbrev = "OʻzLiDeP", color = "#009EE3", shortname = "",},
["Uzbekistan National Revival Democratic Party"] = {abbrev = "", color = "#005AA0", shortname = "Milliy Tiklanish",},
["Uzhaippali Makkal Katchi"] = {abbrev = "UMK", color = "yellowgreen", shortname = "",},
["Uzhavar Uzhaippalar Katchi"] = {abbrev = "UUK", color = "green", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
46e1d2eaaff4939586c6b914f76c42f62efacd93
Template:Infobox officeholder/doc
10
180
351
2023-12-16T23:00:20Z
wikipedia>Omnipaedista
0
rv Atchom as per [[WP:BRD]]
wikitext
text/x-wiki
{{Documentation subpage}}
{{Person infobox header}}
{{High-use}}
{{Notice|Please note that in June 2017, the {{para|religion}} parameter was removed from Infobox officeholder as a result of [[Template talk:Infobox officeholder/Archive 21#Religion in officeholder infoboxes|this discussion]].}}
{{tl|Infobox officeholder}} is incorporated into the following templates (i.e. all the templates listed <span class="plainlinks">[{{fullurl:Special:WhatLinksHere/Template:Infobox officeholder|namespace=10&limit=1000&hidetrans=1&hidelinks=1}} here]</span>). Please use the most appropriate name when placing this template on a page.
{{collapse top |title= List of templates}}
{{refbegin|colwidth=20em}}
* {{Tld|Infobox AM}}
* {{Tld|Infobox Canadian MP}}
* {{Tld|Infobox Canadian senator}}
* {{Tld|Infobox candidate}}
* {{Tld|Infobox civil servant}}
* {{Tld|Infobox chancellor}}
* {{Tld|Infobox congressional candidate}}
* {{Tld|Infobox congressman}}
* {{Tld|Infobox defense minister}}
* {{Tld|Infobox deputy first minister}}
* {{Tld|Infobox deputy prime minister}}
* {{Tld|Infobox doge}}
* {{Tld|Infobox Eritrea cabinet official}}
* {{Tld|Infobox first lady}}
* {{Tld|Infobox first minister}}
* {{Tld|Infobox governor}}
* {{Tld|Infobox governor-elect}}
* {{Tld|Infobox governor general}}
* {{Tld|Infobox governor-general}}
* {{Tld|Infobox Indian politician}}
* {{Tld|Infobox judge}}
* {{Tld|Infobox lt governor}}
* {{Tld|Infobox mayor}}
* {{Tld|Infobox MEP}}
* {{Tld|Infobox minister}}
* {{Tld|Infobox MLA}}
* {{Tld|Infobox MP}}
* {{Tld|Infobox MSP}}
* {{Tld|Infobox PM}}
* {{Tld|Infobox politician}}
* {{Tld|Infobox politician (general)}}
* {{Tld|Infobox premier}}
* {{Tld|Infobox president}}
* {{Tld|Infobox president-elect}}
* {{Tld|Infobox prime minister}}
* {{Tld|Infobox prime minister-elect}}
* {{Tld|Infobox representative-elect}}
* {{Tld|Infobox SCC chief justice}}
* {{Tld|Infobox SCC puisne justice}}
* {{Tld|Infobox secretary-general}}
* {{Tld|Infobox senator}}
* {{Tld|Infobox senator-elect}}
* {{Tld|Infobox speaker}}
* {{Tld|Infobox state representative}}
* {{Tld|Infobox state SC associate justice}}
* {{Tld|Infobox state SC justice}}
* {{Tld|Infobox state senator}}
* {{Tld|Infobox US ambassador}}
* {{Tld|Infobox US associate justice}}
* {{Tld|Infobox US cabinet official}}
* {{Tld|Infobox US chief justice}}
* {{Tld|Infobox US territorial governor}}
* {{Tld|Infobox vice president}}
{{refend}}
{{collapse bottom}}
{{Lua|Module:Infobox|Module:InfoboxImage|Module:Check for unknown parameters}}
==Usage==
{{hatnote|Note: This template is for use on articles about '''individual people'''. For the infobox for use on articles about offices/positions, see [[Template:Infobox official post]].}}
Paste the code for the relevant office and then add the [[#Personal data|personal data]] to the bottom. There are no required fields and some fields will not appear when others are in use. For instructions on how to implement multiple terms, see [[Template:Infobox officeholder/example#Multiple terms|this page]]. For advice on alt text, see ''[[Wikipedia:Alternative text for images]]''.
The parameter {{para|order}} is used in conjunction with {{para|office}} to state that the officeholder is the ''n''th holder of the office, for example "42nd President of the United States". This should only be used when there is a well-established use of such numbering in reliable sources. Do not add numbers simply based on a Wikipedia list of holders of the office, because (1) the list may not be accurate and (2) even with a definite list, different numbering systems could be applied (as to how various categories of "irregular" officeholders should be counted, and as to the counting of those serving for multiple non-consecutive periods) making the numbers arbitrary; and even where such issues are not yet present, they are bound to be in the future, making this unsustainable. Per [[WP:SEAOFBLUE]], it is not recommended to wikilink {{para|order}} to a list of officeholders, even if such a list exists.
If {{para|order}} is not specified, the value of {{para|office}} can be [[Help:Link#Wikilinks|wikilinked]] in the usual way, for example, "<code><nowiki>[[Ministry of Defence (Singapore)|Minister for Defence]]</nowiki></code>". However, if {{para|order}} is specified together with {{para|office}}, the value of {{para|office}} is automatically linked to a Wikipedia article of the same name, whether such an article exists or not. Wikilinking cannot be used to redirect the link elsewhere, but a [[Wikipedia:Piped link|piped link]] can be created like this: "<code><nowiki>Ministry of Defence (Singapore){{!}}Minister for Defence</nowiki></code>" (note that the double square brackets have been omitted).
When both a start and an end term are given, you can instead specify the complete term using the parameters {{para|term}}, {{para|term2}}, etc. This can be helpful for complicated terms that cannot be given as simple starting or ending dates, or if you prefer something other than the default term separator (an en dash, with spaces around it if the start or end is not a simple integer date).
Where a politician was redistricted into a new district, you can use {{para|prior_term}} to indicate which district(s) they were in before. This saves space in the infobox by not generating a completely new office each time redistricting happens. If you do this, it is recommended that you list the person who preceded the subject when the subject first took office and the person who succeeded the subject when the subject last left office. Where the use of "same district number" is used for determining "predecessor" and "successor" in any office, but where the area is so altered as to make such a "predecessor" or "successor" of little or no biographical value, the word "redistricted" should be used rather than using names of officeholders whose connection is accidental by virtue of district number, but unrelated to any election contests between officeholders.
Please do not re-purpose any fields to add decorative images, icons or flags. Template:Infobox viceroy styles or the like can be used for this. [[WP:INFOBOXFLAG]] applies here.
Per consensus in [[Wikipedia:Village pump (proposals)/Archive 175#RfC: Interim use of successor in Infobox officeholder|this RfC]], the infobox for an incumbent officeholder should not mention an [[-elect|elected or designated]] successor, or the end date of the term, until the successor takes office.
===General office===
{{For|examples of this code in use|Template:Infobox officeholder/example#General office}}
{{Generic template demo
| honorific_prefix
| name<!-- defaults to article title when left blank -->
| native_name
| native_name_lang
| honorific_suffix
| image
| image_size
| image_upright
| image name
| image_name_alt
| smallimage
| smallimage_alt
| alt
| caption
| order
| office
| status<!--If this is specified, overrides Incumbent.-->
| term_start
| term_end<!-- Add data only when the actual term has ended, not for terms which will end in the future. (Per usage guideline.) -->
| subterm
| suboffice
| alongside
| monarch
| president
| governor_general
| primeminister
| chancellor
| taoiseach
| governor
| co-leader
| vicepresident
| viceprimeminister
| deputy
| lieutenant
| parliamentarygroup
| constituency
| majority
| predecessor
| successor
| prior_term
| order2
| office2
| term_start2
| term_end2
| subterm2
| suboffice2
| alongside2
| monarch2
| president2
| governor_general2
| primeminister2
| chancellor2
| taoiseach2
| governor2
| co-leader2
| vicepresident2
| viceprimeminister2
| deputy2
| lieutenant2Z
| parliamentarygroup2
| constituency2
| predecessor2
| successor2
| majority2
| prior_term2
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox officeholder
| honorific_prefix =
| name = <!-- defaults to article title when left blank -->
| native_name = <!--The person's name in their own language, if different.-->
| native_name_lang = <!--ISO 639-1 code, e.g., "fr" for French. If more than one, use {{lang}} in |native_name= instead.-->
| honorific_suffix =
| image =
| image_size =
| image_upright =
| smallimage = <!--If this is specified, "image" should not be.-->
| smallimage_alt =
| alt =
| caption =
| order =
| office =
| status = <!--If this is specified, overrides Incumbent.-->
| term_start =
| term_end = <!-- Add data only when the actual term has ended, not for terms which will end in the future. (Per usage guideline.) -->
| subterm =
| suboffice =
| alongside = <!--For two or more people serving in the same position from the same district. (e.g. United States senators.)-->
| monarch =
| president =
| governor_general =
| primeminister =
| taoiseach =
| chancellor =
| governor =
| co-leader =
| vicepresident =
| viceprimeminister =
| deputy =
| lieutenant =
| succeeding = <!--For President-elect or equivalent-->
| parliamentarygroup =
| constituency =
| majority =
| predecessor =
| successor = <!-- should not be filled until the successor takes office-->
| prior_term =
| order2 = <!--Can be repeated up to 16 times by changing the number-->
| office2 = <!--Can be repeated up to 16 times by changing the number-->
| term_start2 = <!--Can be repeated up to 16 times by changing the number-->
| term_end2 = <!--Can be repeated up to 16 times by changing the number-->
| subterm2 = <!--Can be repeated up to 16 times by changing the number-->
| suboffice2 = <!--Can be repeated up to 16 times by changing the number-->
| alongside2 = <!--Can be repeated up to 16 times by changing the number-->
| monarch2 = <!--Can be repeated up to 16 times by changing the number-->
| president2 = <!--Can be repeated up to 16 times by changing the number-->
| governor_general2 = <!--Can be repeated up to 16 times by changing the number-->
| primeminister2 = <!--Can be repeated up to 16 times by changing the number-->
| chancellor2 = <!--Can be repeated up to 16 times by changing the number-->
| taoiseach2 = <!--Can be repeated up to 16 times by changing the number-->
| governor2 = <!--Can be repeated up to 16 times by changing the number-->
| co-leader2 = <!--Can be repeated up to 16 times by changing the number-->
| vicepresident2 = <!--Can be repeated up to 16 times by changing the number-->
| viceprimeminister2 = <!--Can be repeated up to 16 times by changing the number-->
| deputy2 = <!--Can be repeated up to 16 times by changing the number-->
| lieutenant2 = <!--Can be repeated up to 16 times by changing the number-->
| succeeding2 = <!--Can be repeated up to 16 times by changing the number-->
| predecessor2 = <!--Can be repeated up to 16 times by changing the number-->
| successor2 = <!--Can be repeated up to 16 times by changing the number-->
| parliamentarygroup2= <!--Can be repeated up to 16 times by changing the number-->
| constituency2 = <!--Can be repeated up to 16 times by changing the number-->
| majority2 = <!--Can be repeated up to 16 times by changing the number-->
| prior_term2 = <!--Can be repeated up to 16 times by changing the number-->
</syntaxhighlight>
''add [[#Personal data|personal data]]''
{{clear}}
===Ambassador===
{{For|examples of this code in use|Template:Infobox officeholder/example#Ambassador}}
{{Generic template demo
| honorific_prefix
| name
| honorific_suffix
| image
| alt
| order
| ambassador_from
| country
| term_start
| term_end
| predecessor
| successor
| president
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox ambassador
| honorific_prefix =
| name =
| honorific_suffix =
| image =
| alt =
| order = <!--Can be repeated up to 16 times by adding a number-->
| ambassador_from = <!--Can be repeated up to 16 times by adding a number-->
| country = <!--Can be repeated up to 16 times by adding a number-->
| term_start = <!--Can be repeated up to 16 times by adding a number-->
| term_end = <!--Can be repeated up to 16 times by adding a number-->
| predecessor = <!--Can be repeated up to 16 times by adding a number-->
| successor = <!--Can be repeated up to 16 times by adding a number-->
| president = <!--Can be repeated up to 16 times by adding a number-->
</syntaxhighlight>
''add [[#Personal data|personal data]]''
{{clear}}
===Assembly member===
{{For|examples of this code in use|Template:Infobox officeholder/example#Assembly Member}}
{{Generic template demo
| honorific_prefix
| name
| honorific_suffix
| image
| alt
| caption
| constituency_AM
| assembly
| majority
| term_start
| term_end
| predecessor
| successor
| prior_term
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox AM
| honorific_prefix =
| name =
| honorific_suffix =
| image =
| alt =
| caption =
| constituency_AM = <!--Can be repeated up to eight times by adding a number-->
| assembly = <!--Can be repeated up to 16 times by adding a number-->
| majority = <!--Can be repeated up to 16 times by adding a number-->
| term_start = <!--Can be repeated up to 16 times by adding a number-->
| term_end = <!--Can be repeated up to 16 times by adding a number-->
| predecessor = <!--Can be repeated up to 16 times by adding a number-->
| successor = <!--Can be repeated up to 16 times by adding a number-->
| prior_term =
</syntaxhighlight>
''add [[#Personal data|personal data]]''
{{clear}}
===Governor===
{{For|examples of this code in use|Template:Infobox officeholder/example#Governor}}
{{Generic template demo
| honorific_prefix
| name
| honorific_suffix
| image
| alt
| order
| office
| term_start
| term_end
| lieutenant
| predecessor
| successor
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox governor
| honorific_prefix =
| name =
| honorific_suffix =
| image =
| alt =
| order = <!--Can be repeated up to 16 times by adding a number-->
| office = <!--Can be repeated up to 16 times by adding a number-->
| term_start = <!--Can be repeated up to 16 times by adding a number-->
| term_end = <!--Can be repeated up to 16 times by adding a number-->
| lieutenant = <!--Can be repeated up to 16 times by adding a number-->
| predecessor = <!--Can be repeated up to 16 times by adding a number-->
| successor = <!--Can be repeated up to 16 times by adding a number-->
</syntaxhighlight>
''add [[#Personal data|personal data]]''
{{clear}}
If Governor was appointed by a President, add:
{{Generic template demo
| president
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| president = <!--name of president-->
</syntaxhighlight>
{{clear}}
If Governor appointed by other, add:
{{Generic template demo
| appointed
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| appointed = <!--name of appointer-->
</syntaxhighlight>
{{clear}}
===Judge===
{{For|examples of this code in use|Template:Infobox officeholder/example#Judge}}
{{Generic template demo
| honorific_prefix
| name
| honorific_suffix
| image
| alt
| caption
| office
| term_start
| term_end
| nominator
| appointer
| predecessor
| successor
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox judge
| honorific_prefix =
| name =
| honorific_suffix =
| image =
| alt =
| caption =
| office = <!--Can be repeated up to 16 times by changing the number-->
| term_start = <!--Can be repeated up to 16 times by changing the number-->
| term_end = <!--Can be repeated up to 16 times by changing the number-->
| nominator = <!--Can be repeated up to 16 times by changing the number-->
| appointer = <!--Can be repeated up to 16 times by changing the number-->
| predecessor = <!--Can be repeated up to 16 times by changing the number-->
| successor = <!--Can be repeated up to 16 times by changing the number-->
</syntaxhighlight>
''add [[#Personal data|personal data]]''
{{clear}}
===Member of Parliament===
{{For|examples of this code in use|Template:Infobox officeholder/example#Member of Parliament}}
{{Generic template demo
| honorific_prefix
| name
| honorific_suffix
| image
| alt
| caption
| constituency_MP
| parliament
| majority
| term_start
| term_end
| predecessor
| successor
| prior_term
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox MP
| honorific_prefix =
| name =
| honorific_suffix =
| image =
| alt =
| caption =
| constituency_MP = <!--Can be repeated up to eight times by adding a number-->
| parliament = <!--Can be repeated up to 16 times by adding a number-->
| majority = <!--Can be repeated up to 16 times by adding a number-->
| term_start = <!--Can be repeated up to 16 times by adding a number-->
| term_end = <!--Can be repeated up to 16 times by adding a number-->
| predecessor = <!--Can be repeated up to 16 times by adding a number-->
| successor = <!--Can be repeated up to 16 times by adding a number-->
| prior_term =
</syntaxhighlight>
''add [[#Personal data|personal data]]''
{{clear}}
===U.S. Representatives===
====U.S. Congressperson====
{{For|examples of this code in use|Template:Infobox officeholder/example#US Congressperson}}
{{Generic template demo
| honorific_prefix
| name
| honorific_suffix
| image
| alt
| state
| district
| term_start
| term_end
| predecessor
| successor
| prior_term
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox Congressman
| honorific_prefix =
| name =
| honorific_suffix =
| image =
| alt =
| state = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| district = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| term_start = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| term_end = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| predecessor = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| successor = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| prior_term =
</syntaxhighlight>
''add [[#Personal data|personal data]]''
{{clear}}
If Congressperson served as Speaker of the House add:
{{Generic template demo
| speaker
| term_start2
| term_end2
| predecessor2
| successor2
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| speaker = <!--number of office holder-->
| term_start2 =
| term_end2 =
| predecessor2 =
| successor2 =
</syntaxhighlight>
{{clear}}
If Congressman has been elected but not sworn in:
{{Generic template demo
| succeeding
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| succeeding = <!--the name of the incumbent congressman-->
</syntaxhighlight>
{{clear}}
====State Representative====
{{For|examples of this code in use|Template:Infobox officeholder/example#State Representative}}
{{Generic template demo
| honorific_prefix
| name
| honorific_suffix
| image
| alt
| state_house
| district
| term_start
| term_end
| predecessor
| successor
| prior_term
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox state representative
| honorific_prefix =
| name =
| honorific_suffix =
| image =
| alt =
| state_house = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| district = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| term_start = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| term_end = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| predecessor = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| successor = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| prior_term =
</syntaxhighlight>
''add [[#Personal data|personal data]]''
{{clear}}
For Representative from states that have an Assembly, instead of state_house use:
{{Generic template demo
| state_assembly
| district
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| state_assembly = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| district = <!--Can be repeated up to 16 times by adding a number, start at 3-->
</syntaxhighlight>
{{clear}}
For Representative from states that have a House of Delegates, instead of state_house use:
{{Generic template demo
| state_delegate
| district
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| state_delegate = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| district = <!--Can be repeated up to 16 times by adding a number, start at 3-->
</syntaxhighlight>
{{clear}}
For Representative from states that have a Legislature, instead of state_house use:
{{Generic template demo
| state_legislature
| district
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| state_legislature = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| district = <!--Can be repeated up to 16 times by adding a number, start at 3-->
</syntaxhighlight>
{{clear}}
If Representative served as Speaker of the State House add:
{{Generic template demo
| speaker
| state_house
| term_start2
| term_end2
| predecessor2
| successor2
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| speaker = <!--number of office holder-->
| state_house =
| term_start2 =
| term_end2 =
| predecessor2 =
| successor2 =
</syntaxhighlight>
{{clear}}
===U.S. Senators===
====U.S. Senator====
{{For|examples of this code in use|Template:Infobox officeholder/example#US Senator}}
{{Generic template demo
| honorific_prefix
| name
| honorific_suffix
| image
| image_size
| image_upright
| alt
| jr/sr
| state
| term_start
| term_end
| predecessor
| successor
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox senator
| honorific_prefix =
| name =
| honorific_suffix =
| image =
| image_size =
| image_upright =
| alt =
| jr/sr = <!--Can be repeated up to eight times by appending 2, 3, etc--> Set to any value to display the "United States Senator from" header. If this parameter is missing or empty, "United States Senator from" will not be displayed.
| state = <!--Can be repeated up to eight times by appending 2, 3, etc-->
| term_start = <!--Can be repeated up to eight times by appending 2, 3, etc-->
| term_end = <!--Can be repeated up to eight times by appending 2, 3, etc-->
| predecessor = <!--Can be repeated up to eight times by appending 2, 3, etc-->
| successor = <!--Can be repeated up to eight times by appending 2, 3, etc-->
</syntaxhighlight>
''add [[#Personal data|personal data]]''
{{clear}}
{{Generic template demo
| term_start
| alongside
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| term_start =
| alongside = <!--the name of fellow senator-->
</syntaxhighlight>
{{clear}}
If Senator has just been elected and is a Senator-Elect:
{{Generic template demo
| succeeding
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| succeeding = <!--the name of the incumbent senator-->
</syntaxhighlight>
{{clear}}
If Senator served as Senate Majority Leader add:
{{Generic template demo
| majorityleader3
| term_start3
| term_end3
| predecessor3
| successor3
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| majorityleader3 = <!--number of office holder-->
| term_start3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| term_end3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| predecessor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| successor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
</syntaxhighlight>
{{clear}}
If Senator served as Congressman add:
{{Generic template demo
| state3
| district3
| term_start3
| term_end3
| predecessor3
| successor3
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| state3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| district3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| term_start3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| term_end3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| predecessor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| successor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
</syntaxhighlight>
{{clear}}
====State Senator====
{{For|examples of this code in use|Template:Infobox officeholder/example#State Senator}}
{{Generic template demo
| honorific_prefix
| name
| honorific_suffix
| image
| alt
| state_senate
| district
| term_start
| term_end
| predecessor
| successor
| prior_term
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox state senator
| honorific_prefix =
| name =
| honorific_suffix =
| image =
| alt =
| state_senate = <!--Can be repeated up to eight times by appending 2, 3, etc-->
| district = <!--Can be repeated up to eight times by appending 2, 3, etc-->
| term_start = <!--Can be repeated up to eight times by appending 2, 3, etc-->
| term_end = <!--Can be repeated up to eight times by appending 2, 3, etc-->
| predecessor = <!--Can be repeated up to eight times by appending 2, 3, etc-->
| successor = <!--Can be repeated up to eight times by appending 2, 3, etc-->
| prior_term =
</syntaxhighlight>
''add [[#Personal data|personal data]]''
{{clear}}
If State Senator served as Majority Leader of the State Senate add:
{{Generic template demo
| majority_leader3
| term_start3
| term_end3
| predecessor3
| successor3
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| majority_leader3 = <!--number of office holder-->
| term_start3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| term_end3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| predecessor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| successor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
</syntaxhighlight>
{{clear}}
If State Senator served as Minority Leader of the State Senate add:
{{Generic template demo
| minority_leader3
| term_start3
| term_end3
| predecessor3
| successor3
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| minority_leader3 = <!--number of office holder-->
| term_start3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| term_end3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| predecessor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| successor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
</syntaxhighlight>
{{clear}}
If State Senator served as Majority Floor Leader of the State Senate add:
{{Generic template demo
| majority_floor_leader3
| term_start3
| term_end3
| predecessor3
| successor3
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| majority_floor_leader3 = <!--number of office holder-->
| term_start3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| term_end3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| predecessor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| successor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
</syntaxhighlight>
{{clear}}
If State Senator served as Minority Floor Leader of the State Senate add:
{{Generic template demo
| minority_floor_leader3
| term_start3
| term_end3
| predecessor3
| successor3
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| minority_floor_leader3 = <!--number of office holder-->
| term_start3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| term_end3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| predecessor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| successor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
</syntaxhighlight>
{{clear}}
===Ukrainian legislative office===
{{For|examples of this code in use|Template:Infobox officeholder/example#Ukrainian legislative office}}
{{Generic template demo
| name
| native_name
| native_name_lang
| image
| caption
| office1
| convocation1
| constituency1
| term_start1
| term_end1
| convocation2
| constituency2
| term_start2
| term_end2
| office3
| convocation3
| constituency3
| term_start3
| term_end3
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox Ukrainian legislative office
| name =
| native_name =
| native_name_lang =
| image =
| caption =
| office1 =
| convocation1 =
| constituency1 =
| term_start1 =
| term_end1 =
| convocation2 =
| constituency2 =
| term_start2 =
| term_end2 =
| office3 = <!--Can be repeated up to 16 times by adding a number-->
| convocation3 = <!--Can be repeated up to 16 times by adding a number-->
| constituency3 = <!--Can be repeated up to 16 times by adding a number-->
| term_start3 = <!--Can be repeated up to 16 times by adding a number-->
| term_end3 = <!--Can be repeated up to 16 times by adding a number-->
</syntaxhighlight>
==Personal data==
Place this underneath the template
{{Generic template demo
| pronunciation
| birth_name <!-- only use if different from name -->
| birth_date
| birth_place
| death_date
| death_place
| death_cause <!-- should only be included when the cause of death has significance for the subject's notability -->
| resting_place
| resting_place_coordinates
| citizenship <!-- use only when necessary per [[WP:INFONAT]] -->
| nationality <!-- use only when necessary per [[WP:INFONAT]] -->
| party
| otherparty
| height
| spouse <!--Fill only if notable (reference required) or there is a WP article on this person-->
| partner <!--Fill only if notable (reference required) or there is a WP article on this person-->
| relations <!--Fill only if notable (reference required) or there is a WP article on this person-->
| children <!--Fill only if notable (reference required) or there is a WP article on this person-->
| parents <!--Fill only if notable (reference required) or there is a WP article on this person-->
| mother <!--Fill only if notable (reference required) or there is a WP article on this person-->
| father <!--Fill only if notable (reference required) or there is a WP article on this person-->
| relatives <!--Fill only if notable (reference required) or there is a WP article on this person-->
| residence
| education
| alma_mater
| occupation
| profession
| salary
| known_for
| cabinet
| committees
| portfolio
| awards
| blank1
| data1
| blank2
| data2
| blank3
| data3
| blank4
| data4
| blank5
| data5
| signature
| signature_alt
| website
| nickname
| allegiance
| branch
| serviceyears
| rank
| unit
| commands
| battles
| mawards
| military_blank1
| military_data1
| military_blank2
| military_data2
| military_blank3
| military_data3
| military_blank4
| military_data4
| military_blank5
| military_data5
| module
| module2
| module3
| module4
| module5
| footnotes
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| pronunciation =
| birth_name = <!-- only use if different from name -->
| birth_date = <!-- {{Birth date and age|YYYY|MM|DD}} -->
| birth_place =
| death_date = <!-- {{Death date and age|YYYY|MM|DD|YYYY|MM|DD}} -->
| death_place =
| death_cause = <!-- should only be included when the cause of death has significance for the subject's notability -->
| resting_place =
| resting_place_coordinates =
| citizenship = <!-- use only when necessary per [[WP:INFONAT]] -->
| nationality = <!-- use only when necessary per [[WP:INFONAT]] -->
| party =
| otherparty = <!--For additional political affiliations-->
| height = <!-- "X cm", "X m" or "X ft Y in" plus optional reference (conversions are automatic) -->
| spouse =
| partner = <!--For those with a domestic partner and not married-->
| relations =
| children =
| parents = <!-- overrides mother and father parameters -->
| mother = <!-- may be used (optionally with father parameter) in place of parents parameter (displays "Parent(s)" as label) -->
| father = <!-- may be used (optionally with mother parameter) in place of parents parameter (displays "Parent(s)" as label) -->
| relatives =
| residence =
| education =
| alma_mater =
| occupation =
| profession =
| known_for =
| salary =
| cabinet =
| committees =
| portfolio =
| awards = <!-- For civilian awards - appears as "Awards" if |mawards= is not set -->
| blank1 =
| data1 =
| blank2 =
| data2 =
| blank3 =
| data3 =
| blank4 =
| data4 =
| blank5 =
| data5 =
| signature =
| signature_alt =
| signature_size =
| website =
| nickname =
<!--Military service-->
| allegiance =
| branch =
| serviceyears =
| rank =
| unit =
| commands =
| battles =
| mawards = <!-- for military awards - appears as "Awards" if |awards= is not set -->
| military_blank1 =
| military_data1 =
| military_blank2 =
| military_data2 =
| military_blank3 =
| military_data3 =
| military_blank4 =
| military_data4 =
| military_blank5 =
| military_data5 =
<!--Embedded templates / Footnotes-->
| module =
| module2 =
| module3 =
| module4 =
| module5 =
| footnotes =
}}
</syntaxhighlight>
{{clear}}
<code>nationality</code> is [[Wikipedia:Manual of Style/Infoboxes#Nationality and citizenship|not displayed]] if the corresponding country is mentioned in <code>birth_place</code>, for example <code>|birth_place = Tokyo, Japan |nationality = Japanese</code>.
== Embedding other templates ==
The ''module'' parameters (module, module2, ... module5) may used to embed other templates into this infobox (see [[Wikipedia:Infobox modules]]).
<syntaxhighlight lang="wikitext" style="overflow: auto;">
{{Infobox officeholder
| name =
| <!-- etc. -->
| module =
{{Infobox football biography | embed = yes
| <!-- etc. -->
}}
}}
</syntaxhighlight>
== Embedding within a different infobox ==
Many officeholders are known for more than just their appointments (e.g., [[Clint Eastwood]]), and hence it may be desirable to merge this infobox with another one, like {{tl|Infobox person}}. By adding {{para|embed|yes}} to the first line of the infobox code, one can embed this infobox into another, creating the illusion of one continuous infobox. Though the process is a little complicated, it is possible to insert this infobox into most if not all other infoboxes. For {{tl|Infobox person}}, this infobox is passed as a "module" using the {{para|module}} syntax.
<syntaxhighlight lang="wikitext" style="overflow: auto">
{{Infobox person
| name = John Infobox
| image = Example.jpg
| caption = John Infobox in 2005
| birth_name = John Officeholder Person Infobox
| birth_date = {{Birth date|1950|5|25}}
| birth_place = Template City
| death_date = {{Death date and age|2010|10|22|1950|5|25}}
| occupation = Actor
| years_active = 1970–1990
| module =
{{Infobox officeholder | embed = yes
| office = Mayor of Wikipedia
| term_start = 1994
| term_end = 1998
}}
| website = {{URL|example.com}}
}}
</syntaxhighlight>
==Microformat==
{{UF-hcard-person}}
==TemplateData==
{{Collapse top|title=[[Wikipedia:TemplateData|TemplateData]] for this template used by [[mw:Extension:TemplateWizard|TemplateWizard]], [[Wikipedia:VisualEditor|VisualEditor]] and other tools}}
{{TemplateData header|noheader=1}}
<templatedata>
{
"description": "An infobox for office holders",
"format": "{{_\n| ___________________ = _\n}}\n",
"params": {
"name": {
"label": "Name",
"description": "Commonly-known name of person (defaults to article name, without disambiguation)",
"type": "line",
"default": "PAGENAME"
},
"office": {
"label": "office",
"description": "Office held",
"type": "string"
},
"order": {
"label": "order",
"description": "Used in conjunction with 'office' to state that the officeholder is the nth holder of the office",
"type": "string"
},
"bodyclass": {
"label": "bodyclass",
"type": "string"
},
"mainwidth": {
"label": "mainwidth",
"default": "22em",
"type": "string"
},
"native_name": {
"label": "Native name",
"type": "string",
"description": "Name in the person's native language",
"example": "Melquíades Rafael Martínez Ruiz"
},
"native_name_lang": {
"label": "Native name language",
"type": "string",
"description": "Language in which the person's native name is",
"example": "ca"
},
"image": {
"label": "Image",
"description": "Filename for the image (e.g. 'Example.jpg').",
"type": "wiki-file-name",
"required": false
},
"width": {
"label": "width",
"type": "string",
"aliases": [
"imagesize",
" image_size"
]
},
"alt": {
"label": "Alternative text",
"description": "Alternative text for the image.",
"type": "line"
},
"image name": {
"label": "image name",
"type": "string"
},
"smallimage": {
"label": "smallimage",
"type": "string"
},
"caption": {
"label": "Image caption",
"description": "Caption for the image.",
"type": "string",
"required": false
},
"alongside": {
"label": "alongside",
"description": "For two or more people serving in the same position from the same district. (e.g. United States senators.)",
"type": "string"
},
"ambassador_from": {
"label": "ambassador from",
"type": "string"
},
"appointer": {
"label": "appointer",
"type": "string"
},
"assembly": {
"label": "assembly",
"type": "string"
},
"chancellor": {
"label": "chancellor",
"type": "string"
},
"co-leader": {
"label": "co-leader",
"type": "string"
},
"constituency_AM": {
"label": "constituency AM",
"type": "string"
},
"constituency": {
"label": "constituency",
"type": "string"
},
"country": {
"label": "country",
"type": "string",
"example": "Israel"
},
"deputy": {
"label": "deputy",
"type": "string"
},
"district": {
"label": "district",
"type": "string"
},
"firstminister": {
"label": "first minister",
"type": "string"
},
"governor-general": {
"label": "governor-general",
"type": "string"
},
"leader": {
"label": "leader",
"type": "string"
},
"legislature": {
"label": "legislature",
"type": "wiki-page-name",
"example": "[[United States House of Representatives]]"
},
"lieutenant_governor": {
"label": "lieutenant governor",
"type": "string"
},
"lieutenant": {
"label": "lieutenant",
"type": "string"
},
"majorityleader": {
"label": "majority leader",
"type": "string"
},
"minister": {
"label": "minister",
"type": "string"
},
"minister_from": {
"label": "minister from",
"type": "string"
},
"minority_floor_leader": {
"label": "minority floor leader",
"type": "string"
},
"majority_floor_leader": {
"label": "majority floor leader",
"type": "string"
},
"minorityleader": {
"label": "minority leader",
"type": "string",
"example": "[[Chuck Shumer]]"
},
"monarch": {
"label": "monarch",
"type": "string"
},
"nominator": {
"label": "nominator",
"type": "string"
},
"parliament": {
"label": "parliament",
"type": "string"
},
"parliamentarygroup": {
"label": "parliamentary group",
"type": "string"
},
"predecessor": {
"label": "predecessor",
"type": "string"
},
"preceding": {
"label": "preceding",
"type": "string"
},
"preceded": {
"label": "preceded",
"type": "string"
},
"premier": {
"label": "premier",
"type": "string"
},
"president": {
"label": "president",
"type": "string"
},
"primeminister": {
"label": "primeminister",
"type": "string"
},
"riding": {
"label": "riding",
"type": "string"
},
"status": {
"label": "status",
"description": "If this is specified, overrides Incumbent.",
"type": "string"
},
"succeeded": {
"label": "succeeded",
"type": "string"
},
"succeeding": {
"label": "succeeding",
"description": "For President-elect or equivalent.",
"type": "string"
},
"successor": {
"label": "successor",
"type": "string"
},
"taoiseach": {
"label": "taoiseach",
"type": "string"
},
"term_start": {
"label": "term start",
"type": "string",
"description": "Date of the beginning of the person's term"
},
"term_end": {
"label": "term end",
"type": "string",
"description": "Date for the end of the person's term"
},
"title": {
"label": "title",
"type": "string"
},
"vicechair": {
"label": "vice chair",
"type": "string"
},
"vicegovernor": {
"label": "vice governor",
"type": "string"
},
"vicepresident": {
"label": "vice president",
"type": "string"
},
"vicepremier": {
"label": "vice premier",
"type": "string"
},
"viceprimeminister": {
"label": "vice prime minister",
"type": "string"
},
"speaker": {
"label": "speaker",
"type": "string"
},
"footnotes": {
"label": "footnotes",
"type": "string"
},
"date": {
"label": "date",
"type": "string"
},
"year": {
"label": "year",
"type": "string"
},
"source": {
"label": "source",
"type": "string"
},
"signature": {
"label": "signature",
"type": "wiki-file-name"
},
"signature_alt": {
"label": "signature alt text",
"type": "string"
},
"appointe": {
"label": "appointee",
"type": "string"
},
"alongside2": {
"label": "alongside 2",
"type": "string"
},
"peerage2": {
"label": "peerage 2",
"type": "string"
},
"ambassador_from2": {
"label": "ambassador from 2",
"type": "string"
},
"appointer2": {
"label": "appointer 2",
"type": "string"
},
"assembly2": {
"label": "assembly 2",
"type": "string"
},
"chancellor2": {
"label": "chancellor 2",
"type": "string"
},
"co-leader2": {
"label": "co-leader 2",
"type": "string"
},
"constituency_AM2": {
"label": "constituency AM 2",
"type": "string"
},
"country2": {
"label": "country 2",
"type": "string",
"example": "Malaya"
},
"deputy2": {
"label": "deputy 2",
"type": "string"
},
"district2": {
"label": "district 2",
"type": "string"
},
"firstminister2": {
"label": "first minister 2",
"type": "string"
},
"governor": {
"label": "governor",
"type": "string"
},
"governor-general2": {
"label": "governor-general 2",
"type": "string"
},
"governor2": {
"label": "governor 2",
"type": "string"
},
"leader2": {
"label": "leader 2",
"type": "string",
"example": "Donald Trump"
},
"legislature2": {
"label": "legislature 2",
"type": "wiki-page-name",
"example": "[[United States Senate]]"
},
"lieutenant_governor2": {
"label": "lieutenant governor 2",
"type": "string"
},
"lieutenant2": {
"label": "lieutenant2",
"type": "string"
},
"majority": {
"label": "majority",
"type": "string"
},
"majorityleader2": {
"label": "majority leader 2",
"type": "string",
"example": "Mitch McConnell"
},
"minister_from2": {
"label": "minister from 2",
"type": "string"
},
"minority_floor_leader2": {
"label": "minority floor leader 2",
"type": "string"
},
"majority_floor_leader2": {
"label": "majority floor leader 2",
"type": "string"
},
"majority2": {
"label": "majority 2",
"type": "string"
},
"minister2": {
"label": "minister 2",
"type": "string"
},
"minority": {
"label": "minority",
"type": "string"
},
"minorityleader2": {
"label": "minority leader 2",
"type": "string",
"example": "[[Chuck Shumer]]"
},
"monarch2": {
"label": "monarch 2",
"type": "string"
},
"nominator2": {
"label": "nominator 2",
"type": "string"
},
"office2": {
"label": "office 2",
"type": "string"
},
"order2": {
"label": "order 2",
"type": "string"
},
"parliament2": {
"label": "parliament2",
"type": "string"
},
"parliamentarygroup2": {
"label": "parliamentary group 2",
"type": "string"
},
"predecessor2": {
"label": "predecessor 2",
"type": "string"
},
"preceding2": {
"label": "preceding 2",
"type": "string"
},
"preceded2": {
"label": "preceded 2",
"type": "string"
},
"premier2": {
"label": "premier 2",
"type": "string"
},
"president2": {
"label": "president 2",
"type": "string"
},
"primeminister2": {
"label": "prime minister 2",
"type": "string"
},
"riding2": {
"label": "riding 2",
"type": "string"
},
"speaker_office": {
"label": "speaker office",
"type": "string"
},
"state_assembly": {
"label": "state assembly",
"type": "string"
},
"state_delegate": {
"label": "state delegate",
"type": "string"
},
"state_house": {
"label": "state house",
"type": "string"
},
"state_legislature": {
"label": "state legislature",
"type": "string"
},
"state_senate": {
"label": "state senate",
"type": "string"
},
"state": {
"label": "state",
"type": "string",
"description": "The state this officeholder represents or represented",
"example": "[[Alabama]]"
},
"term": {
"label": "term",
"type": "string"
},
"party": {
"label": "party",
"type": "string"
},
"prior_term": {
"label": "prior_term",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"1blankname": {
"label": "1blankname",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"1namedata": {
"label": "1namedata",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"2blankname": {
"label": "2blankname",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"2namedata": {
"label": "2namedata",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"3blankname": {
"label": "3blankname",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"3namedata": {
"label": "3namedata",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"4blankname": {
"label": "4blankname",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"4namedata": {
"label": "4namedata",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"5blankname": {
"label": "5blankname",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"5namedata": {
"label": "5namedata",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"1blankname1": {
"label": "1blankname1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"1namedata1": {
"label": "1namedata1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"2blankname1": {
"label": "2blankname1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"2namedata1": {
"label": "2namedata1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"3blankname1": {
"label": "3blankname1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"3namedata1": {
"label": "3namedata1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"4blankname1": {
"label": "4blankname1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"4namedata1": {
"label": "4namedata1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"5blankname1": {
"label": "5blankname1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"5namedata1": {
"label": "5namedata1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"alongside1": {
"label": "alongside1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"ambassador_from1": {
"label": "ambassador_from1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"appointer1": {
"label": "appointer1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"assembly1": {
"label": "assembly1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"chair1": {
"label": "chair1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"chancellor1": {
"label": "chancellor1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"co-leader1": {
"label": "co-leader1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"constituency_AM1": {
"label": "constituency_AM1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"constituency1": {
"label": "constituency1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"country1": {
"label": "country1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"deputy1": {
"label": "deputy1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"district1": {
"label": "district1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"firstminister1": {
"label": "firstminister1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"governor-general1": {
"label": "governor-general1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"governor1": {
"label": "governor1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"leader1": {
"label": "leader1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"legislature1": {
"label": "legislature1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"lieutenant_governor1": {
"label": "lieutenant governor 1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"lieutenant1": {
"label": "lieutenant 1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"minority_floor_leader1": {
"label": "minority floor leader 1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"minister_from1": {
"label": "minister from 1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"majority_floor_leader1": {
"label": "majority_floor_leader1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"majorityleader1": {
"label": "majorityleader1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"majority1": {
"label": "majority1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"minister1": {
"label": "minister1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"minorityleader1": {
"label": "minorityleader1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"monarch1": {
"label": "monarch1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"nominator1": {
"label": "nominator1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"office1": {
"label": "office1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"order1": {
"label": "order1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"parliament1": {
"label": "parliament1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"parliamentarygroup1": {
"label": "parliamentary group 1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"predecessor1": {
"label": "predecessor1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"preceding1": {
"label": "preceding1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"preceded1": {
"label": "preceded1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"premier1": {
"label": "premier1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"president1": {
"label": "president1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"primeminister1": {
"label": "primeminister1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"riding1": {
"label": "riding 1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state_assembly1": {
"label": "state_assembly1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state_delegate1": {
"label": "state_delegate1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state_house1": {
"label": "state_house1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state_legislature1": {
"label": "state_legislature1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state_senate1": {
"label": "state_senate1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state1": {
"label": "state1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"succeeded1": {
"label": "succeeded1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"succeeding1": {
"label": "succeeding1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"successor1": {
"label": "successor1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"taoiseach1": {
"label": "taoiseach1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"termend1": {
"label": "termend1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"termstart1": {
"label": "termstart1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"term1": {
"label": "term1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"title1": {
"label": "title1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"vicechair1": {
"label": "vicechair1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"vicegovernor1": {
"label": "vicegovernor1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"vicepresident1": {
"label": "vicepresident1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"vicepremier1": {
"label": "vicepremier1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"viceprimeminister1": {
"label": "viceprimeminister1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"prior_term1": {
"label": "prior term 1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"termend2": {
"label": "term end 2",
"type": "string"
},
"termstart2": {
"label": "term start 2",
"type": "string"
},
"term2": {
"label": "term 2",
"type": "string"
},
"title2": {
"label": "title 2",
"type": "string"
},
"vicechair2": {
"label": "vice chair 2",
"type": "string"
},
"vicegovernor2": {
"label": "vice governor 2",
"type": "string"
},
"vicepresident2": {
"label": "vice president 2",
"type": "string"
},
"vicepremier2": {
"label": "vice premier 2",
"type": "string"
},
"viceprimeminister2": {
"label": "vice prime minister 2",
"type": "string"
},
"succeeded2": {
"label": "succeeded 2",
"type": "string"
},
"succeeding2": {
"label": "succeeding 2",
"type": "string"
},
"successor2": {
"label": "successor 2",
"type": "string"
},
"taoiseach2": {
"label": "taoiseach 2",
"type": "string"
},
"state_assembly2": {
"label": "state assembly2",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state_delegate2": {
"label": "state delegate2",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state_house2": {
"label": "state house 2",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state_legislature2": {
"label": "state legislature 2",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state_senate2": {
"label": "state senate2",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state 2": {
"label": "state 2",
"description": "Additional fields numbered up to 14",
"type": "string",
"example": "[[Georgia (U.S. State)|Georgia]]"
},
"prior_term2": {
"label": "prior term 2",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"birth_name": {
"label": "Birth name",
"description": "Name at birth, if different from 'name'.",
"type": "string",
"required": false,
"aliases": [
"birthname"
]
},
"birth_date": {
"label": "Birth date",
"description": "Date of birth. Use {{birth date and age}} (for living people) or {{birth date}} for the deceased.",
"type": "line",
"required": false
},
"birth_place": {
"label": "Birth place",
"description": "Place of birth.",
"type": "line"
},
"death_date": {
"label": "Death date",
"description": "Date of death. Use {{death date and age}}. Use {{death date}} if birth date unknown or incomplete.",
"type": "content"
},
"death_place": {
"label": "Death place",
"description": "The person's place of death, if deceased",
"type": "line",
"required": false,
"example": "[[Crown Heights]]"
},
"resting_place": {
"label": "Resting place",
"description": "Person's grave, etc.",
"type": "line",
"required": false
},
"resting_place_coordinates": {
"label": "Resting place",
"description": "Coordinates of grave, etc. Use {{Coord|LAT|LONG|type:landmark|display=inline}}",
"type": "line"
},
"citizenship": {
"label": "citizenship",
"type": "string",
"description": "The person's country of citizenship",
"example": "[[Germany]]"
},
"nationality": {
"label": "Nationality",
"description": "The person's nationality, use only when necessary per [[WP:INFONAT]]",
"type": "line",
"example": "Canadian"
},
"otherparty": {
"label": "other political party",
"type": "string"
},
"spouse": {
"label": "Spouse(s)",
"description": "Spouse(s), if notable",
"type": "line",
"required": false,
"aliases": [
"spouses"
]
},
"partner": {
"label": "Partner(s)",
"description": "Domestic partner(s), if notable",
"type": "line"
},
"relations": {
"label": "relations",
"type": "string"
},
"children": {
"label": "children",
"type": "string"
},
"parents": {
"label": "parents",
"type": "string"
},
"residence": {
"label": "Residence",
"description": "Where this person lives",
"type": "line"
},
"alma_mater": {
"label": "Alma mater",
"description": "The linked name of attended higher education institution(s).",
"type": "line"
},
"occupation": {
"label": "occupation",
"description": " Please observe sentence case and capitalise only the first letter of the first item: (i.e. Politician, entrepreneur, businessman)",
"type": "string"
},
"profession": {
"label": "profession",
"description": " Please observe sentence case and capitalise only the first letter of the first item: (i.e. Attorney, accountant)",
"type": "string"
},
"cabinet": {
"label": "cabinet",
"type": "string"
},
"committees": {
"label": "committees",
"type": "string"
},
"portfolio": {
"label": "portfolio",
"type": "string"
},
"blank1": {
"label": "blank1",
"description": "Also blank2 ... blank5",
"type": "string"
},
"data1": {
"label": "data1",
"description": "Also data2 ... data5",
"type": "string"
},
"website": {
"label": "Official website",
"description": "Office holder's official website, using {{URL}}.",
"type": "line"
},
"nickname": {
"label": "nickname",
"type": "string"
},
"allegiance": {
"label": "allegiance",
"type": "string"
},
"branch": {
"label": "branch",
"type": "string"
},
"serviceyears": {
"label": "serviceyears",
"type": "string"
},
"rank": {
"label": "rank",
"type": "string"
},
"unit": {
"label": "unit",
"type": "string"
},
"commands": {
"label": "commands",
"type": "string"
},
"battles": {
"label": "battles fought",
"type": "string"
},
"military_blank1": {
"label": "military blank 1",
"description": "Also military_blank2 ... military_blank5",
"type": "string"
},
"military_data1": {
"label": "military data 1",
"description": "Also military_data2 ... military_data5",
"type": "string"
},
"1blankname2": {
"label": "1blankname2",
"type": "string"
},
"1namedata2": {
"label": "1namedata2",
"type": "string"
},
"2blankname2": {
"label": "2blankname2",
"type": "string"
},
"2namedata2": {
"label": "2namedata2",
"type": "string"
},
"3blankname2": {
"label": "3blankname2",
"type": "string"
},
"3namedata2": {
"label": "3namedata2",
"type": "string"
},
"4blankname2": {
"label": "4blankname2",
"type": "string"
},
"4namedata2": {
"label": "4namedata2",
"type": "string"
},
"5blankname2": {
"label": "5blankname2",
"type": "string"
},
"5namedata2": {
"label": "5namedata2",
"type": "string"
},
"pronunciation": {
"label": "Name pronunciation",
"type": "string"
},
"honorific_prefix": {
"label": "Honorific prefix",
"description": "Title such as 'Sir', 'Lord'",
"type": "wiki-page-name",
"required": false,
"aliases": [
"honorific prefix"
]
},
"honorific_suffix": {
"label": "Honorific suffix",
"description": "Initials such as 'OBE', 'FRSA'",
"type": "wiki-page-name",
"required": false,
"aliases": [
"honorific suffix"
]
},
"image_size": {
"label": "Image size",
"description": "Size of the image (e.g. '220px').",
"type": "line",
"default": "varies",
"required": false,
"aliases": [
"imagesize"
]
},
"education": {
"label": "Education",
"description": "Where or with whom the officeholder trained.",
"type": "line",
"required": false
},
"awards": {
"label": "Awards",
"description": "Awards won by the officeholder. Consider using {{awd}}.",
"type": "line",
"required": false
},
"image_name_alt": {},
"smallname_alt": {},
"net_worth": {
"label": "DEPRECATED: Net worth",
"description": "Current estimated net worth, if relevant. Please be sure to support with a citation from a reliable source, in the article body.",
"deprecated": "DEPRECATED: Use of this parameter is discouraged. Delete it when encountered."
}
}
}
</templatedata>
{{Collapse bottom}}
== Tracking categories ==
'''Hidden tracking/maintenance categories (in main and supporting templates)'''
* {{clc|Biography template using pronunciation}}
* {{clc|Pages using infobox officeholder with ambassador from or minister from}}
* {{clc|Pages using infobox officeholder with both term and term_start or term_end}}
* {{clc|Pages using infobox officeholder with office0}}
* {{clc|Pages using infobox officeholder with speaker}}
* {{clc|Pages using infobox officeholder with succeeding and term or termend}}
* {{clc|Pages using infobox officeholder with unknown parameters}}
== See also ==
* [[Template:S-start]] ([[Wikipedia:WikiProject Succession Box Standardization|succession box standardization]])
'''Supporting templates'''
* [[Template:Infobox officeholder/office]]
* <!-- [[Template:Infobox officeholder/Personal data]] -->
<includeonly>{{Sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Infobox templates|Officeholder]]
[[Category:Politics and government infobox templates|Officeholder]]
[[Category:People and person infobox templates|Officeholder]]
[[Category:Infobox templates with module parameter|Officeholder]]
[[Category:Biographical templates usable as a module|Officeholder]]
[[Category:Templates that add a tracking category]]
}}</includeonly>
2172cd2acae07c73230ccb899ef236675cc4e2f7
Module:Transclusion count/data/I
828
136
263
2023-12-17T05:10:26Z
wikipedia>Ahechtbot
0
[[Wikipedia:BOT|Bot]]: Updated page.
Scribunto
text/plain
return {
["IAST"] = 6600,
["IBDB_name"] = 9200,
["ICD10"] = 4700,
["ICD9"] = 4400,
["ICS"] = 2900,
["IDN"] = 3400,
["IMDb_episode"] = 10000,
["IMDb_episodes"] = 2700,
["IMDb_name"] = 155000,
["IMDb_title"] = 191000,
["IMO_Number"] = 4100,
["IMSLP"] = 8300,
["INA"] = 2200,
["IND"] = 7700,
["INR"] = 6600,
["INRConvert"] = 5700,
["INRConvert/CurrentRate"] = 5700,
["INRConvert/USD"] = 5700,
["INRConvert/out"] = 5700,
["IOC_profile"] = 5000,
["IP"] = 2700,
["IPA"] = 144000,
["IPA-de"] = 8300,
["IPA-es"] = 7900,
["IPA-fr"] = 44000,
["IPA-it"] = 5900,
["IPA-nl"] = 3900,
["IPA-pl"] = 4100,
["IPA-pt"] = 3300,
["IPA-sl"] = 6900,
["IPA-th"] = 3000,
["IPA_audio_link"] = 3500,
["IPA_link"] = 3600,
["IPAc-cmn"] = 2300,
["IPAc-en"] = 49000,
["IPAc-pl"] = 51000,
["IPC_athlete"] = 2800,
["IPSummary"] = 79000,
["IP_summary"] = 79000,
["IPtalk"] = 18000,
["IPuser"] = 7100,
["IPvandal"] = 2900,
["IRC"] = 7300,
["IRI"] = 2300,
["IRL"] = 5500,
["IRN"] = 3700,
["ISBN"] = 463000,
["ISBN?"] = 2100,
["ISBNT"] = 39000,
["ISBN_missing"] = 2600,
["ISFDB_name"] = 4100,
["ISFDB_title"] = 4600,
["ISL"] = 2100,
["ISO_15924/script-example-character"] = 2800,
["ISO_15924/wp-article"] = 2800,
["ISO_15924/wp-article/format"] = 2800,
["ISO_15924/wp-article/label"] = 2700,
["ISO_3166_code"] = 497000,
["ISO_3166_name"] = 16000,
["ISO_639_name"] = 8200,
["ISP"] = 5300,
["ISR"] = 4900,
["ISSN"] = 12000,
["ISSN_link"] = 30000,
["ISTAT"] = 8100,
["ISU_figure_skater"] = 2500,
["ITA"] = 17000,
["ITF"] = 6300,
["ITF_profile"] = 9100,
["ITIS"] = 4400,
["ITN_talk"] = 10000,
["ITN_talk/date"] = 10000,
["IUCN_banner"] = 15000,
["I_sup"] = 4600,
["Ice_hockey"] = 19000,
["Ice_hockey_stats"] = 19000,
["Icehockeystats"] = 12000,
["Icon"] = 585000,
["If"] = 279000,
["If_all"] = 6500,
["If_between"] = 3800,
["If_both"] = 130000,
["If_empty"] = 3720000,
["If_first_display_both"] = 73000,
["If_in_page"] = 11000,
["If_last_display_both"] = 30000,
["If_number"] = 2200,
["If_preview"] = 58000,
["If_then_show"] = 297000,
["Ifempty"] = 4000,
["Ifeq"] = 17000,
["Iferror_then_show"] = 3300,
["Ifexist_not_redirect"] = 1320000,
["Ifnotempty"] = 15000,
["Ifnumber"] = 37000,
["Ifsubst"] = 459000,
["Ih"] = 7600,
["Ill"] = 124000,
["Illm"] = 6600,
["Image_frame"] = 5000,
["Image_label"] = 4500,
["Image_label_begin"] = 3900,
["Image_label_end"] = 3800,
["Image_label_small"] = 2600,
["Image_needed"] = 4500,
["Image_other"] = 273000,
["Image_requested"] = 169000,
["Image_requested/Category_helper"] = 161000,
["Imbox"] = 924000,
["Imdb_name"] = 5500,
["Imdb_title"] = 3900,
["Import_style"] = 12000,
["Import_style/inputbox.css"] = 11000,
["Importance"] = 5680000,
["Importance/colour"] = 5690000,
["Importance_mask"] = 10500000,
["Improve_categories"] = 7600,
["Improve_documentation"] = 2700,
["In_class"] = 5700,
["In_lang"] = 359000,
["In_progress"] = 3300,
["In_string"] = 78000,
["In_title"] = 20000,
["Inactive_userpage_blanked"] = 4900,
["Include-USGov"] = 29000,
["Incomplete_list"] = 23000,
["Inconclusive"] = 2100,
["Increase"] = 44000,
["Incumbent_pope"] = 4300,
["Indent"] = 4600,
["IndexFungorum"] = 2200,
["Indian_English"] = 4300,
["Indian_Rupee"] = 10000,
["Indian_railway_code"] = 3200,
["Inflation"] = 21000,
["Inflation-fn"] = 5400,
["Inflation-year"] = 4500,
["Inflation/IN/startyear"] = 5700,
["Inflation/UK"] = 4400,
["Inflation/UK/dataset"] = 4400,
["Inflation/UK/startyear"] = 4400,
["Inflation/US"] = 12000,
["Inflation/US-GDP"] = 2400,
["Inflation/US-GDP/dataset"] = 2400,
["Inflation/US-GDP/startyear"] = 2400,
["Inflation/US/dataset"] = 12000,
["Inflation/US/startyear"] = 12000,
["Inflation/fn"] = 6300,
["Inflation/year"] = 26000,
["Info"] = 7200,
["Infobox"] = 3260000,
["Infobox/Columns"] = 2500,
["Infobox/mobileviewfix.css"] = 146000,
["Infobox3cols"] = 17000,
["Infobox_AFL_biography"] = 14000,
["Infobox_Aircraft_Begin"] = 5300,
["Infobox_Aircraft_Type"] = 4700,
["Infobox_Athletics_Championships"] = 2700,
["Infobox_Australian_place"] = 15000,
["Infobox_CFL_biography"] = 2100,
["Infobox_COA_wide"] = 3300,
["Infobox_Canada_electoral_district"] = 2500,
["Infobox_Canadian_Football_League_biography"] = 5700,
["Infobox_Canadian_Football_League_biography/position"] = 5600,
["Infobox_Chinese"] = 21000,
["Infobox_Chinese/Chinese"] = 2800,
["Infobox_Chinese/Footer"] = 8700,
["Infobox_Chinese/Header"] = 8700,
["Infobox_Chinese/Korean"] = 17000,
["Infobox_Christian_leader"] = 18000,
["Infobox_French_commune"] = 38000,
["Infobox_GAA_player"] = 2700,
["Infobox_Gaelic_games_player"] = 5000,
["Infobox_German_location"] = 13000,
["Infobox_German_place"] = 14000,
["Infobox_Grand_Prix_race_report"] = 2000,
["Infobox_Greece_place"] = 2900,
["Infobox_Greek_Dimos"] = 2800,
["Infobox_Hindu_temple"] = 2500,
["Infobox_Indian_constituency"] = 4700,
["Infobox_Indian_constituency/defaultdata"] = 4700,
["Infobox_Italian_comune"] = 8100,
["Infobox_Korean_name"] = 15000,
["Infobox_Korean_name/categories"] = 15000,
["Infobox_NASCAR_race_report"] = 2300,
["Infobox_NCAA_team_season"] = 17000,
["Infobox_NFL_biography"] = 28000,
["Infobox_NFL_player"] = 7600,
["Infobox_NFL_team_season"] = 3900,
["Infobox_NRHP"] = 73000,
["Infobox_NRHP/conv"] = 18000,
["Infobox_NRHP/locmapin2region"] = 66000,
["Infobox_Officeholder"] = 4700,
["Infobox_Olympic_event"] = 7400,
["Infobox_Olympic_event/games_text"] = 7400,
["Infobox_Pan_American_Games_event"] = 2300,
["Infobox_Paralympic_event"] = 2600,
["Infobox_Paralympic_event/games_text"] = 2600,
["Infobox_Politician"] = 2200,
["Infobox_Romanian_subdivision"] = 3200,
["Infobox_Russian_district"] = 2000,
["Infobox_Russian_inhabited_locality"] = 4500,
["Infobox_SCOTUS_case"] = 3700,
["Infobox_Site_of_Special_Scientific_Interest"] = 2000,
["Infobox_Swiss_town"] = 2800,
["Infobox_Switzerland_municipality"] = 2900,
["Infobox_Turkey_place"] = 19000,
["Infobox_U.S._county"] = 3000,
["Infobox_U.S._county/district"] = 3000,
["Infobox_UK_constituency"] = 2100,
["Infobox_UK_constituency/year"] = 2100,
["Infobox_UK_legislation"] = 3500,
["Infobox_UK_place"] = 26000,
["Infobox_UK_place/NoDialCode"] = 8100,
["Infobox_UK_place/NoPostCode"] = 3200,
["Infobox_UK_place/area"] = 2400,
["Infobox_UK_place/dist"] = 2500,
["Infobox_UK_place/local"] = 26000,
["Infobox_UK_place/styles.css"] = 26000,
["Infobox_UN_resolution"] = 2300,
["Infobox_US_Supreme_Court_case"] = 3900,
["Infobox_US_Supreme_Court_case/courts"] = 3800,
["Infobox_Wikipedia_user"] = 9900,
["Infobox_YouTube_personality"] = 2700,
["Infobox_YouTube_personality/styles.css"] = 2700,
["Infobox_academic"] = 14000,
["Infobox_aircraft_begin"] = 14000,
["Infobox_aircraft_occurrence"] = 2300,
["Infobox_aircraft_type"] = 13000,
["Infobox_airline"] = 4600,
["Infobox_airport"] = 15000,
["Infobox_airport/datatable"] = 15000,
["Infobox_album"] = 163000,
["Infobox_album/color"] = 193000,
["Infobox_album/link"] = 163000,
["Infobox_anatomy"] = 4500,
["Infobox_ancient_site"] = 5500,
["Infobox_animanga/Footer"] = 6900,
["Infobox_animanga/Header"] = 6900,
["Infobox_animanga/Print"] = 5500,
["Infobox_animanga/Video"] = 4800,
["Infobox_architect"] = 3700,
["Infobox_artist"] = 29000,
["Infobox_artist_discography"] = 6000,
["Infobox_artwork"] = 11000,
["Infobox_athlete"] = 2800,
["Infobox_automobile"] = 8500,
["Infobox_award"] = 13000,
["Infobox_badminton_player"] = 3200,
["Infobox_baseball_biography"] = 28000,
["Infobox_baseball_biography/style"] = 28000,
["Infobox_baseball_biography/styles.css"] = 28000,
["Infobox_baseball_team_season"] = 3300,
["Infobox_baseball_team_season/leagueseason"] = 3200,
["Infobox_baseball_team_season/season"] = 3200,
["Infobox_baseball_team_season/styles.css"] = 3200,
["Infobox_basketball_biography"] = 21000,
["Infobox_basketball_biography/style"] = 21000,
["Infobox_basketball_club"] = 3000,
["Infobox_basketball_club/styles.css"] = 3000,
["Infobox_beauty_pageant"] = 2400,
["Infobox_bilateral_relations"] = 4500,
["Infobox_body_of_water"] = 18000,
["Infobox_book"] = 53000,
["Infobox_boxer"] = 5700,
["Infobox_bridge"] = 6100,
["Infobox_building"] = 28000,
["Infobox_character"] = 7500,
["Infobox_chess_biography"] = 4000,
["Infobox_chess_player"] = 3300,
["Infobox_church"] = 15000,
["Infobox_church/denomination"] = 15000,
["Infobox_church/font_color"] = 15000,
["Infobox_civil_conflict"] = 2400,
["Infobox_civilian_attack"] = 5600,
["Infobox_college_coach"] = 12000,
["Infobox_college_football_game"] = 2100,
["Infobox_college_football_player"] = 2200,
["Infobox_college_sports_team_season"] = 40000,
["Infobox_college_sports_team_season/link"] = 40000,
["Infobox_college_sports_team_season/name"] = 40000,
["Infobox_college_sports_team_season/succession"] = 40000,
["Infobox_college_sports_team_season/team"] = 40000,
["Infobox_comic_book_title"] = 3000,
["Infobox_comics_character"] = 3500,
["Infobox_comics_creator"] = 3500,
["Infobox_comics_creator/styles.css"] = 3500,
["Infobox_company"] = 84000,
["Infobox_computing_device"] = 2400,
["Infobox_concert"] = 3300,
["Infobox_constituency"] = 5500,
["Infobox_country"] = 6500,
["Infobox_country/formernext"] = 6100,
["Infobox_country/imagetable"] = 5300,
["Infobox_country/multirow"] = 8400,
["Infobox_country/status_text"] = 2800,
["Infobox_country/styles.css"] = 6500,
["Infobox_country_at_games"] = 15000,
["Infobox_country_at_games/core"] = 15000,
["Infobox_country_at_games/see_also"] = 12000,
["Infobox_court_case"] = 4700,
["Infobox_court_case/images"] = 2400,
["Infobox_cricket_tournament"] = 2400,
["Infobox_cricketer"] = 32000,
["Infobox_cricketer/career"] = 32000,
["Infobox_cricketer/national_side"] = 7500,
["Infobox_criminal"] = 6500,
["Infobox_curler"] = 2600,
["Infobox_cycling_race_report"] = 4500,
["Infobox_cyclist"] = 16000,
["Infobox_dam"] = 5700,
["Infobox_deity"] = 2000,
["Infobox_deity/color"] = 2000,
["Infobox_designation_list"] = 20000,
["Infobox_designation_list/entry"] = 17000,
["Infobox_dim"] = 7000,
["Infobox_dim/core"] = 7000,
["Infobox_diocese"] = 3800,
["Infobox_drug"] = 10000,
["Infobox_drug/chemical_formula"] = 10000,
["Infobox_drug/data_page_link"] = 10000,
["Infobox_drug/formatATC"] = 9900,
["Infobox_drug/formatCASnumber"] = 10000,
["Infobox_drug/formatChEBI"] = 10000,
["Infobox_drug/formatChEMBL"] = 10000,
["Infobox_drug/formatChemDBNIAID"] = 10000,
["Infobox_drug/formatChemSpider"] = 10000,
["Infobox_drug/formatCompTox"] = 10000,
["Infobox_drug/formatDrugBank"] = 10000,
["Infobox_drug/formatIUPHARBPS"] = 10000,
["Infobox_drug/formatJmol"] = 10000,
["Infobox_drug/formatKEGG"] = 10000,
["Infobox_drug/formatPDBligand"] = 9300,
["Infobox_drug/formatPubChemCID"] = 10000,
["Infobox_drug/formatPubChemSID"] = 10000,
["Infobox_drug/formatUNII"] = 10000,
["Infobox_drug/legal_status"] = 10000,
["Infobox_drug/licence"] = 10000,
["Infobox_drug/maintenance_categories"] = 10000,
["Infobox_drug/non-ref-space"] = 4300,
["Infobox_drug/pregnancy_category"] = 10000,
["Infobox_drug/title"] = 10000,
["Infobox_election"] = 30000,
["Infobox_election/row"] = 30000,
["Infobox_election/shortname"] = 28000,
["Infobox_enzyme"] = 5100,
["Infobox_ethnic_group"] = 7300,
["Infobox_event"] = 5500,
["Infobox_family"] = 2200,
["Infobox_figure_skater"] = 4200,
["Infobox_film"] = 158000,
["Infobox_film/short_description"] = 154000,
["Infobox_film_awards"] = 2700,
["Infobox_film_awards/link"] = 2700,
["Infobox_film_awards/style"] = 2700,
["Infobox_food"] = 7000,
["Infobox_football_biography"] = 207000,
["Infobox_football_club"] = 28000,
["Infobox_football_club_season"] = 21000,
["Infobox_football_league"] = 2600,
["Infobox_football_league_season"] = 20000,
["Infobox_football_match"] = 5900,
["Infobox_football_tournament_season"] = 8100,
["Infobox_former_subdivision"] = 3400,
["Infobox_former_subdivision/styles.css"] = 3400,
["Infobox_galaxy"] = 2100,
["Infobox_game"] = 2600,
["Infobox_game_score"] = 3500,
["Infobox_gene"] = 13000,
["Infobox_given_name"] = 4100,
["Infobox_golfer"] = 4500,
["Infobox_golfer/highest_ranking"] = 4500,
["Infobox_government_agency"] = 11000,
["Infobox_government_cabinet"] = 2700,
["Infobox_gridiron_football_person"] = 2400,
["Infobox_gridiron_football_person/position"] = 5600,
["Infobox_gymnast"] = 3500,
["Infobox_handball_biography"] = 4900,
["Infobox_historic_site"] = 12000,
["Infobox_horseraces"] = 2600,
["Infobox_hospital"] = 6300,
["Infobox_hospital/care_system"] = 6300,
["Infobox_hospital/lists"] = 6300,
["Infobox_ice_hockey_biography"] = 20000,
["Infobox_ice_hockey_player"] = 19000,
["Infobox_ice_hockey_team"] = 3000,
["Infobox_ice_hockey_team_season"] = 2000,
["Infobox_international_football_competition"] = 5800,
["Infobox_islands"] = 8900,
["Infobox_islands/area"] = 9300,
["Infobox_islands/density"] = 9300,
["Infobox_islands/length"] = 8900,
["Infobox_islands/styles.css"] = 8900,
["Infobox_journal"] = 9800,
["Infobox_journal/Abbreviation_search"] = 9600,
["Infobox_journal/Bluebook_check"] = 9400,
["Infobox_journal/Former_check"] = 9400,
["Infobox_journal/ISO_4_check"] = 9400,
["Infobox_journal/ISSN-eISSN"] = 9500,
["Infobox_journal/Indexing_search"] = 9600,
["Infobox_journal/MathSciNet_check"] = 9400,
["Infobox_journal/NLM_check"] = 9400,
["Infobox_journal/frequency"] = 8600,
["Infobox_lake"] = 4300,
["Infobox_language"] = 9600,
["Infobox_language/family-color"] = 11000,
["Infobox_language/genetic"] = 6600,
["Infobox_language/linguistlist"] = 9600,
["Infobox_language/ref"] = 7100,
["Infobox_legislation"] = 2000,
["Infobox_legislature"] = 3700,
["Infobox_library"] = 2200,
["Infobox_lighthouse"] = 2600,
["Infobox_lighthouse/light"] = 2600,
["Infobox_locomotive"] = 5000,
["Infobox_magazine"] = 7700,
["Infobox_manner_of_address"] = 3400,
["Infobox_mapframe"] = 81000,
["Infobox_martial_artist"] = 5700,
["Infobox_martial_artist/record"] = 5700,
["Infobox_medal_templates"] = 422000,
["Infobox_medical_condition"] = 10000,
["Infobox_medical_condition_(new)"] = 8100,
["Infobox_medical_details"] = 2100,
["Infobox_military_conflict"] = 22000,
["Infobox_military_installation"] = 9800,
["Infobox_military_person"] = 45000,
["Infobox_military_unit"] = 26000,
["Infobox_mine"] = 2100,
["Infobox_model"] = 2300,
["Infobox_monument"] = 2100,
["Infobox_mountain"] = 28000,
["Infobox_multi-sport_competition_event"] = 2400,
["Infobox_museum"] = 11000,
["Infobox_musical_artist"] = 122000,
["Infobox_musical_artist/color"] = 122000,
["Infobox_musical_artist/hCard_class"] = 315000,
["Infobox_musical_composition"] = 3000,
["Infobox_name"] = 7500,
["Infobox_name_module"] = 7200,
["Infobox_newspaper"] = 9800,
["Infobox_nobility"] = 2300,
["Infobox_noble"] = 7400,
["Infobox_officeholder"] = 223000,
["Infobox_officeholder/office"] = 229000,
["Infobox_official_post"] = 8200,
["Infobox_organization"] = 36000,
["Infobox_pageant_titleholder"] = 3000,
["Infobox_park"] = 7600,
["Infobox_person"] = 485000,
["Infobox_person/Wikidata"] = 4600,
["Infobox_person/height"] = 104000,
["Infobox_person/length"] = 7000,
["Infobox_person/weight"] = 67000,
["Infobox_philosopher"] = 3500,
["Infobox_planet"] = 4700,
["Infobox_play"] = 4000,
["Infobox_political_party"] = 14000,
["Infobox_power_station"] = 3100,
["Infobox_prepared_food"] = 3100,
["Infobox_professional_wrestler"] = 4300,
["Infobox_professional_wrestling_event"] = 2700,
["Infobox_protected_area"] = 14000,
["Infobox_protein_family"] = 2100,
["Infobox_publisher"] = 2400,
["Infobox_racehorse"] = 5600,
["Infobox_racing_driver"] = 4000,
["Infobox_racing_driver_series_section"] = 2100,
["Infobox_radio_station"] = 22000,
["Infobox_rail"] = 2900,
["Infobox_rail_line"] = 7300,
["Infobox_rail_service"] = 3000,
["Infobox_rail_service/doc"] = 2900,
["Infobox_reality_competition_season"] = 3600,
["Infobox_record_label"] = 4000,
["Infobox_recurring_event"] = 6500,
["Infobox_religious_biography"] = 5300,
["Infobox_religious_building"] = 13000,
["Infobox_religious_building/color"] = 18000,
["Infobox_restaurant"] = 3000,
["Infobox_river"] = 30000,
["Infobox_river/calcunit"] = 30000,
["Infobox_river/discharge"] = 30000,
["Infobox_river/row-style"] = 30000,
["Infobox_river/source"] = 30000,
["Infobox_road"] = 24000,
["Infobox_road/meta/mask/category"] = 24000,
["Infobox_road/meta/mask/country"] = 24000,
["Infobox_road/styles.css"] = 25000,
["Infobox_road_small"] = 2300,
["Infobox_rockunit"] = 6400,
["Infobox_royalty"] = 22000,
["Infobox_royalty/short_description"] = 12000,
["Infobox_rugby_biography"] = 16000,
["Infobox_rugby_biography/correct_date"] = 16000,
["Infobox_rugby_biography/depcheck"] = 16000,
["Infobox_rugby_league_biography"] = 10000,
["Infobox_rugby_league_biography/PLAYER"] = 9900,
["Infobox_rugby_team"] = 2600,
["Infobox_sailboat_specifications"] = 2300,
["Infobox_saint"] = 5000,
["Infobox_school"] = 38000,
["Infobox_school/short_description"] = 38000,
["Infobox_school_district"] = 5700,
["Infobox_school_district/styles.css"] = 5700,
["Infobox_scientist"] = 49000,
["Infobox_service_record"] = 2600,
["Infobox_settlement"] = 563000,
["Infobox_settlement/areadisp"] = 239000,
["Infobox_settlement/columns"] = 95000,
["Infobox_settlement/columns/styles.css"] = 95000,
["Infobox_settlement/densdisp"] = 439000,
["Infobox_settlement/impus"] = 82000,
["Infobox_settlement/lengthdisp"] = 169000,
["Infobox_settlement/link"] = 95000,
["Infobox_settlement/metric"] = 212000,
["Infobox_settlement/pref"] = 294000,
["Infobox_settlement/styles.css"] = 563000,
["Infobox_ship_begin"] = 41000,
["Infobox_ship_career"] = 37000,
["Infobox_ship_characteristics"] = 41000,
["Infobox_ship_class_overview"] = 4100,
["Infobox_ship_image"] = 40000,
["Infobox_shopping_mall"] = 3500,
["Infobox_short_story"] = 2400,
["Infobox_skier"] = 2500,
["Infobox_soap_character"] = 2900,
["Infobox_software"] = 14000,
["Infobox_software/simple"] = 14000,
["Infobox_song"] = 76000,
["Infobox_song/color"] = 76000,
["Infobox_song/link"] = 76000,
["Infobox_spaceflight"] = 3600,
["Infobox_spaceflight/styles.css"] = 3600,
["Infobox_sport_event"] = 2200,
["Infobox_sports_competition_event"] = 18000,
["Infobox_sports_competition_event/medalrow"] = 12000,
["Infobox_sports_league"] = 5100,
["Infobox_sports_season"] = 5500,
["Infobox_sports_team"] = 2200,
["Infobox_sportsperson"] = 108000,
["Infobox_stadium"] = 3300,
["Infobox_station"] = 55000,
["Infobox_station/doc"] = 55000,
["Infobox_station/services"] = 55000,
["Infobox_station/styles.css"] = 55000,
["Infobox_street"] = 3500,
["Infobox_swimmer"] = 9400,
["Infobox_television"] = 57000,
["Infobox_television/Short_description"] = 55000,
["Infobox_television_channel"] = 6200,
["Infobox_television_episode"] = 12000,
["Infobox_television_episode/styles.css"] = 12000,
["Infobox_television_season"] = 9600,
["Infobox_television_station"] = 3700,
["Infobox_tennis_biography"] = 10000,
["Infobox_tennis_event"] = 2600,
["Infobox_tennis_tournament_event"] = 19000,
["Infobox_tennis_tournament_year"] = 9300,
["Infobox_tennis_tournament_year/color"] = 28000,
["Infobox_tennis_tournament_year/footer"] = 28000,
["Infobox_tournament_season"] = 11000,
["Infobox_train"] = 2300,
["Infobox_union"] = 2000,
["Infobox_university"] = 26000,
["Infobox_user"] = 2700,
["Infobox_venue"] = 18000,
["Infobox_video_game"] = 28000,
["Infobox_video_game/styles.css"] = 28000,
["Infobox_volleyball_biography"] = 5500,
["Infobox_weapon"] = 7400,
["Infobox_weather_event"] = 2100,
["Infobox_weather_event/Effects"] = 2000,
["Infobox_weather_event/Footer"] = 2100,
["Infobox_weather_event/styles.css"] = 2100,
["Infobox_website"] = 7700,
["Infobox_writer"] = 39000,
["Information"] = 101000,
["Information/styles.css"] = 101000,
["Inline_block"] = 4700,
["Inprogress"] = 2400,
["Input_link"] = 32000,
["Instagram"] = 11000,
["Interlanguage_link"] = 161000,
["Interlanguage_link_multi"] = 18000,
["Internet_Archive_author"] = 19000,
["Internet_Archive_film"] = 2500,
["Intitle"] = 13000,
["Iptalk"] = 17000,
["IranCensus2006"] = 46000,
["IranNCSGN"] = 3200,
["Iran_Census_2006"] = 46000,
["Irc"] = 2100,
["Irish_place_name"] = 2700,
["IsIPAddress"] = 36000,
["IsValidPageName"] = 2600,
["Is_MLB_league"] = 3200,
["Is_NPB_league"] = 3200,
["Is_country_in_Central_America"] = 13000,
["Is_country_in_the_Caribbean"] = 14000,
["Is_interwiki_link"] = 6000,
["Is_italic_taxon"] = 495000,
["Is_redirect"] = 28000,
["Isbn"] = 7900,
["Isfdb_name"] = 3600,
["Isfdb_title"] = 4400,
["Isnumeric"] = 142000,
["Iso2continent"] = 36000,
["Iso2country"] = 23000,
["Iso2country/article"] = 22000,
["Iso2country/data"] = 23000,
["Iso2nationality"] = 204000,
["Issubst"] = 72000,
["Isu_name"] = 2200,
["Italic_dab2"] = 5300,
["Italic_title"] = 277000,
["Italic_title_prefixed"] = 8600,
["Italics_colon"] = 3800,
["Italictitle"] = 4000,
["Ivm"] = 5700,
["Ivm/styles.css"] = 5700,
["Ivmbox"] = 124000,
["Ivory_messagebox"] = 145000,
["Module:I18n/complex_date"] = 67000,
["Module:IP"] = 132000,
["Module:IPA"] = 144000,
["Module:IPA/data"] = 129000,
["Module:IPA/styles.css"] = 115000,
["Module:IPA_symbol"] = 4900,
["Module:IPA_symbol/data"] = 4900,
["Module:IPAc-en"] = 49000,
["Module:IPAc-en/data"] = 49000,
["Module:IPAc-en/phonemes"] = 49000,
["Module:IPAc-en/pronunciation"] = 49000,
["Module:IPAddress"] = 188000,
["Module:ISO_3166"] = 1020000,
["Module:ISO_3166/data/AT"] = 2500,
["Module:ISO_3166/data/BA"] = 3400,
["Module:ISO_3166/data/CA"] = 2500,
["Module:ISO_3166/data/CN"] = 2100,
["Module:ISO_3166/data/DE"] = 15000,
["Module:ISO_3166/data/ES"] = 3600,
["Module:ISO_3166/data/FR"] = 38000,
["Module:ISO_3166/data/GB"] = 6400,
["Module:ISO_3166/data/GR"] = 3100,
["Module:ISO_3166/data/IN"] = 29000,
["Module:ISO_3166/data/IR"] = 9200,
["Module:ISO_3166/data/National"] = 1020000,
["Module:ISO_3166/data/PL"] = 6900,
["Module:ISO_3166/data/RS"] = 3200,
["Module:ISO_3166/data/RU"] = 25000,
["Module:ISO_3166/data/US"] = 85000,
["Module:ISO_639_name"] = 20000,
["Module:ISOdate"] = 67000,
["Module:Icon"] = 585000,
["Module:Icon/data"] = 585000,
["Module:If_empty"] = 3720000,
["Module:If_in_page"] = 11000,
["Module:If_preview"] = 301000,
["Module:If_preview/configuration"] = 301000,
["Module:If_preview/styles.css"] = 301000,
["Module:Import_style"] = 12000,
["Module:In_lang"] = 360000,
["Module:Indent"] = 4600,
["Module:Infobox"] = 4140000,
["Module:Infobox/dates"] = 69000,
["Module:Infobox/styles.css"] = 4400000,
["Module:Infobox3cols"] = 299000,
["Module:InfoboxImage"] = 4460000,
["Module:Infobox_body_of_water_tracking"] = 18000,
["Module:Infobox_cyclist_tracking"] = 16000,
["Module:Infobox_gene"] = 13000,
["Module:Infobox_mapframe"] = 417000,
["Module:Infobox_military_conflict"] = 22000,
["Module:Infobox_military_conflict/styles.css"] = 22000,
["Module:Infobox_multi-lingual_name"] = 21000,
["Module:Infobox_multi-lingual_name/data"] = 21000,
["Module:Infobox_power_station"] = 3100,
["Module:Infobox_road"] = 25000,
["Module:Infobox_road/browselinks"] = 25000,
["Module:Infobox_road/errors"] = 24000,
["Module:Infobox_road/length"] = 25000,
["Module:Infobox_road/locations"] = 24000,
["Module:Infobox_road/map"] = 25000,
["Module:Infobox_road/route"] = 25000,
["Module:Infobox_road/sections"] = 24000,
["Module:Infobox_television"] = 57000,
["Module:Infobox_television_disambiguation_check"] = 64000,
["Module:Infobox_television_episode"] = 12000,
["Module:Infobox_television_season_disambiguation_check"] = 9100,
["Module:Infobox_television_season_name"] = 9600,
["Module:Internet_Archive"] = 19000,
["Module:IrelandByCountyCatNav"] = 3400,
["Module:Is_article"] = 2000,
["Module:Is_infobox_in_lead"] = 378000,
["Module:Is_instance"] = 337000,
["Module:Italic_title"] = 1130000,
["Module:Italic_title2"] = 5300,
}
443e44fe177c5d88fb74f56ec7a0c9bf2d02c30a
Module:Political party/L
828
235
462
2023-12-18T03:47:23Z
wikipedia>James100000
0
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["La France insoumise"] = "La France Insoumise",
["Labor Front"] = "Labour Front",
["Labor Party (United States, 1996)"] = "Labor Party (US, 1996)",
["Labor Party (United States)"] = "Labor Party (US)",
["Labor Party (US, 19th century)"] = "Labor Party (United States, 19th century)",
["Labor Party"] = "Labour Party",
["Labour Party–GroenLinks"] = "GroenLinks–PvdA",
["Labor-Farm Party of Wisconsin"] = "Labor–Farm Party of Wisconsin",
["Labour '87"] = "Labour Party of Northern Ireland",
["Labour Co-operative"] = "Labour and Co-operative Party",
["Labour and Co-operative"] = "Labour and Co-operative Party",
["Labour Coalition"] = "Labour coalition",
["Labour (Ireland)"] = "Labour Party (Ireland)",
["Labour Party (Mexico)"] = "Labor Party (Mexico)",
["Lakas Kampi CMD"] = "Lakas–Kampi",
["Lakas-Christian Muslim Democrats"] = "Lakas–CMD",
["Lakas-CMD"] = "Lakas–CMD",
["Lakas-CMD (1991)"] = "Lakas–CMD (1991)",
["Lakas-CMD (2009)"] = "Lakas–CMD",
["Lakas-Kampi-CMD"] = "Lakas–Kampi",
["Lakas-NUCD-UMDP"] = "Lakas–CMD (1991)",
["Lakas-NUCD"] = "Lakas–CMD (1991)",
["Lakas–Christian Muslim Democrats"] = "Lakas–CMD",
["Lakas–CMD (2009)"] = "Lakas–CMD",
["Lakas–Kampi–CMD"] = "Lakas–CMD",
["Lakas–NUCD–UMDP"] = "Lakas–CMD (1991)",
["Lakas–NUCD"] = "Lakas–CMD (1991)",
["Lalit"] = "Lalit (Mauritius)",
["Lanka Democratic Party"] = "Lanka Prajathanthravadi Pakshaya",
["Lantmannapartiet"] = "Lantmanna Party",
["LaRouche movement"] = "National Democratic Policy Committee",
["Latvian Centrist Party"] = "Centre Party (Latvia)",
["Latvian Social Democratic Alliance"] = "Latvian Social Democratic Workers' Party",
["Law and Order (Latvia)"] = "For Each and Every One",
["Law and Order Party (United States)"] = "Law and Order Party (US)",
["LDPR (political party)"] = "Liberal Democratic Party of Russia",
["Left for the Right to Decide"] = "Republican Left of Catalonia",
["Left Front (India)"] = "Left Front",
["Left Front (Sri Lanka)"] = "Left Liberation Front",
["Left of the Peoples (1987)"] = "Left of the Peoples",
["Left of the Peoples (1989)"] = "Left of the Peoples",
["Left Option"] = "Estonian Left Party",
["Left Party – Communists"] = "Left Party (Sweden)",
["Left Party-Communists"] = "Left Party (Sweden)",
["Left Radical Party"] = "Radical Party of the Left",
["Left Unity (European Parliament)"] = "European United Left–Nordic Green Left",
["Leftist Socialist Party of Japan"] = "Left Socialist Party of Japan",
["Leftist Workers and Farm Labourers"] = "Communist Party of Latvia",
["Lega per Salvini Premier"] = "Lega (political party)",
["Les Engagés"] = "Les Engagés (political party)",
["Libertarian Party (Alaska)"] = "Libertarian Party (US)",
["Liberal–Democratic List"] = "Liberal League (Luxembourg)",
["Liberal/Country Coalition"] = "Coalition (Australia)",
["Liberal-Country Coalition"] = "Coalition (Australia)",
["Liberal–Country Coalition"] = "Coalition (Australia)",
["Liberal/National Coalition"] = "Coalition (Australia)",
["Liberal-National Coalition"] = "Coalition (Australia)",
["Liberal–National Coalition"] = "Coalition (Australia)",
["Lib-Lab"] = "Liberal-Labour (UK)",
["Liberal Coalition Party"] = "Liberals (Sweden)",
["Liberal Constitutional Party (Italy)"] = "Historical Right (Italy)",
["Liberal Democratic Party (Chile)"] = "Liberal Democratic Party (Chile, 1893)",
["Liberal Democratic Party (Italy)"] = "Italian Democratic Liberal Party",
["Liberal Democratic Party (Lithuania)"] = "Order and Justice",
["Liberal Democratic Party (Serbia 2005)"] = "Liberal Democratic Party (Serbia)",
["Liberal Democratic Party (Spain)"] = "Liberal Democratic Party (Spain, 1982)",
["Liberal Democratic Party of Japan"] = "Liberal Democratic Party (Japan)",
["Liberal Democratic Party of Switzerland"] = "Liberal Party of Switzerland",
["Liberal Democrats"] = "Liberal Democrats (UK)",
["Liberal Movement"] = "Liberal Movement (Australia)",
["Liberal Movement (Lithuania)"] = "Liberals' Movement (Lithuania)",
["Liberal National Party (UK, 1931)"] = "National Liberal Party (UK, 1931)",
["Liberal Party (Japan, 1945)"] = "Liberal Party (Japan, 1950)",
["Liberal Party (Luxembourg)"] = "Liberal League (Luxembourg)",
["Liberal Party (Scotland)"] = "Scottish Liberal Party",
["Liberal Party (Serbia, 1989)"] = "Liberal Democratic Party (Serbia, 1989)",
["Liberal Party of Australia (Australian Capital Territory Division)"] = "Liberal Party of Australia (A.C.T. Division)",
["Liberal Party of New York"] = "Liberal Party (New York)",
["Liberal Party of Sweden"] = "Liberals (Sweden)",
["Liberal Party"] = "Democratic Liberal Party (Japan)",
["Liberal People's Party (Sweden)"] = "Liberals (Sweden)",
["Liberal People's Party"] = "Liberals (Sweden)",
["Liberal Reformist Party + Democratic Front of Francophones"] = "Reformist Movement",
["Liberal Reformist Party"] = "Liberal Reformist Party (Belgium)",
["Liberal Republican Party (United States)"] = "Liberal Republican Party (US)",
["Liberal Socialist Party"] = "Liberal Socialist Party (Singapore)",
["Liberal Socialists Party"] = "Liberal Socialists Party (Egypt)",
["Liberal Unionist"] = "Liberal Unionist Party",
["Liberal Unionist Party (UK)"] = "Liberal Unionist Party",
["Liberal-Labour (New Zealand)"] = "Liberal–Labour (New Zealand)",
["Liberals (Italy)"] = "Liberal Union (Italy)",
["Liberals–Democrats–Radicals"] = "Liberals, Democrats and Radicals",
["Liberals' Movement of the Republic of Lithuania"] = "Liberals' Movement (Lithuania)",
["Liberal Party of Andorra"] = "Liberals of Andorra",
["Libertad y Refundación"] = "Liberty and Refoundation",
["Libertarian, Direct, Democratic"] = "Libertair, Direct, Democratisch",
["Libertarian Party UK"] = "Libertarian Party (UK)",
["Libertarian Party (United Kingdom)"] = "Libertarian Party (UK)",
["Libertarian Party (United States)"] = "Libertarian Party (US)",
["Libertarian Party (Alaska)"] = "Libertarian Party (US)",
["Libertarian Party (Arizona)"] = "Libertarian Party (US)",
["Libertarian Party (California)"] = "Libertarian Party (US)",
["Libertarian Party (Colorado)"] = "Libertarian Party (US)",
["Libertarian Party (Connecticut)"] = "Libertarian Party (US)",
["Libertarian Party (Delaware)"] = "Libertarian Party (US)",
["Libertarian Party (Iowa)"] = "Libertarian Party (US)",
["Libertarian Party (Massachusetts)"] = "Libertarian Party (US)",
["Libertarian Party (Michigan)"] = "Libertarian Party (US)",
["Libertarian Party (Missouri)"] = "Libertarian Party (US)",
["Libertarian Party (Nevada)"] = "Libertarian Party (US)",
["Libertarian Party (New Mexico)"] = "Libertarian Party (US)",
["Libertarian Party (New York)"] = "Libertarian Party (US)",
["Libertarian Party (Oregon)"] = "Libertarian Party (US)",
["Libertarian Party (Vermont)"] = "Libertarian Party (US)",
["Libertarian Party (Washington)"] = "Libertarian Party (US)",
["Libertarian Party of Arizona"] = "Libertarian Party (US)",
["Libertarian Party of California"] = "Libertarian Party (US)",
["Libertarian Party of Colorado"] = "Libertarian Party (US)",
["Libertarian Party of Connecticut"] = "Libertarian Party (US)",
["Libertarian Party of Delaware"] = "Libertarian Party (US)",
["Libertarian Party of the District of Columbia"] = "Libertarian Party (US)",
["Libertarian Party of Florida"] = "Libertarian Party (US)",
["Libertarian Party of Georgia"] = "Libertarian Party (US)",
["Libertarian Party of Hawaii"] = "Libertarian Party (US)",
["Libertarian Party of Kentucky"] = "Libertarian Party (US)",
["Libertarian Party of Maryland"] = "Libertarian Party (US)",
["Libertarian Party of Massachusetts"] = "Libertarian Party (US)",
["Libertarian Party of Michigan"] = "Libertarian Party (US)",
["Libertarian Party of Minnesota"] = "Libertarian Party (US)",
["Libertarian Party of Missouri"] = "Libertarian Party (US)",
["Libertarian Party of Montana"] = "Libertarian Party (US)",
["Libertarian Party of Nevada"] = "Libertarian Party (US)",
["Libertarian Party of New Mexico"] = "Libertarian Party (US)",
["Libertarian Party of New York"] = "Libertarian Party (US)",
["Libertarian Party of North Carolina"] = "Libertarian Party (US)",
["Libertarian Party of North Dakota"] = "Libertarian Party (US)",
["Libertarian Party of Ohio"] = "Libertarian Party (US)",
["Libertarian Party of Oklahoma"] = "Libertarian Party (US)",
["Libertarian Party of Oregon"] = "Libertarian Party (US)",
["Libertarian Party of Pennsylvania"] = "Libertarian Party (US)",
["Libertarian Party of Texas"] = "Libertarian Party (US)",
["Libertarian Party of Utah"] = "Libertarian Party (US)",
["Libertarian Party of Washington"] = "Libertarian Party (US)",
["Libertarian Party of Wisconsin"] = "Libertarian Party (US)",
["Libertas (lobby group)"] = "Libertas.eu",
["Libertas Spain"] = "Libertas.eu",
["Liberty Forward Party"] = "Advancement Unification Party",
["Liberty Party (United States, 1840)"] = "Liberty Party (US)",
["Liberty Party (United States, 1932)"] = "Liberty Party (US)",
["Liberty Party (United States)"] = "Liberty Party (US)",
["Liberty Party (US, 1840)"] = "Liberty Party (US)",
["Liberty Party"] = "Liberty Party (US)",
["Liberal People's Party (Finland)"] = "Liberals (Finland)",
["Libra Party (Albania)"] = "Libra Party",
["Libyan Arab Socialist Union"] = "Arab Socialist Union (Libya)",
["LID"] = "Left and Democrats",
["Ligue du Midi"] = "Ligue du Sud",
["Local"] = "Localist",
["Lok Dal"] = "Lokdal",
["Lok Jan Shakti Party"] = "Lok Janshakti Party",
["Long Live Tunisia"] = "Tahya Tounes",
["Louisiana Democratic Party"] = "Democratic Party (United States)",
["LPHK"] = "Liberal Party (Hong Kong)",
["LPR"] = "League of Polish Families",
["LSSP"] = "Lanka Sama Samaja Party",
["Luxembourg Workers' Party"] = "Luxembourg Socialist Workers' Party",
["Luys Alliance"] = "Bright Alliance",
}
local full = {
["L'Alternativa c'è"] = {abbrev = "", color = "#FE9F07", shortname = "",},
["L'Hospitalet Left Alternative"] = {abbrev = "", color = "#42837D", shortname = "",},
["La Axarquía Progress"] = {abbrev = "", color = "#FF990E", shortname = "",},
["La España en Marcha"] = {abbrev = "", color = "#111011", shortname = "",},
["La Falange (1999)"] = {abbrev = "", color = "#29191E", shortname = "",},
["La France En Action"] = {abbrev = "", color = "#F8F1BB", shortname = "",},
["La France Insoumise"] = {abbrev = "LFI", color = "#E53D40", shortname = "",},
["La Fresneda Local Platform"] = {abbrev = "", color = "#004D21", shortname = "",},
["La Fuerza de Santa Fe"] = {abbrev = "", color = "#5F8748", shortname = "",},
["La Libertad Avanza"] = {abbrev = "LLA", color = "#6C4C99", shortname = "",},
["La Línea 100x100"] = {abbrev = "", color = "#FA5841", shortname = "",},
["La Palma Group of Independents"] = {abbrev = "", color = "#072357", shortname = "",},
["La République En Marche!"] = {abbrev = "LREM", color = "#FFD600", shortname = "",},
["Laban ng Demokratikong Pilipino"] = {abbrev = "LDP", color = "#0000CD", shortname = "",},
["Laban ng Makabayang Masang Pilipino"] = {abbrev = "LAMMP", color = "#ffa500", shortname = "",},
["Labor and Agrarian Party"] = {abbrev = "PALA", color = "royalblue", shortname = "",},
["Labor Party (Mexico)"] = {abbrev = "PT", color = "#DB2017", shortname = "",},
["Labor Party (South Korea)"] = {abbrev = "", color = "#DC143C", shortname = "Labor",},
["Labor Party (Taiwan)"] = {abbrev = "", color = "red", shortname = "",},
["Labor Party (United States, 19th century)"] = {abbrev = "", color = "#FF6347", shortname = "Labor",},
["Labor Party (US, 1996)"] = {abbrev = "", color = "#FF6347", shortname = "Labor",},
["Labor Party (US)"] = {abbrev = "", color = "#FF6347", shortname = "Labor",},
["Labor Party of the United States"] = {abbrev = "", color = "#FF6347", shortname = "Labor",},
["Labor Party Philippines"] = {abbrev = "WPP", color = "#00039F", shortname = "",},
["Labor Solidarity"] = {abbrev = "SL", color = "purple", shortname = "",},
["Labor Union of Games and Gambling in Macau"] = {abbrev = "", color = "#B2FFFF", shortname = "",},
["Labor–Farm Party of Wisconsin"] = {abbrev = "", color = "#17aa5c", shortname = "Labor–Farm",},
["Labor-Gesher-Meretz"] = {abbrev = "", color = "#ED1B25", shortname = "Emet",},
["Labor-Gesher"] = {abbrev = "", color = "#EE161F", shortname = "",},
["Labor"] = {abbrev = "", color = "#FF6347", shortname = "",},
["Laboring People's Party"] = {abbrev = "", color = "red", shortname = "",},
["Laborious Ukraine Electoral Bloc"] = {abbrev = "", color = "#872558", shortname = "Labour Ukraine",},
["Laborist Party (Mexico)"] = {abbrev = "", color = "#CE1126", shortname = "Laborist",},
["Laborista Party"] = {abbrev = "", color = "green", shortname = "Laborista",},
["Labour and Co-operative Party"] = {abbrev = "", color = "#E4003B", shortname = "Labour Co-op",},
["Labour and Equity Party"] = {abbrev = "", color = "#4e92d3", shortname = "",},
["Labour and Freedom Alliance"] = {abbrev = "", color = "#90268F", shortname = "Labour and Freedom",},
["Labour and Justice Party (Spain)"] = {abbrev = "", color = "#AD0000", shortname = "",},
["Labour and Social Justice – The Electoral Alternative"] = {abbrev = "WASG", color = "#FF8000", shortname = "Labour and Social Justice",},
["Labour and Solidarity Party"] = {abbrev = "", color = "#5963cf", shortname = "",},
["Labour and Trade Union Group"] = {abbrev = "", color = "#D44442", shortname = "Labour and Trade Union",},
["Labour Cause's Party"] = {abbrev = "", color = "#9F030A", shortname = "",},
["Labour coalition"] = {abbrev = "", color = "#cd5c5c", shortname = "",},
["Labour Democrat Party"] = {abbrev = "", color = "", shortname = "Labour Democrat",},
["Labour Democratic Party"] = {abbrev = "", color = "Pink", shortname = "Labour Democracy",},
["Labour Democrats"] = {abbrev = "", color = "#59A421", shortname = "",},
["Labour Electoral Association"] = {abbrev = "LEA", color = "#B22222", shortname = "",},
["Labour Faction (1937)"] = {abbrev = "SP", color = "#1693F4", shortname = "",},
["Labour Front"] = {abbrev = "LF", color = "#AA5634", shortname = "",},
["Labour Gathering Party"] = {abbrev = "", color = "#8B0000", shortname = "",},
["Labour Independent Group"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Labour Party (Argentina)"] = {abbrev = "PL", color = "#00708B", shortname = "Labour Party",},
["Labour Party (Greenland)"] = {abbrev = "", color = "pink", shortname = "Labour",},
["Labour Party (Hong Kong)"] = {abbrev = "", color = "#F7941E", shortname = "Labour",},
["Labour Party (Indonesia, 1949)"] = {abbrev = "PB", color = "red", shortname = "",},
["Labour Party (Indonesia, 1998)"] = {abbrev = "PB", color = "#000080", shortname = "",},
["Labour Party (Indonesia, 2021)"] = {abbrev = "PB", color = "#ff6800", shortname = "",},
["Labour Party (Ireland)"] = {abbrev = "Lab", color = "#CC0000", shortname = "Labour",},
["Labour Party (Lithuania)"] = {abbrev = "DP", color = "#1D578C", shortname = "",},
["Labour Party (Malta)"] = {abbrev = "", color = "#EE3224", shortname = "Labour",},
["Labour Party (Mauritius)"] = {abbrev = "", color = "#FF0000", shortname = "Labour Party",},
["Labour Party (Morocco)"] = {abbrev = "", color = "#D04933", shortname = "",},
["Labour Party (Netherlands)"] = {abbrev = "PvdA", color = "#DF111A", shortname = "",},
["Labour Party (New Caledonia)"] = {abbrev = "PT", color = "#9A0000", shortname = "",},
["Labour Party (Nigeria)"] = {abbrev = "LP", color = "#DA251C", shortname = "",},
["Labour Party (Norway)"] = {abbrev = "", color = "#D70926", shortname = "Labour",},
["Labour Party (Poland)"] = {abbrev = "SP", color = "#083A7F", shortname = "",},
["Labour Party (Secular)"] = {abbrev = "LP(S)", color = "#2E64FE", shortname = "",},
["Labour Party (Singapore)"] = {abbrev = "", color = "#CC8955", shortname = "Labour Party",},
["Labour Party (Slovakia)"] = {abbrev = "SP", color = "#C31B3E", shortname = "",},
["Labour Party (South Africa, 1969)"] = {abbrev = "", color = "#8D0000", shortname = "Labour",},
["Labour Party (South Africa)"] = {abbrev = "", color = "#FF0000", shortname = "Labour",},
["Labour Party (Thailand)"] = {abbrev = "", color = "#FF0000", shortname = "Labour",},
["Labour Party (Turkey)"] = {abbrev = "", color = "#FFDE4D", shortname = "Labour",},
["Labour Party (UK)"] = {abbrev = "Lab", color = "#E4003B", shortname = "Labour",},
["Labour Party in Northern Ireland"] = {abbrev = "", color = "#DC241F", shortname = "",},
["Labour Party of Bosnia and Herzegovina"] = {abbrev = "", color = "#013971", shortname = "",},
["Labour Party of Brazil"] = {abbrev = "PTdoB", color = "#00FF00", shortname = "",},
["Labour Party of Hong Kong"] = {abbrev = "", color = "#DE2910", shortname = "Labour",},
["Labour Party of India (V V Prasad)"] = {abbrev = "LPI(V)", color = "#4C81B6", shortname = "",},
["Labour Party of India"] = {abbrev = "LPI", color = "#E0E6F8", shortname = "",},
["Labour Party of Malaya"] = {abbrev = "", color = "#FAAFBA", shortname = "",},
["Labour Party of Northern Ireland"] = {abbrev = "", color = "#DC241f", shortname = "Labour Party NI",},
["Labour Party of Serbia"] = {abbrev = "LPS", color = "#2274A5", shortname = "",},
["Labour Party Pakistan"] = {abbrev = "", color = "#FE2712", shortname = "",},
["Labour Party"] = {abbrev = "", color = "#FF0000", shortname = "Labour",},
["Labour Progressive"] = {abbrev = "", color = "red", shortname = "",},
["Labour Renewal Movement"] = {abbrev = "", color = "#23FF00", shortname = "",},
["Labour Representation Committee (1900)"] = {abbrev = "", color = "#b22222", shortname = "Labour Repr. Cmte.",},
["Labour Representation Committee"] = {abbrev = "", color = "#b22222", shortname = "Labour",},
["Labour Republican Party"] = {abbrev = "", color = "#FF9340", shortname = "",},
["Labour Solidarity"] = {abbrev = "SP", color = "#D33F49", shortname = "",},
["Labour Ukraine"] = {abbrev = "", color = "Purple", shortname = "",},
["Labour Union (Poland)"] = {abbrev = "UP", color = "#ED1C24", shortname = "",},
["Labour Unionist"] = {abbrev = "", color = "#DDEEFF", shortname = "",},
["Labour-Farmer Party"] = {abbrev = "", color = "#FF5C85", shortname = "",},
["Labour-Farmer Masses Party"] = {abbrev = "", color = "#FF5C85", shortname = "",},
["Labour, Co-operative and Trade Union"] = {abbrev = "", color = "white", shortname = "Labour, Co-op & Trade Union",},
["Labourers and Farmers Party"] = {abbrev = "", color = "#FE7580", shortname = "Labourers and Farmers",},
["Ladlad"] = {abbrev = "", color = "#FFC0CB", shortname = "",},
["Lahu National Development Party"] = {abbrev = "LHNDP", color = "#A66971", shortname = "",},
["Lakas ng Bansa"] = {abbrev = "LnB", color = "#0000CD", shortname = "",},
["Lakas ng Bayan Coalition"] = {abbrev = "LABAN", color = "#FFFF40", shortname = "",},
["Lakas ng Bayan"] = {abbrev = "LABAN", color = "#FFFF00", shortname = "",},
["Lakas–CMD (1991)"] = {abbrev = "", color = "#B0E0E6", shortname = "Lakas–CMD",},
["Lakas–CMD"] = {abbrev = "", color = "#B0E0E6", shortname = "Lakas",},
["Lakas–Kampi"] = {abbrev = "LKS-KAM", color = "#B0E0E6", shortname = "Lakas–Kampi",},
["Lakas-Laban Coalition"] = {abbrev = "L–L", color = "#B0E0E6", shortname = "Lakas–Laban",},
["Lalit (Mauritius)"] = {abbrev = "", color = "#F7CC06", shortname = "",},
["Land and Justice Party"] = {abbrev = "", color = "#DC261B", shortname = "Land & Justice",},
["Land development"] = {abbrev = "", color = "#CDB79E", shortname = "",},
["Land Justice League"] = {abbrev = "", color = "#73BC7C", shortname = "",},
["Land of Dharma Party"] = {abbrev = "", color = "#593012", shortname = "",},
["Land Party (South Africa)"] = {abbrev = "", color = "#7e803e", shortname = "Land Party",},
["Land Party"] = {abbrev = "", color = "#4898B9", shortname = "",},
["Landbund"] = {abbrev = "", color = "#385A38", shortname = "",},
["Landless People's Movement (Namibia)"] = {abbrev = "LPM", color = "#FC7B2C", shortname = "",},
["Lang Labor"] = {abbrev = "", color = "#E2725B", shortname = "",},
["Lanka Prajathanthravadi Pakshaya"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Lanka Sama Samaja Party"] = {abbrev = "LSSP", color = "#FF0000", shortname = "",},
["Lantmanna and Bourgeois Party"] = {abbrev = "", color = "#ff9933", shortname = "Lantmanna and Bourgeois",},
["Lantmanna Party"] = {abbrev = "", color = "#00529C", shortname = "Lantmanna",},
["Lanzarote Avanza"] = {abbrev = "", color = "#037468", shortname = "",},
["Lanzarote En Pie"] = {abbrev = "", color = "#238EAD", shortname = "",},
["Lanzarote Independents Party"] = {abbrev = "", color = "#31B404", shortname = "",},
["Lanzarote Neighborhood Force"] = {abbrev = "", color = "#98CCFE", shortname = "",},
["Lao National Union Party"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Lao Patriotic Front"] = {abbrev = "", color = "#CE1126", shortname = "",},
["Lao People's Revolutionary Party"] = {abbrev = "LPRP", color = "#CE1126", shortname = "",},
["Lapian ng Masang Pilipino"] = {abbrev = "LAMP", color = "#ffa500", shortname = "",},
["Lapiang Manggagawa"] = {abbrev = "LM", color = "#00039f", shortname = "",},
["LaPrimaire.org"] = {abbrev = "", color = "#800080", shortname = "",},
["Las Palmas de Gran Canaria Puede"] = {abbrev = "", color = "#96CA2D", shortname = "",},
["Latgale Party"] = {abbrev = "", color = "#004B84", shortname = "",},
["Latvia First"] = {abbrev = "LPV", color = "#A8343C", shortname = "",},
["Latvia's First Party"] = {abbrev = "", color = "#582B64", shortname = "",},
["Latvia's First Party/Latvian Way"] = {abbrev = "", color = "#682376", shortname = "",},
["Latvian Association of Regions"] = {abbrev = "LRA", color = "#0E3267", shortname = "",},
["Latvian Farmers' Union"] = {abbrev = "LZS", color = "#D5D900", shortname = "",},
["Latvian Green Party"] = {abbrev = "", color = "#00683A", shortname = "",},
["Latvian National Independence Movement"] = {abbrev = "", color = "#902E3B", shortname = "",},
["Latvian Nationalists"] = {abbrev = "", color = "#9E2B38", shortname = "",},
["Latvian Russian Union"] = {abbrev = "", color = "#3560A9", shortname = "",},
["Latvian Social Democratic Workers' Party"] = {abbrev = "LSDSP", color = "#830D30", shortname = "",},
["Latvian Unity Party"] = {abbrev = "", color = "#DC5356", shortname = "",},
["Latvian Way"] = {abbrev = "", color = "#FFE200", shortname = "",},
["Lauredian Union"] = {abbrev = "UL", color = "#000000", shortname = "",},
["Law and Justice (Georgia)"] = {abbrev = "", color = "#01FFFF", shortname = "",},
["Law and Justice"] = {abbrev = "PiS", color = "#263778", shortname = "",},
["Law and Order Party (US)"] = {abbrev = "", color = "#00DDDD", shortname = "Law and Order",},
["Law Preservation Party"] = {abbrev = "", color = "#FF00FF", shortname = "Law Preservation",},
["Le Trèfle"] = {abbrev = "", color = "#77FF77", shortname = "",},
["Leaders Party of Vanuatu"] = {abbrev = "", color = "#3DAB48", shortname = "Leaders Party",},
["Leading Thai Party"] = {abbrev = "", color = "#DEB887", shortname = "Leading Thai",},
["League Against Usury"] = {abbrev = "LCC", color = "lightgreen", shortname = "",},
["League for Democracy Party"] = {abbrev = "", color = "#3BB9FF", shortname = "",},
["League Nepal Shanti Ekta Party"] = {abbrev = "", color = "#E6DBCF", shortname = "",},
["League of Albanians of Romania"] = {abbrev = "LSR", color = "#444444", shortname = "",},
["League of Anti-Corruption Governors"] = {abbrev = "LIGA", color = "#F5EC49", shortname = "",},
["League of Catalonia–Catalan Liberal Party"] = {abbrev = "", color = "#99FF00", shortname = "",},
["League of Communists – Movement for Yugoslavia"] = {abbrev = "", color = "#FF0000", shortname = "",},
["League of Communists of Bosnia and Herzegovina"] = {abbrev = "SK BiH", color = "#DD0000", shortname = "",},
["League of Communists of Croatia"] = {abbrev = "SKH", color = "#DD0000", shortname = "",},
["League of Communists of Montenegro"] = {abbrev = "SKCG", color = "#DD0000", shortname = "",},
["League of Communists of Serbia"] = {abbrev = "SKS", color = "#DD0000", shortname = "",},
["League of Communists of Slovenia"] = {abbrev = "ZKS", color = "#DD0000", shortname = "",},
["League of Communists of Yugoslavia"] = {abbrev = "SKJ", color = "#DD0000", shortname = "",},
["League of Communists of Yugoslavia in Serbia"] = {abbrev = "SKJS", color = "red", shortname = "",},
["League of Democratic Socialists"] = {abbrev = "BDS", color = "red", shortname = "",},
["League of Free Liberals"] = {abbrev = "BVL", color = "#3399FF", shortname = "",},
["League of Polish Families"] = {abbrev = "LPR", color = "#2DA0D2", shortname = "",},
["League of Social Democrats of Vojvodina"] = {abbrev = "LSV", color = "#03C03C", shortname = "",},
["League of Social Democrats"] = {abbrev = "LSD", color = "#e0050d", shortname = "",},
["League of Socialist Youth of Bosnia and Herzegovina"] = {abbrev = "", color = "#FF6347", shortname = "",},
["League of Supporters of Indonesian Independence"] = {abbrev = "IPKI", color = "#D1E231", shortname = "",},
["League of the South (France)"] = {abbrev = "", color = "#C60B27", shortname = "",},
["League of West German Communists"] = {abbrev = "BWK", color = "red", shortname = "",},
["Lebanese Forces"] = {abbrev = "LF", color = "#ED2027", shortname = "Lebanese Forces",},
["Lecompton Democrat"] = {abbrev = "", color = "#ACCCFE", shortname = "Lecompton Democratic",},
["Leeds Left Alliance"] = {abbrev = "", color = "#00A86B", shortname = "",},
["LEF – For the New Generation"] = {abbrev = "LEF", color = "#6B6BFF", shortname = "",},
["Left (Austria)"] = {abbrev = "", color = "#FF0000", shortname = "Left",},
["Left Alliance (Finland)"] = {abbrev = "Vas.", color = "#F00A64", shortname = "Left Alliance",},
["Left Alternative"] = {abbrev = "", color = "red", shortname = "",},
["Left and Democrats"] = {abbrev = "LiD", color = "#D22833", shortname = "",},
["Left Andalusian Bloc"] = {abbrev = "", color = "#32754C", shortname = "",},
["Left Assembly of Tudela"] = {abbrev = "", color = "#CC7EAE", shortname = "",},
["Left Assembly–Initiative for Andalusia"] = {abbrev = "", color = "#ADA0A3", shortname = "",},
["Left Bloc (Portugal)"] = {abbrev = "BE", color = "#8B0000", shortname = "",},
["Left Bloc for National Liberation"] = {abbrev = "", color = "#FF9933", shortname = "",},
["Left Bloc"] = {abbrev = "", color = "#8B0000", shortname = "",},
["Left Camp of Israel"] = {abbrev = "Sheli", color = "#DC241F", shortname = "",},
["Left Centre"] = {abbrev = "", color = "#2CBFE3", shortname = "",},
["Left Coalition (Serbia)"] = {abbrev = "LK", color = "#A60C19", shortname = "",},
["Left Communists (Weimar Republic)"] = {abbrev = "LK", color = "red", shortname = "",},
["Left Democratic Front (Kerala)"] = {abbrev = "LDF", color = "#EE0000", shortname = "",},
["Left and Democratic Front (India)"] = {abbrev = "LDF", color = "#FF0000", shortname = "",},
["Left Ecology Freedom"] = {abbrev = "", color = "#C80815", shortname = "",},
["Left for Almería"] = {abbrev = "", color = "#037949", shortname = "",},
["Left for Independence"] = {abbrev = "", color = "#DAC125", shortname = "",},
["Left Front (Asturias)"] = {abbrev = "", color = "#76319B", shortname = "",},
["Left Front (France)"] = {abbrev = "FG", color = "#D6232B", shortname = "",},
["Left Front (Russia)"] = {abbrev = "Left Front", color = "#FF131C", shortname = "",},
["Left Front (West Bengal)"] = {abbrev = "LF", color = "#FF0000", shortname = "",},
["Left Front"] = {abbrev = "LF", color = "red", shortname = "",},
["Left in Positive"] = {abbrev = "", color = "#9B0F3B", shortname = "",},
["Left Independentists"] = {abbrev = "", color = "#AF1B1D", shortname = "",},
["Left Liberals"] = {abbrev = "", color = "#00FF00", shortname = "",},
["Left Liberation Front"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Left List"] = {abbrev = "", color = "red", shortname = "",},
["Left Movement"] = {abbrev = "", color = "#BD1928", shortname = "",},
["Left Nationalists"] = {abbrev = "", color = "#E53E13", shortname = "",},
["Left of Catalonia–Democratic Electoral Front"] = {abbrev = "", color = "#EFF24C", shortname = "",},
["Left of Galicia"] = {abbrev = "", color = "#E80810", shortname = "",},
["Left of the Peoples"] = {abbrev = "", color = "#D56545", shortname = "",},
["Left Party - Communists"] = {abbrev = "", color = "#b00000", shortname = "Left-Communist",},
["Left Party (France)"] = {abbrev = "", color = "#AA0000", shortname = "Left Party",},
["Left Party (Sweden)"] = {abbrev = "V", color = "#B00000", shortname = "Left",},
["Left Party (Turkey)"] = {abbrev = "", color = "#0069B4", shortname = "SOL",},
["Left Peraltese Union"] = {abbrev = "", color = "#A1138C", shortname = "",},
["Left Platform of Coslada"] = {abbrev = "", color = "#244E0E", shortname = "",},
["Left Republican Party (Spain)"] = {abbrev = "", color = "#7F1E6D", shortname = "",},
["Left Segovia"] = {abbrev = "", color = "#F53000", shortname = "",},
["Left Socialist Initiative"] = {abbrev = "", color = "#DE0929", shortname = "",},
["Left Socialist Party (Belgium)"] = {abbrev = "", color = "red", shortname = "",},
["Left Socialist Party (Sweden)"] = {abbrev = "", color = "red", shortname = "Left Socialist",},
["Left Socialists"] = {abbrev = "", color = "#E72240", shortname = "",},
["Left Socialist Party of Japan"] = {abbrev = "", color = "#C90F36", shortname = "Left Socialist",},
["Left Struggle"] = {abbrev = "MA", color = "red", shortname = "",},
["Left Together"] = {abbrev = "", color = "#870f57", shortname = "",},
["Left Union for a Clean and Holy Republic"] = {abbrev = "", color = "#F11928", shortname = "",},
["Left Unity (UK)"] = {abbrev = "", color = "red", shortname = "Left Unity",},
["Left Unity"] = {abbrev = "", color = "#990000", shortname = "",},
["Left-Green Movement"] = {abbrev = "", color = "#00B878", shortname = "Left-Green",},
["Left-wing Workers"] = {abbrev = "PTK", color = "#FF0000", shortname = "",},
["Left-wing Revolutionary Nationalist Movement"] = {abbrev = "MNRI", color = "#E34234", shortname = "",},
["Left-wing Revolutionary Nationalist Movement – 1"] = {abbrev = "MNRI-1", color = "#EF86B5", shortname = "",},
["Lega Alpina Lumbarda"] = {abbrev = "LAL", color = "green", shortname = "",},
["Lega Autonomia Veneta"] = {abbrev = "LAV", color = "gold", shortname = "",},
["Lega Lombarda"] = {abbrev = "", color = "green", shortname = "",},
["Lega Marche"] = {abbrev = "", color = "#008000", shortname = "",},
["Lega Nord"] = {abbrev = "", color = "#008000", shortname = "",},
["Lega Piemonte"] = {abbrev = "", color = "#008000", shortname = "",},
["Lega (political party)"] = {abbrev = "", color = "#008000", shortname = "Lega",},
["Legal Marijuana Now Party"] = {abbrev = "", color = "#50C878", shortname = "Legal Marijuana Now",},
["Legalise Cannabis Australia"] = {abbrev = "", color = "#6fc442", shortname = "",},
["Legalise Cannabis Alliance"] = {abbrev = "", color = "#669966", shortname = "Legalise Cannabis",},
["Legality Movement Party"] = {abbrev = "PLL", color = "#FFFF05", shortname = "",},
["Leganemos"] = {abbrev = "", color = "#8183D8", shortname = "",},
["Legitimists"] = {abbrev = "", color = "#1F497D", shortname = "",},
["Lelo for Georgia"] = {abbrev = "", color = "#F0CE0D", shortname = "Lelo",},
["Leighton Baker Party"] = {abbrev = "", color = "#26A805", shortname = "",},
["León Despierta"] = {abbrev = "", color = "#4B244C", shortname = "",},
["León en Común"] = {abbrev = "", color = "#9D181D", shortname = "",},
["Leonese Autonomist Party–Leonesist Unity"] = {abbrev = "", color = "#D44F0C", shortname = "",},
["Leonese Convergence"] = {abbrev = "", color = "#FFCBDB", shortname = "",},
["Leonese People's Union"] = {abbrev = "UPL", color = "#B41062", shortname = "",},
["Leonid Chernovetskyi Bloc"] = {abbrev = "", color = "Gold", shortname = "",},
["Lepsza Polska"] = {abbrev = "", color = "white", shortname = "",},
["Les Centristes"] = {abbrev = "LC", color = "#6F97CF", shortname = "",},
["Les Écologistes"] = {abbrev = "LE", color = "#1F7B52", shortname = "",},
["Les Engagés (political party)"] = {abbrev = "LE", color = "#02E5D2", shortname = "",},
["Les Verts Fraternels"] = {abbrev = "", color = "#32CD32", shortname = "",},
["Lesotho Congress for Democracy"] = {abbrev = "LCD", color = "#78a22c", shortname = "",},
["Lesotho People's Congress"] = {abbrev = "LPC", color = "", shortname = "",},
["Lesotho Workers' Party"] = {abbrev = "LWP", color = "", shortname = "",},
["Lespwa"] = {abbrev = "", color = "#30B700", shortname = "",},
["Let Every Child Have Both Parents"] = {abbrev = "", color = "#DAA520", shortname = "",},
["Let London Live"] = {abbrev = "", color = "#2d1e6d", shortname = "",},
["Let us Give the Change"] = {abbrev = "", color = "#F7D102", shortname = "",},
["Let's Connect Slovenia"] = {abbrev = "PoS", color = "#FDB92E", shortname = "",},
["Let's Go Peru"] = {abbrev = "", color = "#FA8072", shortname = "",},
["Letterkenny Residents Party"] = {abbrev = "", color = "#9900CC", shortname = "",},
["Levantemos El Puerto"] = {abbrev = "", color = "#93117E", shortname = "",},
["Leviathan Movement"] = {abbrev = "", color = "#000000", shortname = "",},
["Lewisham People Before Profit"] = {abbrev = "", color = "#9400d3", shortname = "People Before Profit",},
["Lewisham Peoples' Alliance"] = {abbrev = "", color = "#CCCCCC", shortname = "",},
["Liaison Committee for the Presidential Majority"] = {abbrev = "", color = "#0047AB", shortname = "Presidential Majority",},
["Libera San Marino"] = {abbrev = "", color = "#14AABC", shortname = "Libera",},
["Liberal (Costa Rica)"] = {abbrev = "", color = "#BF1313", shortname = "Liberal",},
["Liberal (South Korea)"] = {abbrev = "", color = "#004EA2", shortname = "",},
["Liberal Alliance (Brazil)"] = {abbrev = "AL", color = "#FF8C00", shortname = "",},
["Liberal Alliance (Chile)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Alliance (Denmark)"] = {abbrev = "", color = "#3FB2BE", shortname = "Liberal Alliance",},
["Liberal Alliance (Denmark, 2021)"] = {abbrev = "", color = "#18354B", shortname = "Liberal Alliance",},
["Liberal Alliance (Greece)"] = {abbrev = "FISY", color = "#800080", shortname = "",},
["Liberal Alliance (Spain)"] = {abbrev = "", color = "#99FF00", shortname = "",},
["Liberal Alliance Focus Team"] = {abbrev = "LIBAFT", color = "#FDBB30", shortname = "Liberal Alliance FT",},
["Liberal Alliance of Montenegro"] = {abbrev = "LSCG", color = "#007F00", shortname = "",},
["Liberal Alternative for Manacor"] = {abbrev = "", color = "#291562", shortname = "",},
["Liberal Alternative"] = {abbrev = "", color = "#846394", shortname = "",},
["Liberal and Centre Union"] = {abbrev = "LiCS", color = "#FFD126", shortname = "",},
["Liberal and Country League (SA)"] = {abbrev = "", color = "#0095B6", shortname = "",},
["Liberal and Country League"] = {abbrev = "", color = "#0095B6", shortname = "",},
["Liberal and Country Party"] = {abbrev = "", color = "#080CAB", shortname = "Liberal and Country",},
["Liberal and Democratic Union"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Liberal and Social Alternative"] = {abbrev = "", color = "#4A4999", shortname = "",},
["Liberal Appeal"] = {abbrev = "", color = "#4A48CF", shortname = "",},
["Liberal bloc (Hong Kong)"] = {abbrev = "", color = "#297329", shortname = "Liberal",},
["Liberal Coalition (Spain)"] = {abbrev = "", color = "#ACAE34", shortname = "",},
["Liberal Centre (Spain)"] = {abbrev = "", color = "#0DB85E", shortname = "",},
["Liberal Centre"] = {abbrev = "", color = "#00CCA3", shortname = "",},
["Liberal Centrist Union (Spain)"] = {abbrev = "", color = "#3399FF", shortname = "",},
["Liberal Citizens Action"] = {abbrev = "", color = "#F96611", shortname = "",},
["Liberal Conservative Reformers"] = {abbrev = "LKR", color = "#F29200", shortname = "",},
["Liberal Constitutional Party (Egypt)"] = {abbrev = "", color = "#483D8B", shortname = "Liberal Constitutional",},
["Liberal Constitutionalist Party (Mexico)"] = {abbrev = "PLC", color = "#D4AA00", shortname = "",},
["Liberal Democracy (France)"] = {abbrev = "DL", color = "#004B8C", shortname = "",},
["Liberal Democracy of Slovenia"] = {abbrev = "LDS", color = "#00BBF0", shortname = "",},
["Liberal Democrat Party (Turkey)"] = {abbrev = "", color = "#00008B", shortname = "Liberal Democrat",},
["Liberal Democrat Party of Chile"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Democratic Alliance for Italy"] = {abbrev = "ALI", color = "#195385", shortname = "",},
["Liberal Democratic Centre"] = {abbrev = "", color = "#21A631", shortname = "",},
["Liberal Democratic Congress"] = {abbrev = "KLD", color = "#007FB2", shortname = "",},
["Liberal Democratic Federation of Hong Kong"] = {abbrev = "LDF", color = "#DC2A2A", shortname = "",},
["Liberal Democratic Focus Team"] = {abbrev = "", color = "#FDBB30", shortname = "Lib Dem Focus Team",},
["Liberal Democratic Party (Angola)"] = {abbrev = "PLD", color = "#FFCB48", shortname = "",},
["Liberal Democratic Party (Australia)"] = {abbrev = "", color = "#FEC327", shortname = "Liberal Democrats",},
["Liberal Democratic Party (Bangladesh)"] = {abbrev = "LDP", color = "#FFBF00", shortname = "",},
["Liberal Democratic Party (Bosnia and Herzegovina)"] = {abbrev = "LDS BiH", color = "#28166F", shortname = "",},
["Liberal Democratic Party (Cambodia)"] = {abbrev = "", color = "blue", shortname = "",},
["Liberal Democratic Party (Chile, 1893)"] = {abbrev = "", color = "#00CCCC", shortname = "Liberal Democratic",},
["Liberal Democratic Party (El Salvador)"] = {abbrev = "PDL", color = "#E7D055", shortname = "",},
["Liberal Democratic Party (France)"] = {abbrev = "PLD", color = "#0080FF", shortname = "",},
["Liberal Democratic Party (Iceland)"] = {abbrev = "", color = "#3466E4", shortname = "",},
["Liberal Democratic Party (Japan)"] = {abbrev = "LDP", color = "#3CA324", shortname = "Liberal Democratic",},
["Liberal Democratic Party (Japan, 2017)"] = {abbrev = "LDP", color = "#D7003A", shortname = "",},
["Liberal Democratic Party (Kenya)"] = {abbrev = "", color = "yellow", shortname = "",},
["Liberal Democratic Party (Malaysia)"] = {abbrev = "", color = "#FF7F00", shortname = "",},
["Liberal Democratic Party (Netherlands)"] = {abbrev = "", color = "#333399", shortname = "",},
["Liberal Democratic Party (North Macedonia)"] = {abbrev = "LDP", color = "#2B2F7D", shortname = "",},
["Liberal Democratic Party (Romania)"] = {abbrev = "PLD", color = "#ff6633", shortname = "",},
["Liberal Democratic Party (Serbia)"] = {abbrev = "LDP", color = "#6901d4", shortname = "",},
["Liberal Democratic Party (Serbia, 1989)"] = {abbrev = "LDS", color = "#D85313", shortname = "",},
["Liberal Democratic Party (Slovenia)"] = {abbrev = "LDS", color = "#139BEA", shortname = "",},
["Liberal Democratic Party (Spain, 1913)"] = {abbrev = "", color = "#009933", shortname = "Liberal Democratic",},
["Liberal Democratic Party (Spain, 1982)"] = {abbrev = "PDL", color = "#339CD5", shortname = "",},
["Liberal Democratic Party (Sri Lanka)"] = {abbrev = "LDP", color = "#FFDE17", shortname = "Liberal Democratic Party",},
["Liberal Democratic Party (Thailand)"] = {abbrev = "", color = "#ffd700", shortname = "Liberal Democratic",},
["Liberal Democratic Party (Turkey)"] = {abbrev = "LDP", color = "#000099", shortname = "",},
["Liberal Democratic Party of the Soviet Union"] = {abbrev = "LDPSU", color = "#7295DB", shortname = "",},
["Liberal Democratic Party of Belarus"] = {abbrev = "LDPB", color = "#011E41", shortname = "",},
["Liberal Democratic Party of Germany"] = {abbrev = "LDPD", color = "#FFA500", shortname = "",},
["Liberal Democratic Party of Moldova"] = {abbrev = "PLDM", color = "#0E8A4A", shortname = "",},
["Liberal Democratic Party of Russia"] = {abbrev = "LDPR", color = "#48C", shortname = "",},
["Liberal Democratic Party of Ukraine"] = {abbrev = "", color = "orange", shortname = "Liberal Democratic",},
["Liberal Democratic Republican Party"] = {abbrev = "", color = "#1DACD6", shortname = "",},
["Liberal Democratic Union (Albania)"] = {abbrev = "BLD", color = "#2EA5E9", shortname = "",},
["Liberal Democrats (Germany)"] = {abbrev = "LD", color = "#F98113", shortname = "",},
["Liberal Democrats (UK)"] = {abbrev = "Lib Dem", color = "#FAA61A", shortname = "Liberal Democrats",},
["Liberal Democrats' Rally for National Reconstruction – Vivoten"] = {abbrev = "", color = "yellow", shortname = "",},
["Liberal Egyptian Party"] = {abbrev = "", color = "#FF3333", shortname = "",},
["Liberal Federation"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Liberal Focus Team"] = {abbrev = "LIBFT", color = "#FDBB30", shortname = "Liberal FT",},
["Liberal Force"] = {abbrev = "FL", color = "#FFDD93", shortname = "",},
["Liberal Forum"] = {abbrev = "LiF", color = "#FFDC00", shortname = "",},
["Liberal Front Party"] = {abbrev = "PFL", color = "#8CC63E", shortname = "",},
["Liberal Group of Andratx"] = {abbrev = "", color = "#6699CC", shortname = "",},
["Liberal Group Sanxenxo"] = {abbrev = "", color = "#0078B3", shortname = "",},
["Liberal Independent Group"] = {abbrev = "", color = "#009B31", shortname = "",},
["Liberal Initiative"] = {abbrev = "IL", color = "#00ADEF", shortname = "",},
["Liberal Integrity Party"] = {abbrev = "", color = "#ff69b4", shortname = "Liberal Integrity",},
["Liberal League (Finland)"] = {abbrev = "", color = "mediumblue", shortname = "",},
["Liberal League (Japan)"] = {abbrev = "", color = "#FFDF00", shortname = "Liberal League",},
["Liberal League (Luxembourg)"] = {abbrev = "", color = "yellow", shortname = "",},
["Liberal Left (France)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Left (Spain)"] = {abbrev = "", color = "#007138", shortname = "Liberal Left",},
["Liberal Left Coalition"] = {abbrev = "", color = "#6EBD57", shortname = "Liberal Left",},
["Liberal Movement (Australia)"] = {abbrev = "", color = "#8B008B", shortname = "Liberal Movement",},
["Liberal National Party of Queensland"] = {abbrev = "", color = "#1456F1", shortname = "Liberal National",},
["Liberal Opening Movement"] = {abbrev = "", color = "yellow", shortname = "",},
["Liberal Oppositionist"] = {abbrev = "", color = "#FFBF00", shortname = "Oppositionist",},
["Liberal Party – Freedom to Choose"] = {abbrev = "Lib.", color = "#F19321", shortname = "Liberal Party",},
["Liberal Party (Armenia)"] = {abbrev = "", color = "#EB5F10", shortname = "",},
["Liberal Party (Belgium)"] = {abbrev = "", color = "#3C40D2", shortname = "Liberal",},
["Liberal Party (Bolivia)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Party (Bourbon Restoration)"] = {abbrev = "", color = "#FDEE00", shortname = "",},
["Liberal Party (Brazil, 1831)"] = {abbrev = "", color = "#F7C100", shortname = "Liberal",},
["Liberal Party (Brazil, 1985)"] = {abbrev = "PL", color = "#080074", shortname = "",},
["Liberal Party (Brazil, 2006)"] = {abbrev = "PL", color = "#015AAA", shortname = "",},
["Liberal Party (Bulgaria)"] = {abbrev = "", color = "#EAC117", shortname = "",},
["Liberal Party (Cambodia)"] = {abbrev = "", color = "#FAAC58", shortname = "Liberal",},
["Liberal Party (Chile)"] = {abbrev = "", color = "#FFAE34", shortname = "",},
["Liberal Party (Chile, 1849)"] = {abbrev = "", color = "#FFD700", shortname = "Liberal",},
["Liberal Party (Chile, 1988)"] = {abbrev = "", color = "#F5D60A", shortname = "",},
["Liberal Party (Chile, 1998)"] = {abbrev = "", color = "#FFEE00", shortname = "",},
["Liberal Party (Croatia)"] = {abbrev = "", color = "#0303fa", shortname = "",},
["Liberal Party (East Timor)"] = {abbrev = "", color = "#2C43DB", shortname = "Liberal",},
["Liberal Party (Greece)"] = {abbrev = "", color = "#FFA500", shortname = "Liberal",},
["Liberal Party (Greece, modern)"] = {abbrev = "", color = "orange", shortname = "Liberal",},
["Liberal Party (Guatemala)"] = {abbrev = "", color = "#0000ff", shortname = "Liberal",},
["Liberal Party (Haiti)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Party (Hong Kong)"] = {abbrev = "", color = "#00aeef", shortname = "Liberal",},
["Liberal Party (Hungary)"] = {abbrev = "", color = "#AAD8E6", shortname = "Liberal",},
["Liberal Party (Iceland, historical)"] = {abbrev = "", color = "#00C6FF", shortname = "Liberal",},
["Liberal Party (Iceland)"] = {abbrev = "", color = "#406899", shortname = "Liberal",},
["Liberal Party (Israel)"] = {abbrev = "", color = "#FFCC00", shortname = "Liberal",},
["Liberal Party (Japan, 1890)"] = {abbrev = "", color = "#EFAB93", shortname = "Liberal",},
["Liberal Party (Japan, 1950)"] = {abbrev = "", color = "#128A45", shortname = "Liberal",},
["Liberal Party (Japan, 1998)"] = {abbrev = "", color = "#000099", shortname = "Liberal",},
["Liberal Party (Japan, 2016)"] = {abbrev = "", color = "#0950A0", shortname = "Liberal",},
["Liberal Party (Kingdom of Serbia)"] = {abbrev = "", color = "#FFDF00", shortname = "Liberal",},
["Liberal Party (Mexico)"] = {abbrev = "PL", color = "#FF3333", shortname = "Liberal",},
["Liberal Party (Moldova)"] = {abbrev = "PL", color = "#73C2FB", shortname = "",},
["Liberal Party (New York)"] = {abbrev = "", color = "#CC0000", shortname = "Liberal",},
["Liberal Party (Nicaragua)"] = {abbrev = "", color = "#800000", shortname = "Liberal",},
["Liberal Party (Norway)"] = {abbrev = "", color = "#006666", shortname = "Liberal",},
["Liberal Party (Panama)"] = {abbrev = "", color = "#FF0000", shortname = "Liberal",},
["Liberal Party (Papua New Guinea)"] = {abbrev = "LP", color = "#1F509F", shortname = "Liberal",},
["Liberal Party (Paraguay)"] = {abbrev = "", color = "#0000FF", shortname = "Liberal",},
["Liberal Party (Philippines)"] = {abbrev = "LP", color = "#f0e68c", shortname = "Liberal",},
["Liberal Party (Radoslavists)"] = {abbrev = "", color = "maroon", shortname = "",},
["Liberal Party (Rwanda)"] = {abbrev = "PL", color = "#03b464", shortname = "",},
["Liberal Party (Serbia)"] = {abbrev = "", color = "#FAFC38", shortname = "",},
["Liberal Party (Slovenia)"] = {abbrev = "", color = "#FFCC00", shortname = "",},
["Liberal Party (South Korea)"] = {abbrev = "", color = "#254170", shortname = "Liberal",},
["Liberal Party (South Korea, 1963)"] = {abbrev = "", color = "#485142", shortname = "Liberal",},
["Liberal Party (Spain, 1880)"] = {abbrev = "", color = "#83C53A", shortname = "Liberal",},
["Liberal Party (Spain, 1976)"] = {abbrev = "", color = "#006C95", shortname = "",},
["Liberal Party (Thailand)"] = {abbrev = "", color = "#00008B", shortname = "Liberal",},
["Liberal Party (UK, 1989)"] = {abbrev = "", color = "#EB7A43", shortname = "Liberal",},
["Liberal Party (UK)"] = {abbrev = "Lib", color = "#FFD700", shortname = "Liberal",},
["Liberal Party (Uruguay)"] = {abbrev = "", color = "#1047a1", shortname = "Liberal",},
["Liberal Party (Venezuela)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Party–Hatoyama"] = {abbrev = "", color = "#8DA405", shortname = "",},
["Liberal Party Bangladesh"] = {abbrev = "", color = "#EA6D6A", shortname = "",},
["Liberal Party of Albania"] = {abbrev = "", color = "#F2D863", shortname = "",},
["Liberals of Andorra"] = {abbrev = "L'A", color = "#019DC5", shortname = "",},
["Liberal Party of Australia (A.C.T. Division)"] = {abbrev = "LP", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia (New South Wales Division)"] = {abbrev = "LP", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia (Queensland Division)"] = {abbrev = "LP", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia (South Australian Division)"] = {abbrev = "LP", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia (Tasmanian Division)"] = {abbrev = "LP", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia (Victorian Division)"] = {abbrev = "LP", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia (Western Australian Division)"] = {abbrev = "LP", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia"] = {abbrev = "LP", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Chile (2013)"] = {abbrev = "", color = "#FF432C", shortname = "Liberal",},
["Liberal Party of Canada"] = {abbrev = "", color = "#D71920", shortname = "Liberal",},
["Liberal Party of Corrientes"] = {abbrev = "", color = "#35AAE0", shortname = "",},
["Liberal Party of Cuba"] = {abbrev = "", color = "#75AADB", shortname = "Liberal",},
["Liberal Party of Ghana"] = {abbrev = "", color = "#F96128", shortname = "",},
["Liberal Party of Gibraltar"] = {abbrev = "", color = "#EF4135", shortname = "Liberal",},
["Liberal Party of Honduras"] = {abbrev = "", color = "#CE2029", shortname = "Liberal",},
["Liberal Party of Ireland"] = {abbrev = "LPI", color = "#ADD8E6", shortname = "Liberal",},
["Liberal Party of Kosovo"] = {abbrev = "", color = "brown", shortname = "",},
["Liberal Party of Macedonia"] = {abbrev = "LPM", color = "#FFFF00", shortname = "",},
["Liberal Party of Montenegro"] = {abbrev = "LPCG", color = "#87CEEB", shortname = "",},
["Liberal Party of Norway"] = {abbrev = "", color = "#8CD600", shortname = "Liberal",},
["Liberal Party of South Africa"] = {abbrev = "", color = "#FED86F", shortname = "",},
["Liberal Party of Sri Lanka"] = {abbrev = "", color = "#FFDE17", shortname = "",},
["Liberal Party of State Employment and Housing"] = {abbrev = "", color = "#311829", shortname = "",},
["Liberal Party of Switzerland"] = {abbrev = "", color = "#134B94", shortname = "Liberals",},
["Liberal Party of the Right"] = {abbrev = "", color = "#4955A1", shortname = "",},
["Liberal Party of Ukraine"] = {abbrev = "", color = "blue", shortname = "Liberal",},
["Liberal People's Party (Norway)"] = {abbrev = "", color = "purple", shortname = "",},
["Liberal People's Party (Norway, 1972)"] = {abbrev = "", color = "red", shortname = "",},
["Liberal Poland – Entrepreneurs' Strike"] = {abbrev = "PL!SP", color = "#FFD900", shortname = "",},
["Liberal Popular Alliance"] = {abbrev = "", color = "#3366FF", shortname = "",},
["Liberal Progressive Party (Costa Rica)"] = {abbrev = "PLP", color = "#ff7300", shortname = "",},
["Liberal-Radical Party"] = {abbrev = "", color = "#ffcc00", shortname = "Liberal-Radical",},
["Liberal Reform Party (Australia)"] = {abbrev = "", color = "#00CED1", shortname = "Liberal Reform",},
["Liberal Reform Party (Czech Republic)"] = {abbrev = "LiRA", color = "yellow", shortname = "",},
["Liberal Reformist Party (Belgium)"] = {abbrev = "PRL", color = "blue", shortname = "",},
["Liberal Reformist Party (Dominican Republic)"] = {abbrev = "", color = "#32cd32", shortname = "",},
["Liberal Reformist Party (Puerto Rico)"] = {abbrev = "", color = "#B9245D", shortname = "",},
["Liberal Reformist Party (Romania)"] = {abbrev = "", color = "#1A92D0", shortname = "",},
["Liberal Reformist Party (Spain)"] = {abbrev = "", color = "#13CED2", shortname = "Liberal Reformist",},
["Liberal Regenerator Party"] = {abbrev = "", color = "#1935D0", shortname = "",},
["Liberal–Republican Coalition (Spain)"] = {abbrev = "", color = "#B1855B", shortname = "",},
["Liberal Republican Party (Turkey)"] = {abbrev = "", color = "#348AC9", shortname = "",},
["Liberal Republican Party (US)"] = {abbrev = "", color = "#FF69B4", shortname = "Liberal Republican",},
["Liberal Republican Right"] = {abbrev = "DLR", color = "#4EC766", shortname = "",},
["Liberal Samajbadi Party"] = {abbrev = "", color = "yellow", shortname = "",},
["Liberal Socialist Party (Singapore)"] = {abbrev = "LSP", color = "#EE5533", shortname = "",},
["Liberal Socialist Party (Switzerland)"] = {abbrev = "PLSS", color = "#F0D90B", shortname = "",},
["Liberal Socialists Party (Egypt)"] = {abbrev = "", color = "#00EE00", shortname = "",},
["Liberal State Party"] = {abbrev = "LSP", color = "#5A5CBD", shortname = "",},
["Liberal Swedish Party"] = {abbrev = "", color = "Blue", shortname = "",},
["Liberal Unification Party"] = {abbrev = "", color = "#013792", shortname = "Liberal Unification",},
["Liberal Union (Australia)"] = {abbrev = "", color = "#0000FF", shortname = "Liberal Union",},
["Liberal Union (Germany)"] = {abbrev = "LV", color = "#EEDC82", shortname = "",},
["Liberal Union (Italy)"] = {abbrev = "", color = "#0047AB", shortname = "Liberal Union",},
["Liberal Union (Netherlands)"] = {abbrev = "LU", color = "#5873DF", shortname = "",},
["Liberal Union (Spain, 1983)"] = {abbrev = "", color = "#1E90FF", shortname = "",},
["Liberal Union (Spain)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Union–Brătianu"] = {abbrev = "UL–B", color = "#FFDD00", shortname = "",},
["Liberal Union of Lithuania"] = {abbrev = "LLS", color = "#E8CA58", shortname = "",},
["Liberal Unionist Party"] = {abbrev = "LibU", color = "#2061A2", shortname = "Liberal Unionist",},
["Liberal Unity"] = {abbrev = "", color = "#FFD300", shortname = "",},
["Liberal Vannin Party"] = {abbrev = "", color = "#FA8000", shortname = "Liberal Vannin",},
["Liberal-Labour (UK)"] = {abbrev = "Lib-Lab", color = "orange", shortname = "",},
["Liberal-Labour"] = {abbrev = "", color = "orange", shortname = "",},
["Liberal–Labour (New Zealand)"] = {abbrev = "", color = "#FFA500", shortname = "Liberal–Labour",},
["Liberal-Social Union"] = {abbrev = "LSU", color = "#50C878", shortname = "",},
["Liberal–Socialist Kartels"] = {abbrev = "", color = "#800080", shortname = "Liberal–Socialist",},
["Liberal/Country coalition"] = {abbrev = "", color = "#0047AB", shortname = "",},
["Liberal/National coalition"] = {abbrev = "", color = "#0047AB", shortname = "",},
["Liberal/NCP coalition"] = {abbrev = "", color = "#0047AB", shortname = "",},
["Liberal"] = {abbrev = "", color = "#FFFF00", shortname = "",}, -- Generic color, not a party color; specify the actual party
["Liberalism in the Netherlands"] = {abbrev = "", color = "#e7cf25", shortname = "",},
["Liberalism"] = {abbrev = "", color = "#FFFF00", shortname = "Liberal",},
["Liberals (Finland)"] = {abbrev = "", color = "gold", shortname = "Liberals",},
["Liberals (Sweden)"] = {abbrev = "L", color = "#006AB3", shortname = "Liberals",},
["Liberals for Åland"] = {abbrev = "", color = "#1F66CA", shortname = "",},
["Liberals for Forests"] = {abbrev = "LFF", color = "#05A593", shortname = "Liberals for Forests",},
["Liberals of Benidorm"] = {abbrev = "", color = "#359E74", shortname = "",},
["Liberals of Serbia"] = {abbrev = "LS", color = "#FF4F00", shortname = "",},
["Liberals' Movement (Lithuania)"] = {abbrev = "LRLS", color = "#F48100", shortname = "",},
["Liberals, Democrats and Radicals"] = {abbrev = "LDR", color = "Gold", shortname = "",},
["Liberate the People"] = {abbrev = "YAW", color = "#FF1493", shortname = "",},
["Liberation Rally"] = {abbrev = "", color = "#CD7F32", shortname = "",},
["Liberation Movement (Serbia)"] = {abbrev = "O", color = "#18478e", shortname = "",},
["Liberator Party (Brazil)"] = {abbrev = "", color = "#F9AF1E", shortname = "",},
["Liberia Destiny Party"] = {abbrev = "LDP", color = "#BEC2CB", shortname = "",},
["Liberia National Union"] = {abbrev = "LNU", color = "#2E7286", shortname = "",},
["Liberia Restoration Party"] = {abbrev = "LRP", color = "#008000", shortname = "",},
["Liberia Transformation Party"] = {abbrev = "LTP", color = "#330104", shortname = "",},
["Liberian Action Party"] = {abbrev = "LAP", color = "#00FFFF", shortname = "",},
["Liberian People's Party"] = {abbrev = "LPP", color = "#DC143C", shortname = "",},
["Libertair, Direct, Democratisch"] = {abbrev = "LDD", color = "#6DCFF6", shortname = "",},
["Libertarian Left (Chile)"] = {abbrev = "", color = "#451255", shortname = "",},
["Libertarian Movement (Costa Rica)"] = {abbrev = "PML", color = "#DC143C", shortname = "",},
["Libertarian Movement Party"] = {abbrev = "", color = "#BA151B", shortname = "",},
["Libertarian Party (Argentina)"] = {abbrev = "PL", color = "#7D03FE", shortname = "",},
["Libertarian Party (Netherlands)"] = {abbrev = "", color = "#1170ce", shortname = "",},
["Libertarian Party (Spain)"] = {abbrev = "", color = "#C9A900", shortname = "",},
["Libertarian Party (Switzerland)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Libertarian Party (US)"] = {abbrev = "LI", color = "#FED105", shortname = "Libertarian",},
["Libertarian Party (UK)"] = {abbrev = "", color = "#FCC820", shortname = "Libertarian",},
["Libertarian Party of Australia"] = {abbrev = "", color = "#E5C601", shortname = "",},
["Libertarian Party of Canada"] = {abbrev = "", color = "#F2BA00", shortname = "",},
["Libertarian Party of South Africa"] = {abbrev = "", color = "#BE9F4D", shortname = "",},
["Libertarianz"] = {abbrev = "", color = "#09296B", shortname = "",},
["Libertas Estonia"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Libertas France"] = {abbrev = "", color = "#003366", shortname = "Libertas",},
["Libertas Ireland"] = {abbrev = "", color = "#3333CC", shortname = "Libertas",},
["Libertas United Kingdom"] = {abbrev = "", color = "#900020", shortname = "Pro-Democracy: Libertas.eu",},
["Libertas.eu"] = {abbrev = "Lib.eu", color = "#2c296e", shortname = "",},
["Liberties, Independents, Overseas and Territories"] = {abbrev = "", color = "#38D4C7", shortname = "LIOT",},
["Liberty (political party, Palestine)"] = {abbrev = "", color = "#C69F14", shortname = "",},
["Liberty (political party)"] = {abbrev = "", color = "#1882C5", shortname = "Volia",},
["Liberty and Lawfulness"] = {abbrev = "WiP", color = "grey", shortname = "",},
["Liberty and Refoundation"] = {abbrev = "", color = "#8B0000", shortname = "Libre",},
["Liberty GB"] = {abbrev = "", color = "#000168", shortname = "",},
["Liberty Korea Party"] = {abbrev = "", color = "#C9151E", shortname = "Liberty Korea",},
["Liberty Party (Liberia)"] = {abbrev = "LP", color = "#FFD600", shortname = "",},
["Liberty Party (US, 1932)"] = {abbrev = "", color = "#00DDDD", shortname = "Liberty",},
["Liberty Party (US)"] = {abbrev = "", color = "#00DDDD", shortname = "Liberty",},
["Liberty Republican Party"] = {abbrev = "", color = "#009944", shortname = "",},
["Liberty Unification Party"] = {abbrev = "", color = "#E12F33", shortname = "Liberty Unification",},
["Liberty Union Party"] = {abbrev = "", color = "#D6FF33", shortname = "Liberty Union",},
["Liberty, Worth Voting For"] = {abbrev = "", color = "#DDDDDD", shortname = "Liberty",},
["Libra Party"] = {abbrev = "", color = "#F8D308", shortname = "",},
["Libre (Guatemala)"] = {abbrev = "", color = "#3467A1", shortname = "Libre",},
["Libres"] = {abbrev = "", color = "#194955", shortname = "",},
["Lider (political party)"] = {abbrev = "", color = "#00AFF0", shortname = "",},
["Liepāja Party"] = {abbrev = "", color = "#50A640", shortname = "",},
["Life – National Party"] = {abbrev = "Život–NS", color = "#032F67", shortname = "",},
["Life and Liberty Party"] = {abbrev = "", color = "black", shortname = "Life and Liberty",},
["Liga Veneta"] = {abbrev = "", color = "#0030AA", shortname = "",},
["LiGanDo"] = {abbrev = "", color = "#02A24A", shortname = "",},
["Light Blue and White Union"] = {abbrev = "", color = "blue", shortname = "",},
["Light of Faith (political party)"] = {abbrev = "", color = "#10C8DF", shortname = "Yiman Nuru",},
["Ligue du Sud"] = {abbrev = "LS", color = "#404040", shortname = "",},
["Likud Yisrael Beiteinu"] = {abbrev = "", color = "#1f5aa5", shortname = "",},
["Likud"] = {abbrev = "", color = "#1f5aa5", shortname = "",},
["Linares First"] = {abbrev = "", color = "#1F1715", shortname = "",},
["Lincoln Democratic Labour Association"] = {abbrev = "", color = "#FF6600", shortname = "Democratic Labour",},
["Lincolnshire Independents"] = {abbrev = "", color = "#000000", shortname = "Lincolnshire Independent",},
["Linese Alternative"] = {abbrev = "", color = "#0CB7F2", shortname = "",},
["Lingkod Taguig"] = {abbrev = "", color = "#0051B0", shortname = "",},
["Linyon Demokratik Seselwa"] = {abbrev = "", color = "#2C50A4", shortname = "",},
["List Burgenland"] = {abbrev = "", color = "#F8D323", shortname = "",},
["List Dedecker"] = {abbrev = "", color = "#000080", shortname = "",},
["List for Fiume"] = {abbrev = "", color = "#545AA7", shortname = "",},
["List for Sandžak"] = {abbrev = "LZS", color = "#307A4D", shortname = "",},
["List for Trieste"] = {abbrev = "", color = "#4CBB17", shortname = "",},
["List of Decency"] = {abbrev = "", color = "#CC00CC", shortname = "",},
["List of Marjan Šarec"] = {abbrev = "LMŠ", color = "#005AAB", shortname = "",},
["Lists of Slavs and Germans"] = {abbrev = "LST", color = "#B00000", shortname = "",},
["Lista del Apruebo"] = {abbrev = "", color = "#6F4D9A", shortname = "",},
["Lista Niun Paso Atras"] = {abbrev = "", color = "gold", shortname = "",},
["Lisu National Development Party"] = {abbrev = "LNDP", color = "#DC0723", shortname = "",},
["Lithuanian Centre Party"] = {abbrev = "", color = "#0CA13B", shortname = "",},
["Lithuanian Centre Union"] = {abbrev = "LCS", color = "#D6D40F", shortname = "",},
["Lithuanian Christian Democratic Party"] = {abbrev = "LKDP", color = "#3D6DBF", shortname = "",},
["Lithuanian Christian Democrats"] = {abbrev = "", color = "#3333CC", shortname = "",},
["Lithuanian Citizens' Alliance"] = {abbrev = "LPA", color = "#799B6F", shortname = "",},
["Lithuanian Democratic Party"] = {abbrev = "LDP", color = "#007272", shortname = "",},
["Lithuanian Farmers and Greens Union"] = {abbrev = "LVŽS", color = "#00A651", shortname = "",},
["Lithuanian Green Party"] = {abbrev = "LŽP", color = "#92C83E", shortname = "",},
["Lithuanian Labour Federation"] = {abbrev = "", color = "#2C6BC7", shortname = "Labour Federation",},
["Lithuanian Liberty Union"] = {abbrev = "LLS", color = "#FBB800", shortname = "",},
["Lithuanian List"] = {abbrev = "LS", color = "#810305", shortname = "",},
["Lithuanian Nationalist and Republican Union"] = {abbrev = "", color = "#FDC52A", shortname = "",},
["Lithuanian Nationalist Union"] = {abbrev = "LTS", color = "#FFD700", shortname = "",},
["Lithuanian Peasant Popular Union"] = {abbrev = "", color = "#BBFF02", shortname = "",},
["Lithuanian Peasants Party"] = {abbrev = "LVP", color = "#BAD759", shortname = "",},
["Lithuanian People's Party"] = {abbrev = "LLP", color = "#E6AD1E", shortname = "",},
["Lithuanian Popular Peasants' Union"] = {abbrev = "LVLS", color = "green", shortname = "",},
["Lithuanian Popular Socialist Democratic Party"] = {abbrev = "LSLDP", color = "", shortname = "",},
["Lithuanian Regions Party"] = {abbrev = "LRP", color = "#CE2C29", shortname = "",},
["Lithuanian Russian Union"] = {abbrev = "SRL", color = "red", shortname = "",},
["Lithuanian Social Democratic Union"] = {abbrev = "LSDS", color = "#901d78", shortname = "",},
["Lithuanian Union of Political Prisoners and Deportees"] = {abbrev = "LPKTS", color = "#216319", shortname = "",},
["Livable Netherlands"] = {abbrev = "LN", color = "#FF4400", shortname = "",},
["Liverpool Community Independents"] = {abbrev = "", color = "#800000", shortname = "Community Independents",},
["Liverpool Independent Party"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Liverpool Protestant Party"] = {abbrev = "", color = "#F88017", shortname = "Protestant",},
["Living Ourense"] = {abbrev = "", color = "#0082CD", shortname = "",},
["LIVRE"] = {abbrev = "", color = "#C2D216", shortname = "",},
["Llais Gwynedd"] = {abbrev = "", color = "#006400", shortname = "",},
["Llantwit First Independents"] = {abbrev = "", color = "#999999", shortname = "Llantwit First Independent",},
["Lliures"] = {abbrev = "", color = "#E75C73", shortname = "",},
["Lloc Espai Independent"] = {abbrev = "", color = "#E6302B", shortname = "",},
["LMP – Hungary's Green Party"] = {abbrev = "LMP", color = "#36CA8B", shortname = "",},
["Lower Hutt Citizens' Association"] = {abbrev = "", color = "#B8BFFE", shortname = "Citizens'",},
["Local Alliance"] = {abbrev = "", color = "#000000", shortname = "",},
["Local and Rural Issues"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Local Danish parties"] = {abbrev = "", color = "#C7C3BF", shortname = "",},
["Local Education Action by Parents"] = {abbrev = "", color = "#CCCCCC", shortname = "",},
["Local Option"] = {abbrev = "", color = "silver", shortname = "",},
["Local Progressive Party"] = {abbrev = "", color = "#FF4500", shortname = "",},
["Localist Bloc of Melilla"] = {abbrev = "", color = "#217118", shortname = "",},
["Localist"] = {abbrev = "", color = "#bb00bb", shortname = "",},
["Localist groups (Hong Kong)"] = {abbrev = "", color = "#002366", shortname = "Localist",},
["Loktantrik Morcha (Rajasthan)"] = {abbrev = "LM", color = "#FF1D15", shortname = "",},
["Lok Bhalai Party"] = {abbrev = "LBP", color = "#386059", shortname = "",},
["Lok Insaaf Party"] = {abbrev = "LIP", color = "Maroon", shortname = "",},
["Lok Janshakti Party (Ram Vilas)"] = {abbrev = "LJP(RV)", color = "#5B006A", shortname = "",},
["Lok Janshakti Party"] = {abbrev = "LJP", color = "#0093DD", shortname = "",},
["Lok Kalayankari Janata Party Nepal"] = {abbrev = "", color = "#FFEFD5", shortname = "Lok Kalayankari Janata Party",},
["Lok Paritran"] = {abbrev = "LKPT", color = "#f3c0f3", shortname = "",},
["Lok Raj Party Himachal Pradesh"] = {abbrev = "LRP", color = "indigo", shortname = "",},
["Lok Rajya Party"] = {abbrev = "", color = "#9900FF", shortname = "",},
["Lok Satta Party"] = {abbrev = "LSP", color = "#FF1493", shortname = "",},
["Lok Sewak Dal"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Lok Sewak Sangh"] = {abbrev = "", color = "#00FF00", shortname = "",},
["Lok Shakti"] = {abbrev = "", color = "#336600", shortname = "",},
["Lokdal"] = {abbrev = "LKD", color = "#00FF66", shortname = "",},
["Lokpriya Samaj Party"] = {abbrev = "LPSP", color = "#66FF99", shortname = "",},
["Loktanter Suraksha Party"] = {abbrev = "LSP", color = "#FF9900", shortname = "",},
["Loktantra Suraksha Party"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Loktantrik Jan Samta Party"] = {abbrev = "LJSP", color = "grey", shortname = "",},
["Loktantrik Janata Dal"] = {abbrev = "LJD", color = "#2E8B57", shortname = "",},
["Loktantrik Janata Party (Secular)"] = {abbrev = "LJP(S)", color = "pink", shortname = "",},
["Loktantrik Morcha Himachal Pradesh"]={abbrev="LHMP",color="",shortname=""},
["Loktantrik Samajwadi Party, Nepal"] = {abbrev = "LSWP", color = "#c7f884 ", shortname = "Loktantrik Samajwadi",},
["Londependence Party"] = {abbrev = "", color = "#751056", shortname = "Londependence",},
["London Real Party"] = {abbrev = "", color = "#af0823", shortname = "London Real",},
["London Socialist Alliance"] = {abbrev = "", color = "red", shortname = "London Socialist",},
["Longthornton and Tamworth Residents Association"] = {abbrev = "", color = "#000000", shortname = "Longthornton and Tamworth Residents",},
["Lord Fusituʻa"] = {abbrev = "", color = "#D3D3D3", shortname = "",},
["Lord Nuku"] = {abbrev = "", color = "#D3D3D3", shortname = "",},
["Lord Speaker"] = {abbrev = "", color = "black", shortname = "",},
["Lord Tuʻiʻafitu"] = {abbrev = "", color = "#D3D3D3", shortname = "",},
["Lords Spiritual"] = {abbrev = "", color = "#7F00FF", shortname = "",},
["Loss"] = {abbrev = "", color = "#999999", shortname = "",},
["Loughton Residents Association"] = {abbrev = "", color = "#50C878", shortname = "Loughton Residents",},
["Love Malaysia Party"] = {abbrev = "", color = "#DAE2EA", shortname = "",},
["Love Party (Italy)"] = {abbrev = "", color = "#FF91AF", shortname = "",},
["Love Sabah Party"] = {abbrev = "", color = "#FB5B47", shortname = "",},
["Love, Faith, Hope"] = {abbrev = "", color = "#BC413C", shortname = "",},
["Lower Cinca Between Everyone"] = {abbrev = "ETXSBC", color = "#F57D02", shortname = "",},
["Lower Minho Independents"] = {abbrev = "", color = "#824941", shortname = "",},
["Loyalty and Dignity"] = {abbrev = "", color = "#1e90ff", shortname = "",},
["Luen Wo United"] = {abbrev = "", color = "#000000", shortname = "",},
["Lugonovo"] = {abbrev = "", color = "#E5432C", shortname = "",},
["Luhansk Economic Union"] = {abbrev = "LES", color = "#76C5F0", shortname = "",},
["Lung Mun Concern Group"] = {abbrev = "LMCG", color = "#11A0B4", shortname = "",},
["Lutte Ouvrière"] = {abbrev = "LO", color = "#AA0000", shortname = "",},
["Luxembourg Socialist Workers' Party"] = {abbrev = "LSAP", color = "#F10035", shortname = "",},
["LXE"] = {abbrev = "", color = "#47B9AF", shortname = "",},
["Lytvyn Bloc"] = {abbrev = "", color = "#01B8A4", shortname = "",},
["Lytyn Bloc"] = {abbrev = "", color = "Green", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
020379feeb53789093f466bb911be68ec969ba1c
Template:CountryPrefixThe
10
172
335
2023-12-18T19:04:07Z
wikipedia>Aidan721
0
add [[Southwest Territory]]
wikitext
text/x-wiki
<includeonly>{{{{{|safesubst:}}}#switch: {{{1|}}}
| Australian Capital Territory | Austrian Empire | Bahamas | Batavian Republic | Belgian Congo | British Antarctic Territory | British Empire | British Virgin Islands | Bukharan People's Soviet Republic | Cape Colony | Captaincy General of Chile | Caribbean | Cayman Islands | Central African Republic | Channel Islands | Collectivity of Saint Martin | Colony of Natal | Colony of Santiago | Comoros | Congo Free State | Cook Islands | Cossack Hetmanate | Crown Dependencies | Czech Republic | Danish colonial empire | Democratic Republic of the Congo | Dominican Republic | Dominion of Newfoundland | Donetsk People's Republic | Duchy of Nassau | Dutch Caribbean | Dutch East Indies | Dutch Empire | Dutch Republic | Empire of Brazil | Falkland Islands | Falkland Islands Dependencies | Faroe Islands | Federal District (Brazil) | Federal Republic of Central America | Federal Republic of Yugoslavia | Federated States of Micronesia | Federation of Rhodesia and Nyasaland | French Union | French colonial empire | Gambia | German Empire | German colonial empire | Greater Republic of Central America | Gilbert and Ellice Islands | Grand Duchy of Hesse | Grand Duchy of Tuscany | Habsburg monarchy | Habsburg Netherlands | Hawaiian Kingdom | Holy Roman Empire | Holy See | Inca civilization | Ionian Islands (region) | Irish Free State | Isle of Man | Italian Empire | Japanese colonial empire | Kazakh Autonomous Socialist Soviet Republic | Kazakh Soviet Socialist Republic | Kingdom of Hanover | Kingdom of Hawaii | Kingdom of Jerusalem | Kingdom of Naples | Kingdom of Sardinia | Kingdom of Sicily | Kingdom of the Two Sicilies | Kirghiz Soviet Socialist Republic | Luhansk People's Republic | Maldives | Mamluk Sultanate | Maratha Empire | Marshall Islands | Moldavian Autonomous Soviet Socialist Republic | Moldavian Soviet Socialist Republic | Mongol Empire | Mughal Empire | Nagorno-Karabakh Republic | Netherlands | Netherlands Antilles | New Hebrides | North Aegean | Northern Mariana Islands | Northern Territory | Orange Free State | Ottoman Empire | Palestinian territories | Papal States | Philippines | Pitcairn Islands | Polish–Lithuanian Commonwealth | Portuguese Empire | Province of Quebec (1763–1791) | Republic of Artsakh | Republic of Florence | Republic of Genoa | Republic of Ireland | Republic of Macedonia | Republic of New Granada | Republic of Texas | Republic of the Congo | Republic of Venice | Russian Empire | Sahrawi Arab Democratic Republic | Socialist Republic of Macedonia | Solomon Islands | South Aegean | South African Republic | Southern Nigeria Protectorate | Southwest Territory | Soviet Union | Spanish East Indies | Spanish Empire | Spanish West Indies | State of Mexico | State of Palestine | Straits Settlements | Swedish colonial empire | Territory of Papua | Thirteen Colonies | Trucial States | Trust Territory of the Pacific Islands | Turkmen Soviet Socialist Republic | Turks and Caicos Islands | United Arab Emirates | United Kingdom | United States | United States Virgin Islands | Vermont Republic | Viceroyalty of New Granada | Viceroyalty of Peru | Viceroyalty of the Río de la Plata | Zulu Kingdom =<!--
-->{{#ifeq: {{Yesno-no|{{{capitalised|{{{capitalized|}}}}}}}}|yes|The|the}} {{#ifeq: {{Yesno-no|{{{onlythe|}}}}}|yes||{{{1|}}}}}<!--
-->|#default={{#ifeq: {{Yesno-no|{{{onlythe|}}}}}|yes||{{{1|}}}}}<!--
-->}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
5453dc9520f098181447c2c5e3b518eda03d054c
Main Page
0
1
1
2023-12-19T14:46:40Z
MediaWiki default
1
Create main page
wikitext
text/x-wiki
__NOTOC__
== Welcome to {{SITENAME}}! ==
This Main Page was created automatically and it seems it hasn't been replaced yet.
=== For the bureaucrat(s) of this wiki ===
Hello, and welcome to your new wiki! Thank you for choosing Miraheze for the hosting of your wiki, we hope you will enjoy our hosting.
You can immediately start working on your wiki or whenever you want.
Need help? No problem! We will help you with your wiki as needed. To start, try checking out these helpful links:
* [[mw:Special:MyLanguage/Help:Contents|MediaWiki guide]] (e.g. navigation, editing, deleting pages, blocking users)
* [[meta:Special:MyLanguage/FAQ|Miraheze FAQ]]
* [[meta:Special:MyLanguage/Request features|Request settings changes on your wiki]]. (Extensions, Skin and Logo/Favicon changes should be done through [[Special:ManageWiki]] on your wiki, see [[meta:Special:MyLanguage/ManageWiki|ManageWiki]] for more information.)
==== I still don't understand X! ====
Well, that's no problem. Even if something isn't explained in the documentation/FAQ, we are still happy to help you. You can find us here:
* [[meta:Special:MyLanguage/Help center|On our own Miraheze wiki]]
* On [[phab:|Phabricator]]
* On [https://miraheze.org/discord Discord]
* On IRC in #miraheze on irc.libera.chat ([irc://irc.libera.chat/%23miraheze direct link]; [https://web.libera.chat/?channel=#miraheze webchat])
=== For visitors of this wiki ===
Hello, the default Main Page of this wiki (this page) has not yet been replaced by the bureaucrat(s) of this wiki. The bureaucrat(s) might still be working on a Main Page, so please check again later!
21236ac3f8d65e5563b6da6b70815ca6bf1e6616
2
1
2023-12-22T20:45:01Z
Floopymichael
2
Basic main page summary, not completed at this time
wikitext
text/x-wiki
__NOTOC__ __NOEDITSECTION__
{| style="border: 2px solid #f2b705; border-left: 12px solid #f2b705; margin: 1px 0% 0px; background-color: #f2e7c7; vertical-align: middle; color:#f2e7c7, box-shadow: 0px black;"
|-
| style="padding: 2px 0 2px 0.5em" | [[File:Achtung-yellow.svg|55px]]
| style="padding: 0.25em 0.5em; width: 100%;" | <big>'''The LTET Wiki is currently under construction, and this main page is not completed yet.'''</big>
The main page and additional subpages will be added soon. It is expected to be completed by mid-January of 2024 alongside the launch of LTET. Thank you for your patience and apologies for the inconvenience!
|}
<!-- page background starts -->
<div style="background:#ffffff; position:relative; margin:1.2em; z-index:1; margin-bottom:0px; margin-left:-12px; margin-right:-13px; padding-top:10px; padding-right:13px; padding-left:13px;">
<div style="margin:5px 0; border:1; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); background:white; width:100%; overflow:hidden;background: #FCFCFC; background: linear-gradient(top, #FCFCFC 0%,#F5F5F5 100%); background: -moz-linear-gradient(top, #FCFCFC 0%, #f2e1e1 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#FCFCFC), color-stop(100%,#f2e1e1)); background: -webkit-linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); background: -o-linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); background: -ms-linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); background: linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); position:relative;">
<!-- page background ends -->
<!-- main page title -->
<div style="text-align: center;">
<span style="font-family: berlin sans fb;font-size: 35px">'''Welcome to the LTET 4.0 Wiki!''' </span>
<br/>
<span style="font-family: berlin sans fb;font-size: 25px"> A Let's Talk Elections Tournament Project
</div>
<!-- main page title ends -->
{| style="width: 100%; background: transparent; border-spacing: 0; table-layout: fixed;"
|- style="vertical-align: top;"
| style="width: 65%; padding-right: 10px;" |
<div style="margin-bottom:15px; font-size:90%; padding:0px 20px; overflow:hidden; position:relative;">
</div>
<div style="border:1px solid #EEE; margin-bottom:20px; padding:10px 20px; overflow:hidden; position:relative; box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.1); background:#FBFBF9;">
'''Let's Talk Elections Tournament''' is a Discord based political simulation in its 4th iteration. Players roleplay as fictional politicians in a dynamic alternate timeline through electoral campaigns, governing on both the state and federal level, and dealing with the political questions of the day. The current iteration of the simulation starts in the year 1965 and launches in mid-January 2024.
<br/>
<br/>
This wikipedia will provide everything you will need to know from election results, passed legislation, and important events that you may need to know. Players will also be able to create their own character pages, granted they follow Wikipedia's existing <span class="plainlinks">[https://simple.wikipedia.org/wiki/Wikipedia:Neutral_point_of_view neutral point of view</span>]</span> and <span class="plainlinks">[https://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style manual of style</span>]</span> policies.
'''You can join our discord <span class="plainlinks">[https://discord.gg/2yHwu9JXKz here</span>]</span>.'''
</table>
</div>
|}
78c0be30ccad9bfe62fe5270bec96b85ba2ff225
3
2
2023-12-22T20:45:39Z
Floopymichael
2
Protected "[[Main Page]]": High traffic page ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
wikitext
text/x-wiki
__NOTOC__ __NOEDITSECTION__
{| style="border: 2px solid #f2b705; border-left: 12px solid #f2b705; margin: 1px 0% 0px; background-color: #f2e7c7; vertical-align: middle; color:#f2e7c7, box-shadow: 0px black;"
|-
| style="padding: 2px 0 2px 0.5em" | [[File:Achtung-yellow.svg|55px]]
| style="padding: 0.25em 0.5em; width: 100%;" | <big>'''The LTET Wiki is currently under construction, and this main page is not completed yet.'''</big>
The main page and additional subpages will be added soon. It is expected to be completed by mid-January of 2024 alongside the launch of LTET. Thank you for your patience and apologies for the inconvenience!
|}
<!-- page background starts -->
<div style="background:#ffffff; position:relative; margin:1.2em; z-index:1; margin-bottom:0px; margin-left:-12px; margin-right:-13px; padding-top:10px; padding-right:13px; padding-left:13px;">
<div style="margin:5px 0; border:1; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); background:white; width:100%; overflow:hidden;background: #FCFCFC; background: linear-gradient(top, #FCFCFC 0%,#F5F5F5 100%); background: -moz-linear-gradient(top, #FCFCFC 0%, #f2e1e1 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#FCFCFC), color-stop(100%,#f2e1e1)); background: -webkit-linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); background: -o-linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); background: -ms-linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); background: linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); position:relative;">
<!-- page background ends -->
<!-- main page title -->
<div style="text-align: center;">
<span style="font-family: berlin sans fb;font-size: 35px">'''Welcome to the LTET 4.0 Wiki!''' </span>
<br/>
<span style="font-family: berlin sans fb;font-size: 25px"> A Let's Talk Elections Tournament Project
</div>
<!-- main page title ends -->
{| style="width: 100%; background: transparent; border-spacing: 0; table-layout: fixed;"
|- style="vertical-align: top;"
| style="width: 65%; padding-right: 10px;" |
<div style="margin-bottom:15px; font-size:90%; padding:0px 20px; overflow:hidden; position:relative;">
</div>
<div style="border:1px solid #EEE; margin-bottom:20px; padding:10px 20px; overflow:hidden; position:relative; box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.1); background:#FBFBF9;">
'''Let's Talk Elections Tournament''' is a Discord based political simulation in its 4th iteration. Players roleplay as fictional politicians in a dynamic alternate timeline through electoral campaigns, governing on both the state and federal level, and dealing with the political questions of the day. The current iteration of the simulation starts in the year 1965 and launches in mid-January 2024.
<br/>
<br/>
This wikipedia will provide everything you will need to know from election results, passed legislation, and important events that you may need to know. Players will also be able to create their own character pages, granted they follow Wikipedia's existing <span class="plainlinks">[https://simple.wikipedia.org/wiki/Wikipedia:Neutral_point_of_view neutral point of view</span>]</span> and <span class="plainlinks">[https://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style manual of style</span>]</span> policies.
'''You can join our discord <span class="plainlinks">[https://discord.gg/2yHwu9JXKz here</span>]</span>.'''
</table>
</div>
|}
78c0be30ccad9bfe62fe5270bec96b85ba2ff225
6
3
2023-12-23T01:17:52Z
Floopymichael
2
Setting up foundations for rest of main page. Not yet completed (formatting still broken)
wikitext
text/x-wiki
__NOTOC__ __NOEDITSECTION__
{| style="border: 2px solid #f2b705; border-left: 12px solid #f2b705; margin: 1px 0% 0px; background-color: #f2e7c7; vertical-align: middle; color:#f2e7c7, box-shadow: 0px black;"
|-
| style="padding: 2px 0 2px 0.5em" | [[File:Achtung-yellow.svg|55px]]
| style="padding: 0.25em 0.5em; width: 100%;" | <big>'''The LTET Wiki is currently under construction, and this main page is not completed yet.'''</big>
The main page and additional subpages will be added soon. It is expected to be completed by mid-January of 2024 alongside the launch of LTET. Thank you for your patience and apologies for the inconvenience!
|}
<!-- page background starts -->
<div style="background:#ffffff; position:relative; margin:1.2em; z-index:1; margin-bottom:0px; margin-left:-12px; margin-right:-13px; padding-top:10px; padding-right:13px; padding-left:13px;">
<div style="margin:5px 0; border:1; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); background:white; width:100%; overflow:hidden;background: #FCFCFC; background: linear-gradient(top, #FCFCFC 0%,#F5F5F5 100%); background: -moz-linear-gradient(top, #FCFCFC 0%, #f2e1e1 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#FCFCFC), color-stop(100%,#f2e1e1)); background: -webkit-linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); background: -o-linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); background: -ms-linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); background: linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); position:relative;">
<!-- page background ends -->
<!-- main page title -->
<div style="text-align: center;">
<span style="font-family: berlin sans fb;font-size: 35px">'''Welcome to the LTET 4.0 Wiki!''' </span>
<br/>
<span style="font-family: berlin sans fb;font-size: 25px"> A Let's Talk Elections Tournament Project
</div>
<!-- main page title ends -->
{| style="width: 100%; background: transparent; border-spacing: 0; table-layout: fixed;"
|- style="vertical-align: top;"
| style="width: 65%; padding-right: 10px;" |
<div style="margin-bottom:15px; font-size:90%; padding:0px 20px; overflow:hidden; position:relative;">
</div>
<div style="border:1px solid #EEE; margin-bottom:20px; padding:10px 20px; overflow:hidden; position:relative; box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.1); background:#FBFBF9;">
'''Let's Talk Elections Tournament''' is a Discord based political simulation in its 4th iteration. Players roleplay as fictional politicians in a dynamic alternate timeline through electoral campaigns, governing on both the state and federal level, and dealing with the political questions of the day. The current iteration of the simulation starts in the year 1965 and launches in mid-January 2024.
<br/>
<br/>
This wikipedia will provide everything you will need to know from election results, passed legislation, and important events that you may need to know. Players will also be able to create their own character pages, granted they follow Wikipedia's existing <span class="plainlinks">[https://simple.wikipedia.org/wiki/Wikipedia:Neutral_point_of_view neutral point of view</span>]</span> and <span class="plainlinks">[https://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style manual of style</span>]</span> policies.
'''You can join our discord <span class="plainlinks">[https://discord.gg/2yHwu9JXKz here</span>]</span>.'''
</table>
</div>
[[File: 1965 House of Representatives Partisan Control.svg|300px|thumb|left|<span style="color:#0074EF">'''151''' Democrats</span> and <span style="color:#EF0034">'''58''' Republicans</span> <br/> The House of Representatives, 1965]]
[[File: 1965 Senate Partisan Control.svg|300px|thumb|right|<span style="color:#0074EF">'''34''' Democrats</span> and <span style="color:#EF0034">'''16''' Republicans</span> <br/> The Senate, 1965]]
[[File: LBJ Swearing in 1965.jpg|300px|thumb|center| President Lyndon Baines Johnson (<span style="color:#0074EF">'''D'''</span>), alongside Vice President Hubert Humphrey (<span style="color:#0074EF">'''D'''</span>) and Chief Justice Earl Warren]]
8ae31bd4ca4a39296c02564d7a2fbeb1b55c9adc
7
6
2023-12-23T01:40:28Z
Floopymichael
2
wikitext
text/x-wiki
__NOTOC__ __NOEDITSECTION__
{| style="border: 2px solid #f2b705; border-left: 12px solid #f2b705; margin: 1px 0% 0px; background-color: #f2e7c7; vertical-align: middle; color:#f2e7c7, box-shadow: 0px black;"
|-
| style="padding: 2px 0 2px 0.5em" | [[File:Achtung-yellow.svg|55px]]
| style="padding: 0.25em 0.5em; width: 100%;" | <big>'''The LTET Wiki is currently under construction, and this main page is not completed yet.'''</big>
The main page and additional subpages will be added soon. It is expected to be completed by mid-January of 2024 alongside the launch of LTET. Thank you for your patience and apologies for the inconvenience!
|}
<!-- page background starts -->
<div style="background:#ffffff; position:relative; margin:1.2em; z-index:1; margin-bottom:0px; margin-left:-12px; margin-right:-13px; padding-top:10px; padding-right:13px; padding-left:13px;">
<div style="margin:5px 0; border:1; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); background:white; width:100%; overflow:hidden;background: #FCFCFC; background: linear-gradient(top, #FCFCFC 0%,#F5F5F5 100%); background: -moz-linear-gradient(top, #FCFCFC 0%, #f2e1e1 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#FCFCFC), color-stop(100%,#f2e1e1)); background: -webkit-linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); background: -o-linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); background: -ms-linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); background: linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); position:relative;">
<!-- page background ends -->
<!-- main page title -->
<div style="text-align: center;">
<span style="font-family: berlin sans fb;font-size: 35px">'''Welcome to the LTET 4.0 Wiki!''' </span>
<br/>
<span style="font-family: berlin sans fb;font-size: 25px"> A Let's Talk Elections Tournament Project
</div>
<!-- main page title ends -->
{| style="width: 100%; background: transparent; border-spacing: 0; table-layout: fixed;"
|- style="vertical-align: top;"
| style="width: 65%; padding-right: 10px;" |
<div style="margin-bottom:15px; font-size:90%; padding:0px 20px; overflow:hidden; position:relative;">
</div>
<div style="border:1px solid #EEE; margin-bottom:20px; padding:10px 20px; overflow:hidden; position:relative; box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.1); background:#FBFBF9;">
'''Let's Talk Elections Tournament''' is a Discord based political simulation in its 4th iteration. Players roleplay as fictional politicians in a dynamic alternate timeline through electoral campaigns, governing on both the state and federal level, and dealing with the political questions of the day. The current iteration of the simulation starts in the year 1965 and launches in mid-January 2024.
<br/>
<br/>
This wikipedia will provide everything you will need to know from election results, passed legislation, and important events that you may need to know. Players will also be able to create their own character pages, granted they follow Wikipedia's existing <span class="plainlinks">[https://simple.wikipedia.org/wiki/Wikipedia:Neutral_point_of_view neutral point of view</span>]</span> and <span class="plainlinks">[https://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style manual of style</span>]</span> policies.
'''You can join our discord <span class="plainlinks">[https://discord.gg/2yHwu9JXKz here</span>]</span>.'''
</table>
</div>
[[File: 1965 House of Representatives Partisan Control.svg|300px|thumb|left|<span style="color:#0074EF">'''151''' Democrats</span> and <span style="color:#EF0034">'''58''' Republicans</span> <br/> The House of Representatives, 1965]]
[[File: 1965 Senate Partisan Control.svg|300px|thumb|right|<span style="color:#0074EF">'''34''' Democrats</span> and <span style="color:#EF0034">'''16''' Republicans</span> <br/> The Senate, 1965]]
[[File: LBJ Swearing in 1965.jpg|250px|thumb|center| President Lyndon Baines Johnson (<span style="color:#0074EF">'''D'''</span>), alongside Vice President Hubert Humphrey (<span style="color:#0074EF">'''D'''</span>) and Chief Justice Earl Warren]]
8680d0000d6a943f7aeff8740991586d67ebe788
14
7
2023-12-23T02:36:46Z
Floopymichael
2
wikitext
text/x-wiki
__NOTOC__ __NOEDITSECTION__
{| style="border: 2px solid #f2b705; border-left: 12px solid #f2b705; margin: 1px 0% 0px; background-color: #f2e7c7; vertical-align: middle; color:#f2e7c7, box-shadow: 0px black;"
|-
| style="padding: 2px 0 2px 0.5em" | [[File:Achtung-yellow.svg|55px]]
| style="padding: 0.25em 0.5em; width: 100%;" | <big>'''The LTET Wiki is currently under construction, and this main page is not completed yet.'''</big>
The main page and additional subpages will be added soon. It is expected to be completed by mid-January of 2024 alongside the launch of LTET. Thank you for your patience and apologies for the inconvenience!
|}
<!-- page background starts -->
<div style="background:#ffffff; position:relative; margin:1.2em; z-index:1; margin-bottom:0px; margin-left:-12px; margin-right:-13px; padding-top:10px; padding-right:13px; padding-left:13px;">
<div style="margin:5px 0; border:1; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); background:white; width:100%; overflow:hidden;background: #FCFCFC; background: linear-gradient(top, #FCFCFC 0%,#F5F5F5 100%); background: -moz-linear-gradient(top, #FCFCFC 0%, #f2e1e1 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#FCFCFC), color-stop(100%,#f2e1e1)); background: -webkit-linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); background: -o-linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); background: -ms-linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); background: linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); position:relative;">
<!-- page background ends -->
<!-- main page title -->
<div style="text-align: center;">
<span style="font-family: berlin sans fb;font-size: 35px">'''Welcome to the LTET 4.0 Wiki!''' </span>
<br/>
<span style="font-family: berlin sans fb;font-size: 25px"> A Let's Talk Elections Tournament Project
</div>
<!-- main page title ends -->
{| style="width: 100%; background: transparent; border-spacing: 0; table-layout: fixed;"
|- style="vertical-align: top;"
| style="width: 65%; padding-right: 10px;" |
<div style="margin-bottom:15px; font-size:90%; padding:0px 20px; overflow:hidden; position:relative;">
</div>
<div style="border:1px solid #EEE; margin-bottom:20px; padding:10px 20px; overflow:hidden; position:relative; box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.1); background:#FBFBF9;">
'''Let's Talk Elections Tournament''' is a Discord based political simulation in its 4th iteration. Players roleplay as fictional politicians in a dynamic alternate timeline through electoral campaigns, governing on both the state and federal level, and dealing with the political questions of the day. The current iteration of the simulation starts in the year 1965 and launches in mid-January 2024.
<br/>
<br/>
This wikipedia will provide everything you will need to know from election results, passed legislation, and important events that you may need to know. Players will also be able to create their own character pages, granted they follow Wikipedia's existing <span class="plainlinks">[https://simple.wikipedia.org/wiki/Wikipedia:Neutral_point_of_view neutral point of view</span>]</span> and <span class="plainlinks">[https://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style manual of style</span>]</span> policies.
'''You can join our discord <span class="plainlinks">[https://discord.gg/2yHwu9JXKz here</span>]</span>.'''
</table>
</div>
<!-- Political Summary -->
= <span style="font-family: berlin sans fb;font-size: 25px">The Current Status of Washington, D.C. </span> =
[[File: 1965 House of Representatives Partisan Control.svg|300px|thumb|left|<span style="color:#0074EF">'''151''' Democrats</span> and <span style="color:#EF0034">'''58''' Republicans</span> <br/> The House of Representatives, 1965]]
[[File: 1965 Senate Partisan Control.svg|300px|thumb|right|<span style="color:#0074EF">'''34''' Democrats</span> and <span style="color:#EF0034">'''16''' Republicans</span> <br/> The Senate, 1965]]
[[File: Lyndon B. Johnson on the phone.jpg|250px|thumb|center| President Lyndon Baines Johnson (<span style="color:#0074EF">'''D'''</span>) on a phone call, 1965]]
<!-- Wiki Timeline -->
{| style="width: 45%; background: transparent; border-spacing: 0; table-layout: fixed;"
|- style="vertical-align: top;"
| style="width: 65%; padding-right: 10px;" |
<div style="margin-bottom:15px; font-size:90%; padding:0px 20px; overflow:hidden; position:relative;">
</div>
<div style="border:1px solid #EEE; margin-bottom:20px; padding:10px 20px; overflow:hidden; position:relative; box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.1); background:#FBFBF9;">
<span style="font-family: berlin sans fb;font-size: 20px">Wiki History </span>
* '''01/2024''': Anticipated launch of the LTET 4.0 simulation <br>
* '''12/22/2023''': Finishing touches on the wiki main page! <br>
* '''12/19/2023''': This wiki was created.
<span style="font-family: berlin sans fb;font-size: 20px">Important Information </span>
{| cellspacing="1" style="font-size:90%; color:#868686; text-align:left;"
|-
| [[File:number-one.png|20px]] [[Special:CreateAccount|Create a wiki account to start helping]] <br/>
|-
| [[File:black-number-2.png|20px]] <span class="plainlinks">[https://meta.miraheze.org/wiki/Content_Policy Content guidelines you need to know]</span> <br/>
|-
| [[File:black-number-3.png|20px]] [[Special:Upload|Upload files]] <br/> [[File:black-number-four.png|20px]] [[Special:AllPages|A list of all {{NUMBEROFARTICLES}} articles and counting]] <br/> [[File:black-number-5.png|20px]] [[Special:Categories|Articles by category]] <br/>
|}
</table>
</div>
45a496fc17041884c1b98e98b5bc09bba104ade1
15
14
2023-12-23T04:39:30Z
Floopymichael
2
wikitext
text/x-wiki
__NOTOC__ __NOEDITSECTION__
{| style="border: 2px solid #f2b705; border-left: 12px solid #f2b705; margin: 1px 0% 0px; background-color: #f2e7c7; vertical-align: middle; color:#f2e7c7, box-shadow: 0px black;"
|-
| style="padding: 2px 0 2px 0.5em" | [[File:Achtung-yellow.svg|55px]]
| style="padding: 0.25em 0.5em; width: 100%;" | <big>'''The LTET Wiki is currently under construction, and this main page is not completed yet.'''</big>
The main page and additional subpages will be added soon. It is expected to be completed by mid-January of 2024 alongside the launch of LTET. Thank you for your patience and apologies for the inconvenience!
|}
<!-- page background starts -->
<div style="background:#ffffff; position:relative; margin:1.2em; z-index:1; margin-bottom:0px; margin-left:-12px; margin-right:-13px; padding-top:10px; padding-right:13px; padding-left:13px;">
<div style="margin:5px 0; border:1; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); background:white; width:100%; overflow:hidden;background: #FCFCFC; background: linear-gradient(top, #FCFCFC 0%,#F5F5F5 100%); background: -moz-linear-gradient(top, #FCFCFC 0%, #f2e1e1 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#FCFCFC), color-stop(100%,#f2e1e1)); background: -webkit-linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); background: -o-linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); background: -ms-linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); background: linear-gradient(top, #FCFCFC 0%,#f2e1e1 100%); position:relative;">
<!-- page background ends -->
<!-- main page title -->
<div style="text-align: center;">
<span style="font-family: berlin sans fb;font-size: 35px">'''Welcome to the LTET 4.0 Wiki!''' </span>
<br/>
<span style="font-family: berlin sans fb;font-size: 25px"> A Let's Talk Elections Tournament Project
</div>
<!-- main page title ends -->
{| style="width: 100%; background: transparent; border-spacing: 0; table-layout: fixed;"
|- style="vertical-align: top;"
| style="width: 65%; padding-right: 10px;" |
<div style="margin-bottom:15px; font-size:90%; padding:0px 20px; overflow:hidden; position:relative;">
</div>
<div style="border:1px solid #EEE; margin-bottom:20px; padding:10px 20px; overflow:hidden; position:relative; box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.1); background:#FBFBF9;">
'''Let's Talk Elections Tournament''' is a Discord based political simulation in its 4th iteration. Players roleplay as fictional politicians in a dynamic alternate timeline through electoral campaigns, governing on both the state and federal level, and dealing with the political questions of the day. The current iteration of the simulation starts in the year 1965 and launches in mid-January 2024.
<br/>
<br/>
This wikipedia will provide everything you will need to know from election results, passed legislation, and important events that you may need to know. Players will also be able to create their own character pages, granted they follow Wikipedia's existing <span class="plainlinks">[https://simple.wikipedia.org/wiki/Wikipedia:Neutral_point_of_view neutral point of view</span>]</span> and <span class="plainlinks">[https://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style manual of style</span>]</span> policies.
'''You can join our discord <span class="plainlinks">[https://discord.gg/2yHwu9JXKz here</span>]</span>.'''
</table>
</div>
<!-- Political Summary -->
= <span style="font-family: berlin sans fb;font-size: 25px">The Current Status of Washington, D.C. </span> =
[[File: 1965 House of Representatives Partisan Control.svg|300px|thumb|left|<span style="color:#0074EF">'''151''' Democrats</span> and <span style="color:#EF0034">'''58''' Republicans</span> <br/> The House of Representatives, 1965]]
[[File: 1965 Senate Partisan Control.svg|300px|thumb|right|<span style="color:#0074EF">'''34''' Democrats</span> and <span style="color:#EF0034">'''16''' Republicans</span> <br/> The Senate, 1965]]
[[File: Lyndon B. Johnson on the phone.jpg|250px|thumb|center| President Lyndon Baines Johnson (<span style="color:#0074EF">'''D'''</span>) on a phone call, 1965]]
<!-- Wiki Timeline -->
{| style="width: 95%; background: transparent; border-spacing: 0; table-layout: fixed;"
|- style="vertical-align: top;"
| style="width: 65%; padding-right: 10px;" |
<div style="margin-bottom:15px; font-size:90%; padding:0px 20px; overflow:hidden; position:relative;">
</div>
<div style="border:1px solid #EEE; margin-bottom:20px; padding:10px 20px; overflow:hidden; position:relative; box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.1); background:#FBFBF9;">
<span style="font-family: berlin sans fb;font-size: 20px">Wiki History </span>
* '''01/2024''': Anticipated launch of the LTET 4.0 simulation <br>
* '''12/22/2023''': Finishing touches on the wiki main page! <br>
* '''12/19/2023''': This wiki was created.
<span style="font-family: berlin sans fb;font-size: 20px">Important Information </span>
{| cellspacing="1" style="font-size:90%; color:#868686; text-align:left;"
|-
| [[File:number-one.png|20px]] [[Special:CreateAccount|Create a wiki account to start helping]] <br/>
|-
| [[File:black-number-2.png|20px]] <span class="plainlinks">[https://meta.miraheze.org/wiki/Content_Policy Content guidelines you need to know]</span> <br/>
|-
| [[File:black-number-3.png|20px]] [[Special:Upload|Upload files]] <br/> [[File:black-number-four.png|20px]] [[Special:AllPages|A list of all {{NUMBEROFARTICLES}} articles and counting]] <br/> [[File:black-number-5.png|20px]] [[Special:Categories|Articles by category]] <br/>
</div>
</table>
<span style="font-family: berlin sans fb;font-size: 20px">This Week's News </span> <br/>
The most important or interesting events in sim for the past week will be placed here. For now, this placeholder will have to do just fine!
|}
5eb84530cc30e06046d29d5924b2170c0bb26a68
Module:Disambiguation/templates
828
71
135
2023-12-20T09:39:21Z
wikipedia>MSGJ
0
+["Dab page"]
Scribunto
text/plain
-- This page contains a table of all disambiguation templates and their
-- redirects. Templates names are capitalized, and the Template: prefix is
-- removed. Templates are grouped with the main template first, followed by
-- its redirects.
return {
["Disambiguation"] = true,
["Begriffsklärung"] = true,
["DAB"] = true,
["Dab"] = true,
["Dab page"] = true,
["Dabpage"] = true,
["Dbig"] = true,
["Dis"] = true,
["Disam"] = true,
["Disamb"] = true,
["Disambig"] = true,
["Disambig misspelling"] = true,
["Disambig-plants"] = true,
["Disambiguation page"] = true,
["Meta disambig"] = true,
["Project disambiguation"] = true,
["Shortcut disambig"] = true,
["WP disambig"] = true,
["WP-disambig"] = true,
["Wikipedia disambiguation"] = true,
["Airport disambiguation"] = true,
["Airport disambig"] = true,
["Biology disambiguation"] = true,
["Call sign disambiguation"] = true,
["Callsigndis"] = true,
["Caselaw disambiguation"] = true,
["Case law disambiguation"] = true,
["Chinese title disambiguation"] = true,
["CJKVdab"] = true,
["Chinese title disambig"] = true,
["Disambig-Chinese-char-title"] = true,
["Disambiguation cleanup"] = true,
["Cleanup disambig"] = true,
["Cleanup disambiguation"] = true,
["CleanupDisambig"] = true,
["Dab cleanup"] = true,
["Dab-cleanup"] = true,
["Dabclean"] = true,
["Disamb-cleanup"] = true,
["Disambcleanup"] = true,
["Disambig cleanup"] = true,
["Disambig-CU"] = true,
["Disambig-cleanup"] = true,
["Disambig-cu"] = true,
["Disambigcleanup"] = true,
["Disambiguate-cleanup"] = true,
["Disambiguation-cleanup"] = true,
["Geodis-cleanup"] = true,
["Genus disambiguation"] = true,
["Genus disambig"] = true,
["Hangul title disambiguation"] = true,
["Hospital disambiguation"] = true,
["Hospitaldis"] = true,
["Human name disambiguation"] = true,
["Bio-dab"] = true,
["HNDIS"] = true,
["HnDis"] = true,
["Hndab"] = true,
["Hndis"] = true,
["Hndisambig"] = true,
["Human name dab"] = true,
["Personal name"] = true,
["Personal name disambiguation"] = true,
["Human name disambiguation cleanup"] = true,
["Hndis-cleanup"] = true,
["Personal name disambiguation cleanup"] = true,
["Hurricane season disambiguation"] = true,
["Letter–number combination disambiguation"] = true,
["LNCD"] = true,
["Letter-Number Combination Disambiguation"] = true,
["Letter-Number combination disambiguation"] = true,
["Letter-NumberCombDisambig"] = true,
["Letter-NumberCombdisambig"] = true,
["Letter-NumberCombinationDisambiguation"] = true,
["Letter-number combination disambiguation"] = true,
["Mathematical disambiguation"] = true,
["Math dab"] = true,
["Math disambiguation"] = true,
["Mathdab"] = true,
["Mathematics disambiguation"] = true,
["Maths disambiguation"] = true,
["Military unit disambiguation"] = true,
["Mil-unit-dis"] = true,
["Mil-unit-disambig"] = true,
["Music disambiguation"] = true,
["Music disambig"] = true,
["Number disambiguation"] = true,
["Numberdis"] = true,
["Numdab"] = true,
["Numdisambig"] = true,
["Opus number disambiguation"] = true,
["Phonetics disambiguation"] = true,
["Place name disambiguation"] = true,
["DisambigG"] = true,
["DisambigGeo"] = true,
["Disambiggeo"] = true,
["Geo-dis"] = true,
["Geodab"] = true,
["Geodis"] = true,
["Geodisambig"] = true,
["Geographic disambiguation"] = true,
["Portal disambiguation"] = true,
["Portal disambig"] = true,
["Road disambiguation"] = true,
["Roaddis"] = true,
["School disambiguation"] = true,
["School disambig"] = true,
["Schooldab"] = true,
["Schooldis"] = true,
["Species Latin name abbreviation disambiguation"] = true,
["Species Latin name disambiguation"] = true,
["LatinNameDisambig"] = true,
["SpeciesLatinNameDisambig"] = true,
["Station disambiguation"] = true,
["Station dab"] = true,
["Synagogue disambiguation"] = true,
["Taxonomic authority disambiguation"] = true,
["Taxonomic authorities disambiguation"] = true,
["Taxonomy disambiguation"] = true,
["Species disambiguation"] = true,
["Template disambiguation"] = true,
["Template ambiguous"] = true,
["Template dab"] = true,
["Template disambig"] = true,
["WoO number disambiguation"] = true,
}
80e83cb6d90e1e23e1810373e244a1c6f917fac0
Module:Political party/M
828
243
478
2023-12-21T21:44:34Z
wikipedia>Number 57
0
+
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["Macau Business Int"] = "Macau Union of Employers Interests",
["Macau Business Interest Union"] = "Macau Union of Employers Interests",
["Macau professional Interest Union"] = "Macau Union of Professional Interests",
["Madhya Pradesh Congress Committee"] = "Indian National Congress",
["Madrilenian Socialist Federation"] = "Spanish Socialist Workers' Party",
["Magdalo para sa Pilipino"] = "Magdalo Party-List",
["Maghrebin Liberal Party"] = "Maghrebi Republican Party",
["Majorité pour l'autre Europe"] = "Movement for France",
["Makabayang Koalisyon ng Mamamayan"] = "Makabayan",
["Makkal Manadu Katchi"] = "Tamizhaga Murpokku Makkal Katchi",
["Malaysia United People's Party"] = "Malaysian United People's Party",
["Malaysian Workers Party"] = "National Trust Party (Malaysia)",
["Mana Motuhake (political party)"] = "Mana Motuhake",
["Mana Party (New Zealand)"] = "Mana Movement",
["Manipur People's Party"] = "Manipur Peoples Party",
["Maori Party"] = "Te Pāti Māori",
["Māori Party"] = "Te Pāti Māori",
["Marek Hilšer"] = "Marek Hilšer to Senate",
["Marijuana Party (United States)"] = "Marijuana Party (US)",
["Marxist-Leninist Party of Germany"] = "Marxist–Leninist Party of Germany",
["Maryland Democratic Party"] = "Democratic Party (United States)",
["Maryland Green Party"] = "Green Party (US)",
["Maryland Republican Party"] = "Republican Party (United States)",
["Massachusetts Democratic Party"] = "Democratic Party (United States)",
["Maurist Conservatives"] = "Maurist Party",
["Meghalaya Democratic Alliance"] = "Meghalaya Democratic Alliance (2018)",
["MEMO"] = "Solution Movement",
["MFG – Austria People – Freedom – Fundamental Rights"] = "MFG Austria – People Freedom Fundamental Rights",
["Mouvement Militant Mauricien"] = "Mauritian Militant Movement",
["Mauritian Social Democrat Party"] = "Parti Mauricien Social-Démocrate",
["Mexican Laborist Party"] = "Laborist Party (Mexico)",
["Michigan Democratic Party"] = "Democratic Party (United States)",
["Michigan Republican Party"] = "Republican Party (United States)",
["Milan Bandić 365 - The Party of Labour and Solidarity"] = "Bandić Milan 365 – Labour and Solidarity Party",
["Mouvement Socialiste Militant"] = "Militant Socialist Movement",
["Military Rule"] = "Military rule",
["Military"] = "Military rule",
["Mineiro Republican Party"] = "Minas Republican Party",
["Minjoo Party of Korea"] = "Democratic Party of Korea",
["Minnesota Democratic Party"] = "Democratic Party (United States)",
["Minnesota Democratic-Farmer-Labor Party"] = "Minnesota Democratic–Farmer–Labor Party",
["Minnesota Progressive Party"] = "Progressive Party (US)",
["Miscellaneous far left"] = "Far-left",
["Miscellaneous far right"] = "Far-right",
["Miscellaneous Left"] = "Miscellaneous left",
["Miscellaneous Right"] = "Miscellaneous right",
["Missouri Democratic Party"] = "Democratic Party (United States)",
["Missouri Republican Party"] = "Republican Party (United States)",
["MMA"] = "Muttahida Majlis-e-Amal",
["MN"] = "German Minority Electoral Committee",
["Mochrena"] = "Christian Movement for a New Haiti",
["Moderate (Estonia)"] = "Social Democratic Party (Estonia)",
["Moderate Party (Rhode Island)"] = "Moderate Party of Rhode Island",
["Moderate People's Party"] = "Social Democratic Party (Estonia)",
["Moderates (Estonia)"] = "Social Democratic Party (Estonia)",
["Modern"] = "Modern (political party)",
["Mongolian People's Revolutionary Party (old)"] = "Mongolian People's Party",
["Mongolian People's Revolutionary Party"] = "Mongolian People's Party",
["Mongolian Traditionally United Party"] = "Mongolian Traditional United Party",
["Montana Democratic Party"] = "Democratic Party (United States)",
["Montana Republican Party"] = "Republican Party (United States)",
["Montana Libertarian Party"] = "Libertarian Party (US)",
["Moramo (political coalition)"] = "We Must (Serbia)",
["Morena"] = "Morena (political party)",
["Morley Borough Independent"] = "Morley Borough Independents",
["Most-Híd"] = "Most–Híd",
["Motherland (Latvia)"] = "New Harmony (Latvia)",
["Motherland People's Party"] = "Sinhalaye Mahasammatha Bhoomiputra Pakshaya",
["Mouvement Réformateur"] = "Reformist Movement",
["Mouvement Rodriguais"] = "Rodrigues Movement",
["Movement for a People's Party"] = "People's Party (US, 2017)",
["Movement for Autonomies"] = "Movement for Autonomy",
["Movement for Change"] = "Gorran Movement",
["Movement for Democratic Change - Tsvangirai"] = "Movement for Democratic Change – Tsvangirai",
["Movement for Democratic Change (pre-2005)"] = "Movement for Democratic Change (1999–2005)",
["Movement for Democratic Change-Tsvangirai"] = "Movement for Democratic Change – Tsvangirai",
["Movement for Justice"] = "Pakistan Tehreek-e-Insaf",
["Movement for Liberty - European Georgia"] = "European Georgia — Movement for Liberty",
["Movement for Multiparty Democracy"] = "Movement for Multi-Party Democracy",
["Movement for the Development of Mayotte"] = "Miscellaneous right",
["Movement for the Future"] = "Movement for the Future of Curaçao",
["Movement for the Liberation of São Tomé and Príncipe/Social Democratic Party"] = "Movement for the Liberation of São Tomé and Príncipe – Social Democratic Party",
["Movement of Citizens"] = "Citizen and Republican Movement",
["Movement of Democratic Socialists (Greece)"] = "Movement of Democratic Socialists",
["Movement of Ecologists - Citizens' Cooperation"] = "Movement of Ecologists – Citizens' Cooperation",
["Movement of Ecologists — Citizens' Cooperation"] = "Movement of Ecologists – Citizens' Cooperation", -- em dash
["Movement of Radicals of the Left"] = "Radical Party of the Left",
["Movementu 21"] = "Movement 21 (Bonaire)",
["Murcian Socialist Federation"] = "Spanish Socialist Workers' Party",
["Muslim League (Opposition)"] = "All-India Muslim League",
["Muslim National Unity Alliance"] = "National Unity Alliance",
["Muttahida Qaumi Movement-Pakistan"] = "Muttahida Qaumi Movement – Pakistan",
["Muttahida Qaumi Movement–Pakistan"] = "Muttahida Qaumi Movement – Pakistan", -- dash difference
}
local full = {
["M10 (political party)"] = {abbrev = "", color = "#232575", shortname = "",},
["Macao Civic Power"] = {abbrev = "", color = "#FF007F", shortname = "Cívico",},
["Macau Union of Employers Interests"] = {abbrev = "", color = "#EDC2FD", shortname = "",},
["Macau Union of Medical Professional Interests"] = {abbrev = "", color = "#2CADC7", shortname = "",},
["Macau Union of Professional Interests"] = {abbrev = "", color = "#FBCBC7", shortname = "",},
["Macau United Citizens Association"] = {abbrev = "ACUM", color = "#DC143C", shortname = "",},
["Macau-Guangdong Union"] = {abbrev = "UGM", color = "#ED6C10", shortname = "",},
["Macedonian Alliance for European Integration"] = {abbrev = "", color = "red", shortname = "",},
["Machrouu Tounes"] = {abbrev = "", color = "#000000", shortname = "",},
["Madem G15"] = {abbrev = "", color = "#01A35A", shortname = "",},
["Madheshi Jana Adhikar Forum, Nepal"] = {abbrev = "MJF-N", color = "orangered", shortname = "",},
["Madheshi Jana Adhikar Forum, Nepal (Loktantrik)"] = {abbrev = "MJAF(L)", color = "lightgreen", shortname = "",},
["Madrid En Pie"] = {abbrev = "", color = "#86073A", shortname = "",},
["Madrilenian Independent Regional Party"] = {abbrev = "", color = "#FA641B", shortname = "",},
["Maendeleo Chap Chap Party"] = {abbrev = "MCC", color = "#632F91", shortname = "",},
["Maendeleo Democratic Party"] = {abbrev = "MDP", color = "#03F601", shortname = "",},
["Magdalo Party-List"] = {abbrev = "", color = "#DC143C", shortname = "Magdalo",},
["Maghrebi Republican Party"] = {abbrev = "", color = "#2B5D29", shortname = "",},
["Magtymguly Youth Organisation of Turkmenistan"] = {abbrev = "TMÃ G", color = "#367A00", shortname = "",},
["Magyar Party (Romania)"] = {abbrev = "PM", color = "#2e502d", shortname = "",},
["Maha Vikas Aghadi"] = {abbrev = "MVA", color = "#1C89B7", shortname = "",},
["Mahachon Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Mahagathbandhan (Bihar)"] = {abbrev = "MGB", color = "#1E6914", shortname = "",},
["Mahagujarat Janta Party"] = {abbrev = "MJP", color = "#FFFFF5", shortname = "",},
["Mahajana Eksath Peramuna (1956)"] = {abbrev = "MEP", color = "#0000FF", shortname = "Mahajana Eksath Peramuna",},
["Mahajana Eksath Peramuna"] = {abbrev = "MEP", color = "#FF0000", shortname = "",},
["Mahajana Socialist Party"] = {abbrev = "", color = "blue", shortname = "",},
["Mahajot (Assam)"] = {abbrev = "UOF", color = "#52FFCC", shortname = "",},
["Mahan Dal"] = {abbrev = "MD", color = "#330066", shortname = "",},
["Maharashtra Ekikaran Samiti"] = {abbrev = "MES", color = "#FF9933", shortname = "",},
["Maharashtra Navnirman Sena"] = {abbrev = "MNS", color = "#5F2301", shortname = "",},
["Maharashtra Parivartan Sena (T)"] = {abbrev = "", color = "#FF9933", shortname = "",},
["Maharashtra Rajiv Congress"] = {abbrev = "", color = "#9966CC", shortname = "",},
["Maharashtra Swabhiman Paksha"] = {abbrev = "MSHP", color = "#FFA500", shortname = "",},
["Maharashtrawadi Gomantak Party"] = {abbrev = "MGP", color = "#AF7050", shortname = "",},
["Maharlika People's Party"] = {abbrev = "MPP", color = "#000040", shortname = "",},
["Máis Galiza"] = {abbrev = "", color = "#2F9A26", shortname = "",},
["Majadahonda Centrists"] = {abbrev = "", color = "#146F4C", shortname = "",},
["Majd Movement"] = {abbrev = "", color = "#00529F", shortname = "",},
["Majdoor Kisan Union Party"] = {abbrev = "MKUP", color = "#81BEF7", shortname = "",},
["Majlis Bachao Tahreek"] = {abbrev = "", color = "#9900CC", shortname = "",},
["Majlis Wahdat-e-Muslimeen"] = {abbrev = "MWM", color = "#008000", shortname = "",},
["Majorcan Union"] = {abbrev = "UM", color = "#333583", shortname = "",},
["Majorera Assembly"] = {abbrev = "AM", color = "#284BAF", shortname = "",},
["Majorero Progressive Party"] = {abbrev = "", color = "#3C6C06", shortname = "",},
["Makabayan"] = {abbrev = "", color = "#29176E", shortname = "",},
["Makatizens United Party"] = {abbrev = "MKTZNU", color = "#1F51FF", shortname = "",},
["Make Politicians History"] = {abbrev = "", color = "#FFC0CB", shortname = "",},
["Maki (historical political party)"] = {abbrev = "", color = "#FF524D", shortname = "Maki",},
["Maki (political party)"] = {abbrev = "", color = "#cb1a1d", shortname = "Maki",},
["Makkal Needhi Maiam"] = {abbrev = "MNM", color = "#900C3F", shortname = "",},
["Makkal Sevai Katchi"] = {abbrev = "", color = "#006060", shortname = "",},
["Makkal Tamil Desam Katchi"] = {abbrev = "MTD", color = "#006060", shortname = "",},
["Málaga Ahora"] = {abbrev = "", color = "#3EA9A7", shortname = "",},
["Málaga for Yes"] = {abbrev = "", color = "#0087BF", shortname = "",},
["Malagasy Revolutionary Party"] = {abbrev = "AREMA", color = "#BB0102", shortname = "",},
["Malawi Congress Party"] = {abbrev = "MCP", color = "#FF0000", shortname = "",},
["Malayan Chinese Association"] = {abbrev = "MCA", color = "#EFCC00", shortname = "",},
["Malayan Party"] = {abbrev = "", color = "black", shortname = "",},
["Malayan Peoples' Socialist Front"] = {abbrev = "", color = "#C00000", shortname = "Socialist Front",},
["Malayang Kilusan ng Mamamayang Zambaleño"] = {abbrev = "", color = "#3344FF", shortname = "MAKIMAZA",},
["Malaysia Makkal Sakti Party"] = {abbrev = "MMSP", color = "orange", shortname = "",},
["Malaysia National Alliance Party"] = {abbrev = "", color = "#CD2122", shortname = "",},
["Malaysian Chinese Association"] = {abbrev = "MCA", color = "#102a7e", shortname = "",},
["Malaysian Democratic Party"] = {abbrev = "MDP", color = "#0000FF", shortname = "",},
["Malaysian Indian Congress"] = {abbrev = "MIC", color = "#00A988", shortname = "",},
["Malaysian Indian Muslim Congress"] = {abbrev = "", color = "#FFCC00", shortname = "",},
["Malaysian Indian United Party"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Malaysian Islamic Party"] = {abbrev = "", color = "#009000", shortname = "",},
["Malaysian Nationalist Party"] = {abbrev = "NASMA", color = "", shortname = "",},
["Malaysian Social Justice Party"] = {abbrev = "PEKEMAS", color = "#C00000", shortname = "",},
["Malaysian United Democratic Alliance"] = {abbrev = "MUDA", color = "#000000", shortname = "",},
["Malaysian United Indigenous Party"] = {abbrev = "", color = "#E62020", shortname = "",},
["Malaysian United Party"] = {abbrev = "", color = "#F617D4", shortname = "",},
["Malaysian United People's Party"] = {abbrev = "MUPP", color = "#F2D8D8", shortname = "",},
["Maldives Development Alliance"] = {abbrev = "MDA", color = "#DB5702", shortname = "",},
["Maldivian Democratic Party"] = {abbrev = "MDP", color = "#ffcc33", shortname = "",},
["Maldon and District Independent Democratic Alliance"] = {abbrev = "MDIDA", color = "MediumOrchid", shortname = "",},
["Maldon District Independent Group"] = {abbrev = "MDIG", color = "#985FF0", shortname = "Maldon Independents",},
["Malian Union for the African Democratic Rally"] = {abbrev = "", color = "#000000", shortname = "",},
["Malta Workers Party"] = {abbrev = "", color = "#B87333", shortname = "Workers",},
["Maltese Political Union"] = {abbrev = "", color = "#00AD06", shortname = "",},
["Mana Māori Movement"] = {abbrev = "", color = "#964B00", shortname = "Mana Māori",},
["Mana Motuhake"] = {abbrev = "", color = "#C32148", shortname = "",},
["Mana Movement"] = {abbrev = "", color = "#770808", shortname = "Mana",},
["Mana Party"] = {abbrev = "", color = "#7C0808", shortname = "",},
["Mana Wahine Te Ira Tangata"] = {abbrev = "", color = "#964B00", shortname = "Mana Wahine",},
["Manav Kalyan Sangh Dal"] = {abbrev = "MKSD", color = "#333300", shortname = "",},
["Manav Samaj Party"] = {abbrev = "MSP", color = "#F2F2F2", shortname = "",},
["Manchegan Regionalist Party"] = {abbrev = "", color = "#DC143C", shortname = "",},
["Manipur Hills Union"] = {abbrev = "", color = "#400080", shortname = "",},
["Manipur Peoples Party"] = {abbrev = "MPP", color = "#99CC99", shortname = "",},
["Manipur State Congress Party"] = {abbrev = "MSCP", color = "#99CC99", shortname = "",},
["Manithaneya Makkal Katchi"] = {abbrev = "MNMK", color = "lime", shortname = "",},
["Manko Taxawu Sénégal"] = {abbrev = "MTS", color = "#FF8040", shortname = "",},
["Mansfield Independent Forum"] = {abbrev = "MIF", color = "#DDDDDD", shortname = "Mansfield Independent",},
["Mantra Bhakta Party"] = {abbrev = "MBP", color = "#FAAC58", shortname = "",},
["Manx Labour Party"] = {abbrev = "", color = "#DC241f", shortname = "Manx Labour",},
["Mapai"] = {abbrev = "", color = "#AD0101", shortname = "",},
["Mapam"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Marada Movement"] = {abbrev = "", color = "#02CB00", shortname = "",},
["Maraland Democratic Front"] = {abbrev = "", color = "#FF8822", shortname = "",},
["March 14 Alliance"] = {abbrev = "M14th", color = "#d61a21", shortname = "M14th",},
["March 26 Movement"] = {abbrev = "", color = "#E34234", shortname = "",},
["March 8 Alliance"] = {abbrev = "44263", color = "#FF6000", shortname = "",},
["Marcus Garvey People's Political Party"] = {abbrev = "MGPPP", color = "black", shortname = "",},
["Marea Ártabra"] = {abbrev = "", color = "#009AA5", shortname = "",},
["Marea Atlántica"] = {abbrev = "", color = "#009FE3", shortname = "",},
["Marea de Ferrol"] = {abbrev = "", color = "#4EA602", shortname = "",},
["Marea de Vigo"] = {abbrev = "", color = "#C53374", shortname = "",},
["Marea Galeguista"] = {abbrev = "", color = "#205C78", shortname = "",},
["Marea Pontevedra"] = {abbrev = "", color = "#0085BE", shortname = "",},
["Marematlou Freedom Party"] = {abbrev = "MFP", color = "#1bb5a4", shortname = "",},
["Marek Hilšer to Senate"] = {abbrev = "MHS", color = "#87CEFA", shortname = "",},
["Marijuana Party (US)"] = {abbrev = "", color = "#50C878", shortname = "Marijuana",},
["Marijuana Party"] = {abbrev = "", color = "#50C878", shortname = "",},
["Marijuana Reform Party"] = {abbrev = "", color = "#50C878", shortname = "Marijuana Reform",},
["Martinican Communist Party"] = {abbrev = "", color = "#DD0000", shortname = "",},
["Martinican Democratic Rally"] = {abbrev = "RDM", color = "#FFD1DC", shortname = "",},
["Martinican Independence Movement"] = {abbrev = "MIM", color = "#d53736", shortname = "",},
["Martinican Progressive Party"] = {abbrev = "PPM", color = "#ef4836", shortname = "",},
["Martinican Regionalist Party"] = {abbrev = "", color = "#FFCC33", shortname = "",},
["Martists"] = {abbrev = "", color = "#5BAF50", shortname = "Martist",},
["Marumalarchi Dravida Munnetra Kazhagam"] = {abbrev = "MDMK", color = "#FC0000", shortname = "",},
["Marxist Co-ordination Committee"] = {abbrev = "MCC", color = "#c24e4e", shortname = "",},
["Marxist Co-Ordination"] = {abbrev = "", color = "#B22222", shortname = "",},
["Marxist Communist Party of India (S.S. Srivastava)"] = {abbrev = "MCPI(S)", color = "#990099", shortname = "",},
["Marxist Communist Party of India (United)"] = {abbrev = "", color = "red", shortname = "",},
["Marxist Forward Bloc"] = {abbrev = "MFB", color = "red", shortname = "",},
["Marxist Party of Armenia"] = {abbrev = "", color = "red", shortname = "",},
["Marxist–Leninist Communist Party of Greece"] = {abbrev = "M-L KKE", color = "#D71920", shortname = "",},
["Marxist–Leninist Communist Party of Venezuela"] = {abbrev = "", color = "Red", shortname = "",},
["Marxist–Leninist Party of Austria"] = {abbrev = "MLPÖ", color = "red", shortname = "",},
["Marxist–Leninist Party of Germany"] = {abbrev = "MLPD", color = "#FF0000", shortname = "",},
["Marxist–Leninist Popular Action Movement"] = {abbrev = "", color = "red", shortname = "",},
["Más Andalucía"] = {abbrev = "", color = "#445A1A", shortname = "",},
["Más Costa Tropical"] = {abbrev = "", color = "#095B2D", shortname = "",},
["Más Eivissa"] = {abbrev = "", color = "#D60014", shortname = "",},
["Más Granada"] = {abbrev = "", color = "#9D3B23", shortname = "",},
["Más Madrid"] = {abbrev = "", color = "#45BB89", shortname = "",},
["Más País"] = {abbrev = "", color = "#0FDEC4", shortname = "",},
["Más para Entre Ríos"] = {abbrev = "", color = "#A31212", shortname = "",},
["Más Ponferrada"] = {abbrev = "", color = "#B55B8B", shortname = "",},
["MAS Region"] = {abbrev = "", color = "crimson", shortname = "",},
["Mass Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Massachusetts Republican Party"] = {abbrev = "", color = "#ff3300", shortname = "Republican",},
["Masyumi Party"] = {abbrev = "", color = "#000000", shortname = "Masyumi",},
["Matubhum Party"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Mauri Pacific"] = {abbrev = "", color = "#003153", shortname = "",},
["Maurin Kiribati Party"] = {abbrev = "MKP", color = "#48D1CC", shortname = "",},
["Maurist Party"] = {abbrev = "", color = "#0063B6", shortname = "Maurist",},
["Maurists–Ciervists"] = {abbrev = "", color = "#1959AA", shortname = "",},
["Mauritian Militant Movement"] = {abbrev = "MMM", color = "#800080", shortname = "",},
["Mauritanian Party for Renewal"] = {abbrev = "PMR", color = "#6DC2F9", shortname = "",},
["Mauritanian Party of Union and Change"] = {abbrev = "HATEM", color = "#4BB9F2", shortname = "",},
["Mauritanian People's Party"] = {abbrev = "", color = "#006233", shortname = "",},
["Mauritanian Popular Front"] = {abbrev = "", color = "#FDD003", shortname = "",},
["Mauritanian Regroupment Party"] = {abbrev = "", color = "#009F6B", shortname = "",},
["Mauritian Militant Socialist Movement"] = {abbrev = "", color = "red", shortname = "",},
["Mauritian Party of Xavier-Luc Duval"] = {abbrev = "", color = "#0000CD", shortname = "",},
["Mauritian Solidarity Front"] = {abbrev = "", color = "green", shortname = "",},
["Mavambo/Kusile/Dawn"] = {abbrev = "", color = "yellow", shortname = "",},
["Mayor 4 Stoke"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Mayors and Independents"] = {abbrev = "STAN", color = "#5BC5F2", shortname = "",},
["Mayors for the Liberec Region"] = {abbrev = "SLK", color = "#804e96", shortname = "",},
["Mazingira Green Party of Kenya"] = {abbrev = "", color = "#009926", shortname = "",},
["McGillicuddy Serious Party"] = {abbrev = "", color = "#FFC0CB", shortname = "McGillicuddy Serious",},
["Mebyon Kernow"] = {abbrev = "", color = "#d5c229", shortname = "",},
["Medrek"] = {abbrev = "", color = "#503335", shortname = "",},
["Meeting Point"] = {abbrev = "", color = "#04770a", shortname = "",},
["Meghalaya Democratic Alliance (2018)"] = {abbrev = "MDA", color = "#006081", shortname = "",},
["Meimad"] = {abbrev = "", color = "#3BABA3", shortname = "",},
["Mejor Vargas Lleras"] = {abbrev = "", color = "#2E3191", shortname = "",},
["Mekenchil"] = {abbrev = "", color = "#1F4B99", shortname = "",},
["Mekenim Kyrgyzstan"] = {abbrev = "", color = "#FFCF06", shortname = "",},
["Melanesian Alliance Party"] = {abbrev = "MAP", color = "#C78919", shortname = "",},
["Melanesian Liberal Party"] = {abbrev = "MLP", color = "#326D93", shortname = "",},
["Melanesian Progressive Party"] = {abbrev = "MPP", color = "#DE3938", shortname = "Melanesian Progressive",},
["Melanesian Progressive Union"] = {abbrev = "UPM", color = "#CC3300", shortname = "",},
["Melillan People's Union"] = {abbrev = "", color = "#0A1555", shortname = "",},
["MELS Movement of Botswana"] = {abbrev = "", color = "red", shortname = "",},
["Menorcan Independent Candidacy"] = {abbrev = "", color = "#B0B0B0", shortname = "",},
["Menorcan Party"] = {abbrev = "", color = "#00D1D1", shortname = "",},
["Menorcan Union"] = {abbrev = "", color = "#10308D", shortname = "",},
["Mensch Im Mittelpunkt"] = {abbrev = "MIM", color = "#9B2A58", shortname = "",},
["Menschliche Welt"] = {abbrev = "", color = "#ee6600", shortname = "",},
["Menshevik"] = {abbrev = "", color = "#ED1B34", shortname = "",},
["MeRA25"] = {abbrev = "", color = "#EF3F24", shortname = "",},
["Merab Kostava Society"] = {abbrev = "", color = "#751133", shortname = "",},
["Mercian Nationalist Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Meretz"] = {abbrev = "", color = "#40AE49", shortname = "",},
["Meretz (2022)"] = {abbrev = "", color = "#23E164", shortname = "",},
["Meri (political party)"] = {abbrev = "", color = "#FF3A3A", shortname = "Meri",},
["Mérida Participa"] = {abbrev = "", color = "#5D225A", shortname = "",},
["Merindades of Castile Initiative"] = {abbrev = "", color = "#335DA3", shortname = "",},
["Merit and Society Movement"] = {abbrev = "", color = "#00B4C8", shortname = "",},
["Merton Park Ward Residents Association"] = {abbrev = "", color = "#9f0fc8", shortname = "Merton Park Residents",},
["Més Compromís"] = {abbrev = "", color = "#DA5C31", shortname = "",},
["Més Esquerra"] = {abbrev = "", color = "#DACE5D", shortname = "",},
["Més Gandia"] = {abbrev = "", color = "#D6502B", shortname = "",},
["Més per Mallorca"] = {abbrev = "Més", color = "#D8DE40", shortname = "",},
["Més per Menorca"] = {abbrev = "MpM", color = "#BCD500", shortname = "",},
["Més–Compromís"] = {abbrev = "", color = "#FF6600", shortname = "",},
["Metapolitical Unitary Movement"] = {abbrev = "", color = "#FC0FC0", shortname = "",},
["Mexborough First"] = {abbrev = "", color = "#000000", shortname = "",},
["Mexican Communist Party"] = {abbrev = "PCM", color = "Red", shortname = "",},
["Mexican Democratic Party"] = {abbrev = "PDM", color = "#CC0000", shortname = "",},
["Mexican Liberal Party"] = {abbrev = "", color = "#CE1126", shortname = "",},
["Mexican Liberal Party (2003)"] = {abbrev = "PLM", color = "#d48a49", shortname = "",},
["MFG Austria – People Freedom Fundamental Rights"] = {abbrev = "MFG", color = "#4E4E4E", shortname = "",},
["MGR Anna Dravida Munnetra Kazhagam"] = {abbrev = "MADMK", color = "maroon", shortname = "",},
["MGR Thonderkal Katchi"] = {abbrev = "", color = "slategray", shortname = "MGR Thonderkal",},
["Mi Pais (political party)"] = {abbrev = "", color = "#00A5DD", shortname = "",},
["Middle Class Party"] = {abbrev = "", color = "#FFFF66", shortname = "",},
["Middle Class Party (Belgium)"] = {abbrev = "", color = "#0000A0", shortname = "Middle Class",},
["Middle Class Union"] = {abbrev = "", color = "#70147A", shortname = "",},
["Middle European Class"] = {abbrev = "", color = "#2E239D", shortname = "",},
["Middleton Independents Party"] = {abbrev = "", color = "#ffcc00", shortname = "Middleton Ind."},
["Middlewich First"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Midroad-Populist Party"] = {abbrev = "", color = "#CCFFCC", shortname = "Midroad-Populist",},
["MIGATO"] = {abbrev = "", color = "#1DA1F2", shortname = "",},
["Mighty Fatherland"] = {abbrev = "", color = "black", shortname = "",},
["Mijas Neighborhood Movement"] = {abbrev = "", color = "#5AD181", shortname = "",},
["Militant (Trotskyist group)"] = {abbrev = "", color = "#ED1941", shortname = "Militant Labour",},
["Militant Elvis Anti-Tesco Popular Front"] = {abbrev = "", color = "#FF00FF", shortname = "",},
["Militant Labour"] = {abbrev = "", color = "#ED1941", shortname = "",},
["Militant Left (Ireland)"] = {abbrev = "", color = "#DC241F", shortname = "Militant Left",},
["Militant Socialist Movement"] = {abbrev = "MSM", color = "#FF8C00", shortname = "",},
["Military (Brazil)"] = {abbrev = "", color = "#808000", shortname = "Military",},
["Military (Italy)"] = {abbrev = "", color = "#C3B091", shortname = "",},
["Military (Japan)"] = {abbrev = "", color = "#808080", shortname = "",},
["Military of Guinea-Bissau"] = {abbrev = "FARP", color = "#C3B091", shortname = "",},
["Military of São Tomé and Príncipe"] = {abbrev = "", color = "#C3B091", shortname = "",},
["Military rule"] = {abbrev = "", color = "#C3B091", shortname = "Military",},
["Millat Party"] = {abbrev = "MP", color = "red", shortname = "",},
["Millennium Democratic Party"] = {abbrev = "", color = "#00AA7B", shortname = "Millennium Democratic",},
["Minas Republican Party"] = {abbrev = "", color = "#ED1C24", shortname = "PR Mineiro",},
["Mindanao Alliance"] = {abbrev = "", color = "#008000", shortname = "",},
["Mindoro Bago Sarili"] = {abbrev = "MBS", color = "#F09042", shortname = "",},
["Ministerialist"] = {abbrev = "", color = "darkblue", shortname = "",},
["Minjoo Party (2014)"] = {abbrev = "", color = "#FFCA08", shortname = "",},
["Minjung Party"] = {abbrev = "", color = "#f26522", shortname = "Minjung",},
["Minkuotang"] = {abbrev = "", color = "#FCC800", shortname = "",},
["Minnesota Democratic–Farmer–Labor Party"] = {abbrev = "", color = "#0055AA", shortname = "Democratic (DFL)",},
["Minnesota Farmer–Labor Party"] = {abbrev = "", color = "#66FF99", shortname = "Farmer–Labor",},
["Minnesota Open Progressive Party"] = {abbrev = "", color = "#CCFF33", shortname = "",},
["Minnesota Pirate Party"] = {abbrev = "", color = "#572b85", shortname = "",},
["Minor Sea Independent Party"] = {abbrev = "", color = "#808040", shortname = "",},
["Minorities' Party"] = {abbrev = "", color = "#000000", shortname = "",},
["Minority Front"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Minority Party (Denmark)"] = {abbrev = "", color = "#FF0800", shortname = "",},
["Minsaeng Party"] = {abbrev = "", color = "#00A85F", shortname = "Minsaeng",},
["Mintō (liberal parties)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Mirae Party"] = {abbrev = "", color = "#2E3192", shortname = "Mirae",},
["Mișcarea Politică Unirea"] = {abbrev = "", color = "#8CD7F6", shortname = "",},
["Miscellaneous centre"] = {abbrev = "DVC", color = "#fcdaa8", shortname = "",},
["Miscellaneous"] = {abbrev = "DIV", color = "#CECECE", shortname = "",},
["Miscellaneous Green"] = {abbrev = "ECO", color = "#8FBC8F", shortname = "",},
["Miscellaneous left"] = {abbrev = "DVG", color = "#FFC0C0", shortname = "",},
["Miscellaneous right"] = {abbrev = "DVD", color = "#ADC1FD", shortname = "",},
["Mission Party"] = {abbrev = "", color = "#17C307", shortname = "Mission",},
["Mississippi Democratic Party"] = {abbrev = "", color = "#3333FF", shortname = "Democratic",},
["Mississippi Freedom Democratic Party"] = {abbrev = "", color = "#3333FF", shortname = "Mississippi Freedom Democratic",},
["Mississippi Republican Party"] = {abbrev = "", color = "#E81B23", shortname = "Republican",},
["Mixed Group"] = {abbrev = "GM", color = "#C0C0C0", shortname = "",},
["Mizo National Front"] = {abbrev = "MNF", color = "#2E5694", shortname = "",},
["Mizo Union"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Mizoram People's Conference"] = {abbrev = "MPC", color = "#FD7793", shortname = "",},
["Mizrachi (political party)"] = {abbrev = "", color = "#37658C", shortname = "Mizrachi",},
["Moderate (London)"] = {abbrev = "", color = "#0087DC", shortname = "Moderate",},
["Moderate Coalition for Åland"] = {abbrev = "", color = "#0095DA", shortname = "Moderate Coalition",},
["Moderate Liberal Party"] = {abbrev = "", color = "#BAE666", shortname = "Moderate Liberal",},
["Moderate Opposition"] = {abbrev = "", color = "#b070ad", shortname = "Moderate",},
["Moderate Party (Brazil)"] = {abbrev = "", color = "#E9FFDB", shortname = "Moderate",},
["Moderate Party (Illinois)"] = {abbrev = "", color = "#66023C", shortname = "Moderate",},
["Moderate Party (Italy)"] = {abbrev = "", color = "#1E87B2", shortname = "",},
["Moderate Party (Spain)"] = {abbrev = "", color = "#1060AF", shortname = "Moderate",},
["Moderate Party of Rhode Island"] = {abbrev = "", color = "#9CCECF", shortname = "Moderate",},
["Moderate Party"] = {abbrev = "M", color = "#019CDB", shortname = "Moderate",},
["Moderate Republicans (France, 1848–1870)"] = {abbrev = "", color = "#FF7F50", shortname = "Republican",},
["Moderate Venstre (Denmark)"] = {abbrev = "", color = "#3333A2", shortname = "Moderate Venstre",},
["Moderates (Denmark)"] = {abbrev = "", color = "#B48CD2", shortname = "Moderates",},
["Moderates (Italy)"] = {abbrev = "", color = "#008ECE", shortname = "Moderates",},
["Moderates (Scotland)"] = {abbrev = "", color = "#5555FF", shortname = "Moderates",},
["Moderates of Åland"] = {abbrev = "", color = "#72cced", shortname = "Moderates",},
["Moderation and Development Party"] = {abbrev = "MDP", color = "#B666D2", shortname = "",},
["Modern (political party)"] = {abbrev = ".N", color = "#005CA9", shortname = "",},
["Modern Centre Party"] = {abbrev = "", color = "#000099", shortname = "",},
["Modern Christian-Democratic Union"] = {abbrev = "MKD", color = "#FF9E23", shortname = "",},
["Modern Egypt Party"] = {abbrev = "", color = "#EB264D", shortname = "",},
["Modern Equality Party"] = {abbrev = "", color = "#eee8aa", shortname = "",},
["Modern Hungary Movement"] = {abbrev = "MoMa", color = "#007DC0", shortname = "",},
["Modern Left"] = {abbrev = "LGM", color = "#A83578", shortname = "",},
["Modern People's Party"] = {abbrev = "MPP", color = "#FFFFFF", shortname = "",},
["Modern Revolutionary Party"] = {abbrev = "", color = "#00416A", shortname = "",},
["Modern Whig Party"] = {abbrev = "", color = "#FF7F00", shortname = "Modern Whig",},
["Modrí, Most – Híd"] = {abbrev = "", color = "#002E74", shortname = "",},
["Moked"] = {abbrev = "", color = "#DC241F", shortname = "",},
["Moledet"] = {abbrev = "", color = "#000080", shortname = "",},
["Momentum (organisation)"] = {abbrev = "", color = "#CC0000", shortname = "Labour (Momentum)",},
["Momentum Movement"] = {abbrev = "", color = "#8E6FCE", shortname = "Momentum",},
["Mon National Party"] = {abbrev = "MNP", color = "#ED2124", shortname = "",},
["Mon Unity Party"] = {abbrev = "MUP", color = "#C13830", shortname = "",},
["Monarchiens"] = {abbrev = "", color = "#1C39BB", shortname = "",},
["Monarchist Action League"] = {abbrev = "", color = "#266F91", shortname = "",},
["Monarchist Coalition (Spain)"] = {abbrev = "", color = "#003E70", shortname = "",},
["Monarchist Democratic Party"] = {abbrev = "", color = "#4FA937", shortname = "Democratic",},
["Monarchist National Party"] = {abbrev = "", color = "#4B61D1", shortname = "",},
["Monarchy of Cambodia"] = {abbrev = "", color = "#FFDF00", shortname = "",},
["Monegasque National Union"] = {abbrev = "UNM", color = "#D21116", shortname = "",},
["Monetary Reform Party"] = {abbrev = "MRP", color = "#777777", shortname = "Monetary Reform",},
["Money Reform Party"] = {abbrev = "", color = "#997A8D", shortname = "Money Reform",},
["Mongol National Organisation"] = {abbrev = "", color = "#008080", shortname = "",},
["Mongolian Democratic Party (1990)"] = {abbrev = "", color = "#074da9", shortname = "",},
["Mongolian Green Party"] = {abbrev = "", color = "green", shortname = "",},
["Mongolian National Progress Party"] = {abbrev = "", color = "#006994", shortname = "",},
["Mongolian People's Party"] = {abbrev = "MPP", color = "#ED1B34", shortname = "",},
["Mongolian People's Revolutionary Party (2010)"] = {abbrev = "MPRP", color = "#FE001A", shortname = "",},
["Mongolian Republican Party"] = {abbrev = "", color = "#800080", shortname = "",},
["Mongolian Social Democratic Party"] = {abbrev = "MSDP", color = "#1C5CAC", shortname = "",},
["Mongolian Traditional United Party"] = {abbrev = "", color = "#085CB6", shortname = "",},
["Monise Laafai"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Monitor Action Group"] = {abbrev = "", color = "blue", shortname = "",},
["Monster Raving Loony William Hill Party"] = {abbrev = "", color = "hotpink", shortname = "Monster Raving Loony",},
["Montenegrin Federalist Party"] = {abbrev = "", color = "darkgreen", shortname = "",},
["Montenegrin Party"] = {abbrev = "CP", color = "#E31E25", shortname = "",},
["Montserrat Labour Party"] = {abbrev = "", color = "red", shortname = "",},
["Moovendar Munnetra Kazhagam"] = {abbrev = "", color = "Pink", shortname = "",},
["Moral Vanguard of the Fatherland"] = {abbrev = "VMP", color = "yellow", shortname = "",},
["Morality, Initiative and Patriotism"] = {abbrev = "MIP", color = "#009168", shortname = "",},
["Moravané"] = {abbrev = "", color = "#FFE101", shortname = "",},
["Moravian Democratic Party"] = {abbrev = "MDS", color = "#00ffff", shortname = "",},
["Moravian Land Movement"] = {abbrev = "", color = "#FFDF10", shortname = "",},
["More Europe"] = {abbrev = "", color = "gold", shortname = "",},
["More for Telde"] = {abbrev = "", color = "#08669A", shortname = "",},
["More Galicia"] = {abbrev = "", color = "#0191C6", shortname = "",},
["More Than One Citizen Platform of Guadalajara"] = {abbrev = "", color = "#99CF16", shortname = "",},
["Morecambe Bay Independents"] = {abbrev = "", color = "#000000", shortname = "MB Independent",},
["Morena (political party)"] = {abbrev = "", color = "#C0311A", shortname = "MORENA",},
["Morley Borough Independents"] = {abbrev = "", color = "#006600", shortname = "",},
["Moroccan Communist Party"] = {abbrev = "", color = "red", shortname = "Communist",},
["Moroccan Liberal Party"] = {abbrev = "", color = "#C58E34", shortname = "",},
["Moroccan Union for Democracy"] = {abbrev = "", color = "#CD1237", shortname = "",},
["Moroccan Workers' Union"] = {abbrev = "", color = "#0160B2", shortname = "",},
["Most–Híd"] = {abbrev = "", color = "#F58120", shortname = "Most-Híd",},
["Mostolenian Socialism"] = {abbrev = "", color = "#962016", shortname = "",},
["Motherland Defenders Party"] = {abbrev = "PZV", color = "#E30B5C", shortname = "",},
["Motherland Party (Azerbaijan)"] = {abbrev = "", color = "#022F56", shortname = "Motherland",},
["Motherland Party (Mongolia)"] = {abbrev = "", color = "yellow", shortname = "",},
["Motherland Party (Turkey)"] = {abbrev = "ANAP", color = "#FFD300", shortname = "",},
["Motril Dice"] = {abbrev = "", color = "#21A199", shortname = "",},
["Mountain Party"] = {abbrev = "", color = "#004b24", shortname = "Mountain",},
["Mouvement Action Socialiste"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Mouvement Authentique Mauricien"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Mouvement des Citoyens pour le Changement"] = {abbrev = "", color = "#0897A7", shortname = "",},
["Mouvement Franciste"] = {abbrev = "", color = "darkblue", shortname = "",},
["Mouvement Libérateur"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Mouvement Mauricien Sociale Démocrate"] = {abbrev = "", color = "#00BFFF", shortname = "",},
["Mouvement National Congolais"] = {abbrev = "", color = "#0047AB", shortname = "",},
["Move Forward Party"] = {abbrev = "", color = "#FF7F2A", shortname = "Move Forward",},
["Movem Reus"] = {abbrev = "", color = "#71B223", shortname = "",},
["Movement 21"] = {abbrev = "D21", color = "#824D99", shortname = "",},
["Movement 21 (Bonaire)"] = {abbrev = "M21", color = "#FF808B", shortname = "",},
["Movement 88"] = {abbrev = "", color = "#AA0088", shortname = "",},
["Movement Against Illegal Immigration"] = {abbrev = "DPNI", color = "#A2070F", shortname = "",},
["Movement for a Democratic Slovakia"] = {abbrev = "HZDS", color = "#00CCFF", shortname = "",},
["Movement for a Europe of Liberties and Democracy"] = {abbrev = "MELD", color = "#007A89", shortname = "",},
["Movement for a Europe of Nations and Freedom"] = {abbrev = "", color = "#26428B", shortname = "",},
["Movement for an Equal Public Model"] = {abbrev = "", color = "#2a4b98", shortname = "",},
["Movement for Autonomous Democracy–Party for Moravia and Silesia"] = {abbrev = "HSD–SMS", color = "#FF9999", shortname = "",},
["Movement for Autonomy"] = {abbrev = "", color = "#00CCCC", shortname = "",},
["Movement for Benalmádena"] = {abbrev = "", color = "#18A6B1", shortname = "",},
["Movement for Change (Greece)"] = {abbrev = "KINAL", color = "#179045", shortname = "",},
["Movement for Change and Prosperity"] = {abbrev = "MCAP", color = "#FFFF01", shortname = "",},
["Movement for Changes"] = {abbrev = "PzP", color = "#0D70B1", shortname = "",},
["Movement for Constitutional Freedoms"] = {abbrev = "MLS", color = "#FFFF00", shortname = "",},
["Movement for Democracy (Cape Verde)"] = {abbrev = "MpD", color = "#01C700", shortname = "",},
["Movement for Democracy (Slovakia)"] = {abbrev = "HZD", color = "#79B6D7", shortname = "",},
["Movement for Democracy and Development (Central African Republic)"] = {abbrev = "", color = "#191970", shortname = "",},
["Movement for Democracy and Progress (Comoros)"] = {abbrev = "MDP", color = "", shortname = "",},
["Movement for Democracy and Progress (Niger)"] = {abbrev = "MDP-Alkawali", color = "green", shortname = "",},
["Movement for Democracy and Reconstruction"] = {abbrev = "MDR", color = "#71A1D1", shortname = "",},
["Movement for Democratic Change – Mutambara"] = {abbrev = "MDC-M", color = "#FF7F00", shortname = "",},
["Movement for Democratic Change – Ncube"] = {abbrev = "MDC–N", color = "#1EDD1E", shortname = "",},
["Movement for Democratic Change – Tsvangirai"] = {abbrev = "MDC–T", color = "#DC241f", shortname = "",},
["Movement for Democratic Change (1999–2005)"] = {abbrev = "MDC", color = "#DC241f", shortname = "",},
["Movement for Democratic Change (prior to 2005)"] = {abbrev = "MDC", color = "#DC241f", shortname = "",},
["Movement for Democratic Change Alliance"] = {abbrev = "", color = "#ed1c24", shortname = "",},
["Movement for Democratic Change"] = {abbrev = "", color = "#DC241f", shortname = "",},
["Movement for Democratic Renewal and Development"] = {abbrev = "", color = "#333399", shortname = "",},
["Movement for Dignity and Citizenship"] = {abbrev = "MDyC", color = "#2D2D2D", shortname = "",},
["Movement for Dignity and Independence"] = {abbrev = "", color = "#FFEF00", shortname = "",},
["Movement for Economic Change"] = {abbrev = "MEC", color = "#1F4398", shortname = "",},
["Movement for Economic Empowerment"] = {abbrev = "MOVEE", color = "", shortname = "",},
["Movement for European Reform"] = {abbrev = "MER", color = "#30455e", shortname = "",},
["Movement for France"] = {abbrev = "MPF", color = "#8040C0", shortname = "",},
["Movement for Grassroots Democracy"] = {abbrev = "MGD", color = "#FFFDD0", shortname = "",},
["Movement for Humanist Socialism"] = {abbrev = "", color = "#FFEA3F", shortname = "",},
["Movement for Multi-Party Democracy"] = {abbrev = "MMD", color = "#0064FF", shortname = "",},
["Movement for National Development (Trinidad and Tobago)"] = {abbrev = "MND", color = "#2A60AA", shortname = "",},
["Movement for National Development"] = {abbrev = "", color = "#2D276C", shortname = "",},
["Movement for National Reform"] = {abbrev = "MRN", color = "#C1CC6F", shortname = "",},
["Movement for People's Unity–Republicans"] = {abbrev = "", color = "#DA251C", shortname = "",},
["Movement for Piedmontese Regional Autonomy"] = {abbrev = "MARP", color = "#6578DC", shortname = "",},
["Movement for Prague 11"] = {abbrev = "HPP11", color = "#FECC00", shortname = "",},
["Movement for Progressive Change"] = {abbrev = "", color = "#008000", shortname = "",},
["Movement for Reconstruction of Poland"] = {abbrev = "ROP", color = "#BD0934", shortname = "",},
["Movement for Reversal"] = {abbrev = "PZP", color = "#F7801D", shortname = "",},
["Movement for Rights and Freedoms"] = {abbrev = "DPS", color = "#0066B7", shortname = "",},
["Movement for Social Democracy"] = {abbrev = "EDEK", color = "#164f46", shortname = "",},
["Movement for Social Justice"] = {abbrev = "MSJ", color = "#27AAE1", shortname = "",},
["Movement for Socialism (Bolivia)"] = {abbrev = "MAS-IPSP", color = "#143A83", shortname = "",},
["Movement for Socialism (Venezuela)"] = {abbrev = "", color = "DarkOrange", shortname = "Movement for Socialism",},
["Movement for Sovereignty"] = {abbrev = "", color = "#1B63AB", shortname = "",},
["Movement for the Defence of the Republic"] = {abbrev = "MDR", color = "#BEE4E5", shortname = "",},
["Movement for the Future of Curaçao"] = {abbrev = "MFK", color = "#01A7FF", shortname = "",},
["Movement for the Independence of Sicily"] = {abbrev = "MIS", color = "#FFEB3B", shortname = "",},
["Movement for the Liberation of Peoples"] = {abbrev = "MLP", color = "#EC0408", shortname = "",},
["Movement for the Liberation of São Tomé and Príncipe – Social Democratic Party"] = {abbrev = "MLSTP–PSD", color = "#00AD06", shortname = "",},
["Movement for the Liberation of the Central African People"] = {abbrev = "MLPC", color = "#15A247", shortname = "",},
["Movement for the Liberation of the Congo"] = {abbrev = "MLC", color = "blue", shortname = "",},
["Movement for the Progress of Madagascar"] = {abbrev = "", color = "red", shortname = "",},
["Movement for the Renewal of Social Zionism"] = {abbrev = "", color = "#1C2969", shortname = "",},
["Movement for the Restoration of the Kingdom of Serbia"] = {abbrev = "POKS", color = "#4169E1", shortname = "",},
["Movement for the Social Evolution of Black Africa"] = {abbrev = "MESAN", color = "black", shortname = "",},
["Movement for the Unity of the Canarian People"] = {abbrev = "", color = "#60B16B", shortname = "",},
["Movement for Tolerance and Progress"] = {abbrev = "", color = "red", shortname = "",},
["Movement For!"] = {abbrev = "", color = "#FFF200", shortname = "",},
["Movement in Support of the Army"] = {abbrev = "DPA", color = "#7C273A", shortname = "",},
["Movement Now"] = {abbrev = "Liik", color = "#ae2375", shortname = "",},
["Movement of Action in Solidarity"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Movement of Centrist Republicans"] = {abbrev = "", color = "#133366", shortname = "",},
["Movement of Democratic Action"] = {abbrev = "PDA", color = "#8fbc8f", shortname = "",},
["Movement of Democratic Integration"] = {abbrev = "", color = "#FF9000", shortname = "",},
["Movement of Democratic Socialists"] = {abbrev = "", color = "#E70C21", shortname = "",},
["Movement of Ecologists – Citizens' Cooperation"] = {abbrev = "KOSP", color = "#0A9748", shortname = "",},
["Movement of Free Citizens (Algeria)"] = {abbrev = "MCL", color = "", shortname = "",},
["Movement of Free Citizens (Serbia)"] = {abbrev = "PSG", color = "#63C3D0", shortname = "",},
["Movement of Growth Objectors"] = {abbrev = "", color = "#BB0000", shortname = "",},
["Movement of Independent Citizens of São Tomé and Príncipe"] = {abbrev = "", color = "black", shortname = "",},
["Movement of Independents for the Harmonious Development of Municipalities and Cities"] = {abbrev = "HNHRM", color = "pink", shortname = "",},
["Movement of Militant Muslims"] = {abbrev = "MMM", color = "#FFE4E1", shortname = "",},
["Movement of National Solidarity"] = {abbrev = "MSN", color = "lightgreen", shortname = "",},
["Movement of National Understanding"] = {abbrev = "MEN", color = "#006b00", shortname = "",},
["Movement of New Forces"] = {abbrev = "RNS", color = "#0068ae", shortname = "",},
["Movement of Popular Participation"] = {abbrev = "", color = "#E34234", shortname = "",},
["Movement of Progressives"] = {abbrev = "MDP", color = "#9C005E", shortname = "",},
["Movement of Socialist Democrats"] = {abbrev = "", color = "SeaGreen", shortname = "",},
["Movement of Socialists"] = {abbrev = "PS", color = "#E62020", shortname = "",},
["Movement of Society for Peace"] = {abbrev = "MSP", color = "#009900", shortname = "",},
["Movement of the First"] = {abbrev = "", color = "#FD4F4A", shortname = "",},
["Movement of Unity"] = {abbrev = "MU", color = "#90BF43", shortname = "",},
["Movement Party (France)"] = {abbrev = "", color = "#FB607F", shortname = "",},
["Movement to Defend the Pancasila"] = {abbrev = "GPPS", color = "#FFA500", shortname = "",},
["Movement We Are Venezuela"] = {abbrev = "", color = "#621E7B", shortname = "",},
["Movemento pola Base"] = {abbrev = "", color = "#1B9EE4", shortname = "",},
["Movementu Kousa Promé"] = {abbrev = "", color = "#C24483", shortname = "",},
["Movementu Progresivo"] = {abbrev = "", color = "#D4306B", shortname = "",},
["MOVER (political party)"] = {abbrev = "", color = "#438b44", shortname = "MOVER",},
["Mover Parla"] = {abbrev = "", color = "#9BBB59", shortname = "",},
["Moviment Patrijotti Maltin"] = {abbrev = "", color = "#FF4000", shortname = "",},
["Movimiento al Socialismo (Argentina)"] = {abbrev = "MAS", color = "#FE3A3B", shortname = "Movement for Socialism",},
["Movimiento Construye"] = {abbrev = "", color = "#000080", shortname = "Construye",},
["Movimiento Nacional"] = {abbrev = "", color = "#708090", shortname = "National Movement",},
["Movimiento Unión Soberanista"] = {abbrev = "", color = "#66CCCC", shortname = "",},
["Movimiento Victoria Ciudadana"] = {abbrev = "MVC", color = "#E0A230", shortname = "Citizens' Victory",},
["MPLA"] = {abbrev = "", color = "#CE0921", shortname = "",},
["Mudiraj Rashtriya Samithi"] = {abbrev = "", color = "#996666", shortname = "",},
["Muhajir Qaumi Movement (Haqiqi)"] = {abbrev = "MQM-H", color = "red", shortname = "",},
["Muintir na hÉireann"] = {abbrev = "", color = "#8032CC", shortname = "",},
["Mukt Bharat"] = {abbrev = "", color = "#00FF33", shortname = "",},
["Municipal Assemblies of Fuerteventura"] = {abbrev = "", color = "#0806AF", shortname = "",},
["Municipal Independent Platform of Villalbilla"] = {abbrev = "", color = "#FBED06", shortname = "",},
["Municipal Reform Party"] = {abbrev = "", color = "#0087DC", shortname = "Municipal Reform",},
["Municipal Unity 9"] = {abbrev = "", color = "#FF5F00", shortname = "",},
["Municipalists for Change"] = {abbrev = "", color = "#73969B", shortname = "",},
["Murba Party"] = {abbrev = "", color = "#ffe5e5", shortname = "Murba",},
["Murcian Regionalist Party"] = {abbrev = "", color = "#CE9A00", shortname = "",},
["Mureran Democratic Convergence"] = {abbrev = "", color = "#033780", shortname = "",},
["Musavat"] = {abbrev = "", color = "#3BB9FF", shortname = "",},
["Muslim Bosniak Organisation"] = {abbrev = "", color = "green", shortname = "",},
["Muslim Brotherhood in Egypt"] = {abbrev = "", color = "#009900", shortname = "",},
["Muslim Brotherhood of Syria"] = {abbrev = "", color = "#009900", shortname = "",},
["Muslim Brotherhood"] = {abbrev = "", color = "#009900", shortname = "",},
["Muslim Committee of Action"] = {abbrev = "", color = "green", shortname = "",},
["Muslim League (Qayyum)"] = {abbrev = "", color = "green", shortname = "",},
["Muslim League Kerala State Committee"] = {abbrev = "MUL", color = "green", shortname = "",},
["Muslim League"] = {abbrev = "", color = "#00CCCC", shortname = "",},
["Muslim People's Party of Malaysia"] = {abbrev = "HAMIM", color = "", shortname = "",},
["Muslim People's Republican Party"] = {abbrev = "MPRP", color = "#A7E3A3", shortname = "",},
["Muslim Union Party"] = {abbrev = "MUP", color = "#32CD32", shortname = "",},
["Mustaqbil Pakistan"] = {abbrev = "", color = "blue", shortname = "",},
["Mutahida Deeni Mahaz"] = {abbrev = "MDM", color = "#FFFFFF", shortname = "",},
["Muttahida Majlis-e-Amal"] = {abbrev = "MMA", color = "#004000", shortname = "",},
["Muttahida Qabail Party"] = {abbrev = "MQP", color = "#40E0D0", shortname = "",},
["Muttahida Qaumi Movement – London"] = {abbrev = "MQM", color = "#C80000", shortname = "",},
["Muttahida Qaumi Movement – Pakistan"] = {abbrev = "MQM-P", color = "#be1212", shortname = "",},
["Muttahida Qaumi Movement"] = {abbrev = "MQM", color = "#C80000", shortname = "",},
["Muttahidoon"] = {abbrev = "", color = "#0D4E76", shortname = "",},
["Muungano Party"] = {abbrev = "MP", color = "#254306", shortname = "",},
["My Family"] = {abbrev = "MF", color = "#00ec03", shortname = "",},
["My Homeland Kyrgyzstan"] = {abbrev = "", color = "", shortname = "Mekenim Kyrgyzstan",},
["My Step Alliance"] = {abbrev = "", color = "#ED1A24", shortname = "",},
["My Vote Counts!"] = {abbrev = "", color = "#CD5C5C", shortname = "",},
["Myanmar Farmers Development Party"] = {abbrev = "", color = "#F01A26", shortname = "",},
["Myanmar National Congress"] = {abbrev = "MNC", color = "#ED1E24", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
a0d567eafa4c4f92f55a7259d1b21cbe25b44d0c
Template:Align
10
237
466
2023-12-21T21:57:41Z
wikipedia>Ahecht
0
safesubst<noinclude/>:
wikitext
text/x-wiki
{{safesubst<noinclude/>:#switch: {{safesubst<noinclude/>:lc:{{{1|center}}}}}
|left = <div style="float: left;{{safesubst<noinclude/>:#if: {{{style|}}} | {{{style}}};}}">{{{2}}}</div>
|right = <div style="float: right;{{safesubst<noinclude/>:#if: {{{style|}}} | {{{style}}};}}">{{{2}}}</div>
|center = {{safesubst<noinclude/>:center|{{{2}}}|style={{{style|}}} }}
|#default = Error in [[Template:Align]]: the alignment setting "{{{1}}}" is invalid.
}}<noinclude>
{{documentation}}
</noinclude>
6d03351dca1cab3abf83d24f4e7dfe2c1948f615
Module:Political party/C
828
227
446
2023-12-22T13:14:11Z
wikipedia>Primefac
0
shortname fix
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["California Democratic Party"] = "Democratic Party (United States)",
["California Progressive Party"] = "Progressive Party (US)",
["California Republican Party"] = "Republican Party (United States)",
["Cambiamo"] = "Cambiamo!",
["Cambodian National Rescue Party"] = "Cambodia National Rescue Party",
["Canarian Nationalist Assembly"] = "Nationalist Canarian Assembly",
["Canarian United Left"] = "United Left (Spain)",
["Cap 21"] = "Cap21",
["Carlist Party"] = "Carlist Party (1970)",
["Carlist Party of Euskal Herria"] = "Carlist Party (1970)",
["Cartel (Luxembourg)"] = "Party of Independents of the East",
["Catalan Democratic Party"] = "Catalan European Democratic Party",
["Catalan Federation of the PSOE"] = "Spanish Socialist Workers' Party",
["Catalan Socialist Federation"] = "Spanish Socialist Workers' Party",
["Catalunya en Comú–Podem"] = "Catalunya en Comú",
["Catholic Democrats (The National Party)"] = "Catholic Democrats (Ireland)",
["Catholic Democrats"] = "Catholic Democrats (Ireland)",
["CCM"] = "Chama Cha Mapinduzi",
["CD&V"] = "Christen-Democratisch en Vlaams",
["CdH"] = "Humanist Democratic Centre",
["CDS - People's Party"] = "CDS – People's Party",
["CDU"] = "Christian Democratic Union of Germany",
["CDU/CSU"] = "Christian Democratic Union of Germany",
["CDU (2023)"] = "Christian Democratic Union of Germany (2023)",
["Centre Agreement"] = "Centre Alliance",
["Centre Democratic Action of Galicia"] = "Citizens of Galicia Democratic Action",
["Centre démocrate humaniste"] = "Humanist Democratic Centre",
["Centre Independent Aragonese Candidacy"] = "Aragonese Party",
["Centre Party (Israel)"] = "Center Party (Israel)",
["Centre Party"] = "Centre Party (Sweden)",
["Centre Union (Greece)"] = "Centre Union",
["Centre Union – New Forces"] = "Centre Union",
["Centre-left coalition"] = "Centre-left coalition (Italy)",
["Centre-right coalition"] = "Centre-right coalition (Italy)",
["Centre-right Coalition"] = "Centre-right coalition (Italy)",
["Centrist Party (United States)"] = "Centrist Party (US)",
["Centrists of Catalonia"] = "Union of the Democratic Centre (Spain)",
["Ceylon Indian Congress"] = "Ceylon Workers' Congress",
["Chama cha Mapinduzi"] = "Chama Cha Mapinduzi",
["Cambio 90 – New Majority"] = "Cambio 90",
["Chart Thai Pattana Party"] = "Chartthaipattana Party",
["Change UK – The Independent Group"] = "The Independent Group for Change",
["Change UK"] = "The Independent Group for Change",
["Chilean Socialist Party (1987-1990)"] = "Chilean Socialist Party",
["Chilean Socialist Party (1987–1990)"] = "Chilean Socialist Party", -- dash differences
["China Democratic National Construction Association"] = "China National Democratic Construction Association",
["Chinese Youth Party"] = "Young China Party",
["Chrisitan Democracy for the Autonomies"] = "Christian Democracy for the Autonomies",
["Christian and Democratic Union - Czechoslovak People's Party"] = "KDU-ČSL",
["Christian and Democratic Union – Czechoslovak People's Party"] = "KDU-ČSL", -- dash difference
["Christian Democracy"] = "Christian Democracy (Italy)",
["Christian Democrat Party of Chile"] = "Christian Democratic Party (Chile)",
["Christian Democratic and Flemish"] = "Christen-Democratisch en Vlaams",
["Christian Democratic Party (France)"] = "VIA, the Way of the People",
["Christian Democratic Team of the Spanish State"] = "Christian Democracy Federation–Christian Democracy Team",
["Christian Democratic Union (Germany)"] = "Christian Democratic Union of Germany",
["Christian Democratic Union (Germany, 2023)"] = "Christian Democratic Union of Germany (2023)",
["Christian Democratic Unity"] = "Christian Democrats (Sweden)",
["Christian Heritage New Zealand"] = "Christian Heritage Party of New Zealand",
["Christian Liberal Party"] = "Christian Liberty Unification Party",
["Christian Liberty Party"] = "Christian Liberty Unification Party",
["Christian Nationalist Party (US)"] = "Constitution Party (US, 1952)",
["Christian People's Party (Latvia)"] = "Popular Front of Latvia",
["Christian Social Party (Belgium, defunct)"] = "Christian Social Party (Belgium, 1945)",
["Christian Social Party (Wallonia)"] = "Humanist Democratic Centre",
["Christian Social Party"] = "Christian Social Party (Germany)",
["Christian Social Union of Bavaria"] = "Christian Social Union in Bavaria",
["Christian Workers' Union (Finland)"] = "Christian Workers' Union of Finland",
["Christian-Democratic National Peasants' Party (Romania)"] = "Christian Democratic National Peasants' Party",
["ChristianUnion"] = "Christian Union (Netherlands)",
["CIBAC"] = "Citizens' Battle Against Corruption",
["CISTA"] = "Cannabis Is Safer Than Alcohol",
["Citizen Europe"] = "Cap21",
["Citizen’s Coalition for Justice Party (Mongolia)"] = "Citizen's Coalition for Justice Party (Mongolia)",
["Citizens Coalition For Change"] = "Citizens Coalition for Change",
["Citizens of Democratic Centre"] = "Democratic Centre Coalition",
["Citizens Party (United States)"] = "Citizens Party (US)",
["Citizens' Liberation Party"] = "Nagrik Unmukti Party",
["Citizens' Movement (France)"] = "Citizen and Republican Movement",
["Citizens' Movement for Change"] = "Mouvement des Citoyens pour le Changement",
["Citizens' Party (Philippines)"] = "Nationalist Citizens' Party",
["Citizenship, Action, Participation for the 21st Century"] = "Cap21",
["Civic Centre Alliance"] = "Centre Civic Alliance",
["Civic-Liberal Alliance"] = "Civic Liberal Alliance",
["Civil Congress of Ukraine"] = "Slavic Party (Ukraine)",
["Civil Contract"] = "Civil Contract (Armenia)",
["Civil Initiative"] = "Civic Initiative",
["Civil Will-Green Party"] = "Civil Will–Green Party",
["Club 2002"] = "Club 2002 – Party for the Unity and the Republic",
["Coalition for Bulgaria"] = "BSP for Bulgaria",
["Coalition for Democratic Unity"] = "Democratic Unity Roundtable",
["Coalition for Europe (2009)"] = "Coalition for Europe",
["Coalition for Europe (2014)"] = "Coalition for Europe",
["Coalition for Republic – Republican Party of Czechoslovakia"] = "Rally for the Republic – Republican Party of Czechoslovakia",
["Coalition for the Europe of the Peoples"] = "Europe of the Peoples",
["Coalition Liberal"] = "National Liberal Party (UK, 1922)",
["Coalition New Zealand"] = "Vision NZ",
["Coalition of the Radical Left"] = "Syriza",
["Coalition Party and Rural People's Association"] = "Estonian Coalition Party",
["Coalition Unionist"] = "Coalition Conservative",
["Collective Action Party — Civic Congress"] = "Common Action Political Party — Civil Congress",
["Collective Action Party – Civic Congress"] = "Common Action Political Party — Civil Congress",
["Colorado Democratic Party"] = "Democratic Party (United States)",
["Colorado Republican Party"] = "Republican Party (United States)",
["Colombia Coalition"] = "Citizens' Compromise",
["Common Peoples' Party"] = "Other parties",
["Commonwealth Land Party (United States)"] = "Commonwealth Land Party (US)",
["Commonwealth Liberal"] = "Commonwealth Liberal Party",
["Communist League Marxist–Leninists (the revolutionaries)"] = "Communist Party (Sweden)",
["Communist Movement of Aragon"] = "Communist Movement (Spain)",
["Communist Movement of Asturias"] = "Communist Movement (Spain)",
["Communist Movement of Catalonia"] = "Communist Movement (Spain)",
["Communist Movement of Euskadi"] = "Communist Movement (Spain)",
["Communist Movement of Galicia"] = "Communist Movement (Spain)",
["Communist Movement of the Valencian Country"] = "Communist Movement (Spain)",
["Communist Party (Sweden, 2018)"] = "Party of Labour of Albania",
["Communist Party (United States)"] = "Communist Party (US)",
["Communist Party of Andalusia"] = "Communist Party of Spain",
["Communist Party of Aragon"] = "Communist Party of Spain",
["Communist Party of Armenia (Soviet Union)"] = "Communist Party of the Soviet Union",
["Communist Party of Asturias"] = "Communist Party of Spain",
["Communist Party of Belgium"] = "Workers' Party of Belgium",
["Communist Party of Britain (Marxist-Leninist)"] = "Communist Party of Britain (Marxist–Leninist)",
["Communist Party of Cantabria"] = "Communist Party of Spain",
["Communist Party of Castile and León"] = "Communist Party of Spain",
["Communist Party of Castilla–La Mancha"] = "Communist Party of Spain",
["Communist Party of Ceylon"] = "Communist Party of Sri Lanka",
["Communist Party of China"] = "Chinese Communist Party",
["Communist Party of Estonia"] = "Communist Party of the Soviet Union",
["Communist Party of Extremadura"] = "Communist Party of Spain",
["Communist Party of Finland (1997)"] = "Communist Party of Finland (1994)",
["Communist Party of Galicia (Revolutionary Marxist)"] = "Workers' Party of Spain–Communist Unity",
["Communist Party of Galicia"] = "Communist Party of Spain",
["Communist Party of Germany (Opposition)"] = "Communist Party of Germany",
["Communist Party of Great Britain (Marxist-Leninist)"] = "Communist Party of Great Britain (Marxist–Leninist)",
["Communist Party of India (Marxist-Leninist) (Liberation)"] = "Communist Party of India (Marxist–Leninist) Liberation",
["Communist Party of India (Marxist-Leninist) Liberation"] = "Communist Party of India (Marxist–Leninist) Liberation",
["Communist Party of India (Marxist-Leninist) Red Star"] = "Communist Party of India (Marxist–Leninist) Red Star",
["Communist Party of India (Marxist–Leninist)"] = "Provisional Central Committee, Communist Party of India (Marxist–Leninist)",
["Communist Party of Ireland (Marxist-Leninist)"] = "Communist Party of Ireland (Marxist–Leninist)",
["Communist Party of La Rioja"] = "Communist Party of Spain",
["Communist Party of Madrid"] = "Communist Party of Spain",
["Communist Party of Nepal (Marxist-Leninist) (1998)"] = "Communist Party of Nepal (Marxist–Leninist) (2002)",
["Communist Party of Nepal (Marxist-Leninist) (2002)"] = "Communist Party of Nepal (Marxist–Leninist) (2002)",
["Communist Party of Nepal (Unified Marxist-Leninist)"] = "Communist Party of Nepal (Unified Marxist–Leninist)",
["Communist Party of the Balearic Islands"] = "Communist Party of Spain",
["Communist Party of the Basque Country"] = "Communist Party of Spain",
["Communist Party of the Canaries"] = "Communist Party of Spain",
["Communist Party of the Catalan People"] = "Communist Party of the Peoples of Spain",
["Communist Party of the Galician People"] = "Communist Party of the Peoples of Spain",
["Communist Party of the Portuguese Workers / Reorganizative Movement of the Party of the Proletariat"] = "Portuguese Workers' Communist Party",
["Communist Party of the Region of Murcia"] = "Communist Party of Spain",
["Communist Party of the Valencian Country"] = "Communist Party of Spain",
["Communist Party of Turkey (current)"] = "Communist Party of Turkey (modern)",
["Communist Party of Turkey (today)"] = "Communist Party of Turkey (modern)",
["Communist Party of Yugoslavia"] = "League of Communists of Yugoslavia",
["Communist Workers' Party of Catalonia"] = "Spanish Communist Workers' Party",
["Communists' Unity Board"] = "Workers' Party of Spain–Communist Unity",
["Community of the People"] = "Inuit Ataqatigiit",
["Concert of Parties for Democracy"] = "Concertación",
["Concertación de Partidos por la Democracia"] = "Concertación",
["Confederation for an Independent Poland"] = "Confederation of Independent Poland",
["Connecticut Democratic Party"] = "Democratic Party (United States)",
["Connecticut for Lieberman"] = "Independent (US)",
["Connecticut Republican Party"] = "Republican Party (United States)",
["Connecticut Green Party"] = "Green Party (US)",
["Connecticut Working Families Party"] = "Working Families Party",
["Conservatism"] = "Conservatism sidebar",
["Conservative and National Liberal"] = "National Liberal Party (UK, 1931)",
["Conservative and Unionist"] = "Scottish Conservatives",
["Conservative Party (New York)"] = "Conservative Party (US)",
["Conservative Party (UK)"] = "Conservative and Unionist Party (UK)",
["Conservative Party (United States)"] = "Conservative Party (US)",
["Conservative Party of Canada (historical)"] = "Conservative Party of Canada (1867–1942)",
["Conservative Party (Virginia, 1867)"] = "Conservative Party (US)",
["Conservative Party of Cuba"] = "National Conservative Party (Cuba)",
["Conservative Party of New York State"] = "Conservative Party (US)",
["Conservative Party of New York"] = "Conservative Party (US)",
["Conservative Party of New Zealand"] = "New Conservative Party of New Zealand",
["Conservative Party of Norway"] = "Conservative Party (Norway)",
["Conservative Party of Virginia (1965)"] = "Conservative Party (Virginia, 1965)",
["Conservative Party"] = "Conservative and Unionist Party (UK)",
["Conservatives in Northern Ireland"] = "Northern Ireland Conservatives",
["Constituent Unity"] = "New Social Pact",
["Constitution Party (Oregon)"] = "Constitution Party (US)",
["Constitution Party (United States)"] = "Constitution Party (US)",
["Constitution Party (Utah)"] = "Constitution Party (US)",
["Constitution Party of Minnesota"] = "Constitution Party (US)",
["Constitution Party of Oregon"] = "Constitution Party (US)",
["Constitution Party of Washington"] = "Constitution Party (US)",
["Constitutional Democratic Rally"] = "Democratic Constitutional Rally",
["Constitutional People's Party (Finland)"] = "Constitutional Right Party",
["Constitutional Union Party (United States)"] = "Constitutional Union Party (US)",
["Constructive Ecological Party \"KEDR\""] = "Russian Ecological Party \"The Greens\"",
["Cook Islands Party Tumu"] = "Party Tumu",
["COPEI"] = "Copei",
["Costa Rican Renovation Party"] = "Costa Rican Renewal Party",
["Country Party of Australia – Tasmania"] = "National Party of Australia – Tasmania",
["Country Party of Western Australia"] = "National Party of Australia",
["Country Party"] = "National Party of Australia",
["Country–Liberal Coalition"] = "Country/Liberal Coalition",
["Country"] = "National Party of Australia",
["Country/National coalition"] = "National Party of Australia",
["Country/Nationalist coalition"] = "National Party of Australia",
["Country/QPP coalition"] = "National Party of Australia",
["Country/UAP coalition"] = "National Party of Australia",
["Country/United coalition"] = "National Party of Australia",
["Courage Italy"] = "Coraggio Italia",
["CPI(M)"] = "Communist Party of India (Marxist)",
["CREO Movement"] = "Creating Opportunities",
["Crescent Star Party"] = "Crescent Star Party (Indonesia)",
["Croatian Citizen Party"] = "Croatian Civic Party",
["Croatian Labourists - Labour Party"] = "Croatian Labourists – Labour Party",
["Croatian People's Party - Liberal Democrats"] = "Croatian People's Party – Liberal Democrats",
["Croatian Sustainable Development"] = "Green Alternative - Sustainable Development of Croatia",
["Crossbench"] = "Crossbencher",
["CSSD"] = "Czech Social Democratic Party",
["CSSD (2021)"] = "Czech Social Democratic Party (2021)",
["Cuban Popular Party-National League"] = "Cuban Popular Party",
["Cumann na nGaedhael"] = "Cumann na nGaedheal",
["CumbriaFirst"] = "Putting Cumbria First",
["Cumbria First"] = "Putting Cumbria First",
["CVP"] = "Christen-Democratisch en Vlaams",
}
local full = {
["Caballas Coalition"] = {abbrev = "", color = "#C9601C", shortname = "Caballas",},
["Cabal (political party)"] = {abbrev = "", color = "#1642fd", shortname = "Cabal",},
["Cáceres Eres Tú"] = {abbrev = "", color = "#5A1E5A", shortname = "",},
["Cáceres Viva"] = {abbrev = "", color = "#008B15", shortname = "",},
["Caledonia Together"] = {abbrev = "", color = "#00CCCC", shortname = "",},
["Caledonian Union"] = {abbrev = "", color = "#008000", shortname = "",},
["California National Party"] = {abbrev = "", color = "#FFD700", shortname = "California National",},
["Caló Nationalist Party"] = {abbrev = "", color = "#008284", shortname = "",},
["Cambia Avilés"] = {abbrev = "", color = "#19905A", shortname = "",},
["Cambia Logroño"] = {abbrev = "", color = "#A30052", shortname = "",},
["Cámbialo Municipalistas"] = {abbrev = "", color = "#AD0B5A", shortname = "",},
["Cambiamo!"] = {abbrev = "", color = "#E58321", shortname = "",},
["Cambiando Burlada"] = {abbrev = "", color = "#9F82A1", shortname = "",},
["Cambiar Huesca"] = {abbrev = "", color = "#27933E", shortname = "",},
["Cambiar la Región de Murcia"] = {abbrev = "", color = "#80B620", shortname = "",},
["Cambiemos Murcia"] = {abbrev = "", color = "#C0CD37", shortname = "",},
["Cambiemos Orihuela"] = {abbrev = "", color = "#009A97", shortname = "",},
["Cambiemos Parla"] = {abbrev = "", color = "#BF469A", shortname = "",},
["Cambiemos Villalba"] = {abbrev = "", color = "#B00868", shortname = "",},
["Cambiemos"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Cambio (political party)"] = {abbrev = "", color = "#fbd504", shortname = "Change",},
["Cambio 90"] = {abbrev = "", color = "#D45500", shortname = "",},
["Cambio-Aldaketa"] = {abbrev = "", color = "#A2AA00", shortname = "",},
["Cambodia Indigenous Peoples Democracy Party"] = {abbrev = "", color = "#522315", shortname = "",},
["Cambodia National Rescue Party"] = {abbrev = "CNRP", color = "#0047AB", shortname = "",},
["Cambodian Nationality Party"] = {abbrev = "", color = "#FDEB04", shortname = "",},
["Cambodian People's Party"] = {abbrev = "CPP", color = "#1E90FF", shortname = "",},
["Cambodian Youth Party"] = {abbrev = "CYP", color = "#0045BC", shortname = "",},
["Cambridge Socialists"] = {abbrev = "", color = "red", shortname = "",},
["Camden Charter"] = {abbrev = "", color = "white", shortname = "",},
["Cameroon Democratic Union"] = {abbrev = "UDC", color = "#2B3781", shortname = "",},
["Cameroon People's Democratic Movement"] = {abbrev = "RDPC", color = "#73C2FB", shortname = "",},
["Cameroon Renaissance Movement"] = {abbrev = "MRC", color = "#9BC8E9", shortname = "",},
["Cameroonian National Union"] = {abbrev = "UNC", color = "#00CD12", shortname = "",},
["Cameroonian Union"] = {abbrev = "", color = "#007F00", shortname = "",},
["Caminando Juntos"] = {abbrev = "CJ", color = "#203C90", shortname = "",},
["Camp of National Unity"] = {abbrev = "OZN", color = "#00177C", shortname = "",},
["Campaign for a More Prosperous Britain"] = {abbrev = "", color = "grey", shortname = "More Prosperous Britain",},
["Can Lao Party"] = {abbrev = "", color = "#39944A", shortname = "",},
["Canadian Alliance"] = {abbrev = "", color = "#5F9EA0", shortname = "Alliance",},
["Canarian Assembly"] = {abbrev = "", color = "#C62821", shortname = "",},
["Canarian Centrist Group"] = {abbrev = "", color = "#0D601C", shortname = "",},
["Canarian Coalition–New Canaries"] = {abbrev = "", color = "#BAF73E", shortname = "",},
["Canarian Coalition"] = {abbrev = "CC", color = "#FFD700", shortname = "",},
["Canarian Green Party"] = {abbrev = "", color = "#85C026", shortname = "",},
["Canarian Greens"] = {abbrev = "", color = "#008000", shortname = "",},
["Canarian Independent Groups"] = {abbrev = "AIC", color = "#000088", shortname = "",},
["Canarian Nationalist Alternative"] = {abbrev = "", color = "#AD221B", shortname = "",},
["Canarian Nationalist Convergence"] = {abbrev = "", color = "#65BFE3", shortname = "",},
["Canarian Nationalist Federation"] = {abbrev = "FNC", color = "#823D8F", shortname = "",},
["Canarian Nationalist Party"] = {abbrev = "", color = "#495087", shortname = "",},
["Canarian People's Union"] = {abbrev = "", color = "#BA0033", shortname = "",},
["Canarian Popular Alternative"] = {abbrev = "", color = "#009642", shortname = "",},
["Canarian Social Democratic Centre"] = {abbrev = "", color = "#FF7F02", shortname = "",},
["Canarian Union"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Canaries Decides"] = {abbrev = "", color = "#9B0024", shortname = "",},
["Canaries for Progress"] = {abbrev = "", color = "#3485BD", shortname = "",},
["Candidacy for the Neighbors' Participation in the City Council"] = {abbrev = "", color = "#DEC939", shortname = "",},
["Candidatura de Unidad Popular"] = {abbrev = "", color = "#A0866E", shortname = "",},
["Candlelight Party"] = {abbrev = "", color = "#020878", shortname = "Candlelight",},
["Cangas Left Alternative"] = {abbrev = "", color = "#6F956C", shortname = "",},
["Cannabis Is Safer Than Alcohol"] = {abbrev = "CISTA", color = "#D2B48C", shortname = "",},
["Cannabis Law Reform"] = {abbrev = "", color = "#556B2F", shortname = "",},
["Cannabis Party (Spain)"] = {abbrev = "", color = "#428600", shortname = "",},
["Cannabis Party–Green Light"] = {abbrev = "", color = "#3AAA35", shortname = "",},
["Cantabrian Nationalist Council"] = {abbrev = "", color = "#973D3C", shortname = "",},
["Cantabrian Unity"] = {abbrev = "", color = "#08C853", shortname = "",},
["Cantabristas"] = {abbrev = "", color = "#7D002E", shortname = "",},
["Cantonal Party"] = {abbrev = "", color = "#8F3F42", shortname = "",},
["Canvey Island Independent Party"] = {abbrev = "CIIP", color = "#000000", shortname = "",},
["Canviem entre Tots"] = {abbrev = "", color = "#5B244B", shortname = "",},
["Canviem Mollet"] = {abbrev = "", color = "#631F5E", shortname = "",},
["Cap Ecology"] = {abbrev = "", color = "#509A32", shortname = "",},
["Cap21"] = {abbrev = "", color = "#9db55c", shortname = "",},
["Cape Coloured Congress"] = {abbrev = "", color = "#000000", shortname = "",},
["Cape Party"] = {abbrev = "", color = "#000076", shortname = "",},
["Capitalist Party of South Africa"] = {abbrev = "", color = "#693C97", shortname = "",},
["Capitalist Party"] = {abbrev = "", color = "#4A104A", shortname = "",},
["Caribbean Socialist Party"] = {abbrev = "", color = "#be1918", shortname = "",},
["Caring for Macau"] = {abbrev = "", color = "#1034A6", shortname = "",},
["Carlist Party (1970)"] = {abbrev = "", color = "#FF454F", shortname = "",},
["Carlist Traditionalist Communion"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Carpatho-Russian Labour Party of Small Peasants and Landless"] = {abbrev = "KTPMB", color = "orange", shortname = "",},
["Cartagena Sí Se Puede"] = {abbrev = "", color = "#572458", shortname = "",},
["Cartagenerist Party"] = {abbrev = "", color = "#BE2F33", shortname = "",},
["Cartago Agrarian Force Party"] = {abbrev = "FAC", color = "#87CEEB", shortname = "",},
["Cartago Agrarian Union Party"] = {abbrev = "PUAC", color = "#BA55D3", shortname = "",},
["Cartago Green Party"] = {abbrev = "PVC", color = "green", shortname = "",},
["Carthaginense Citizens' Initiative"] = {abbrev = "", color = "#820004", shortname = "",},
["Cartista"] = {abbrev = "", color = "#002395", shortname = "",},
["CASA–CE"] = {abbrev = "", color = "#52a8ff", shortname = "",},
["CasaPound"] = {abbrev = "", color = "#000000", shortname = "",},
["Cascadia Bioregional Party"] = {abbrev = "", color = "#067DC4", shortname = "",},
["Cassolists"] = {abbrev = "", color = "#2EA5A5", shortname = "",},
["Castelló en Moviment"] = {abbrev = "", color = "#35A299", shortname = "",},
["Castellón Democracy"] = {abbrev = "", color = "#0D9F4E", shortname = "",},
["Castilian Left"] = {abbrev = "", color = "#C5496F", shortname = "",},
["Castilian Party"] = {abbrev = "", color = "#551D79", shortname = "",},
["Castilian Regionalist Party"] = {abbrev = "", color = "#F0DD07", shortname = "",},
["Castilian Unity"] = {abbrev = "", color = "#313494", shortname = "",},
["Castilianist Union"] = {abbrev = "", color = "#DC143C", shortname = "",},
["CastroVerde (political party)"] = {abbrev = "", color = "#06BC58", shortname = "",},
["Casual vacancy"] = {abbrev = "", color = "#FFFFFF", shortname = "Vacant",},
["Catalan Action"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Catalan Agreement of Progress"] = {abbrev = "", color = "#FA8005", shortname = "",},
["Catalan Centre"] = {abbrev = "", color = "#6D1402", shortname = "",},
["Catalan Civil Support"] = {abbrev = "", color = "#A11C26", shortname = "",},
["Catalan Coexistence"] = {abbrev = "", color = "#0E2D87", shortname = "",},
["Catalan European Democratic Party"] = {abbrev = "PDeCAT", color = "#0263AC", shortname = "",},
["Catalan Left"] = {abbrev = "", color = "#D6B800", shortname = "",},
["Catalan Nationalist Republican"] = {abbrev = "", color = "#FACF9A", shortname = "",},
["Catalan Republican Party (1917)"] = {abbrev = "", color = "#B35359", shortname = "",},
["Catalan Republican Party"] = {abbrev = "", color = "#EB5604", shortname = "",},
["Catalan Solidarity (1906)"] = {abbrev = "SC", color = "#FFBC3D", shortname = "",},
["Catalan Solidarity (1980)"] = {abbrev = "", color = "#FFA07A", shortname = "",},
["Catalan Solidarity for Independence"] = {abbrev = "SI", color = "#CA0405", shortname = "",},
["Catalan Sovereigntist Bloc"] = {abbrev = "", color = "#C1001F", shortname = "",},
["Catalonia Among Neighbors"] = {abbrev = "", color = "#914B1E", shortname = "",},
["Catalonia in the Senate"] = {abbrev = "", color = "#FFD74D", shortname = "",},
["Catalonia Yes"] = {abbrev = "", color = "#1E242E", shortname = "",},
["Catalunya en Comú"] = {abbrev = "", color = "#912C45", shortname = "",},
["Catalunya Lliure"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Catalunya Sí que es Pot"] = {abbrev = "", color = "#C4375B", shortname = "CatSíqueesPot",},
["Catamarca People's Movement"] = {abbrev = "", color = "#0052CE", shortname = "",},
["Catarinense Republican Party"] = {abbrev = "PRC", color = "#FA8072", shortname = "",},
["Catholic-National Conservative Party in Bohemia"] = {abbrev = "KNKSČ", color = "#004F50", shortname = "",},
["Catholic Centre Party (Portugal)"] = {abbrev = "CCP", color = "#00BFFF", shortname = "Catholic Centre",},
["Catholic Church footer"] = {abbrev = "", color = "#FFD700", shortname = "Catholic",},
["Catholic Democrats (Ireland)"] = {abbrev = "", color = "#8A8AE0", shortname = "Catholic Democrats",},
["Catholic Election Action"] = {abbrev = "WAK", color = "#3F82C6", shortname = "",},
["Catholic League"] = {abbrev = "LC", color = "#2D2D2D", shortname = "",},
["Catholic National Party"] = {abbrev = "KNP", color = "#47B26B", shortname = "",},
["Catholic Party (Belgium)"] = {abbrev = "", color = "#FFD700", shortname = "Catholic",},
["Catholic Party (Indonesia)"] = {abbrev = "", color = "#800000", shortname = "Catholic",},
["Catholic Party (Liverpool)"] = {abbrev = "", color = "#99FF66", shortname = "Catholic",},
["Catholic People's Party (Poland)"] = {abbrev = "SKL", color = "#335B5B", shortname = "",},
["Catholic People's Party"] = {abbrev = "KVP", color = "#004F50", shortname = "",},
["Catholic Union (Spain)"] = {abbrev = "", color = "#1D5D96", shortname = "",},
["Catholic Workers' Party"] = {abbrev = "PCO", color = "#800000", shortname = "",},
["Cavalier"] = {abbrev = "", color = "white", shortname = "",},
["Cayman Democratic Party"] = {abbrev = "CDP", color = "#345284", shortname = "",},
["Cayman Islands People's Party"] = {abbrev = "", color = "#FFC30D", shortname = "",},
["CDS – People's Party"] = {abbrev = "CDS–PP", color = "#0093DD", shortname = "",},
["CEDA"] = {abbrev = "", color = "#303180", shortname = "",},
["Ceann Comhairle"] = {abbrev = "", color = "#000000", shortname = "",},
["Ceire Cion"] = {abbrev = "", color = "salmon", shortname = "",},
["Célbakísér Civil Szövetség"] = {abbrev = "", color = "#95C241", shortname = "",},
["Center for Islamic Iran Academics"] = {abbrev = "CIIA", color = "#03babe", shortname = "",},
["Center for the Study of Natural Resources"] = {abbrev = "", color = "#17AA5C", shortname = "",},
["Center Party (Israel)"] = {abbrev = "", color = "#1935D0", shortname = "",},
["Center Party (Norway)"] = {abbrev = "", color = "#D63D2D", shortname = "",},
["Center Union-New Forces"] = {abbrev = "EK-ND", color = "#FF7F50", shortname = "",},
["Centered for Tarragona"] = {abbrev = "", color = "#00436E", shortname = "",},
["Centered Progressives Coalition"] = {abbrev = "", color = "#C60079", shortname = "",},
["Centrados"] = {abbrev = "", color = "#D9007F", shortname = "",},
["Central African Democratic Rally"] = {abbrev = "RDC", color = "#FFE339", shortname = "",},
["Central African Democratic Union"] = {abbrev = "UDC", color = "#B1CF70", shortname = "",},
["Central African Republican Party"] = {abbrev = "", color = "#4682B4", shortname = "",},
["Central and Western Democratic Power"] = {abbrev = "CWDP", color = "#d75453", shortname = "",},
["Central and Western District Coalition"] = {abbrev = "", color = "#3FA900", shortname = "",},
["Central Committee of Tallinn Trade Unions"] = {abbrev = "TAK", color = "#FF0000", shortname = "",},
["Central Polish Electoral Committee"] = {abbrev = "LCRK", color = "#F200CB", shortname = "",},
["Centralist Republican Party"] = {abbrev = "", color = "#B82761", shortname = "",},
["Centrats"] = {abbrev = "", color = "#16946F", shortname = "",},
["Centre (Croatian political party)"] = {abbrev = "", color = "#2D7AB0", shortname = "",},
["Centre Alliance (Argentina)"] = {abbrev = "", color = "#0087D1", shortname = "Centre Alliance",},
["Centre Alliance"] = {abbrev = "", color = "#ff6300", shortname = "",},
["Centre and Democracy Forum"] = {abbrev = "", color = "#009E31", shortname = "",},
["Centre Civic Alliance"] = {abbrev = "POC", color = "#FFD054", shortname = "",},
["Centre Democracy and Progress"] = {abbrev = "", color = "#00CCCC", shortname = "",},
["Centre Democrats (Denmark)"] = {abbrev = "", color = "#800080", shortname = "Centre Democrats",},
["Centre Democrats (Netherlands)"] = {abbrev = "CD", color = "#7F663D", shortname = "",},
["Centre for Poland"] = {abbrev = "CdP", color = "#0D3570", shortname = "",},
["Centre Group"] = {abbrev = "", color = "#F47F31", shortname = "",},
["Centre of Arona"] = {abbrev = "", color = "#70B72B", shortname = "",},
["Centre of Social Democrats"] = {abbrev = "", color = "#4B0082", shortname = "",},
["Centre Party '86"] = {abbrev = "", color = "red", shortname = "",},
["Centre Party (Denmark)"] = {abbrev = "", color = "#39944A", shortname = "Centre",},
["Centre Party (Faroe Islands)"] = {abbrev = "", color = "#0A4168", shortname = "Centre",},
["Centre Party (Finland)"] = {abbrev = "Kesk.", color = "#3AAD2E", shortname = "Centre",},
["Centre Party (Germany)"] = {abbrev = "", color = "#000000", shortname = "Centre",},
["Centre Party (Germany, 1945)"] = {abbrev = "", color = "#004C90", shortname = "Centre",},
["Centre Party (Greenland)"] = {abbrev = "", color = "#FFCC00", shortname = "Akulliit",},
["Centre Party (Hungary)"] = {abbrev = "", color = "#FFB900", shortname = "Centre",},
["Centre Party (Iceland)"] = {abbrev = "", color = "#002169", shortname = "Centre",},
["Centre Party (Jersey)"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Centre Party (Latvia)"] = {abbrev = "", color = "#8D2421", shortname = "",},
["Centre Party (Nauru)"] = {abbrev = "", color = "#FFC718", shortname = "",},
["Centre Party (Netherlands)"] = {abbrev = "CP", color = "red", shortname = "",},
["Centre Party (Norway)"] = {abbrev = "", color = "#00843D", shortname = "Centre",},
["Centre Party (Rhodesia)"] = {abbrev = "", color = "#0088ff", shortname = "Centre Party",},
["Centre Party (Sweden)"] = {abbrev = "C", color = "#124838", shortname = "Centre",},
["Centre Party (Sweden, 1873)"] = {abbrev = "", color = "#6BB7EC", shortname = "Centre",},
["Centre Party (Tasmania)"] = {abbrev = "", color = "#3E933E", shortname = "Centre",},
["Centre Party (Turkey)"] = {abbrev = "", color = "#12A19A", shortname = "Centre",},
["Centre Party of Ireland"] = {abbrev = "Cen", color = "#0000A5", shortname = "Centre Party",},
["Centre Republican Party"] = {abbrev = "", color = "#00984B", shortname = "",},
["Centre through Action for Progress"] = {abbrev = "CAP", color = "#0EF70E", shortname = "",},
["Centre Union"] = {abbrev = "ΕΚ", color = "#FCB825", shortname = "",},
["Centre Union for Terrassa"] = {abbrev = "", color = "#C7DB08", shortname = "",},
["Centre Unity"] = {abbrev = "", color = "#881A2D", shortname = "",},
["Centre-left coalition (Italy)"] = {abbrev = "", color = "#EF3E3E", shortname = "Centre-left",},
["Centre-Left of Albacete"] = {abbrev = "", color = "#F4644A", shortname = "",},
["Centre-left politics"] = {abbrev = "", color = "#464646", shortname = "Centre-left",},
["Centre-right coalition (Italy)"] = {abbrev = "", color = "#0A6BE1", shortname = "Centre-right",},
["Centre-right politics"] = {abbrev = "", color = "#ADC1FD", shortname = "Centre-right",},
["Centrem"] = {abbrev = "", color = "#0B5663", shortname = "",},
["Centrism (Italy)"] = {abbrev = "", color = "lightblue", shortname = "Centrismo",},
["Centrist Alliance"] = {abbrev = "AC", color = "#473B84", shortname = "",},
["Centrist Convergence–Democratic and Social Centre"] = {abbrev = "", color = "#FF9900", shortname = "",},
["Centrist Democratic Party (Rwanda)"] = {abbrev = "", color = "#F0E68C", shortname = "",},
["Centrist Democratic Party of the Philippines"] = {abbrev = "CDP", color = "#0067B4", shortname = "",},
["Centrist Party (Spain)"] = {abbrev = "", color = "#08D152", shortname = "",},
["Centrist Party (US)"] = {abbrev = "", color = "#3333FF", shortname = "",},
["Centrist Republican Stable Movement"] = {abbrev = "MECR", color = "purple", shortname = "",},
["Centrist Union group"] = {abbrev = "UC", color = "#0073c3", shortname = "",},
["Centrist Union of Moldova"] = {abbrev = "", color = "#062A78", shortname = "",},
["Centrists for Europe"] = {abbrev = "", color = "#A6DBEC", shortname = "",},
["Centrists of Galicia"] = {abbrev = "", color = "#0EB2D5", shortname = "",},
["Centrists of the Valencian Community"] = {abbrev = "", color = "#39B639", shortname = "",},
["Centrolew"] = {abbrev = "", color = "#BC235B", shortname = "",},
["Centrum"] = {abbrev = "", color = "#5F9F3F", shortname = "",},
["Cerna (political organization)"] = {abbrev = "", color = "#00A3E0", shortname = "",},
["Ceuta Ya!"] = {abbrev = "", color = "#F6CC46", shortname = "",},
["Ceutan Democratic Union"] = {abbrev = "", color = "#AD2916", shortname = "",},
["Ceutan Party"] = {abbrev = "", color = "#2F4378", shortname = "",},
["Ceylon Communist Party (Maoist)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Ceylon Labour Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Ceylon Workers' Congress"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Chadema"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Chadian Action for Unity and Socialism"] = {abbrev = "", color = "red", shortname = "",},
["Chadian Progressive Party"] = {abbrev = "", color = "#2D2A3B", shortname = "",},
["Chadian Social Action"] = {abbrev = "", color = "#F08080", shortname = "",},
["Chaldean Syriac Assyrian Popular Council"] = {abbrev = "", color = "saddlebrown", shortname = "",},
["Chama Cha Kijamii"] = {abbrev = "", color = "navy", shortname = "",},
["Chama Cha Mapinduzi"] = {abbrev = "CCM", color = "#228B22", shortname = "",},
["Chama Cha Mashinani"] = {abbrev = "", color = "#ffff00", shortname = "",},
["Chama cha Ukombozi wa Umma"] = {abbrev = "", color = "red", shortname = "",},
["Chama Cha Uzalendo"] = {abbrev = "", color = "#51B757", shortname = "",},
["Chance (Moldova)"] = {abbrev = "", color = "#FF412C", shortname = "Chance",},
["Chance. Duties. Realization."] = {abbrev = "ȘOR", color = "#4CA355", shortname = "",},
["Change 2011"] = {abbrev = "M11", color = "#01414D", shortname = "",},
["Change It (Spain)"] = {abbrev = "", color = "#739C29", shortname = "",},
["Change Party (Thailand)"] = {abbrev = "", color = "#BD1F2E", shortname = "Change",},
["Chart Pattana Kla Party"] = {abbrev = "", color = "#FF4919", shortname = "Chart Pattana Kla",},
["Chart Pattana Party (2007)"] = {abbrev = "", color = "#F69520", shortname = "",},
["Chart Pattana Party"] = {abbrev = "", color = "#fe980d", shortname = "",},
["Charter Party"] = {abbrev = "", color = "#C0C0C0", shortname = "Charter",},
["Chartism"] = {abbrev = "", color = "#FF3333", shortname = "Chartist",},
["Chartthaipattana Party"] = {abbrev = "", color = "#E20884", shortname = "Chart Thai Pattana",},
["Chase Community Independents Group"] = {abbrev = "", color = "#065E5E", shortname = "Chase Indies",},
["Chat Rung Rueang Party"] = {abbrev = "", color = "#E7B138", shortname = "",},
["Chehabist"] = {abbrev = "", color = "#808080", shortname = "",},
["Chega (political party)"] = {abbrev = "", color = "#222256", shortname = "CHEGA",},
["Cheung Sha Wan Community Establishment Power"] = {abbrev = "CSWCEP", color = "#F48326", shortname = "",},
["Chez Nous (Belgian political party)"] = {abbrev = "", color = "#002D61", shortname = "Chez Nous",},
["Cheung Sha Wan West Front"] = {abbrev = "CSWWF", color = "#53bfa7", shortname = "",},
["Chile Digno"] = {abbrev = "", color = "#EE113A", shortname = "",},
["Chile Podemos Más"] = {abbrev = "", color = "#ffd700", shortname = "",},
["Chile Vamos"] = {abbrev = "", color = "#006BB0", shortname = "",},
["Chilean Renovating Action"] = {abbrev = "", color = "black", shortname = "",},
["Chilean Social Democracy Party"] = {abbrev = "", color = "#FF6347", shortname = "",},
["Chilean Socialist Party"] = {abbrev = "", color = "#ED1624", shortname = "",},
["ChileFirst"] = {abbrev = "", color = "#D1FF00", shortname = "",},
["Chin National League for Democracy"] = {abbrev = "CNLD", color = "#01AEF2", shortname = "",},
["Chin National Party"] = {abbrev = "CNP", color = "#006600", shortname = "",},
["Chin Progressive Party"] = {abbrev = "CPP", color = "#FFFFFF", shortname = "",},
["China Association for Promoting Democracy"] = {abbrev = "CAPD", color = "#FFF500", shortname = "",},
["China Democratic League"] = {abbrev = "CDL", color = "#cb7e1f", shortname = "",},
["China Democratic Socialist Party"] = {abbrev = "CDSP", color = "#008000", shortname = "Democratic Socialist",},
["China National Democratic Construction Association"] = {abbrev = "CNDCA", color = "Orangered", shortname = "",},
["China Youth Service & Recreation Centre"] = {abbrev = "CYSRC", color = "#4ED052", shortname = "",},
["China Zhi Gong Party"] = {abbrev = "CZGP", color = "Red", shortname = "",},
["Chinbak Yeondae"] = {abbrev = "", color = "#0a50a1", shortname = "",},
["Chinese Communist Party"] = {abbrev = "CCP", color = "#DD0000", shortname = "Communist",},
["Chinese Empire Reform Association"] = {abbrev = "CERA", color = "navy", shortname = "",},
["Chinese Peasants' and Workers' Democratic Party"] = {abbrev = "CPWDP", color = "#189df0", shortname = "",},
["Chinese People's Party"] = {abbrev = "", color = "green", shortname = "",},
["Chinese Production Party"] = {abbrev = "", color = "#21358F", shortname = "",},
["Chinese Social Democratic Party"] = {abbrev = "CSDP", color = "#FFD900", shortname = "",},
["Chinese Unification Promotion Party"] = {abbrev = "", color = "#253686", shortname = "",},
["Ching Fat Living Concern Group"] = {abbrev = "CFLCG", color = "#10791D", shortname = "",},
["Chipani cha Pfuko"] = {abbrev = "CCP", color = "#9F622B", shortname = "",},
["Choi Hung Estate Social Service Association"] = {abbrev = "CHESSA", color = "#468CA8", shortname = "",},
["Choice of Russia (electoral bloc)"] = {abbrev = "VR", color = "#29166F", shortname = "",},
["Chondoist Chongu Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Christchurch 2021"] = {abbrev = "", color = "#AB0616", shortname = "",},
["Christchurch Independents"] = {abbrev = "CI", color = "#999999", shortname = "",},
["Christen-Democratisch en Vlaams"] = {abbrev = "CD&V", color = "#FF6200", shortname = "",},
["Christene Volkspartij"] = {abbrev = "CVP", color = "#FFA500", shortname = "",},
["Christian and Democratic Union"] = {abbrev = "KDU", color = "#FFCB03", shortname = "",},
["Christian Centre"] = {abbrev = "", color = "#00BFFF", shortname = "",},
["Christian Centrist Party"] = {abbrev = "", color = "#8032CC", shortname = "Christian Centrist",},
["Christian Citizens"] = {abbrev = "", color = "darkblue", shortname = "",},
["Christian Coalition (New Zealand)"] = {abbrev = "", color = "#878FB8", shortname = "Christian Coalition",},
["Christian Conservative Party (Chile)"] = {abbrev = "", color = "#000080", shortname = "",},
["Christian Conservative Party"] = {abbrev = "", color = "yellow", shortname = "",},
["Christian Conservative Social Union"] = {abbrev = "", color = "#332F83", shortname = "",},
["Christian Democracy (Brazil)"] = {abbrev = "DC", color = "#015F9D", shortname = "",},
["Christian Democracy (Greece)"] = {abbrev = "ChD", color = "#013220", shortname = "",},
["Christian Democracy (Italy, 2002)"] = {abbrev = "DC", color = "#1560BD", shortname = "Christian Democracy",},
["Christian Democracy (Italy)"] = {abbrev = "DC", color = "#87CEFA", shortname = "",},
["Christian Democracy (Poland)"] = {abbrev = "ChD", color = "#5C3FB5", shortname = "",},
["Christian Democracy Federation–Christian Democracy Team"] = {abbrev = "", color = "#E94E1B", shortname = "",},
["Christian Democracy for the Autonomies"] = {abbrev = "", color = "#ADD8E6", shortname = "Christian Democracy",},
["Christian Democrat Party (New Zealand)"] = {abbrev = "", color = "#800080", shortname = "Christian Democrats",},
["Christian Democrat Party (Peru)"] = {abbrev = "", color = "#00008B", shortname = "",},
["Christian Democratic Alliance (Costa Rica)"] = {abbrev = "ADC", color = "#483D8B", shortname = "",},
["Christian Democratic Alliance (Fiji)"] = {abbrev = "VLV", color = "orange", shortname = "",},
["Christian Democratic Alliance (South Africa)"] = {abbrev = "", color = "#300064", shortname = "Christian Democratic Alliance",},
["Christian Democratic Appeal (2021)"] = {abbrev = "", color = "#2CC84D", shortname = "",},
["Christian Democratic Appeal"] = {abbrev = "CDA", color = "#007C5E", shortname = "",},
["Christian Democratic Centre"] = {abbrev = "CCD", color = "#A6DBEC", shortname = "",},
["Christian Democratic Front"] = {abbrev = "", color = "orange", shortname = "",},
["Christian Democratic Movement (2021)"] = {abbrev = "KDH", color = "#173a70", shortname = "",},
["Christian Democratic Movement"] = {abbrev = "KDH", color = "#FFE17D", shortname = "",},
["Christian Democratic Movement (Montenegro)"] = {abbrev = "DP", color = "#0172BB", shortname = "",},
["Christian Democratic National Peasants' Party"] = {abbrev = "PNȚCD", color = "#004A92", shortname = "",},
["Christian Democratic Party (Argentina)"] = {abbrev = "PDC", color = "#00008B", shortname = "Christian Democratic Party",},
["Christian Democratic Party (Australia)"] = {abbrev = "", color = "#7F007F", shortname = "Christian Democrats",},
["Christian Democratic Party (Belgium)"] = {abbrev = "CDP", color = "#FFA500", shortname = "",},
["Christian Democratic Party (Belize)"] = {abbrev = "CDP", color = "#FF7F00", shortname = "",},
["Christian Democratic Party (Bolivia)"] = {abbrev = "PDC", color = "#016167", shortname = "",},
["Christian Democratic Party (Brazil)"] = {abbrev = "PDC", color = "#FF7700", shortname = "",},
["Christian Democratic Party (Chile)"] = {abbrev = "PDC", color = "#0061A7", shortname = "",},
["Christian Democratic Party (Costa Rica)"] = {abbrev = "PDC", color = "#CC1B56", shortname = "",},
["Christian Democratic Party (Democratic Republic of the Congo)"] = {abbrev = "", color = "orange", shortname = "Christian Democratic Party",},
["Christian Democratic Party (East Timor)"] = {abbrev = "", color = "#3F5EBE", shortname = "Christian Democratic Party",},
["Christian Democratic Party (El Salvador)"] = {abbrev = "PDC", color = "#00732E", shortname = "",},
["Christian Democratic Party (Norway)"] = {abbrev = "", color = "#ffd959", shortname = "Christian Democratic",},
["Christian Democratic Party (Papua New Guinea)"] = {abbrev = "CDP", color = "#FF0000", shortname = "Christian Democratic Party",},
["Christian Democratic Party (Paraguay)"] = {abbrev = "", color = "#11a018", shortname = "Christian Democratic Party",},
["Christian Democratic Party (Samoa)"] = {abbrev = "CDP", color = "#FF00FF", shortname = "Christian Democratic Party",},
["Christian Democratic Party (South Africa)"] = {abbrev = "", color = "#662D91", shortname = "Christian Democratic Party",},
["Christian Democratic Party (Spain)"] = {abbrev = "", color = "#068B1C", shortname = "Christian Democratic Party",},
["Christian Democratic Party of Albania"] = {abbrev = "PKDSH", color = "#0080FF", shortname = "",},
["Christian Democratic Party of Cuba"] = {abbrev = "", color = "#3EB489", shortname = "Christian Democratic Party",},
["Christian Democratic Party of Honduras"] = {abbrev = "CD", color = "#11992B", shortname = "",},
["Christian Democratic Party of Russia"] = {abbrev = "", color = "#9999FF", shortname = "Christian Democratic Party",},
["Christian Democratic Party of Serbia"] = {abbrev = "DHSS", color = "#964B00", shortname = "",},
["Christian Democratic Party of Ukraine"] = {abbrev = "CDPU", color = "#222629", shortname = "",},
["Christian Democratic Party of Uruguay"] = {abbrev = "PDCU", color = "#FFA500", shortname = "",},
["Christian Democratic People's Party (Hungary)"] = {abbrev = "KDNP", color = "#938862", shortname = "",},
["Christian Democratic People's Party of Switzerland"] = {abbrev = "", color = "#EF7D00", shortname = "Christian Democrats",},
["Christian Democratic Union (Bolivia)"] = {abbrev = "CDU", color = "#0047AB", shortname = "",},
["Christian Democratic Union (Dominican Republic)"] = {abbrev = "", color = "#ffd300", shortname = "",},
["Christian Democratic Union (East Germany)"] = {abbrev = "CDU", color = "#237CDB", shortname = "",},
["Christian Democratic Union (Ecuador)"] = {abbrev = "", color = "#008F4C", shortname = "",},
["Christian Democratic Union (Latvia)"] = {abbrev = "", color = "#F3AE12", shortname = "",},
["Christian Democratic Union (Lithuania)"] = {abbrev = "KDS", color = "#5DA782", shortname = "",},
["Christian Democratic Union (Netherlands)"] = {abbrev = "CDU", color = "#E50066", shortname = "",},
["Christian Democratic Union (Ukraine)"] = {abbrev = "CDU", color = "#F39518", shortname = "",},
["Christian Democratic Union of Timor"] = {abbrev = "UDC", color = "#2FAAD6", shortname = "",},
["Christian Democratic Union of Germany"] = {abbrev = "CDU", color = "#151518", shortname = "",},
["Christian Democratic Union of Germany (2023)"] = {abbrev = "CDU", color = "#51B8C2", shortname = "",},
["Christian Democratic Voice"] = {abbrev = "CDV", color = "#24B87A", shortname = "",},
["Christian Democrats (Denmark)"] = {abbrev = "", color = "#53619B", shortname = "Christian Democrats",},
["Christian Democrats (Denmark, 2022)"] = {abbrev = "", color = "#53619B", shortname = "Christian Democrats",},
["Christian Democrats (Finland)"] = {abbrev = "KD", color = "#2B67C9", shortname = "",},
["Christian Democrats (Sweden)"] = {abbrev = "KD", color = "#005EA1", shortname = "Christian Democrats",},
["Christian Economic and Social Party"] = {abbrev = "KGSZP", color = "#006447", shortname = "",},
["Christian Flemish People's Union"] = {abbrev = "CVV", color = "black", shortname = "",},
["Christian Heritage Party of Canada"] = {abbrev = "", color = "#800020", shortname = "Christian Heritage",},
["Christian Heritage Party of New Zealand"] = {abbrev = "", color = "#878FB8", shortname = "Christian Heritage",},
["Christian Historical Party"] = {abbrev = "CHP", color = "#008080", shortname = "",},
["Christian Historical Union"] = {abbrev = "CHU", color = "#006F70", shortname = "",},
["Christian Independent Alliance"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Christian Labour Party"] = {abbrev = "PTC", color = "#009966", shortname = "",},
["Christian Liberty Unification Party"] = {abbrev = "", color = "#0095DA", shortname = "",},
["Christian Movement for a New Haiti"] = {abbrev = "", color = "#00923F", shortname = "",},
["Christian National Alliance Party"] = {abbrev = "PANC", color = "saddlebrown", shortname = "",},
["Christian National Party (Chile)"] = {abbrev = "", color = "turquoise", shortname = "",},
["Christian National Party (Hungary)"] = {abbrev = "KNP", color = "#6091ba", shortname = "",},
["Christian National Union for the Reconstruction of Haiti"] = {abbrev = "UNCRH", color = "#FFFF00", shortname = "",},
["Christian National Union Party"] = {abbrev = "KNEP", color = "#43884A", shortname = "",},
["Christian National Union"] = {abbrev = "", color = "#007FFF", shortname = "",},
["Christian Party (Samoa)"] = {abbrev = "SCP", color = "#FFFFDD", shortname = "",},
["Christian Party (UK)"] = {abbrev = "", color = "#9966CC", shortname = "Christian",},
["Christian Party of Austria"] = {abbrev = "", color = "#FAD41B", shortname = "Christian Party",},
["Christian People's Alliance"] = {abbrev = "", color = "#FF00FF", shortname = "",},
["Christian People's Party (Belgium)"] = {abbrev = "CVP", color = "#EEAA00", shortname = "",},
["Christian People's Party (Dominican Republic)"] = {abbrev = "", color = "#ff7900", shortname = "",},
["Christian People's Party (Estonia)"] = {abbrev = "KRE", color = "#000000", shortname = "",},
["Christian People's Party (Faroe Islands)"] = {abbrev = "", color = "#FF6600", shortname = "Christian People's",},
["Christian People's Party (Germany)"] = {abbrev = "CVP", color = "#8DCEE7", shortname = "",},
["Christian People's Party (Peru)"] = {abbrev = "", color = "#14953B", shortname = "",},
["Christian Peoples Alliance"] = {abbrev = "CPA", color = "#813887", shortname = "",},
["Christian Political Movement"] = {abbrev = "", color = "#E8AE0B", shortname = "",},
["Christian Positivist Party (Spain)"] = {abbrev = "", color = "#8B898B", shortname = "",},
["Christian Principles Party"] = {abbrev = "", color = "#8032CC", shortname = "Christian Principles",},
["Christian Social Democratic Party"] = {abbrev = "PSDC", color = "#7797E0", shortname = "",},
["Christian Social Front"] = {abbrev = "", color = "#2A58A6", shortname = "",},
["Christian Social Party (Austria)"] = {abbrev = "CS", color = "#000000", shortname = "",},
["Christian Social Party (Belgium, 1945)"] = {abbrev = "", color = "orange", shortname = "Christian Social",},
["Christian Social Party (Belgium)"] = {abbrev = "", color = "#FFCC99", shortname = "",},
["Christian Social Party (Chile)"] = {abbrev = "", color = "#26348D", shortname = "",},
["Christian Social Party (German-speaking Community)"] = {abbrev = "CSP", color = "orange", shortname = "",},
["Christian Social Party (Germany)"] = {abbrev = "", color = "#008080", shortname = "",},
["Christian Social Party (Liechtenstein)"] = {abbrev = "", color = "#80FFFF", shortname = "",},
["Christian Social Party (Netherlands)"] = {abbrev = "", color = "#D2691E", shortname = "",},
["Christian Social Party (Switzerland)"] = {abbrev = "", color = "#0F95A7", shortname = "Christian Social",},
["Christian Social Party of Obwalden"] = {abbrev = "", color = "#BF3235", shortname = "CSP Obwalden",},
["Christian Social People's Party"] = {abbrev = "CSV", color = "#FFC300", shortname = "",},
["Christian Social People's Service"] = {abbrev = "", color = "#1DB4E1", shortname = "",},
["Christian Social Rally of Liberty"] = {abbrev = "RSCL", color = "#FF4500", shortname = "",},
["Christian Social Union in Bavaria"] = {abbrev = "CSU", color = "#008AC5", shortname = "",},
["Christian Solidarity Party"] = {abbrev = "", color = "#FFFF99", shortname = "Christian Solidarity",},
["Christian Spanish Party"] = {abbrev = "", color = "#AAAAFF", shortname = "",},
["Christian Union – Reformed Political Party"] = {abbrev = "CU–SGP", color = "#00a7eb", shortname = "",},
["Christian Union (Lithuania)"] = {abbrev = "", color = "#445C64", shortname = "",},
["Christian Union (Netherlands)"] = {abbrev = "CU", color = "#00A7EB", shortname = "",},
["Christian Union (Slovakia)"] = {abbrev = "KÚ", color = "#04B2E8", shortname = "",},
["Christian Union Movement"] = {abbrev = "", color = "#6ca860", shortname = "",},
["Christian Union of National Unity"] = {abbrev = "ChZJN", color = "#2B3F3D", shortname = "",},
["Christian Unity Party"] = {abbrev = "", color = "#143d8d", shortname = "",},
["Christian Workers' Alliance"] = {abbrev = "", color = "#8B0000", shortname = "Christian Workers",},
["Christian Workers' Union of Finland"] = {abbrev = "SKrTL", color = "#FF5050", shortname = "",},
["Christian-Democratic Movement (Georgia)"] = {abbrev = "KDM", color = "#881532", shortname = "",},
["Christian-Democratic People's Party (Moldova)"] = {abbrev = "PPCD", color = "#8D8E56", shortname = "",},
["Christian-National Peasants' and Farmers' Party"] = {abbrev = "CNBL", color = "#7FCEB1", shortname = "",},
["Christian-Social People's Party (Liechtenstein)"] = {abbrev = "CSVP", color = "red", shortname = "",},
["Christians Against Abortion"] = {abbrev = "", color = "#000080", shortname = "",},
["Christians to the World"] = {abbrev = "", color = "#F2EA35", shortname = "",},
["Christlich Soziale Partei (Belgium)"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Chubut Action Party"] = {abbrev = "", color = "#0A1172", shortname = "",},
["Chubut Somos Todos"] = {abbrev = "", color = "#008E6F", shortname = "",},
["Chunta Aragonesista"] = {abbrev = "CHA", color = "#008A21", shortname = "",},
["Chuquisaca We Are All"] = {abbrev = "", color = "#ED8603", shortname = "",},
["Church of the Militant Elvis Party"] = {abbrev = "", color = "#FF00FF", shortname = "Church of the Militant Elvis",},
["Chure Bhawar Rastriya Ekta Party Nepal"] = {abbrev = "", color = "#F0FFF0", shortname = "Churebhawar Rastriya Ekta Party",},
["Cidadania"] = {abbrev = "", color = "#EC008C", shortname = "",},
["Ciervists"] = {abbrev = "", color = "#314F9D", shortname = "",},
["Circle of Liberal Reformers"] = {abbrev = "CLR", color = "#FE492E", shortname = "",},
["Circle of Rhine Party"] = {abbrev = "", color = "#4287f5", shortname = "",},
["Ciskei National Independence Party"] = {abbrev = "CNIP", color = "#0070BB", shortname = "",},
["Citizen Action of Ferrol"] = {abbrev = "", color = "#D9017A", shortname = "",},
["Citizen Alternative of Ponteareas"] = {abbrev = "", color = "#005747", shortname = "",},
["Citizen Alternative of Rubí"] = {abbrev = "", color = "#97C00E", shortname = "",},
["Citizen and Republican Movement"] = {abbrev = "MRC", color = "#DD391F", shortname = "",},
["Citizen Association Jesús Lara"] = {abbrev = "", color = "#F9CC67", shortname = "",},
["Citizen Convergence Movement"] = {abbrev = "", color = "#37960F", shortname = "",},
["Citizen Force"] = {abbrev = "", color = "#F5A23E", shortname = "",},
["Citizen Force (Colombia)"] = {abbrev = "", color = "#FA6709", shortname = "",},
["Citizen Force (Peru)"] = {abbrev = "FC", color = "#E30B5C", shortname = "",},
["Citizen Forum (Spain)"] = {abbrev = "", color = "#1E90FF", shortname = "",},
["Citizen Forum of Cáceres"] = {abbrev = "", color = "#7EBA00", shortname = "",},
["Citizen Forum of Jerez"] = {abbrev = "", color = "#005AD6", shortname = "",},
["Citizen Hope (Spain)"] = {abbrev = "", color = "#F89430", shortname = "",},
["Citizen Initiative for Development"] = {abbrev = "", color = "#102547", shortname = "",},
["Citizen Initiative for Paracuellos"] = {abbrev = "", color = "#94C11F", shortname = "",},
["Citizen Initiative of Puertollano"] = {abbrev = "", color = "#FE6400", shortname = "",},
["Citizen Left"] = {abbrev = "", color = "#BB98C7", shortname = "",},
["Citizen Movement of Soria"] = {abbrev = "", color = "#EC9F42", shortname = "",},
["Citizen Open Platform of Lalín"] = {abbrev = "", color = "#999999", shortname = "",},
["Citizen Option for Macedonia"] = {abbrev = "GROM", color = "#00FFF7", shortname = "",},
["Citizen Option"] = {abbrev = "OC", color = "#FED403", shortname = "",},
["Citizen Party"] = {abbrev = "", color = "#707070", shortname = "Citizen",},
["Citizen Platform for Sabadell"] = {abbrev = "", color = "#CD3037", shortname = "",},
["Citizen Power (political party)"] = {abbrev = "", color = "#412560", shortname = "Citizen Power",},
["Citizen Prosperity"] = {abbrev = "PC", color = "#FFDC2A", shortname = "",},
["Citizen Revolution"] = {abbrev = "RC", color = "#00B0F6", shortname = "",},
["Citizen Revolution Movement"] = {abbrev = "RC", color = "#00AEEF", shortname = "",},
["Citizen Unity"] = {abbrev = "", color = "#CCE35F", shortname = "",},
["Citizen's Coalition for Justice Party (Mongolia)"] = {abbrev = "", color = "#f26022", shortname = "",},
["Citizen's Decision"] = {abbrev = "", color = "#82bb29", shortname = "",},
["Citizen's Unity"] = {abbrev = "", color = "#009CDE", shortname = "",},
["Citizens (Chilean political party)"] = {abbrev = "", color = "#db8f16", shortname = "Citizens",},
["Citizens (Georgia)"] = {abbrev = "", color = "#8BC43F", shortname = "Citizens",},
["Citizens (Spanish political party)"] = {abbrev = "Cs", color = "#EB6109", shortname = "",},
["Citizens & Ratepayers"] = {abbrev = "", color = "#00529F", shortname = "",},
["Citizens Coalition for Change"] = {abbrev = "CCC", color = "#FAE64D", shortname = "",},
["Citizens for Arona"] = {abbrev = "", color = "#77777B", shortname = "",},
["Citizens for Benidorm"] = {abbrev = "", color = "#855794", shortname = "",},
["Citizens for Blank Votes"] = {abbrev = "", color = "#969696", shortname = "",},
["Citizens for Cádiz"] = {abbrev = "", color = "#5E89AA", shortname = "",},
["Citizens for Canarian Change"] = {abbrev = "", color = "#1A3F98", shortname = "",},
["Citizens for Change"] = {abbrev = "", color = "#FF2F00", shortname = "",},
["Citizens for Ciempozuelos"] = {abbrev = "", color = "#2A277E", shortname = "",},
["Citizens for San Fernando"] = {abbrev = "", color = "#000B6F", shortname = "",},
["Citizens for their People"] = {abbrev = "", color = "#046305", shortname = "",},
["Citizens in Rage"] = {abbrev = "", color = "#0000AA", shortname = "",},
["Citizens of Alcalá de Guadaíra"] = {abbrev = "", color = "#23BEDC", shortname = "",},
["Citizens of Burgos"] = {abbrev = "", color = "#CA2D29", shortname = "",},
["Citizens of Democratic Centre–Independent Candidacy"] = {abbrev = "", color = "#F67A32", shortname = "",},
["Citizens of Galicia Democratic Action"] = {abbrev = "", color = "#63A6C6", shortname = "",},
["Citizens of Galicia"] = {abbrev = "", color = "#0BB70B", shortname = "",},
["Citizens of Logroño"] = {abbrev = "", color = "#E88005", shortname = "",},
["Citizens of Lorca"] = {abbrev = "", color = "#0D086E", shortname = "",},
["Citizens of Menorca"] = {abbrev = "", color = "#FA8100", shortname = "",},
["Citizens of Santa Cruz"] = {abbrev = "", color = "#0194E4", shortname = "",},
["Citizens Party (Hong Kong)"] = {abbrev = "", color = "#000000", shortname = "Citizens",},
["Citizens Party (US)"] = {abbrev = "", color = "#00FF90", shortname = "Citizens",},
["Citizens, Inhabitants and People of Marbella"] = {abbrev = "", color = "#FF9D21", shortname = "",},
["Citizens' Action for Málaga"] = {abbrev = "", color = "#A94699", shortname = "",},
["Citizens' Action Party (Costa Rica)"] = {abbrev = "PAC", color = "#FFD700", shortname = "",},
["Citizens' Action Party"] = {abbrev = "", color = "#FFE902", shortname = "",},
["Citizens' Alliance (Cyprus)"] = {abbrev = "SYPOL", color = "#9AB973", shortname = "",},
["Citizens' Assembly for Torrelavega"] = {abbrev = "", color = "#2F6623", shortname = "",},
["Citizens' Battle Against Corruption"] = {abbrev = "CIBAC", color = "#FDCD01", shortname = "",},
["Citizens' Coalition"] = {abbrev = "MED", color = "#506d28", shortname = "",},
["Citizens' Compromise"] = {abbrev = "", color = "#A0BE00", shortname = "",},
["Citizens' Convergence of the South-East"] = {abbrev = "", color = "#0824AD", shortname = "",},
["Citizens' Democratic Renewal Movement"] = {abbrev = "", color = "#6B2484", shortname = "",},
["Citizens' Forces"] = {abbrev = "", color = "#4C4B51", shortname = "",},
["Citizens' Forum Austria"] = {abbrev = "FRITZ", color = "#E43226", shortname = "",},
["Citizens' Initiative (Andorra)"] = {abbrev = "IC", color = "#390037", shortname = "",},
["Citizens' List"] = {abbrev = "", color = "darkgray", shortname = "",},
["Citizens' Movement (Iceland)"] = {abbrev = "", color = "#FF8C00", shortname = "",},
["Citizens' Movement (Mexico)"] = {abbrev = "MC", color = "#FF8C00", shortname = "",},
["Citizens' Movement of Cartagena"] = {abbrev = "", color = "#87305B", shortname = "",},
["Citizens' Party (Finland)"] = {abbrev = "KP", color = "#2354A8", shortname = "Citizens' Party",},
["Citizens' Party (Iceland, 1923)"] = {abbrev = "", color = "#0026FF", shortname = "Citizens'",},
["Citizens' Party (Iceland, 1987)"] = {abbrev = "", color = "#000000", shortname = "Citizens'",},
["Citizens' Party for Revival"] = {abbrev = "", color = "yellow", shortname = "",},
["Citizens' Radio"] = {abbrev = "", color = "#ff7e22", shortname = "",},
["Citizens' Rights Association"] = {abbrev = "ADDC", color = "#FFC0CB", shortname = "",},
["Citizens' Union–Independent Progressives of Canaries"] = {abbrev = "", color = "#181C21", shortname = "",},
["City Fusion Party"] = {abbrev = "", color = "#CF9FFF", shortname = "City Fusion",},
["City Independents"] = {abbrev = "", color = "#FFC0CB", shortname = "",},
["City Vision (Auckland political ticket)"] = {abbrev = "", color = "#B3FFB3", shortname = "City Vision",},
["CiU Space"] = {abbrev = "", color = "#2849C8", shortname = "",},
["Ciutadella de Menorca People's Union"] = {abbrev = "", color = "#CA6601", shortname = "",},
["Cives"] = {abbrev = "", color = "#729E2A", shortname = "",},
["Civic 10"] = {abbrev = "", color = "#4BD9FD", shortname = "",},
["Civic Act-up"] = {abbrev = "", color = "#000000", shortname = "",},
["Civic Alliance of Serbia"] = {abbrev = "GSS", color = "orange", shortname = "",},
["Civic and Social Agreement"] = {abbrev = "", color = "#005599", shortname = "",},
["Civic and Social Front of Catamarca"] = {abbrev = "FCSC", color = "#009241", shortname = "",},
["Civic Autonomy Power"] = {abbrev = "CAP", color = "#6CC6CF", shortname = "",},
["Civic Choice"] = {abbrev = "", color = "#1560BD", shortname = "",},
["Civic Coalition (Poland)"] = {abbrev = "KO", color = "#F68F2D", shortname = "",},
["Civic Coalition ARI"] = {abbrev = "CC-ARI", color = "#6fb53e", shortname = "",},
["Civic Coalition"] = {abbrev = "", color = "#008080", shortname = "",},
["Civic Commitment"] = {abbrev = "", color = "#1E889D", shortname = "",},
["Civic Community"] = {abbrev = "", color = "#F26524", shortname = "",},
["Civic Conservative Party (Slovakia)"] = {abbrev = "OKS", color = "#A00000", shortname = "",},
["Civic Conservative Party"] = {abbrev = "", color = "#990000", shortname = "",},
["Civic Democratic Alliance"] = {abbrev = "ODA", color = "#0000FF", shortname = "",},
["Civic Democratic Forum"] = {abbrev = "GDF", color = "#272361", shortname = "",},
["Civic Democratic Party (Bosnia and Herzegovina)"] = {abbrev = "GDS", color = "#ffdf00", shortname = "",},
["Civic Democratic Party (Czech Republic)"] = {abbrev = "ODS", color = "#034EA2", shortname = "",},
["Civic Democratic Party (Hungary)"] = {abbrev = "", color = "#96825A", shortname = "Civic Democratic",},
["Civic Democratic Party (Lithuania)"] = {abbrev = "PDP", color = "#023366", shortname = "",},
["Civic Democratic Union (Slovakia)"] = {abbrev = "", color = "#553D73", shortname = "",},
["Civic Force"] = {abbrev = "", color = "#3183CD", shortname = "",},
["Civic Forum (Central African Republic)"] = {abbrev = "", color = "#008080", shortname = "",},
["Civic Forum"] = {abbrev = "OF", color = "#386bA5", shortname = "",},
["Civic Freedom Party"] = {abbrev = "", color = "yellow", shortname = "Civic Freedom",},
["Civic Front (Córdoba)"] = {abbrev = "", color = "#FF6600", shortname = "",},
["Civic Front for Santiago"] = {abbrev = "", color = "#FF0080", shortname = "",},
["Civic Initiative of Gora"] = {abbrev = "", color = "#82D1F7", shortname = "",},
["Civic Initiative"] = {abbrev = "", color = "#1B3E89", shortname = "",},
["Civic League"] = {abbrev = "", color = "#B8BFFE", shortname = "",},
["Civic Liberal Alliance"] = {abbrev = "", color = "#067CBF", shortname = "",},
["Civic List (Slovenia)"] = {abbrev = "", color = "#0067A5", shortname = "",},
["Civic Movement"] = {abbrev = "OH", color = "#423F83", shortname = "",},
["Civic Party of Kazakhstan"] = {abbrev = "", color = "#2f2f2f", shortname = "",},
["Civic Party of Montenegro"] = {abbrev = "GPCG", color = "#2554C7", shortname = "",},
["Civic Party"] = {abbrev = "", color = "#7F3F98", shortname = "Civic",},
["Civic Passion–Proletariat Political Institute–Hong Kong Resurgence Order"] = {abbrev = "CP/PPI/HKRO", color = "#FBDD07", shortname = "",},
["Civic Passion"] = {abbrev = "", color = "#FBDD07", shortname = "",},
["Civic Platform (Russia)"] = {abbrev = "", color = "#420F77", shortname = "Civic Platform",},
["Civic Platform (Serbia)"] = {abbrev = "GP", color = "#002899", shortname = "",},
["Civic Platform"] = {abbrev = "PO", color = "#F68F2D", shortname = "",},
["Civic Renovation Party"] = {abbrev = "", color = "#183b69", shortname = "",},
["Civic Renewal Party"] = {abbrev = "PRC", color = "dodgerblue", shortname = "",},
["Civic Response"] = {abbrev = "PV", color = "#AE413A", shortname = "",},
["Civic Solidarity of Alicante"] = {abbrev = "", color = "#FFF200", shortname = "",},
["Civic Solidarity Party"] = {abbrev = "", color = "#0F88C9", shortname = "Civic Solidarity",},
["Civic Union (Latvia)"] = {abbrev = "", color = "#9e1b34", shortname = "",},
["Civic Union (Russia)"] = {abbrev = "", color = "#F73239", shortname = "Civic Union",},
["Civic Union (Uruguay)"] = {abbrev = "", color = "white", shortname = "Civic Union",},
["Civic Union"] = {abbrev = "", color = "#AB3C20", shortname = "",},
["Civic United Front"] = {abbrev = "CUF", color = "#0293E2", shortname = "",},
["Civic Unity Party (Azerbaijan)"] = {abbrev = "", color = "#F29923", shortname = "",},
["Civics of Italy"] = {abbrev = "CdI", color = "#5683B3", shortname = "",},
["Civil Alliance (Argentina)"] = {abbrev = "", color = "#F69A69", shortname = "Civil Alliance",},
["Civil Contract (Armenia)"] = {abbrev = "", color = "#5169B1", shortname = "Civil Contract",},
["Civil Democratic Alliance"] = {abbrev = "", color = "orange", shortname = "",},
["Civil Force"] = {abbrev = "", color = "#00a754", shortname = "",},
["Civil Liberties Party"] = {abbrev = "", color = "#0038A5", shortname = "",},
["Civil Movement"] = {abbrev = "CM", color = "#80BB3D", shortname = "",},
["Civil Party (Costa Rica)"] = {abbrev = "", color = "#C61318", shortname = "Civil",},
["Civil Party (Taiwan)"] = {abbrev = "", color = "red", shortname = "",},
["Civil Position"] = {abbrev = "", color = "#FFDD00", shortname = "",},
["Civil Response"] = {abbrev = "", color = "#AE413A", shortname = "",},
["Civil Revolution"] = {abbrev = "", color = "#FF6600", shortname = "",},
["Civil Rights Movement"] = {abbrev = "", color = "#000000", shortname = "",},
["Civil Rights Party (South Korea)"] = {abbrev = "CRP", color = "#4CA459", shortname = "Civil Rights",},
["Civil Rule Party"] = {abbrev = "CRP", color = "#FFD700", shortname = "Civil Rule",},
["Civil Society and Democracy"] = {abbrev = "", color = "#94969C", shortname = "",},
["Civil Watch"] = {abbrev = "", color = "#FF007F", shortname = "",},
["Civil Will–Green Party"] = {abbrev = "", color = "#027E40", shortname = "Civil Will-Green",},
["Civilian Power"] = {abbrev = "GS", color = "#00A650", shortname = "",},
["Civilista Party"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Civiqus"] = {abbrev = "", color = "#047235", shortname = "",},
["Civis (Montenegro)"] = {abbrev = "", color = "#D7D501", shortname = "",},
["Clann Éireann"] = {abbrev = "CÉ", color = "#228B22", shortname = "Clann Éireann",},
["Clann na Poblachta"] = {abbrev = "CnaP", color = "#DDFFDD", shortname = "Clann na Poblachta",},
["Clann na Talmhan"] = {abbrev = "CnaT", color = "#BDB76B", shortname = "Clann na Talmhan",},
["CLARO (political party)"] = {abbrev = "", color = "#314A82", shortname = "",},
["Class Action Reform Movement"] = {abbrev = "", color = "#000000", shortname = "CARM",},
["Class War"] = {abbrev = "", color = "Black", shortname = "",},
["Classical Liberal Party (Sweden)"] = {abbrev = "KLP", color = "#FFDF00", shortname = "",},
["Clause 28 Children's Protection Christian Democrats"] = {abbrev = "", color = "#bc8f8f", shortname = "Clause 28",},
["Clean Chile, Vote Happy"] = {abbrev = "", color = "green", shortname = "",},
["Clichy Club"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Climat Québec"] = {abbrev = "", color = "#0E9D0D", shortname = "",},
["Climate Party"] = {abbrev = "", color = "#36D0B6", shortname = "Climate",},
["Clive Palmer's United Australia Party"] = {abbrev = "UAP", color = "#FFED00", shortname = "",},
["Club 2002 – Party for the Unity and the Republic"] = {abbrev = "Club 2002-PUR", color = "#73160F", shortname = "Club 2002",},
["Club of Committed Non-Party Members"] = {abbrev = "KAN", color = "#10547d", shortname = "",},
["Clydesdale and South Scotland Independent"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Co-operative Party"] = {abbrev = "", color = "#3F1D70", shortname = "",},
["Co-operative Resources Centre"] = {abbrev = "CRC", color = "#DD6A45", shortname = "",},
["Coalició Compromís"] = {abbrev = "Compromís", color = "#EC8953", shortname = "",},
["Coalition (Australia)"] = {abbrev = "", color = "#00557C", shortname = "Coalition",},
["Coalition (Chile)"] = {abbrev = "", color = "blue", shortname = "",},
["Coalition Conservative"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Coalition for a New Socialist Party"] = {abbrev = "", color = "#D82E1E", shortname = "",},
["Coalition for a Solidary Europe"] = {abbrev = "", color = "#00309A", shortname = "",},
["Coalition for Cáceres"] = {abbrev = "", color = "#BE1C2B", shortname = "",},
["Coalition for Cayman"] = {abbrev = "C4C", color = "#0c1c47", shortname = "",},
["Coalition for Change"] = {abbrev = "", color = "Steelblue", shortname = "",},
["Coalition for Change (Sierra Leone)"] = {abbrev = "", color = "#FFAB3D", shortname = "",},
["Coalition for Democratic Change"] = {abbrev = "CDC", color = "#183883", shortname = "",},
["Coalition for El Bierzo"] = {abbrev = "", color = "#68A0D6", shortname = "",},
["Coalition for Europe"] = {abbrev = "", color = "#2D0680", shortname = "",},
["Coalition for Gran Canaria"] = {abbrev = "", color = "#0F47AF", shortname = "",},
["Coalition for L'Hospitalet"] = {abbrev = "", color = "#C32C25", shortname = "",},
["Coalition for Melilla"] = {abbrev = "CpM", color = "#298642", shortname = "",},
["Coalition for Peace and Tolerance"] = {abbrev = "KZMT", color = "#5D689C", shortname = "",},
["Coalition for Reform Party"] = {abbrev = "CRP", color = "#3AEB2A", shortname = "",},
["Coalition for Reforms and Democracy"] = {abbrev = "CORD", color = "#F6A438", shortname = "",},
["Coalition for the Balearics"] = {abbrev = "", color = "#692647", shortname = "",},
["Coalition for the Good of All"] = {abbrev = "CBT", color = "#FFCB01", shortname = "",},
["Coalition for Unity and Democracy"] = {abbrev = "", color = "blue", shortname = "",},
["Coalition Labour"] = {abbrev = "", color = "#e0afaf", shortname = "",},
["Coalition Movement"] = {abbrev = "", color = "#00CED1", shortname = "",},
["Coalition National Democratic and Labour Party"] = {abbrev = "", color = "#FFDEAD", shortname = "Coalition National Democratic",},
["Coalition of Democrats (Zimbabwe)"] = {abbrev = "CODE", color = "#ADD8E6", shortname = "",},
["Coalition of Democratic Forces (Kazakhstan)"] = {abbrev = "DKK", color = "#9A6DC0", shortname = "",},
["Coalition of Ethiopian Federalist Forces"] = {abbrev = "", color = "#4398B4", shortname = "",},
["Coalition of Independents"] = {abbrev = "COI", color = "#5ce1e6", shortname = "",},
["Coalition of Islamic Parties"] = {abbrev = "CIP", color = "", shortname = "",},
["Coalition of People's Accord"] = {abbrev = "KNS", color = "#ffe01c", shortname = "",},
["Coalition of Progressive Organizations"] = {abbrev = "", color = "#394184", shortname = "",},
["Coalition of the Left and the Progress"] = {abbrev = "", color = "#FFD000", shortname = "Coalition of the Left (SYN)",},
["Coalition of the Left of Movements and Ecology"] = {abbrev = "", color = "#FFD000", shortname = "Coalition of the Left (SYN)",},
["Coalition of the Pleasant Scent of Servitude"] = {abbrev = "CPSS", color = "blue", shortname = "",},
["Coalition Party (Norway)"] = {abbrev = "", color = "#99EDBD", shortname = "Coalition",},
["Coalition Together"] = {abbrev = "", color = "#1F8C87", shortname = "Together",},
["Coastal Party"] = {abbrev = "", color = "#00ad8e", shortname = "Coastal",},
["Cochinchinese Democratic Party"] = {abbrev = "", color = "#E3FF2A", shortname = "",},
["Code Orange (political party)"] = {abbrev = "", color = "#EF7601", shortname = "Code Orange",},
["Coexistence (political party)"] = {abbrev = "", color = "#32CD32", shortname = "",},
["Colère et espoir"] = {abbrev = "", color = "#BB0000", shortname = "",},
["Collectif Des Inkoruptibles"] = {abbrev = "", color = "#FFBF60", shortname = "",},
["Colombia First"] = {abbrev = "", color = "#800080", shortname = "",},
["Colombia Has a Future"] = {abbrev = "CFT", color = "#32CD32", shortname = "",},
["Colombia Justa Libres"] = {abbrev = "CJL", color = "#C29B61", shortname = "",},
["Colombian Communist Party"] = {abbrev = "", color = "#DA251D", shortname = "",},
["Colombian Community and Communal Political Movement"] = {abbrev = "MCCC", color = "#F5EC49", shortname = "",},
["Colombian Conservative Party"] = {abbrev = "", color = "#1935D0", shortname = "Conservative",},
["Colombian Liberal Party"] = {abbrev = "", color = "#FF3333", shortname = "Liberal",},
["Colorado Party (Paraguay)"] = {abbrev = "", color = "#EE1D23", shortname = "Colorado",},
["Colorado Party (Uruguay)"] = {abbrev = "", color = "#BB0000", shortname = "Colorado Party",},
["Colored Republican Party"] = {abbrev = "", color = "#FF5600", shortname = "Colored Republican",},
["Combatant Clergy Association"] = {abbrev = "CCA", color = "#009900", shortname = "",},
["Combatants' Party"] = {abbrev = "PdC", color = "#8B4513", shortname = "",},
["Come Venezuela"] = {abbrev = "VV", color = "#00BFFF", shortname = "",},
["Comité d'Action Musulman"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Comités Jeanne"] = {abbrev = "", color = "#202F55", shortname = "",},
["Commitment for Caspe"] = {abbrev = "", color = "#ED750E", shortname = "",},
["Commitment to Cantabria"] = {abbrev = "", color = "#28734C", shortname = "",},
["Commitment to Europe"] = {abbrev = "", color = "#E7995C", shortname = "",},
["Commitment to Galicia"] = {abbrev = "", color = "#087D42", shortname = "",},
["Commitment to Gran Canaria"] = {abbrev = "", color = "#8AAD53", shortname = "",},
["Commitment to Torrevieja"] = {abbrev = "", color = "#266E87", shortname = "",},
["Commitment with Aragon"] = {abbrev = "", color = "#ECD807", shortname = "",},
["Commitment, Renewal and Order"] = {abbrev = "CREO", color = "#FDAF17", shortname = "",},
["Committed Citizens"] = {abbrev = "CC", color = "#63277F", shortname = "",},
["Committee for a Worker's International (Ireland)"] = {abbrev = "", color = "#DC241F", shortname = "CWI (Ireland)",},
["Committee for Another Policy"] = {abbrev = "", color = "red", shortname = "",},
["Committee for the Defence of the Republic"] = {abbrev = "CDR", color = "#264E4E", shortname = "",},
["Committee of Freedom"] = {abbrev = "CdL", color = "#C71585", shortname = "",},
["Committee of National Unity"] = {abbrev = "", color = "#B93434", shortname = "",},
["Committees for the Defense of the Revolution"] = {abbrev = "CDR", color = "", shortname = "",},
["Common Action Political Party — Civil Congress"] = {abbrev = "PAC–CC", color = "#EF7F1A", shortname = "",},
["Common Alternative Revolutionary Force"] = {abbrev = "FARC", color = "#AF1120", shortname = "",},
["Common Choice"] = {abbrev = "", color = "#ED1B30", shortname = "",},
["Common Course"] = {abbrev = "", color = "#AD3801", shortname = "",},
["Common Force"] = {abbrev = "", color = "#ED5C3E", shortname = "",},
["Common Ground Alliance"] = {abbrev = "", color = "#005B54", shortname = "Common Ground",},
["Common Man's Front"] = {abbrev = "", color = "#00008B", shortname = "",},
["Common Sense (political party)"] = {abbrev = "", color = "#1a6862", shortname = "Common Sense",},
["Common Sense Party (UK)"] = {abbrev = "", color = "#FFFFFF", shortname = "Common Sense",},
["Common Wealth Party"] = {abbrev = "", color = "#ff7f50", shortname = "Common Wealth",},
["Commoner Party of Thailand"] = {abbrev = "", color = "#FF4500", shortname = "",},
["Commoners' Land"] = {abbrev = "TC–PNC", color = "#7A76B4", shortname = "",},
["Commoners' Party (Thailand)"] = {abbrev = "", color = "#000000", shortname = "",},
["Commons (Chilean political party)"] = {abbrev = "", color = "#461D3D", shortname = "",},
["Commons (Colombian political party)"] = {abbrev = "", color = "#AF1120", shortname = "Commons",},
["Commonwealth Labour Party"] = {abbrev = "ComLab", color = "#b22222", shortname = "Commonwealth Labour",},
["Commonwealth Land Party (US)"] = {abbrev = "", color = "#4C915F", shortname = "Commonwealth Land",},
["Commonwealth Liberal Party"] = {abbrev = "", color = "#8CB4D2", shortname = "Commonwealth Liberal",},
["Commonwealth Party (Gibraltar)"] = {abbrev = "", color = "#CE0F25", shortname = "Commonwealth",},
["Communal Democracy Party"] = {abbrev = "TDP", color = "#0D1AAF", shortname = "",},
["Communal Liberation Party"] = {abbrev = "TKP", color = "red", shortname = "",},
["Communal Liberation Party New Forces"] = {abbrev = "TKP-YG", color = "#E3000D", shortname = "",},
["Communist Alternative Party"] = {abbrev = "", color = "maroon", shortname = "",},
["Communist Archio-Marxist Party of Greece"] = {abbrev = "KAKE", color = "red", shortname = "",},
["Communist Collective of Catalonia"] = {abbrev = "", color = "#B82E35", shortname = "",},
["Communist League (New Zealand)"] = {abbrev = "", color = "#dd0048", shortname = "Communist League",},
["Communist League (Sweden)"] = {abbrev = "", color = "red", shortname = "",},
["Communist League (UK, 1988)"] = {abbrev = "", color = "#C71585", shortname = "Communist League",},
["Communist League of Great Britain"] = {abbrev = "", color = "red", shortname = "Communist League",},
["Communist League of Luxemburg"] = {abbrev = "", color = "red", shortname = "",},
["Communist League of West Germany"] = {abbrev = "KBW", color = "red", shortname = "",},
["Communist Marxist Party (John)"] = {abbrev = "", color = "#EE0000", shortname = "",},
["Communist Marxist Party"] = {abbrev = "CMP", color = "#FF0000", shortname = "",},
["Communist Movement (Spain)"] = {abbrev = "", color = "#BF4249", shortname = "",},
["Communist Movement of Turkey"] = {abbrev = "TKH", color = "#990000", shortname = "",},
["Communist Organization of Spain (Red Flag)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Communist Party"] = {abbrev = "", color = "#D50000", shortname = "Communist",},
["Communist Party (Argentina)"] = {abbrev = "PC", color = "#FF0000", shortname = "Communist Party",},
["Communist Party (bolsheviks) of Lithuania and Belorussia"] = {abbrev = "LBSSR", color = "#CC0000", shortname = "",},
["Communist Party (Bolsheviks) of Ukraine"] = {abbrev = "", color = "#DD0000", shortname = "Communist Party",},
["Communist Party (Bosnia and Herzegovina)"] = {abbrev = "", color = "red", shortname = "Communist Party",},
["Communist Party (Denmark)"] = {abbrev = "", color = "#FF0000", shortname = "Communist Party",},
["Communist Party (Italy)"] = {abbrev = "", color = "#F00000", shortname = "Communist Party",},
["Communist Party (Serbia)"] = {abbrev = "", color = "#C6363C", shortname = "Communist Party",},
["Communist Party (Sweden)"] = {abbrev = "", color = "#D91A12", shortname = "Communist",},
["Communist Party (Turkey, 2014)"] = {abbrev = "", color = "#c00", shortname = "Communist",},
["Communist Party (UK)"] = {abbrev = "", color = "red", shortname = "Communist",},
["Communist Party (US)"] = {abbrev = "CPUSA", color = "#D50000", shortname = "Communist",},
["Communist Party in Denmark"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Communist Party of Albania (1991)"] = {abbrev = "", color = "#E61919", shortname = "",},
["Communist Party of Aragon (1980)"] = {abbrev = "", color = "#C5000F", shortname = "",},
["Communist Party of Argentina (Extraordinary Congress)"] = {abbrev = "", color = "#E0040B", shortname = "",},
["Communist Party of Argentina"] = {abbrev = "", color = "#E22928", shortname = "",},
["Communist Party of Artsakh"] = {abbrev = "", color = "#FF1111", shortname = "",},
["Communist Party of Australia"] = {abbrev = "CPA", color = "#CD2027", shortname = "Communist",},
["Communist Party of Australia (1971)"] = {abbrev = "CPA", color = "#CD2027", shortname = "Communist",},
["Communist Party of Australia (Marxist–Leninist)"] = {abbrev = "CPA", color = "#CD2027", shortname = "Communist",},
["Communist Party of Austria"] = {abbrev = "KPÖ", color = "#AA0000", shortname = "",},
["Communist Party of Bangladesh (Marxist–Leninist) (Barua)"] = {abbrev = "CPB (M-L)", color = "#FB6F76", shortname = "",},
["Communist Party of Bangladesh"] = {abbrev = "CPB", color = "#E91621", shortname = "",},
["Communist Party of Belarus"] = {abbrev = "CPB", color = "#D30400", shortname = "",},
["Communist Party of Belgium (1989)"] = {abbrev = "", color = "red", shortname = "Communist",},
["Communist Party of Benin"] = {abbrev = "", color = "#B22222", shortname = "",},
["Communist Party of Bohemia and Moravia"] = {abbrev = "KSČM", color = "#FF0000", shortname = "",},
["Communist Party of Bolivia (Marxist–Leninist)"] = {abbrev = "", color = "#C9021A", shortname = "",},
["Communist Party of Bolivia"] = {abbrev = "", color = "red", shortname = "",},
["Communist Party of Brazil"] = {abbrev = "PCdoB", color = "#820000", shortname = "",},
["Communist Party of Britain (Marxist–Leninist)"] = {abbrev = "", color = "#EE1F23", shortname = "Communist (ML)",},
["Communist Party of Britain"] = {abbrev = "", color = "#F93822", shortname = "Communist",},
["Communist Party of Bulgaria"] = {abbrev = "CPB", color = "#B20406", shortname = "",},
["Communist Party of Byelorussia"] = {abbrev = "CPB", color = "#DC143C", shortname = "",},
["Communist Party of Canada (Marxist–Leninist)"] = {abbrev = "", color = "#F5191A", shortname = "Marxist–Leninist",},
["Communist Party of Canada"] = {abbrev = "", color = "#FF6347", shortname = "Communist",},
["Communist Party of Chile"] = {abbrev = "", color = "#B22222", shortname = "Communist",},
["Communist Party of Cuba"] = {abbrev = "PCC", color = "#CE2029", shortname = "",},
["Communist Party of Czechoslovakia"] = {abbrev = "KSČ", color = "#DC241F", shortname = "",},
["Communist Party of Denmark"] = {abbrev = "", color = "#A52A2A", shortname = "Communists",},
["Communist Party of Denmark/Marxist–Leninists"] = {abbrev = "DKP/ML", color = "red", shortname = "",},
["Communist Party of Ecuador"] = {abbrev = "", color = "#da251d", shortname = "",},
["Communist Party of England (Marxist-Leninist)"] = {abbrev = "", color = "#660000", shortname = "Marxist-Leninist (England)",},
["Communist Party of Finland (1994)"] = {abbrev = "SKP", color = "#8B0000", shortname = "Communist Party of Finland",},
["Communist Party of Finland"] = {abbrev = "", color = "#DA2301", shortname = "Communist Party",},
["Communist Party of Georgia (Soviet Union)"] = {abbrev = "SKP", color = "#CD0000", shortname = "",},
["Communist Party of Georgia"] = {abbrev = "", color = "red", shortname = "",},
["Communist Party of Germany (1990)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Communist Party of Germany"] = {abbrev = "KPD", color = "#8B0000", shortname = "",},
["Communist Party of Germany/Marxists–Leninists"] = {abbrev = "KPD/ML", color = "red", shortname = "",},
["Communist Party of Great Britain (Marxist–Leninist)"] = {abbrev = "", color = "#FF0000", shortname = "Communist GB (ML)",},
["Communist Party of Great Britain (Provisional Central Committee)"] = {abbrev = "", color = "red", shortname = "Communist (PCC)",},
["Communist Party of Great Britain"] = {abbrev = "", color = "red", shortname = "Communist",},
["Communist Party of Greece (Interior)"] = {abbrev = "", color = "red", shortname = "KKE Interior",},
["Communist Party of Greece (Marxist–Leninist)"] = {abbrev = "KKE-M-L", color = "#960018", shortname = "",},
["Communist Party of Greece"] = {abbrev = "KKE", color = "#e30301", shortname = "",},
["Communist Party of Iceland"] = {abbrev = "", color = "#FF0000", shortname = "Communist",},
["Communist Party of Iceland (Marxist–Leninist)"] = {abbrev = "", color = "red", shortname = "Communist (M-L)",},
["Communist Party of India (Marxist-Leninist) (Kanu Sanyal)"] = {abbrev = "CPI(M-L)", color = "#FF0000", shortname = "",},
["Communist Party of India (Marxist-Leninist)"] = {abbrev = "CPI(ML)", color = "#FF0000", shortname = "",},
["Communist Party of India (Marxist–Leninist) Liberation"] = {abbrev = "CPI(ML)L", color = "#C41301", shortname = "",},
["Communist Party of India (Marxist–Leninist) Red Star"] = {abbrev = "CPI(ML) Red Star", color = "red", shortname = "",},
["Communist Party of India (Marxist)"] = {abbrev = "CPI(M)", color = "#FF1D15", shortname = "",},
["Communist Party of India"] = {abbrev = "CPI", color = "#e70d21", shortname = "",},
["Communist Party of Indonesia"] = {abbrev = "", color = "#ED3237", shortname = "Communist",},
["Communist Party of Ireland (Marxist–Leninist)"] = {abbrev = "", color = "#660000", shortname = "Marxist–Leninist (Ireland)",},
["Communist Party of Ireland"] = {abbrev = "", color = "#E3170D", shortname = "Communist",},
["Communist Party of Italy"] = {abbrev = "", color = "#C72F35", shortname = "",},
["Communist Party of Kampuchea"] = {abbrev = "", color = "#E61919", shortname = "",},
["Communist Party of Kazakhstan"] = {abbrev = "", color = "#D40000", shortname = "Communist Party",},
["Communist Party of Kenya"] = {abbrev = "", color = "#D40000", shortname = "",},
["Communist Party of Korea"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Communist Party of Kurdistan – Iraq"] = {abbrev = "", color = "#dd0000", shortname = "",},
["Communist Party of Kurdistan (Turkey)"] = {abbrev = "KKP", color = "#DA221C", shortname = "",},
["Communist Party of Kyrgyzstan"] = {abbrev = "", color = "#B22222", shortname = "",},
["Communist Party of Latvia"] = {abbrev = "", color = "#D40000", shortname = "",},
["Communist Party of Lithuania"] = {abbrev = "LKP", color = "#D1020A", shortname = "",},
["Communist Party of Luxembourg"] = {abbrev = "KPL", color = "#CC0000", shortname = "",},
["Communist Party of Macedonia (1992)"] = {abbrev = "KPM", color = "red", shortname = "",},
["Communist Party of Malta"] = {abbrev = "", color = "Red", shortname = "",},
["Communist Party of Mexico (Marxist–Leninist)"] = {abbrev = "", color = "#FE3A22", shortname = "",},
["Communist Party of Moldavia"] = {abbrev = "PCM", color = "#DF0000", shortname = "",},
["Communist Party of National Liberation"] = {abbrev = "", color = "#D00620", shortname = "",},
["Communist Party of Nepal (Maoist) (1994)"] = {abbrev = "", color = "#8B0000", shortname = "CPN (Maoist)",},
["Communist Party of Nepal (Maoist Centre)"] = {abbrev = "CPN (MC)", color = "#8B0000", shortname = "Maoist Centre",},
["Communist Party of Nepal (Marxist–Leninist) (2002)"] = {abbrev = "", color = "indianred", shortname = "",},
["Communist Party of Nepal (Marxist) (1991–2005)"] = {abbrev = "", color = "crimson", shortname = "CPN (Marxist)",},
["Communist Party of Nepal (Unified Marxist–Leninist)"] = {abbrev = "UML", color = "#DC241F", shortname = "CPN (UML)",},
["Communist Party of Nepal (Unified Socialist)"] = {abbrev = "CPN (US)", color = "#f4230c", shortname = "Unified Socialist",},
["Communist Party of Nepal (Unified)"] = {abbrev = "", color = "#ff007f", shortname = "CPN (Unified)",},
["Communist Party of Nepal (United Marxist)"] = {abbrev = "", color = "crimson", shortname = "CPN (United Marxist)",},
["Communist Party of Nepal (United) (1991–2005)"] = {abbrev = "", color = "red", shortname = "",},
["Communist Party of Nepal (United)"] = {abbrev = "", color = "palevioletred", shortname = "CPN (United)",},
["Communist Party of Nepal (Unity Centre)"] = {abbrev = "", color = "Red", shortname = "",},
["Communist party of Nepal (Unity National Campaign)"] = {abbrev = "CPN (UNC)", color = "#FF0000", shortname = "Unity Campaign",},
["Communist Party of New Zealand"] = {abbrev = "", color = "#800000", shortname = "Communist",},
["Communist Party of Nicaragua"] = {abbrev = "", color = "red", shortname = "",},
["Communist Party of Northern Ireland"] = {abbrev = "", color = "red", shortname = "Communist (NI)",},
["Communist Party of Norway"] = {abbrev = "", color = "#990000", shortname = "Communist",},
["Communist Party of Poland"] = {abbrev = "KPP", color = "#E20001", shortname = "",},
["Communist Party of Réunion"] = {abbrev = "PCR", color = "#DD0000", shortname = "",},
["Communist Party of Revolutionary Marxists"] = {abbrev = "CPRM", color = "#FF0000", shortname = "",},
["Communist Party of Scotland"] = {abbrev = "", color = "red", shortname = "Communist (Scotland)",},
["Communist Party of Slovakia – 91"] = {abbrev = "", color = "red", shortname = "",},
["Communist Party of Slovakia (1939)"] = {abbrev = "KSS", color = "#8B0000", shortname = "",},
["Communist Party of Slovakia"] = {abbrev = "KSS", color = "#e70101", shortname = "",},
["Communist Party of South Ossetia"] = {abbrev = "HIKP", color = "#CA0808", shortname = "",},
["Communist Party of Spain (Marxist–Leninist)"] = {abbrev = "", color = "#DF0020", shortname = "",},
["Communist Party of Spain (Marxist–Leninist) (historical)"] = {abbrev = "", color = "#CD5C5C", shortname = "",},
["Communist Party of Spain"] = {abbrev = "PCE", color = "#971324", shortname = "",},
["Communist Party of Sri Lanka"] = {abbrev = "", color = "#FF0000", shortname = "Communist Party",},
["Communist Party of Sweden (1921-1967)"] = {abbrev = "", color = "#b00000", shortname = "Communist",},
["Communist Party of Sweden (1924)"] = {abbrev = "", color = "#800000", shortname = "Höglund Communist",},
["Communist Party of Sweden (1967)"] = {abbrev = "", color = "red", shortname = "Communist",},
["Communist Party of Sweden (1995)"] = {abbrev = "", color = "#990000", shortname = "Communist - APK",},
["Communist Party of Sweden (Kilbommare)"] = {abbrev = "", color = "#b00000", shortname = "Kilbommare Communist",},
["Communist Party of Switzerland"] = {abbrev = "", color = "#D50000", shortname = "Communist",},
["Communist Party of Tajikistan"] = {abbrev = "", color = "#D91D1D", shortname = "Communist",},
["Communist Party of the Basque Homelands"] = {abbrev = "PCTV/EHAK", color = "#800118", shortname = "",},
["Communist Party of the Donetsk People's Republic"] = {abbrev = "", color = "#CF0A13", shortname = "",},
["Communist Party of the Netherlands"] = {abbrev = "CPN", color = "#BB5555", shortname = "",},
["Communist Party of the Peoples of Spain"] = {abbrev = "", color = "#D1141A", shortname = "",},
["Communist Party of the Philippines"] = {abbrev = "CPP", color = "#FF0000", shortname = "",},
["Communist Party of the Russian Federation"] = {abbrev = "", color = "#CC1111", shortname = "Communist",},
["Communist Party of the Russian Soviet Federative Socialist Republic"] = {abbrev = "", color = "#CD0000", shortname = "",},
["Communist Party of the Soviet Union"] = {abbrev = "CPSU", color = "#D40000", shortname = "",},
["Communist Party of the Workers of Spain"] = {abbrev = "", color = "#CD0711", shortname = "",},
["Communist Party of Turkey (modern)"] = {abbrev = "TKP", color = "#A63931", shortname = "",},
["Communist Party of Ukraine (renewed)"] = {abbrev = "KPU(o)", color = "red", shortname = "",},
["Communist Party of Ukraine (Soviet Union)"] = {abbrev = "CPU", color = "#CD0000", shortname = "",},
["Communist Party of Ukraine"] = {abbrev = "KPU", color = "#B70100", shortname = "",},
["Communist Party of Uruguay"] = {abbrev = "", color = "#123E89", shortname = "",},
["Communist Party of Uzbekistan (1994)"] = {abbrev = "", color = "#CC0000", shortname = "",},
["Communist Party of Venezuela"] = {abbrev = "", color = "#8B0000", shortname = "",},
["Communist Party of Vietnam"] = {abbrev = "", color = "#EA0504", shortname = "Communist Party",},
["Communist Party of Workers and Peasants"] = {abbrev = "KPRS", color = "#f31206", shortname = "Communist Party",},
["Communist Party Opposition (Switzerland)"] = {abbrev = "KPO", color = "#FF0000", shortname = "",},
["Communist Party USA"] = {abbrev = "", color = "#D50000", shortname = "Communist",},
["Communist People's Party of Kazakhstan"] = {abbrev = "QKHP", color = "#D5271E", shortname = "",},
["Communist Refoundation Party"] = {abbrev = "PRC", color = "#A1292F", shortname = "",},
["Communist Unification of Spain"] = {abbrev = "", color = "#EF2808", shortname = "",},
["Communist Vanguard of the Revolutionary Workers' Party"] = {abbrev = "", color = "#aa0000", shortname = "",},
["Communist Workers League (Spain)"] = {abbrev = "", color = "#B1343A", shortname = "",},
["Communist Workers' Party – For Peace and Socialism"] = {abbrev = "KTP", color = "#FF4D00", shortname = "",},
["Communist Workers Party (Denmark)"] = {abbrev = "KAP", color = "#de0000", shortname = "",},
["Communist Workers Party of Turkey"] = {abbrev = "", color = "#CB2027", shortname = "",},
["Communist"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Communistes"] = {abbrev = "", color = "#BB0000", shortname = "",},
["Communists and Allies"] = {abbrev = "COM", color = "#990000", shortname = "",},
["Communists of Catalonia"] = {abbrev = "", color = "#CC082D", shortname = "",},
["Communists of Russia"] = {abbrev = "CPCR", color = "#D71A21", shortname = "",},
["Communities & Residents"] = {abbrev = "", color = "#0066CC", shortname = "",},
["Communities United Party"] = {abbrev = "", color = "Orange", shortname = "Communities United",},
["Community Action Party"] = {abbrev = "", color = "#33FF33", shortname = "Community Action",},
["Community Alliance"] = {abbrev = "", color = "#1E4399", shortname = "",},
["Community Campaign (Hart)"] = {abbrev = "CCH", color = "#8d19ff", shortname = "",},
["Community Democrats of Ireland"] = {abbrev = "CDI", color = "#9FE2BF", shortname = "Community Democrats",},
["Community for Social Justice People's Party"] = {abbrev = "KTI", color = "#1C39BB", shortname = "",},
["Community Group"] = {abbrev = "", color = "#808080", shortname = "",},
["Community Integration Party"] = {abbrev = "", color = "#0869AD", shortname = "",},
["Community March"] = {abbrev = "", color = "#BDDC06", shortname = "",},
["Community Movement"] = {abbrev = "", color = "#800080", shortname = "",},
["Community Municipalist Party"] = {abbrev = "PMC", color = "#000000", shortname = "",},
["Community of the Lipovan Russians in Romania"] = {abbrev = "ORL", color = "#DA7C3E", shortname = "",},
["Community Performance First"] = {abbrev = "", color = "yellowgreen", shortname = "",},
["Community Representatives"] = {abbrev = "", color = "#FF719D", shortname = "Community Representative",},
["Community Sha Tin"] = {abbrev = "", color = "#00B2BD", shortname = "",},
["Comorian Democratic Union"] = {abbrev = "UDC", color = "#008000", shortname = "",},
["Comorian Union for Progress"] = {abbrev = "UCP", color = "#77BC11", shortname = "",},
["Compatriots of South Africa"] = {abbrev = "", color = "#98E03A", shortname = "",},
["Compostela Aberta"] = {abbrev = "", color = "#69C8EC", shortname = "",},
["Compromís amb Formentera"] = {abbrev = "", color = "#0AC5B3", shortname = "",},
["Compromís pel País Valencià"] = {abbrev = "Compromís PV", color = "#F2635B", shortname = "",},
["Compromisu por Asturies"] = {abbrev = "", color = "#7CB900", shortname = "",},
["Comú de Lleida"] = {abbrev = "", color = "#8B001F", shortname = "",},
["Comunes (political party)"] = {abbrev = "", color = "#412560", shortname = "",},
["Concentration of People's Forces"] = {abbrev = "CFP", color = "#000000", shortname = "",},
["Conceptual Party \"Unity\""] = {abbrev = "", color = "#11007D", shortname = "",},
["Concern for the Nation Functional Party"] = {abbrev = "PKPB", color = "#014133", shortname = "",},
["Concern Group for Tseung Kwan O People's Livelihood"] = {abbrev = "CGPLTKO", color = "#E3572B", shortname = "",},
["Concerned Citizens Party"] = {abbrev = "", color = "#A356DE", shortname = "Concerned Citizens",},
["Concerned Citizens' Movement"] = {abbrev = "CCM", color = "#3DADF2", shortname = "",},
["Concert of Parties for Democracy & Juntos Podemos Más"] = {abbrev = "", color = "Orange", shortname = "",},
["Concertación"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Concertación (Paraguay)"] = {abbrev = "", color = "#003399", shortname = "Concertación",},
["Conceyu Abiertu"] = {abbrev = "", color = "#214AFF", shortname = "",},
["Conceyu"] = {abbrev = "", color = "#D9DB4C", shortname = "",},
["Concord (political party)"] = {abbrev = "", color = "#0C6D76", shortname = "Concord",},
["Concordance (Bolivia)"] = {abbrev = "", color = "#4E81BD", shortname = "",},
["Concordancia (Argentina)"] = {abbrev = "", color = "#bfd0da", shortname = "Concordancia",},
["Concordia Association of Manchukuo"] = {abbrev = "", color = "#FFC500", shortname = "",},
["Concretely"] = {abbrev = "", color = "#0053A5", shortname = "",},
["Condado–Paradanta Union"] = {abbrev = "", color = "#008675", shortname = "",},
["Confederation Liberty and Independence"] = {abbrev = "", color = "#122746", shortname = "Confederation",},
["Confederation of Democracy"] = {abbrev = "", color = "#104F7C", shortname = "",},
["Confederation of Feminist Organizations"] = {abbrev = "", color = "#530F66", shortname = "",},
["Confederation of Independent Poland"] = {abbrev = "KPN", color = "#333300", shortname = "",},
["Confederation of the Greens (1987)"] = {abbrev = "", color = "#36A119", shortname = "",},
["Confederation of the Greens"] = {abbrev = "", color = "#74B32A", shortname = "",},
["Confederation of the Polish Crown"] = {abbrev = "", color = "#D4AA00", shortname = "",},
["Conference Party"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Congolese Movement for Democracy and Integral Development"] = {abbrev = "", color = "#374CCB", shortname = "",},
["Congolese Party of Labour"] = {abbrev = "PCT", color = "#DC241F", shortname = "",},
["Congress (A)"] = {abbrev = "INC (A)", color = "#30D5C8", shortname = "",},
["Congress (J)"] = {abbrev = "INC(J)", color = "black", shortname = "",},
["Congress (Secular)"] = {abbrev = "Cong(S)", color = "#FF7F7F", shortname = "",},
["Congress for Democracy and Progress"] = {abbrev = "CDP", color = "#E5321C", shortname = "",},
["Congress for Democratic Change"] = {abbrev = "CDC", color = "#183883", shortname = "",},
["Congress for Progressive Change"] = {abbrev = "CPC", color = "lightskyblue", shortname = "",},
["Congress for the Republic (Niger)"] = {abbrev = "", color = "#11580C", shortname = "",},
["Congress for the Republic"] = {abbrev = "CPR", color = "#77B32A", shortname = "",},
["Congress Nationalist Party"] = {abbrev = "CNP", color = "#0099CC", shortname = "",},
["Congress of Democrats"] = {abbrev = "COD", color = "#0040FC", shortname = "",},
["Congress of Russian Communities"] = {abbrev = "KRO", color = "#FCCA19", shortname = "",},
["Congress of the New Right"] = {abbrev = "KNP", color = "#1B3458", shortname = "",},
["Congress of the People (South African political party)"] = {abbrev = "COPE", color = "#FFCA08", shortname = "",},
["Congress of the People (Trinidad and Tobago)"] = {abbrev = "COP", color = "#000000", shortname = "",},
["Congress of Ukrainian Nationalists"] = {abbrev = "KUN", color = "#B30027", shortname = "",},
["Congress Party Alliance"] = {abbrev = "", color = "#FCC800", shortname = "",},
["Congress Party for the Independence of Madagascar"] = {abbrev = "AKFM", color = "#B20000", shortname = "",},
["Connect Andalusia"] = {abbrev = "", color = "#FECB00", shortname = "",},
["Conscience of Fatherland"] = {abbrev = "", color = "#B8860B", shortname = "",},
["Conservatism sidebar"] = {abbrev = "", color = "#0000FF", shortname = "Conservative",},
["Conservative (New Zealand)"] = {abbrev = "", color = "#9999CC", shortname = "Conservative",},
["Conservative (Norwegian political party)"] = {abbrev = "", color = "#2E316F", shortname = "Conservative",},
["Conservative (South Korea)"] = {abbrev = "", color = "#E61E2B", shortname = "Conservative",},
["Conservative Alliance-Matanitu Vanua"] = {abbrev = "CAMV", color = "blue", shortname = "",},
["Conservative Alliance of Zimbabwe"] = {abbrev = "CAZ", color = "#800080", shortname = "",},
["Conservative and Liberal Unionist"] = {abbrev = "", color = "#0281aa", shortname = "",},
["Conservative and Unionist Party (UK)"] = {abbrev = "Con", color = "#0087DC", shortname = "Conservative",},
["Conservative Ascension Party"] = {abbrev = "", color = "#0053CF", shortname = "",},
["Conservative bloc (Hong Kong)"] = {abbrev = "", color = "#0D3B68", shortname = "Conservative",},
["Conservative Christian Party – BPF"] = {abbrev = "", color = "#B31B20", shortname = "",},
["Conservative-Democratic Party"] = {abbrev = "PCD", color = "#66CCFF", shortname = "",},
["Conservative Democratic Party (Greece)"] = {abbrev = "KSD", color = "#9F99E5", shortname = "",},
["Conservative Democratic Party of Switzerland"] = {abbrev = "BDP", color = "#FBD918", shortname = "",},
["Conservative Democrats of Slovakia"] = {abbrev = "", color = "#6F0470", shortname = "",},
["Conservative Group"] = {abbrev = "", color = "#006EB7", shortname = "",},
["Conservative Ministerialist"] = {abbrev = "", color = "darkblue", shortname = "Ministerialist",},
["Conservative Movement/Alt-Info"] = {abbrev = "", color = "#4E0A0E", shortname = "Alt-Info",},
["Conservative Party (Bolivia)"] = {abbrev = "", color = "#0F52BA", shortname = "",},
["Conservative Party (Brazil)"] = {abbrev = "", color = "#00913D", shortname = "Conservative",},
["Conservative Party (Bulgaria)"] = {abbrev = "", color = "#00008b", shortname = "",},
["Conservative Party (Chile)"] = {abbrev = "", color = "#1935D0", shortname = "Conservative",},
["Conservative Party (Czech Republic)"] = {abbrev = "", color = "#4b0082", shortname = "KONS",},
["Conservative Party (Ecuador)"] = {abbrev = "PC", color = "#0000FF", shortname = "",},
["Conservative Party (Egypt)"] = {abbrev = "", color = "#B31E46", shortname = "",},
["Conservative Party (Guatemala)"] = {abbrev = "", color = "navy", shortname = "Conservative",},
["Conservative Party (Hong Kong)"] = {abbrev = "", color = "#0A4C90", shortname = "Conservative",},
["Conservative Party (Iceland)"] = {abbrev = "", color = "#87add7", shortname = "Conservative",},
["Conservative Party (Mexico)"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Conservative Party (New Zealand)"] = {abbrev = "", color = "#00AEEF", shortname = "Conservative",},
["Conservative Party (Nicaragua)"] = {abbrev = "", color = "#008000", shortname = "Conservative",},
["Conservative Party (Norway)"] = {abbrev = "", color = "#87add7", shortname = "Conservative",},
["Conservative Party (Panama)"] = {abbrev = "", color = "#095498", shortname = "",},
["Conservative Party (Prussia)"] = {abbrev = "", color = "#0781E5", shortname = "Conservatives",},
["Conservative Party (Romania, 1880–1918)"] = {abbrev = "", color = "#0047AB", shortname = "",},
["Conservative Party (Romania)"] = {abbrev = "", color = "#01357E", shortname = "",},
["Conservative Party (Serbia)"] = {abbrev = "", color = "#60AFFF", shortname = "Conservative",},
["Conservative Party (South Africa)"] = {abbrev = "", color = "#FFD700", shortname = "Conservative",},
["Conservative Party (Spain)"] = {abbrev = "", color = "#1286CB", shortname = "Conservative",},
["Conservative Party (Thailand)"] = {abbrev = "", color = "#FF0800", shortname = "",},
["Conservative Party (Uganda)"] = {abbrev = "", color = "purple", shortname = "",},
["Conservative Party (US)"] = {abbrev = "", color = "#FF8C00", shortname = "Conservative",},
["Conservative Party (Venezuela)"] = {abbrev = "", color = "#ED2939", shortname = "",},
["Conservative Party (Virginia, 1965)"] = {abbrev = "", color = "#FF8C00", shortname = "",},
["Conservative Party (Virginia)"] = {abbrev = "", color = "#FF8C00", shortname = "",},
["Conservative Party of Albania"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Conservative Party of Canada"] = {abbrev = "", color = "#6495ED", shortname = "Conservative",},
["Conservative Party of Canada (1867–1942)"] = {abbrev = "", color = "#9999FF", shortname = "Conservative (historical)",},
["Conservative Party of Norway (2020)"] = {abbrev = "", color = "#0065F1", shortname = "",},
["Conservative Party of Russia"] = {abbrev = "", color = "#1093EC", shortname = "",},
["Conservative People's Party (Argentina)"] = {abbrev = "PCP", color = "#000081", shortname = "Conservative People's Party",},
["Conservative People's Party (Denmark)"] = {abbrev = "", color = "#6B9249", shortname = "Conservatives",},
["Conservative People's Party (Germany)"] = {abbrev = "KVP", color = "#455B95", shortname = "",},
["Conservative People's Party (Poland)"] = {abbrev = "SKL", color = "#4B61D1", shortname = "Conservative People's Party",},
["Conservative People's Party of Estonia"] = {abbrev = "EKRE", color = "#0063AF", shortname = "",},
["Conservative People's Party"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Conservative Republican Party"] = {abbrev = "PRC", color = "#3333FF", shortname = "",},
["Conservative Resident"] = {abbrev = "", color = "#00ADEF", shortname = "",},
["Conservative Trade Unionist"] = {abbrev = "", color = "white", shortname = "",},
["Conservative Union (Spain)"] = {abbrev = "", color = "#27A6E2", shortname = "Silvelist",},
["Conservative"] = {abbrev = "", color = "#318CE7", shortname = "",},
["Conservatives and Reformists (Italy)"] = {abbrev = "", color = "#0054A5", shortname = "",},
["Conservatives of Catalonia"] = {abbrev = "", color = "#2A52BE", shortname = "",},
["Constitution Democracy Republic Party"] = {abbrev = "CDRP", color = "#BB443E", shortname = "",},
["Constitution Party (Egypt)"] = {abbrev = "", color = "#0A72BB", shortname = "Constitution Party",},
["Constitution Party (Estonia)"] = {abbrev = "", color = "#E56509", shortname = "",},
["Constitution Party (US)"] = {abbrev = "C", color = "#A356DE", shortname = "Constitution",},
["Constitution Party (US, 1952)"] = {abbrev = "C", color = "#000000", shortname = "Constitution",},
["Constitutional Action Party"] = {abbrev = "", color = "#9ab27d", shortname = "",},
["Constitutional and Democratic Party (Spain)"] = {abbrev = "", color = "#9999FF", shortname = "",},
["Constitutional and Democratic Popular Movement"] = {abbrev = "", color = "#D0353B", shortname = "",},
["Constitutional Bloc (Bulgaria)"] = {abbrev = "", color = "#0092CB", shortname = "",},
["Constitutional Bloc (Lebanon)"] = {abbrev = "", color = "orange", shortname = "Constitutional Bloc",},
["Constitutional Democratic Party (Italy)"] = {abbrev = "", color = "#6495ed", shortname = "",},
["Constitutional Democratic Party (Japan)"] = {abbrev = "", color = "#3773BE", shortname = "Rikken Minseitō",},
["Constitutional Democratic Party of Japan"] = {abbrev = "CDP", color = "#184589", shortname = "",},
["Constitutional Democratic Party"] = {abbrev = "", color = "#0087DC", shortname = "Cadet",},
["Constitutional Front (Thailand)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Constitutional Movement"] = {abbrev = "", color = "DarkGoldenrod", shortname = "",},
["Constitutional Nationalist Party UNIR"] = {abbrev = "", color = "#2E4371", shortname = "",},
["Constitutional Party (Costa Rica)"] = {abbrev = "", color = "#FF0000", shortname = "Constitutional",},
["Constitutional Party (Malta)"] = {abbrev = "", color = "#C71585", shortname = "",},
["Constitutional Party (Peru)"] = {abbrev = "", color = "#0072BB", shortname = "",},
["Constitutional Party (Spain)"] = {abbrev = "", color = "#58B474", shortname = "Constitutional",},
["Constitutional Party (Vietnam)"] = {abbrev = "", color = "#D99FE8", shortname = "",},
["Constitutional Reform Association of Hong Kong"] = {abbrev = "CRA", color = "#000080", shortname = "",},
["Constitutional Right Party"] = {abbrev = "", color = "darkblue", shortname = "",},
["Constitutional Union (Morocco)"] = {abbrev = "UC", color = "#F29400", shortname = "",},
["Constitutional Union of Cuba"] = {abbrev = "", color = "#537AB0", shortname = "",},
["Constitutional Union Party (Iraq)"] = {abbrev = "CUP", color = "#A52A2A", shortname = "",},
["Constitutional Union Party (US)"] = {abbrev = "CU", color = "#F59100", shortname = "Constitutional Union",},
["Constitutionalist (UK)"] = {abbrev = "", color = "#8C92AC", shortname = "Constitutionalist",},
["Constitutionalist Liberal Party"] = {abbrev = "PLC", color = "#FF2400", shortname = "",},
["Constitutionalist Party of Iran"] = {abbrev = "", color = "#000099", shortname = "",},
["Constitutionalist Party of São Paulo"] = {abbrev = "PCSP", color = "#CC0000", shortname = "",},
["Constitutionalist"] = {abbrev = "", color = "white", shortname = "",},
["ConstitutionUSA Party"] = {abbrev = "", color = "#A356DE", shortname = "",}, -- TODO: is duplicate?
["Consultative Council for Indonesian Citizenship"] = {abbrev = "", color = "#800080", shortname = "Baperki",},
["Contigo (political party)"] = {abbrev = "", color = "#E2007A", shortname = "",},
["Contigo Más"] = {abbrev = "", color = "#DF617D", shortname = "",},
["Contigo Navarra"] = {abbrev = "", color = "#4DAE97", shortname = "Contigo/Zurekin",},
["Contigo Somos Democracia"] = {abbrev = "", color = "#85BE3D", shortname = "",},
["Convention for a Progressive Alternative"] = {abbrev = "CAP", color = "#FF0000", shortname = "",},
["Convention for the Renewal of the Comoros"] = {abbrev = "CRC", color = "#0471C3", shortname = "",},
["Convention Muslim League"] = {abbrev = "CML", color = "#00CCCC", shortname = "",},
["Convention of Christian Democrats"] = {abbrev = "", color = "#556627", shortname = "",},
["Convention of Democratic Forces"] = {abbrev = "", color = "green", shortname = "",},
["Convention of Republican Institutions"] = {abbrev = "", color = "#E75480", shortname = "",},
["Convention People's Party"] = {abbrev = "CPP", color = "#C80815", shortname = "",},
["Convergence (Guatemala)"] = {abbrev = "", color = "#3481B9", shortname = "",},
["Convergence (Mexico)"] = {abbrev = "", color = "#F18130", shortname = "Convergence",},
["Convergence and Union"] = {abbrev = "CiU", color = "#18307B", shortname = "",},
["Convergence for Development"] = {abbrev = "CODEM", color = "blue", shortname = "",},
["Convergence for Extremadura"] = {abbrev = "", color = "#0A892E", shortname = "",},
["Convergence for Social Democracy (Equatorial Guinea)"] = {abbrev = "CPDS", color = "red", shortname = "",},
["Convergence for the Development of Mali"] = {abbrev = "", color = "#3BB9FF", shortname = "",},
["Convergence for the Isles"] = {abbrev = "", color = "#02AECA", shortname = "",},
["Convergence for Vigo"] = {abbrev = "", color = "#CE1126", shortname = "",},
["Convergence of Democrats of Navarre"] = {abbrev = "CDN", color = "#9D3E4D", shortname = "",},
["Convergence of Independents of Galicia"] = {abbrev = "", color = "#0062E3", shortname = "",},
["Convergence of Manacor"] = {abbrev = "", color = "#E2C767", shortname = "",},
["Convergence of Melilla"] = {abbrev = "", color = "#F04E98", shortname = "",},
["Convergents"] = {abbrev = "", color = "#172A88", shortname = "",},
["Converxencia XXI"] = {abbrev = "", color = "#FDB812", shortname = "",},
["Cook Islands First Party"] = {abbrev = "", color = "#FFDDFF", shortname = "",},
["Cook Islands National Party"] = {abbrev = "CINP", color = "#0000FF", shortname = "",},
["Cook Islands Party"] = {abbrev = "", color = "#005a00", shortname = "Cook Islands",},
["Cook Islands United Party"] = {abbrev = "", color = "#0000fe", shortname = "Cook Islands United",},
["Cooperation and Brotherhood"] = {abbrev = "", color = "#AF0000", shortname = "",},
["Cooperation Party"] = {abbrev = "", color = "#311179", shortname = "",},
["Cooperative NATCCO Network Party"] = {abbrev = "", color = "#6495ED", shortname = "",},
["Cooperative Power Party"] = {abbrev = "", color = "#038F48", shortname = "",},
["Copei"] = {abbrev = "", color = "#009900", shortname = "",},
["Coraggio Italia"] = {abbrev = "", color = "#E5007D", shortname = "",},
["Córas na Poblachta"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Cordeliers club"] = {abbrev = "", color = "#374d5f", shortname = "",},
["Córdoba Neighbourhood Encounter"] = {abbrev = "", color = "#E76003", shortname = "",},
["Cordobese Union"] = {abbrev = "", color = "#067237", shortname = "",},
["Cork Socialist Party"] = {abbrev = "", color = "#D20000", shortname = "",},
["Cornellà en Comú–Crida per Cornellà"] = {abbrev = "", color = "#783E8B", shortname = "",},
["Cornellà Left Alternative"] = {abbrev = "", color = "#581960", shortname = "",},
["Cornish Nationalist Party"] = {abbrev = "", color = "#000000", shortname = "",},
["Corsaris Democràtics"] = {abbrev = "", color = "#E7D072", shortname = "",},
["Corsica Libera"] = {abbrev = "CL", color = "#CC5500", shortname = "",},
["Corunnan Democracy"] = {abbrev = "", color = "#166CBF", shortname = "",},
["Corunnan Union"] = {abbrev = "", color = "#804B32", shortname = "",},
["Costa del Sol Sí Puede"] = {abbrev = "", color = "#269283", shortname = "",},
["Costa Rica Fair"] = {abbrev = "CRJ", color = "#00A5DB", shortname = "",},
["Costa Rican Concord Party"] = {abbrev = "PCC", color = "#4366F1", shortname = "",},
["Costa Rican People's Party"] = {abbrev = "", color = "Red", shortname = "",},
["Costa Rican Peoples' Front"] = {abbrev = "FPC", color = "#800000", shortname = "",},
["Costa Rican Renewal Party"] = {abbrev = "PRC", color = "#013ca6", shortname = "",},
["Council Muslim League"] = {abbrev = "", color = "#00ffff", shortname = "",},
["Council of Serbian Unity"] = {abbrev = "SSJ", color = "#36454F", shortname = "",},
["Country Alliance (Dominican Republic)"] = {abbrev = "", color = "#00ACA1", shortname = "",},
["Country and Progressive National Party"] = {abbrev = "CPNP", color = "#008B8B", shortname = "",},
["Country Liberal Party"] = {abbrev = "", color = "#f8981d", shortname = "Country Liberal",},
["Country of Living"] = {abbrev = "", color = "#FC283F", shortname = "",},
["Country-Liberal Coalition"] = {abbrev = "", color = "#006644", shortname = "Coalition",},
["Country/Liberal Coalition"] = {abbrev = "", color = "#006644", shortname = "Coalition",},
["Country Party (New Zealand)"] = {abbrev = "", color = "#B9F58B", shortname = "Country Party",},
["Country Party (NSW)"] = {abbrev = "", color = "#006644", shortname = "Country",},
["Country Party (South Australia)"] = {abbrev = "", color = "#006644", shortname = "Country",},
["Country Party (Victoria)"] = {abbrev = "", color = "#006644", shortname = "Country",},
["Country Party of Australia"] = {abbrev = "", color = "#006644", shortname = "Country",},
["Country Party of Australia (1920)"] = {abbrev = "", color = "#006644", shortname = "Country",},
["Country with Managers"] = {abbrev = "", color = "#EAFF00", shortname = "",},
["Countryside Party (UK)"] = {abbrev = "", color = "olive", shortname = "Countryside",},
["Courage Party"] = {abbrev = "", color = "#CC66FF", shortname = "Courage",},
["Course of Freedom"] = {abbrev = "PE", color = "#9F1897", shortname = "",},
["Covenant Party (Northern Mariana Islands)"] = {abbrev = "", color = "#CCFFCC", shortname = "Covenant",},
["Covenant Society"] = {abbrev = "", color = "#DC143C", shortname = "",},
["Cowry Forces for an Emerging Benin"] = {abbrev = "", color = "#56963F", shortname = "FCBE",},
["CPC"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Crawford Republican"] = {abbrev = "", color = "#5FD35F", shortname = "",},
["Creando Melilla"] = {abbrev = "CREAME", color = "#3182C1", shortname = "",},
["Creating Opportunities"] = {abbrev = "CREO", color = "#1B5DA6", shortname = "",},
["Creative Korea Party"] = {abbrev = "", color = "#B30000", shortname = "Creative Korea",},
["Creemos"] = {abbrev = "", color = "#d02d69", shortname = "",},
["Creemos Colombia"] = {abbrev = "", color = "#e40078", shortname = "",},
["Creo en Huelva"] = {abbrev = "", color = "#18B3B7", shortname = "",},
["Crescent Star Party (Indonesia)"] = {abbrev = "PBB", color = "#005825", shortname = "",},
["Crida per Palma"] = {abbrev = "", color = "#F3CB2D", shortname = "",},
["Cristiannan Uni Reforzando Potencial di Aruba"] = {abbrev = "", color = "purple", shortname = "",},
["Croat People's Union"] = {abbrev = "", color = "blue", shortname = "",},
["Croat-Serb Coalition"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Croatia is Growing"] = {abbrev = "", color = "#e00f20", shortname = "",},
["Croatian Bunjevac-Šokac Party"] = {abbrev = "HBŠS", color = "#AD3201", shortname = "",},
["Croatian Christian Democratic Union of Bosnia and Herzegovina"] = {abbrev = "", color = "blue", shortname = "",},
["Croatian Christian Democratic Union"] = {abbrev = "", color = "cornflowerblue", shortname = "",},
["Croatian Civic Initiative"] = {abbrev = "HGI", color = "#f08080", shortname = "",},
["Croatian Civic Party"] = {abbrev = "HGS", color = "#1F75FE", shortname = "",},
["Croatian Coalition (2010)"] = {abbrev = "", color = "#E61717", shortname = "",},
["Croatian Conservative Party"] = {abbrev = "", color = "#002366", shortname = "",},
["Croatian Demochristian Party"] = {abbrev = "", color = "#1974D2", shortname = "",},
["Croatian Democratic Alliance of Slavonia and Baranja"] = {abbrev = "HDSSB", color = "#990000", shortname = "",},
["Croatian Democratic Peasant Party"] = {abbrev = "", color = "green", shortname = "",},
["Croatian Democratic Union 1990"] = {abbrev = "HDZ 1990", color = "#A3DCFF", shortname = "",},
["Croatian Democratic Union of Bosnia and Herzegovina"] = {abbrev = "HDZ BiH", color = "#0064AA", shortname = "",},
["Croatian Democratic Union"] = {abbrev = "HDZ", color = "#005BAA", shortname = "",},
["Croatian Growth"] = {abbrev = "", color = "#5299E1", shortname = "",},
["Croatian Independent Party"] = {abbrev = "", color = "#5CA8EC", shortname = "",},
["Croatian Labourists – Labour Party"] = {abbrev = "", color = "#F4A460", shortname = "Labour",},
["Croatian Labourists"] = {abbrev = "HL", color = "#F4A460", shortname = "",},
["Croatian Liberation Movement"] = {abbrev = "HOP", color = "#FF0000", shortname = "",},
["Croatian National Shift"] = {abbrev = "HNP", color = "#EB332D", shortname = "",},
["Croatian Party of Pensioners"] = {abbrev = "", color = "#004B88", shortname = "HSU",},
["Croatian Party of Rights 1861"] = {abbrev = "HSP 1861", color = "#000000", shortname = "",},
["Croatian Party of Rights Dr. Ante Starčević"] = {abbrev = "HSP AS", color = "#6082B6", shortname = "",},
["Croatian Party of Rights of Bosnia and Herzegovina"] = {abbrev = "", color = "#000000", shortname = "",},
["Croatian Party of Rights"] = {abbrev = "HSP", color = "#000000", shortname = "",},
["Croatian Peasant Party of Bosnia and Herzegovina"] = {abbrev = "HSS BiH", color = "#3D863D", shortname = "",},
["Croatian Peasant Party"] = {abbrev = "HSS", color = "#02B14B", shortname = "",},
["Croatian People's Party – Liberal Democrats"] = {abbrev = "HNS-LD", color = "#FF931E", shortname = "",},
["Croatian People's Party"] = {abbrev = "HNS", color = "#F4A460", shortname = "",},
["Croatian Popular Party (1919)"] = {abbrev = "", color = "blue", shortname = "",},
["Croatian Pure Party of Rights"] = {abbrev = "HČSP", color = "#000000", shortname = "",},
["Croatian Republican Party"] = {abbrev = "HRS", color = "#004E9C", shortname = "",},
["Croatian Republican Union"] = {abbrev = "", color = "#000000", shortname = "",},
["Croatian Right Bloc"] = {abbrev = "", color = "#000000", shortname = "",},
["Croatian Romani Union \"Kali Sara\""] = {abbrev = "", color = "#FF0000", shortname = "Kali Sara",},
["Croatian Social Democrats"] = {abbrev = "HSD", color = "#FF0000", shortname = "",},
["Croatian Social Liberal Party"] = {abbrev = "HSLS", color = "#FFE01A", shortname = "",},
["Croatian Syrmian Initiative"] = {abbrev = "HSI", color = "#AA8251", shortname = "",},
["Croatian True Revival"] = {abbrev = "HIP", color = "darkblue", shortname = "",},
["Croatian Workers Party"] = {abbrev = "HRS", color = "Blue", shortname = "",},
["Croats Together"] = {abbrev = "HZ", color = "#A3DCFF", shortname = "",},
["Crofters Party"] = {abbrev = "", color = "#ddff55", shortname = "Crofters",},
["Cross-Community Labour Alternative"] = {abbrev = "", color = "#cd5c5c", shortname = "Labour Alternative",},
["Crossbencher"] = {abbrev = "", color = "grey", shortname = "Crossbench",},
["Crusade of Romanianism"] = {abbrev = "CR", color = "#390E0C", shortname = "",},
["Crystal Party"] = {abbrev = "", color = "#88309E", shortname = "Kristall.",},
["Cuban National Party"] = {abbrev = "PNC", color = "#0080FF", shortname = "",},
["Cuban Popular Party"] = {abbrev = "", color = "#C71585", shortname = "",},
["Cuenca Nos Une"] = {abbrev = "", color = "#13A69E", shortname = "",},
["Culleredo Neighborhood Tide"] = {abbrev = "", color = "#00ACEE", shortname = "",},
["Cultural Association of the GDR"] = {abbrev = "", color = "#011993", shortname = "",},
["Cultural Union of Ruthenians of Romania"] = {abbrev = "KTRR", color = "red", shortname = "",},
["Cumann na nGaedheal"] = {abbrev = "CnaG", color = "#87CEFA", shortname = "Cumann na nGaedheal",},
["Cumann Poblachta na hÉireann"] = {abbrev = "", color = "#008800", shortname = "",},
["Cumbernauld Independent Councillors Alliance"] = {abbrev = "CICA", color = "#DDDDDD", shortname = "",},
["Curaçao a New Dutch Municipality"] = {abbrev = "", color = "#FE8A23", shortname = "",},
["Current of Love"] = {abbrev = "", color = "#C49A6C", shortname = "",},
["Cymru Rydd"] = {abbrev = "", color = "#E32636", shortname = "",},
["Cymru Sovereign"] = {abbrev = "", color = "#fbff3c", shortname = "",},
["Cynon Valley Party"] = {abbrev = "", color = "#fac43a", shortname = "",},
["Czech Christian Social Party in the Kingdom of Bohemia"] = {abbrev = "ČKSSKČ", color = "#d6c3a5", shortname = "",},
["Czech National Social Party"] = {abbrev = "ČSNS", color = "#FAC469", shortname = "",},
["Czech National Socialist Party"] = {abbrev = "ČSNS 2005", color = "#C80000", shortname = "",},
["Czech Pirate Party"] = {abbrev = "", color = "#000000", shortname = "Pirates",},
["Czech Realist Party"] = {abbrev = "ČSP", color = "#6495ED", shortname = "",},
["Czech Social Democratic Party"] = {abbrev = "ČSSD", color = "#EC5800", shortname = "",},
["Czech Social Democratic Party (2021)"] = {abbrev = "ČSSD (2021)", color = "#EF331A", shortname = "",},
["Czechoslovak Agrarian and Conservative Party"] = {abbrev = "ČSAK", color = "#004953", shortname = "",},
["Czechoslovak National Democracy"] = {abbrev = "ČsND", color = "#2B347F", shortname = "",},
["Czechoslovak National Socialist Party"] = {abbrev = "ČSNS", color = "#FAC469", shortname = "",},
["Czechoslovak People's Party"] = {abbrev = "ČSL", color = "#FFD700", shortname = "",},
["Czechoslovak Social Democracy"] = {abbrev = "ČSSD", color = "#EC5800", shortname = "",},
["Czechoslovak Traders' Party"] = {abbrev = "ČŽOS", color = "#F27A7A", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
95d3d419d3c65618e6f6db50651bf64aa730443a
Module:Wd
828
276
544
2023-12-22T23:23:29Z
wikipedia>Pppery
0
Per edit request
Scribunto
text/plain
-- Original module located at [[:en:Module:Wd]] and [[:en:Module:Wd/i18n]].
require("strict")
local p = {}
local arg = ...
local i18n
local function loadI18n(aliasesP, frame)
local title
if frame then
-- current module invoked by page/template, get its title from frame
title = frame:getTitle()
else
-- current module included by other module, get its title from ...
title = arg
end
if not i18n then
i18n = require(title .. "/i18n").init(aliasesP)
end
end
p.claimCommands = {
property = "property",
properties = "properties",
qualifier = "qualifier",
qualifiers = "qualifiers",
reference = "reference",
references = "references"
}
p.generalCommands = {
label = "label",
title = "title",
description = "description",
alias = "alias",
aliases = "aliases",
badge = "badge",
badges = "badges"
}
p.flags = {
linked = "linked",
short = "short",
raw = "raw",
multilanguage = "multilanguage",
unit = "unit",
-------------
preferred = "preferred",
normal = "normal",
deprecated = "deprecated",
best = "best",
future = "future",
current = "current",
former = "former",
edit = "edit",
editAtEnd = "edit@end",
mdy = "mdy",
single = "single",
sourced = "sourced"
}
p.args = {
eid = "eid",
page = "page",
date = "date",
globalSiteId = "globalSiteId"
}
local aliasesP = {
coord = "P625",
-----------------------
image = "P18",
author = "P50",
authorNameString = "P2093",
publisher = "P123",
importedFrom = "P143",
wikimediaImportURL = "P4656",
statedIn = "P248",
pages = "P304",
language = "P407",
hasPart = "P527",
publicationDate = "P577",
startTime = "P580",
endTime = "P582",
chapter = "P792",
retrieved = "P813",
referenceURL = "P854",
sectionVerseOrParagraph = "P958",
archiveURL = "P1065",
title = "P1476",
formatterURL = "P1630",
quote = "P1683",
shortName = "P1813",
definingFormula = "P2534",
archiveDate = "P2960",
inferredFrom = "P3452",
typeOfReference = "P3865",
column = "P3903",
subjectNamedAs = "P1810",
wikidataProperty = "P1687",
publishedIn = "P1433"
}
local aliasesQ = {
percentage = "Q11229",
prolepticJulianCalendar = "Q1985786",
citeWeb = "Q5637226",
citeQ = "Q22321052"
}
local parameters = {
property = "%p",
qualifier = "%q",
reference = "%r",
alias = "%a",
badge = "%b",
separator = "%s",
general = "%x"
}
local formats = {
property = "%p[%s][%r]",
qualifier = "%q[%s][%r]",
reference = "%r",
propertyWithQualifier = "%p[ <span style=\"font-size:85\\%\">(%q)</span>][%s][%r]",
alias = "%a[%s]",
badge = "%b[%s]"
}
local hookNames = { -- {level_1, level_2}
[parameters.property] = {"getProperty"},
[parameters.reference] = {"getReferences", "getReference"},
[parameters.qualifier] = {"getAllQualifiers"},
[parameters.qualifier.."\\d"] = {"getQualifiers", "getQualifier"},
[parameters.alias] = {"getAlias"},
[parameters.badge] = {"getBadge"}
}
-- default value objects, should NOT be mutated but instead copied
local defaultSeparators = {
["sep"] = {" "},
["sep%s"] = {","},
["sep%q"] = {"; "},
["sep%q\\d"] = {", "},
["sep%r"] = nil, -- none
["punc"] = nil -- none
}
local rankTable = {
["preferred"] = 1,
["normal"] = 2,
["deprecated"] = 3
}
local function replaceAlias(id)
if aliasesP[id] then
id = aliasesP[id]
end
return id
end
local function errorText(code, param)
local text = i18n["errors"][code]
if param then text = mw.ustring.gsub(text, "$1", param) end
return text
end
local function throwError(errorMessage, param)
error(errorText(errorMessage, param))
end
local function replaceDecimalMark(num)
return mw.ustring.gsub(num, "[.]", i18n['numeric']['decimal-mark'], 1)
end
local function padZeros(num, numDigits)
local numZeros
local negative = false
if num < 0 then
negative = true
num = num * -1
end
num = tostring(num)
numZeros = numDigits - num:len()
for _ = 1, numZeros do
num = "0"..num
end
if negative then
num = "-"..num
end
return num
end
local function replaceSpecialChar(chr)
if chr == '_' then
-- replace underscores with spaces
return ' '
else
return chr
end
end
local function replaceSpecialChars(str)
local chr
local esc = false
local strOut = ""
for i = 1, #str do
chr = str:sub(i,i)
if not esc then
if chr == '\\' then
esc = true
else
strOut = strOut .. replaceSpecialChar(chr)
end
else
strOut = strOut .. chr
esc = false
end
end
return strOut
end
local function buildWikilink(target, label)
if not label or target == label then
return "[[" .. target .. "]]"
else
return "[[" .. target .. "|" .. label .. "]]"
end
end
-- used to make frame.args mutable, to replace #frame.args (which is always 0)
-- with the actual amount and to simply copy tables
local function copyTable(tIn)
if not tIn then
return nil
end
local tOut = {}
for i, v in pairs(tIn) do
tOut[i] = v
end
return tOut
end
-- used to merge output arrays together;
-- note that it currently mutates the first input array
local function mergeArrays(a1, a2)
for i = 1, #a2 do
a1[#a1 + 1] = a2[i]
end
return a1
end
local function split(str, del)
local out = {}
local i, j = str:find(del)
if i and j then
out[1] = str:sub(1, i - 1)
out[2] = str:sub(j + 1)
else
out[1] = str
end
return out
end
local function parseWikidataURL(url)
local id
if url:match('^http[s]?://') then
id = split(url, "Q")
if id[2] then
return "Q" .. id[2]
end
end
return nil
end
local function parseDate(dateStr, precision)
precision = precision or "d"
local i, j, index, ptr
local parts = {nil, nil, nil}
if dateStr == nil then
return parts[1], parts[2], parts[3] -- year, month, day
end
-- 'T' for snak values, '/' for outputs with '/Julian' attached
i, j = dateStr:find("[T/]")
if i then
dateStr = dateStr:sub(1, i-1)
end
local from = 1
if dateStr:sub(1,1) == "-" then
-- this is a negative number, look further ahead
from = 2
end
index = 1
ptr = 1
i, j = dateStr:find("-", from)
if i then
-- year
parts[index] = tonumber(dateStr:sub(ptr, i-1), 10) -- explicitly give base 10 to prevent error
if parts[index] == -0 then
parts[index] = tonumber("0") -- for some reason, 'parts[index] = 0' may actually store '-0', so parse from string instead
end
if precision == "y" then
-- we're done
return parts[1], parts[2], parts[3] -- year, month, day
end
index = index + 1
ptr = i + 1
i, j = dateStr:find("-", ptr)
if i then
-- month
parts[index] = tonumber(dateStr:sub(ptr, i-1), 10)
if precision == "m" then
-- we're done
return parts[1], parts[2], parts[3] -- year, month, day
end
index = index + 1
ptr = i + 1
end
end
if dateStr:sub(ptr) ~= "" then
-- day if we have month, month if we have year, or year
parts[index] = tonumber(dateStr:sub(ptr), 10)
end
return parts[1], parts[2], parts[3] -- year, month, day
end
local function datePrecedesDate(aY, aM, aD, bY, bM, bD)
if aY == nil or bY == nil then
return nil
end
aM = aM or 1
aD = aD or 1
bM = bM or 1
bD = bD or 1
if aY < bY then
return true
end
if aY > bY then
return false
end
if aM < bM then
return true
end
if aM > bM then
return false
end
if aD < bD then
return true
end
return false
end
local function getHookName(param, index)
if hookNames[param] then
return hookNames[param][index]
elseif param:len() > 2 then
return hookNames[param:sub(1, 2).."\\d"][index]
else
return nil
end
end
local function alwaysTrue()
return true
end
-- The following function parses a format string.
--
-- The example below shows how a parsed string is structured in memory.
-- Variables other than 'str' and 'child' are left out for clarity's sake.
--
-- Example:
-- "A %p B [%s[%q1]] C [%r] D"
--
-- Structure:
-- [
-- {
-- str = "A "
-- },
-- {
-- str = "%p"
-- },
-- {
-- str = " B ",
-- child =
-- [
-- {
-- str = "%s",
-- child =
-- [
-- {
-- str = "%q1"
-- }
-- ]
-- }
-- ]
-- },
-- {
-- str = " C ",
-- child =
-- [
-- {
-- str = "%r"
-- }
-- ]
-- },
-- {
-- str = " D"
-- }
-- ]
--
local function parseFormat(str)
local chr, esc, param, root, cur, prev, new
local params = {}
local function newObject(array)
local obj = {} -- new object
obj.str = ""
array[#array + 1] = obj -- array{object}
obj.parent = array
return obj
end
local function endParam()
if param > 0 then
if cur.str ~= "" then
cur.str = "%"..cur.str
cur.param = true
params[cur.str] = true
cur.parent.req[cur.str] = true
prev = cur
cur = newObject(cur.parent)
end
param = 0
end
end
root = {} -- array
root.req = {}
cur = newObject(root)
prev = nil
esc = false
param = 0
for i = 1, #str do
chr = str:sub(i,i)
if not esc then
if chr == '\\' then
endParam()
esc = true
elseif chr == '%' then
endParam()
if cur.str ~= "" then
cur = newObject(cur.parent)
end
param = 2
elseif chr == '[' then
endParam()
if prev and cur.str == "" then
table.remove(cur.parent)
cur = prev
end
cur.child = {} -- new array
cur.child.req = {}
cur.child.parent = cur
cur = newObject(cur.child)
elseif chr == ']' then
endParam()
if cur.parent.parent then
new = newObject(cur.parent.parent.parent)
if cur.str == "" then
table.remove(cur.parent)
end
cur = new
end
else
if param > 1 then
param = param - 1
elseif param == 1 then
if not chr:match('%d') then
endParam()
end
end
cur.str = cur.str .. replaceSpecialChar(chr)
end
else
cur.str = cur.str .. chr
esc = false
end
prev = nil
end
endParam()
-- make sure that at least one required parameter has been defined
if not next(root.req) then
throwError("missing-required-parameter")
end
-- make sure that the separator parameter "%s" is not amongst the required parameters
if root.req[parameters.separator] then
throwError("extra-required-parameter", parameters.separator)
end
return root, params
end
local function sortOnRank(claims)
local rankPos
local ranks = {{}, {}, {}, {}} -- preferred, normal, deprecated, (default)
local sorted = {}
for _, v in ipairs(claims) do
rankPos = rankTable[v.rank] or 4
ranks[rankPos][#ranks[rankPos] + 1] = v
end
sorted = ranks[1]
sorted = mergeArrays(sorted, ranks[2])
sorted = mergeArrays(sorted, ranks[3])
return sorted
end
local Config = {}
-- allows for recursive calls
function Config:new()
local cfg = {}
setmetatable(cfg, self)
self.__index = self
cfg.separators = {
-- single value objects wrapped in arrays so that we can pass by reference
["sep"] = {copyTable(defaultSeparators["sep"])},
["sep%s"] = {copyTable(defaultSeparators["sep%s"])},
["sep%q"] = {copyTable(defaultSeparators["sep%q"])},
["sep%r"] = {copyTable(defaultSeparators["sep%r"])},
["punc"] = {copyTable(defaultSeparators["punc"])}
}
cfg.entity = nil
cfg.entityID = nil
cfg.propertyID = nil
cfg.propertyValue = nil
cfg.qualifierIDs = {}
cfg.qualifierIDsAndValues = {}
cfg.bestRank = true
cfg.ranks = {true, true, false} -- preferred = true, normal = true, deprecated = false
cfg.foundRank = #cfg.ranks
cfg.flagBest = false
cfg.flagRank = false
cfg.periods = {true, true, true} -- future = true, current = true, former = true
cfg.flagPeriod = false
cfg.atDate = {parseDate(os.date('!%Y-%m-%d'))} -- today as {year, month, day}
cfg.mdyDate = false
cfg.singleClaim = false
cfg.sourcedOnly = false
cfg.editable = false
cfg.editAtEnd = false
cfg.inSitelinks = false
cfg.langCode = mw.language.getContentLanguage().code
cfg.langName = mw.language.fetchLanguageName(cfg.langCode, cfg.langCode)
cfg.langObj = mw.language.new(cfg.langCode)
cfg.siteID = mw.wikibase.getGlobalSiteId()
cfg.states = {}
cfg.states.qualifiersCount = 0
cfg.curState = nil
cfg.prefetchedRefs = nil
return cfg
end
local State = {}
function State:new(cfg, type)
local stt = {}
setmetatable(stt, self)
self.__index = self
stt.conf = cfg
stt.type = type
stt.results = {}
stt.parsedFormat = {}
stt.separator = {}
stt.movSeparator = {}
stt.puncMark = {}
stt.linked = false
stt.rawValue = false
stt.shortName = false
stt.anyLanguage = false
stt.unitOnly = false
stt.singleValue = false
return stt
end
-- if id == nil then item connected to current page is used
function Config:getLabel(id, raw, link, short)
local label = nil
local prefix, title= "", nil
if not id then
id = mw.wikibase.getEntityIdForCurrentPage()
if not id then
return ""
end
end
id = id:upper() -- just to be sure
if raw then
-- check if given id actually exists
if mw.wikibase.isValidEntityId(id) and mw.wikibase.entityExists(id) then
label = id
end
prefix, title = "d:Special:EntityPage/", label -- may be nil
else
-- try short name first if requested
if short then
label = p._property{aliasesP.shortName, [p.args.eid] = id} -- get short name
if label == "" then
label = nil
end
end
-- get label
if not label then
label = mw.wikibase.getLabelByLang(id, self.langCode) -- XXX: should use fallback labels?
end
end
if not label then
label = ""
elseif link then
-- build a link if requested
if not title then
if id:sub(1,1) == "Q" then
title = mw.wikibase.getSitelink(id)
elseif id:sub(1,1) == "P" then
-- properties have no sitelink, link to Wikidata instead
prefix, title = "d:Special:EntityPage/", id
end
end
label = mw.text.nowiki(label) -- escape raw label text so it cannot be wikitext markup
if title then
label = buildWikilink(prefix .. title, label)
end
end
return label
end
function Config:getEditIcon()
local value = ""
local prefix = ""
local front = " "
local back = ""
if self.entityID:sub(1,1) == "P" then
prefix = "Property:"
end
if self.editAtEnd then
front = '<span style="float:'
if self.langObj:isRTL() then
front = front .. 'left'
else
front = front .. 'right'
end
front = front .. '">'
back = '</span>'
end
value = "[[File:OOjs UI icon edit-ltr-progressive.svg|frameless|text-top|10px|alt=" .. i18n['info']['edit-on-wikidata'] .. "|link=https://www.wikidata.org/wiki/" .. prefix .. self.entityID .. "?uselang=" .. self.langCode
if self.propertyID then
value = value .. "#" .. self.propertyID
elseif self.inSitelinks then
value = value .. "#sitelinks-wikipedia"
end
value = value .. "|" .. i18n['info']['edit-on-wikidata'] .. "]]"
return front .. value .. back
end
-- used to create the final output string when it's all done, so that for references the
-- function extensionTag("ref", ...) is only called when they really ended up in the final output
function Config:concatValues(valuesArray)
local outString = ""
local j, skip
for i = 1, #valuesArray do
-- check if this is a reference
if valuesArray[i].refHash then
j = i - 1
skip = false
-- skip this reference if it is part of a continuous row of references that already contains the exact same reference
while valuesArray[j] and valuesArray[j].refHash do
if valuesArray[i].refHash == valuesArray[j].refHash then
skip = true
break
end
j = j - 1
end
if not skip then
-- add <ref> tag with the reference's hash as its name (to deduplicate references)
outString = outString .. mw.getCurrentFrame():extensionTag("ref", valuesArray[i][1], {name = valuesArray[i].refHash})
end
else
outString = outString .. valuesArray[i][1]
end
end
return outString
end
function Config:convertUnit(unit, raw, link, short, unitOnly)
local space = " "
local label = ""
local itemID
if unit == "" or unit == "1" then
return nil
end
if unitOnly then
space = ""
end
itemID = parseWikidataURL(unit)
if itemID then
if itemID == aliasesQ.percentage then
return "%"
else
label = self:getLabel(itemID, raw, link, short)
if label ~= "" then
return space .. label
end
end
end
return ""
end
function State:getValue(snak)
return self.conf:getValue(snak, self.rawValue, self.linked, self.shortName, self.anyLanguage, self.unitOnly, false, self.type:sub(1,2))
end
function Config:getValue(snak, raw, link, short, anyLang, unitOnly, noSpecial, type)
if snak.snaktype == 'value' then
local datatype = snak.datavalue.type
local subtype = snak.datatype
local datavalue = snak.datavalue.value
if datatype == 'string' then
if subtype == 'url' and link then
-- create link explicitly
if raw then
-- will render as a linked number like [1]
return "[" .. datavalue .. "]"
else
return "[" .. datavalue .. " " .. datavalue .. "]"
end
elseif subtype == 'commonsMedia' then
if link then
return buildWikilink("c:File:" .. datavalue, datavalue)
elseif not raw then
return "[[File:" .. datavalue .. "]]"
else
return datavalue
end
elseif subtype == 'geo-shape' and link then
return buildWikilink("c:" .. datavalue, datavalue)
elseif subtype == 'math' and not raw then
local attribute = nil
if (type == parameters.property or (type == parameters.qualifier and self.propertyID == aliasesP.hasPart)) and snak.property == aliasesP.definingFormula then
attribute = {qid = self.entityID}
end
return mw.getCurrentFrame():extensionTag("math", datavalue, attribute)
elseif subtype == 'external-id' and link then
local url = p._property{aliasesP.formatterURL, [p.args.eid] = snak.property} -- get formatter URL
if url ~= "" then
url = mw.ustring.gsub(url, "$1", datavalue)
return "[" .. url .. " " .. datavalue .. "]"
else
return datavalue
end
else
return datavalue
end
elseif datatype == 'monolingualtext' then
if anyLang or datavalue['language'] == self.langCode then
return datavalue['text']
else
return nil
end
elseif datatype == 'quantity' then
local value = ""
local unit
if not unitOnly then
-- get value and strip + signs from front
value = mw.ustring.gsub(datavalue['amount'], "^%+(.+)$", "%1")
if raw then
return value
end
-- replace decimal mark based on locale
value = replaceDecimalMark(value)
-- add delimiters for readability
value = i18n.addDelimiters(value)
end
unit = self:convertUnit(datavalue['unit'], raw, link, short, unitOnly)
if unit then
value = value .. unit
end
return value
elseif datatype == 'time' then
local y, m, d, p, yDiv, yRound, yFull, value, calendarID, dateStr
local yFactor = 1
local sign = 1
local prefix = ""
local suffix = ""
local mayAddCalendar = false
local calendar = ""
local precision = datavalue['precision']
if precision == 11 then
p = "d"
elseif precision == 10 then
p = "m"
else
p = "y"
yFactor = 10^(9-precision)
end
y, m, d = parseDate(datavalue['time'], p)
if y < 0 then
sign = -1
y = y * sign
end
-- if precision is tens/hundreds/thousands/millions/billions of years
if precision <= 8 then
yDiv = y / yFactor
-- if precision is tens/hundreds/thousands of years
if precision >= 6 then
mayAddCalendar = true
if precision <= 7 then
-- round centuries/millenniums up (e.g. 20th century or 3rd millennium)
yRound = math.ceil(yDiv)
if not raw then
if precision == 6 then
suffix = i18n['datetime']['suffixes']['millennium']
else
suffix = i18n['datetime']['suffixes']['century']
end
suffix = i18n.getOrdinalSuffix(yRound) .. suffix
else
-- if not verbose, take the first year of the century/millennium
-- (e.g. 1901 for 20th century or 2001 for 3rd millennium)
yRound = (yRound - 1) * yFactor + 1
end
else
-- precision == 8
-- round decades down (e.g. 2010s)
yRound = math.floor(yDiv) * yFactor
if not raw then
prefix = i18n['datetime']['prefixes']['decade-period']
suffix = i18n['datetime']['suffixes']['decade-period']
end
end
if raw and sign < 0 then
-- if BCE then compensate for "counting backwards"
-- (e.g. -2019 for 2010s BCE, -2000 for 20th century BCE or -3000 for 3rd millennium BCE)
yRound = yRound + yFactor - 1
end
else
local yReFactor, yReDiv, yReRound
-- round to nearest for tens of thousands of years or more
yRound = math.floor(yDiv + 0.5)
if yRound == 0 then
if precision <= 2 and y ~= 0 then
yReFactor = 1e6
yReDiv = y / yReFactor
yReRound = math.floor(yReDiv + 0.5)
if yReDiv == yReRound then
-- change precision to millions of years only if we have a whole number of them
precision = 3
yFactor = yReFactor
yRound = yReRound
end
end
if yRound == 0 then
-- otherwise, take the unrounded (original) number of years
precision = 5
yFactor = 1
yRound = y
mayAddCalendar = true
end
end
if precision >= 1 and y ~= 0 then
yFull = yRound * yFactor
yReFactor = 1e9
yReDiv = yFull / yReFactor
yReRound = math.floor(yReDiv + 0.5)
if yReDiv == yReRound then
-- change precision to billions of years if we're in that range
precision = 0
yFactor = yReFactor
yRound = yReRound
else
yReFactor = 1e6
yReDiv = yFull / yReFactor
yReRound = math.floor(yReDiv + 0.5)
if yReDiv == yReRound then
-- change precision to millions of years if we're in that range
precision = 3
yFactor = yReFactor
yRound = yReRound
end
end
end
if not raw then
if precision == 3 then
suffix = i18n['datetime']['suffixes']['million-years']
elseif precision == 0 then
suffix = i18n['datetime']['suffixes']['billion-years']
else
yRound = yRound * yFactor
if yRound == 1 then
suffix = i18n['datetime']['suffixes']['year']
else
suffix = i18n['datetime']['suffixes']['years']
end
end
else
yRound = yRound * yFactor
end
end
else
yRound = y
mayAddCalendar = true
end
if mayAddCalendar then
calendarID = parseWikidataURL(datavalue['calendarmodel'])
if calendarID and calendarID == aliasesQ.prolepticJulianCalendar then
if not raw then
if link then
calendar = " ("..buildWikilink(i18n['datetime']['julian-calendar'], i18n['datetime']['julian'])..")"
else
calendar = " ("..i18n['datetime']['julian']..")"
end
else
calendar = "/"..i18n['datetime']['julian']
end
end
end
if not raw then
local ce = nil
if sign < 0 then
ce = i18n['datetime']['BCE']
elseif precision <= 5 then
ce = i18n['datetime']['CE']
end
if ce then
if link then
ce = buildWikilink(i18n['datetime']['common-era'], ce)
end
suffix = suffix .. " " .. ce
end
value = tostring(yRound)
if m then
dateStr = self.langObj:formatDate("F", "1-"..m.."-1")
if d then
if self.mdyDate then
dateStr = dateStr .. " " .. d .. ","
else
dateStr = d .. " " .. dateStr
end
end
value = dateStr .. " " .. value
end
value = prefix .. value .. suffix .. calendar
else
value = padZeros(yRound * sign, 4)
if m then
value = value .. "-" .. padZeros(m, 2)
if d then
value = value .. "-" .. padZeros(d, 2)
end
end
value = value .. calendar
end
return value
elseif datatype == 'globecoordinate' then
-- logic from https://github.com/DataValues/Geo (v4.0.1)
local precision, unitsPerDegree, numDigits, strFormat, value, globe
local latitude, latConv, latValue, latLink
local longitude, lonConv, lonValue, lonLink
local latDirection, latDirectionN, latDirectionS, latDirectionEN
local lonDirection, lonDirectionE, lonDirectionW, lonDirectionEN
local degSymbol, minSymbol, secSymbol, separator
local latDegrees = nil
local latMinutes = nil
local latSeconds = nil
local lonDegrees = nil
local lonMinutes = nil
local lonSeconds = nil
local latDegSym = ""
local latMinSym = ""
local latSecSym = ""
local lonDegSym = ""
local lonMinSym = ""
local lonSecSym = ""
local latDirectionEN_N = "N"
local latDirectionEN_S = "S"
local lonDirectionEN_E = "E"
local lonDirectionEN_W = "W"
if not raw then
latDirectionN = i18n['coord']['latitude-north']
latDirectionS = i18n['coord']['latitude-south']
lonDirectionE = i18n['coord']['longitude-east']
lonDirectionW = i18n['coord']['longitude-west']
degSymbol = i18n['coord']['degrees']
minSymbol = i18n['coord']['minutes']
secSymbol = i18n['coord']['seconds']
separator = i18n['coord']['separator']
else
latDirectionN = latDirectionEN_N
latDirectionS = latDirectionEN_S
lonDirectionE = lonDirectionEN_E
lonDirectionW = lonDirectionEN_W
degSymbol = "/"
minSymbol = "/"
secSymbol = "/"
separator = "/"
end
latitude = datavalue['latitude']
longitude = datavalue['longitude']
if latitude < 0 then
latDirection = latDirectionS
latDirectionEN = latDirectionEN_S
latitude = math.abs(latitude)
else
latDirection = latDirectionN
latDirectionEN = latDirectionEN_N
end
if longitude < 0 then
lonDirection = lonDirectionW
lonDirectionEN = lonDirectionEN_W
longitude = math.abs(longitude)
else
lonDirection = lonDirectionE
lonDirectionEN = lonDirectionEN_E
end
precision = datavalue['precision']
if not precision or precision <= 0 then
precision = 1 / 3600 -- precision not set (correctly), set to arcsecond
end
-- remove insignificant detail
latitude = math.floor(latitude / precision + 0.5) * precision
longitude = math.floor(longitude / precision + 0.5) * precision
if precision >= 1 - (1 / 60) and precision < 1 then
precision = 1
elseif precision >= (1 / 60) - (1 / 3600) and precision < (1 / 60) then
precision = 1 / 60
end
if precision >= 1 then
unitsPerDegree = 1
elseif precision >= (1 / 60) then
unitsPerDegree = 60
else
unitsPerDegree = 3600
end
numDigits = math.ceil(-math.log10(unitsPerDegree * precision))
if numDigits <= 0 then
numDigits = tonumber("0") -- for some reason, 'numDigits = 0' may actually store '-0', so parse from string instead
end
strFormat = "%." .. numDigits .. "f"
if precision >= 1 then
latDegrees = strFormat:format(latitude)
lonDegrees = strFormat:format(longitude)
if not raw then
latDegSym = replaceDecimalMark(latDegrees) .. degSymbol
lonDegSym = replaceDecimalMark(lonDegrees) .. degSymbol
else
latDegSym = latDegrees .. degSymbol
lonDegSym = lonDegrees .. degSymbol
end
else
latConv = math.floor(latitude * unitsPerDegree * 10^numDigits + 0.5) / 10^numDigits
lonConv = math.floor(longitude * unitsPerDegree * 10^numDigits + 0.5) / 10^numDigits
if precision >= (1 / 60) then
latMinutes = latConv
lonMinutes = lonConv
else
latSeconds = latConv
lonSeconds = lonConv
latMinutes = math.floor(latSeconds / 60)
lonMinutes = math.floor(lonSeconds / 60)
latSeconds = strFormat:format(latSeconds - (latMinutes * 60))
lonSeconds = strFormat:format(lonSeconds - (lonMinutes * 60))
if not raw then
latSecSym = replaceDecimalMark(latSeconds) .. secSymbol
lonSecSym = replaceDecimalMark(lonSeconds) .. secSymbol
else
latSecSym = latSeconds .. secSymbol
lonSecSym = lonSeconds .. secSymbol
end
end
latDegrees = math.floor(latMinutes / 60)
lonDegrees = math.floor(lonMinutes / 60)
latDegSym = latDegrees .. degSymbol
lonDegSym = lonDegrees .. degSymbol
latMinutes = latMinutes - (latDegrees * 60)
lonMinutes = lonMinutes - (lonDegrees * 60)
if precision >= (1 / 60) then
latMinutes = strFormat:format(latMinutes)
lonMinutes = strFormat:format(lonMinutes)
if not raw then
latMinSym = replaceDecimalMark(latMinutes) .. minSymbol
lonMinSym = replaceDecimalMark(lonMinutes) .. minSymbol
else
latMinSym = latMinutes .. minSymbol
lonMinSym = lonMinutes .. minSymbol
end
else
latMinSym = latMinutes .. minSymbol
lonMinSym = lonMinutes .. minSymbol
end
end
latValue = latDegSym .. latMinSym .. latSecSym .. latDirection
lonValue = lonDegSym .. lonMinSym .. lonSecSym .. lonDirection
value = latValue .. separator .. lonValue
if link then
globe = parseWikidataURL(datavalue['globe'])
if globe then
globe = mw.wikibase.getLabelByLang(globe, "en"):lower()
else
globe = "earth"
end
latLink = table.concat({latDegrees, latMinutes, latSeconds}, "_")
lonLink = table.concat({lonDegrees, lonMinutes, lonSeconds}, "_")
value = "[https://geohack.toolforge.org/geohack.php?language="..self.langCode.."¶ms="..latLink.."_"..latDirectionEN.."_"..lonLink.."_"..lonDirectionEN.."_globe:"..globe.." "..value.."]"
end
return value
elseif datatype == 'wikibase-entityid' then
local label
local itemID = datavalue['numeric-id']
if subtype == 'wikibase-item' then
itemID = "Q" .. itemID
elseif subtype == 'wikibase-property' then
itemID = "P" .. itemID
else
return '<strong class="error">' .. errorText('unknown-data-type', subtype) .. '</strong>'
end
label = self:getLabel(itemID, raw, link, short)
if label == "" then
label = nil
end
return label
else
return '<strong class="error">' .. errorText('unknown-data-type', datatype) .. '</strong>'
end
elseif snak.snaktype == 'somevalue' and not noSpecial then
if raw then
return " " -- single space represents 'somevalue'
else
return i18n['values']['unknown']
end
elseif snak.snaktype == 'novalue' and not noSpecial then
if raw then
return "" -- empty string represents 'novalue'
else
return i18n['values']['none']
end
else
return nil
end
end
function Config:getSingleRawQualifier(claim, qualifierID)
local qualifiers
if claim.qualifiers then qualifiers = claim.qualifiers[qualifierID] end
if qualifiers and qualifiers[1] then
return self:getValue(qualifiers[1], true) -- raw = true
else
return nil
end
end
function Config:snakEqualsValue(snak, value)
local snakValue = self:getValue(snak, true) -- raw = true
if snakValue and snak.snaktype == 'value' and snak.datavalue.type == 'wikibase-entityid' then value = value:upper() end
return snakValue == value
end
function Config:setRank(rank)
local rankPos
if rank == p.flags.best then
self.bestRank = true
self.flagBest = true -- mark that 'best' flag was given
return
end
if rank:sub(1,9) == p.flags.preferred then
rankPos = 1
elseif rank:sub(1,6) == p.flags.normal then
rankPos = 2
elseif rank:sub(1,10) == p.flags.deprecated then
rankPos = 3
else
return
end
-- one of the rank flags was given, check if another one was given before
if not self.flagRank then
self.ranks = {false, false, false} -- no other rank flag given before, so unset ranks
self.bestRank = self.flagBest -- unsets bestRank only if 'best' flag was not given before
self.flagRank = true -- mark that a rank flag was given
end
if rank:sub(-1) == "+" then
for i = rankPos, 1, -1 do
self.ranks[i] = true
end
elseif rank:sub(-1) == "-" then
for i = rankPos, #self.ranks do
self.ranks[i] = true
end
else
self.ranks[rankPos] = true
end
end
function Config:setPeriod(period)
local periodPos
if period == p.flags.future then
periodPos = 1
elseif period == p.flags.current then
periodPos = 2
elseif period == p.flags.former then
periodPos = 3
else
return
end
-- one of the period flags was given, check if another one was given before
if not self.flagPeriod then
self.periods = {false, false, false} -- no other period flag given before, so unset periods
self.flagPeriod = true -- mark that a period flag was given
end
self.periods[periodPos] = true
end
function Config:qualifierMatches(claim, id, value)
local qualifiers
if claim.qualifiers then qualifiers = claim.qualifiers[id] end
if qualifiers then
for _, v in pairs(qualifiers) do
if self:snakEqualsValue(v, value) then
return true
end
end
elseif value == "" then
-- if the qualifier is not present then treat it the same as the special value 'novalue'
return true
end
return false
end
function Config:rankMatches(rankPos)
if self.bestRank then
return (self.ranks[rankPos] and self.foundRank >= rankPos)
else
return self.ranks[rankPos]
end
end
function Config:timeMatches(claim)
local startTime = nil
local startTimeY = nil
local startTimeM = nil
local startTimeD = nil
local endTime = nil
local endTimeY = nil
local endTimeM = nil
local endTimeD = nil
if self.periods[1] and self.periods[2] and self.periods[3] then
-- any time
return true
end
startTime = self:getSingleRawQualifier(claim, aliasesP.startTime)
if startTime and startTime ~= "" and startTime ~= " " then
startTimeY, startTimeM, startTimeD = parseDate(startTime)
end
endTime = self:getSingleRawQualifier(claim, aliasesP.endTime)
if endTime and endTime ~= "" and endTime ~= " " then
endTimeY, endTimeM, endTimeD = parseDate(endTime)
end
if startTimeY ~= nil and endTimeY ~= nil and datePrecedesDate(endTimeY, endTimeM, endTimeD, startTimeY, startTimeM, startTimeD) then
-- invalidate end time if it precedes start time
endTimeY = nil
endTimeM = nil
endTimeD = nil
end
if self.periods[1] then
-- future
if startTimeY and datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], startTimeY, startTimeM, startTimeD) then
return true
end
end
if self.periods[2] then
-- current
if (startTimeY == nil or not datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], startTimeY, startTimeM, startTimeD)) and
(endTimeY == nil or datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], endTimeY, endTimeM, endTimeD)) then
return true
end
end
if self.periods[3] then
-- former
if endTimeY and not datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], endTimeY, endTimeM, endTimeD) then
return true
end
end
return false
end
function Config:processFlag(flag)
if not flag then
return false
end
if flag == p.flags.linked then
self.curState.linked = true
return true
elseif flag == p.flags.raw then
self.curState.rawValue = true
if self.curState == self.states[parameters.reference] then
-- raw reference values end with periods and require a separator (other than none)
self.separators["sep%r"][1] = {" "}
end
return true
elseif flag == p.flags.short then
self.curState.shortName = true
return true
elseif flag == p.flags.multilanguage then
self.curState.anyLanguage = true
return true
elseif flag == p.flags.unit then
self.curState.unitOnly = true
return true
elseif flag == p.flags.mdy then
self.mdyDate = true
return true
elseif flag == p.flags.single then
self.singleClaim = true
return true
elseif flag == p.flags.sourced then
self.sourcedOnly = true
return true
elseif flag == p.flags.edit then
self.editable = true
return true
elseif flag == p.flags.editAtEnd then
self.editable = true
self.editAtEnd = true
return true
elseif flag == p.flags.best or flag:match('^'..p.flags.preferred..'[+-]?$') or flag:match('^'..p.flags.normal..'[+-]?$') or flag:match('^'..p.flags.deprecated..'[+-]?$') then
self:setRank(flag)
return true
elseif flag == p.flags.future or flag == p.flags.current or flag == p.flags.former then
self:setPeriod(flag)
return true
elseif flag == "" then
-- ignore empty flags and carry on
return true
else
return false
end
end
function Config:processFlagOrCommand(flag)
local param = ""
if not flag then
return false
end
if flag == p.claimCommands.property or flag == p.claimCommands.properties then
param = parameters.property
elseif flag == p.claimCommands.qualifier or flag == p.claimCommands.qualifiers then
self.states.qualifiersCount = self.states.qualifiersCount + 1
param = parameters.qualifier .. self.states.qualifiersCount
self.separators["sep"..param] = {copyTable(defaultSeparators["sep%q\\d"])}
elseif flag == p.claimCommands.reference or flag == p.claimCommands.references then
param = parameters.reference
else
return self:processFlag(flag)
end
if self.states[param] then
return false
end
-- create a new state for each command
self.states[param] = State:new(self, param)
-- use "%x" as the general parameter name
self.states[param].parsedFormat = parseFormat(parameters.general) -- will be overwritten for param=="%p"
-- set the separator
self.states[param].separator = self.separators["sep"..param] -- will be nil for param=="%p", which will be set separately
if flag == p.claimCommands.property or flag == p.claimCommands.qualifier or flag == p.claimCommands.reference then
self.states[param].singleValue = true
end
self.curState = self.states[param]
return true
end
function Config:processSeparators(args)
local sep
for i, v in pairs(self.separators) do
if args[i] then
sep = replaceSpecialChars(args[i])
if sep ~= "" then
self.separators[i][1] = {sep}
else
self.separators[i][1] = nil
end
end
end
end
function Config:setFormatAndSeparators(state, parsedFormat)
state.parsedFormat = parsedFormat
state.separator = self.separators["sep"]
state.movSeparator = self.separators["sep"..parameters.separator]
state.puncMark = self.separators["punc"]
end
-- determines if a claim has references by prefetching them from the claim using getReferences,
-- which applies some filtering that determines if a reference is actually returned,
-- and caches the references for later use
function State:isSourced(claim)
self.conf.prefetchedRefs = self:getReferences(claim)
return (#self.conf.prefetchedRefs > 0)
end
function State:resetCaches()
-- any prefetched references of the previous claim must not be used
self.conf.prefetchedRefs = nil
end
function State:claimMatches(claim)
local matches, rankPos
-- first of all, reset any cached values used for the previous claim
self:resetCaches()
-- if a property value was given, check if it matches the claim's property value
if self.conf.propertyValue then
matches = self.conf:snakEqualsValue(claim.mainsnak, self.conf.propertyValue)
else
matches = true
end
-- if any qualifier values were given, check if each matches one of the claim's qualifier values
for i, v in pairs(self.conf.qualifierIDsAndValues) do
matches = (matches and self.conf:qualifierMatches(claim, i, v))
end
-- check if the claim's rank and time period match
rankPos = rankTable[claim.rank] or 4
matches = (matches and self.conf:rankMatches(rankPos) and self.conf:timeMatches(claim))
-- if only claims with references must be returned, check if this one has any
if self.conf.sourcedOnly then
matches = (matches and self:isSourced(claim)) -- prefetches and caches references
end
return matches, rankPos
end
function State:out()
local result -- collection of arrays with value objects
local valuesArray -- array with value objects
local sep = nil -- value object
local out = {} -- array with value objects
local function walk(formatTable, result)
local valuesArray = {} -- array with value objects
for i, v in pairs(formatTable.req) do
if not result[i] or not result[i][1] then
-- we've got no result for a parameter that is required on this level,
-- so skip this level (and its children) by returning an empty result
return {}
end
end
for _, v in ipairs(formatTable) do
if v.param then
valuesArray = mergeArrays(valuesArray, result[v.str])
elseif v.str ~= "" then
valuesArray[#valuesArray + 1] = {v.str}
end
if v.child then
valuesArray = mergeArrays(valuesArray, walk(v.child, result))
end
end
return valuesArray
end
-- iterate through the results from back to front, so that we know when to add separators
for i = #self.results, 1, -1 do
result = self.results[i]
-- if there is already some output, then add the separators
if #out > 0 then
sep = self.separator[1] -- fixed separator
result[parameters.separator] = {self.movSeparator[1]} -- movable separator
else
sep = nil
result[parameters.separator] = {self.puncMark[1]} -- optional punctuation mark
end
valuesArray = walk(self.parsedFormat, result)
if #valuesArray > 0 then
if sep then
valuesArray[#valuesArray + 1] = sep
end
out = mergeArrays(valuesArray, out)
end
end
-- reset state before next iteration
self.results = {}
return out
end
-- level 1 hook
function State:getProperty(claim)
local value = {self:getValue(claim.mainsnak)} -- create one value object
if #value > 0 then
return {value} -- wrap the value object in an array and return it
else
return {} -- return empty array if there was no value
end
end
-- level 1 hook
function State:getQualifiers(claim, param)
local qualifiers
if claim.qualifiers then qualifiers = claim.qualifiers[self.conf.qualifierIDs[param]] end
if qualifiers then
-- iterate through claim's qualifier statements to collect their values;
-- return array with multiple value objects
return self.conf.states[param]:iterate(qualifiers, {[parameters.general] = hookNames[parameters.qualifier.."\\d"][2], count = 1}) -- pass qualifier state with level 2 hook
else
return {} -- return empty array
end
end
-- level 2 hook
function State:getQualifier(snak)
local value = {self:getValue(snak)} -- create one value object
if #value > 0 then
return {value} -- wrap the value object in an array and return it
else
return {} -- return empty array if there was no value
end
end
-- level 1 hook
function State:getAllQualifiers(claim, param, result, hooks)
local out = {} -- array with value objects
local sep = self.conf.separators["sep"..parameters.qualifier][1] -- value object
-- iterate through the output of the separate "qualifier(s)" commands
for i = 1, self.conf.states.qualifiersCount do
-- if a hook has not been called yet, call it now
if not result[parameters.qualifier..i] then
self:callHook(parameters.qualifier..i, hooks, claim, result)
end
-- if there is output for this particular "qualifier(s)" command, then add it
if result[parameters.qualifier..i] and result[parameters.qualifier..i][1] then
-- if there is already some output, then add the separator
if #out > 0 and sep then
out[#out + 1] = sep
end
out = mergeArrays(out, result[parameters.qualifier..i])
end
end
return out
end
-- level 1 hook
function State:getReferences(claim)
if self.conf.prefetchedRefs then
-- return references that have been prefetched by isSourced
return self.conf.prefetchedRefs
end
if claim.references then
-- iterate through claim's reference statements to collect their values;
-- return array with multiple value objects
return self.conf.states[parameters.reference]:iterate(claim.references, {[parameters.general] = hookNames[parameters.reference][2], count = 1}) -- pass reference state with level 2 hook
else
return {} -- return empty array
end
end
-- level 2 hook
function State:getReference(statement)
local key, citeWeb, citeQ, label
local params = {}
local citeParams = {['web'] = {}, ['q'] = {}}
local citeMismatch = {}
local useCite = nil
local useParams = nil
local value = ""
local ref = {}
local referenceEmpty = true -- will be set to false if at least one parameter is left unremoved
local numAuthorParameters = 0
local numAuthorNameStringParameters = 0
local tempLink
local additionalRefProperties = {} -- will hold properties of the reference which are not in statement.snaks, namely backup title from "subject named as" and URL from an external ID
local wikidataPropertiesOfSource -- will contain "Wikidata property" properties of the item in stated in, if any
local version = 5 -- increment this each time the below logic is changed to avoid conflict errors
if statement.snaks then
-- don't include "imported from", which is added by a bot
if statement.snaks[aliasesP.importedFrom] then
statement.snaks[aliasesP.importedFrom] = nil
end
-- don't include "Wikimedia import URL"
if statement.snaks[aliasesP.wikimediaImportURL] then
statement.snaks[aliasesP.wikimediaImportURL] = nil
-- don't include "retrieved" if no "referenceURL" is present,
-- as "retrieved" probably belongs to "Wikimedia import URL"
if statement.snaks[aliasesP.retrieved] and not statement.snaks[aliasesP.referenceURL] then
statement.snaks[aliasesP.retrieved] = nil
end
end
-- don't include "inferred from", which is added by a bot
if statement.snaks[aliasesP.inferredFrom] then
statement.snaks[aliasesP.inferredFrom] = nil
end
-- don't include "type of reference"
if statement.snaks[aliasesP.typeOfReference] then
statement.snaks[aliasesP.typeOfReference] = nil
end
-- don't include "image" to prevent littering
if statement.snaks[aliasesP.image] then
statement.snaks[aliasesP.image] = nil
end
-- don't include "language" if it is equal to the local one
if self:getReferenceDetail(statement.snaks, aliasesP.language) == self.conf.langName then
statement.snaks[aliasesP.language] = nil
end
if statement.snaks[aliasesP.statedIn] and not statement.snaks[aliasesP.referenceURL] then
-- "stated in" was given but "reference URL" was not.
-- get "Wikidata property" properties from the item in "stated in"
-- if any of the returned properties of the external-id datatype is in statement.snaks, generate a URL from it and use the URL in the reference
-- find the "Wikidata property" properties in the item from "stated in"
wikidataPropertiesOfSource = mw.text.split(p._properties{p.flags.raw, aliasesP.wikidataProperty, [p.args.eid] = self.conf:getValue(statement.snaks[aliasesP.statedIn][1], true, false)}, ", ", true)
for i, wikidataPropertyOfSource in pairs(wikidataPropertiesOfSource) do
if statement.snaks[wikidataPropertyOfSource] and statement.snaks[wikidataPropertyOfSource][1].datatype == "external-id" then
tempLink = self.conf:getValue(statement.snaks[wikidataPropertyOfSource][1], false, true) -- not raw, linked
if mw.ustring.match(tempLink, "^%[%Z- %Z+%]$") then -- getValue returned a URL.
additionalRefProperties[aliasesP.referenceURL] = mw.ustring.gsub(tempLink, "^%[(%Z-) %Z+%]$", "%1") -- the URL is in wiki markup, so strip the square brackets and the display text
statement.snaks[wikidataPropertyOfSource] = nil
break
end
end
end
end
-- don't include "subject named as", but use it as the title when "title" is not present but a URL is
if statement.snaks[aliasesP.subjectNamedAs] then
if not statement.snaks[aliasesP.title] and (statement.snaks[aliasesP.referenceURL] or additionalRefProperties[aliasesP.referenceURL]) then
additionalRefProperties[aliasesP.title] = statement.snaks[aliasesP.subjectNamedAs][1].datavalue.value
end
statement.snaks[aliasesP.subjectNamedAs] = nil
end
-- retrieve all the parameters
for i in pairs(statement.snaks) do
label = ""
-- multiple authors may be given
if i == aliasesP.author or i == aliasesP.authorNameString then
params[i] = self:getReferenceDetails(statement.snaks, i, false, self.linked, true) -- link = true/false, anyLang = true
else
params[i] = {self:getReferenceDetail(statement.snaks, i, false, (self.linked or (i == aliasesP.statedIn)) and (statement.snaks[i][1].datatype ~= 'url'), true)} -- link = true/false, anyLang = true
end
if #params[i] == 0 then
params[i] = nil
else
referenceEmpty = false
if statement.snaks[i][1].datatype == 'external-id' then
key = "external-id"
label = self.conf:getLabel(i)
if label ~= "" then
label = label .. " "
end
else
key = i
end
-- add the parameter to each matching type of citation
for j in pairs(citeParams) do
-- do so if there was no mismatch with a previous parameter
if not citeMismatch[j] then
-- check if this parameter is not mismatching itself
if i18n['cite'][j][key] then
-- continue if an option is available in the corresponding cite template
if i18n['cite'][j][key] ~= "" then
-- handle non-author properties (and author properties ("author" and "author name string"), if they don't use the same template parameter)
if (i ~= aliasesP.author and i ~= aliasesP.authorNameString) or (i18n['cite'][j][aliasesP.author] ~= i18n['cite'][j][aliasesP.authorNameString]) then
citeParams[j][i18n['cite'][j][key]] = label .. params[i][1]
-- to avoid problems with non-author multiple parameters (if existent), the following old code is retained
for k=2, #params[i] do
citeParams[j][i18n['cite'][j][key]..k] = label .. params[i][k]
end
-- handle "author" and "author name string" specially if they use the same template parameter
elseif i == aliasesP.author or i == aliasesP.authorNameString then
if params[aliasesP.author] ~= nil then
numAuthorParameters = #params[aliasesP.author]
else
numAuthorParameters = 0
end
if params[aliasesP.authorNameString] ~= nil then
numAuthorNameStringParameters = #params[aliasesP.authorNameString]
else
numAuthorNameStringParameters = 0
end
-- execute only if both "author" and "author name string" satisfy this condition: the property is both in params and in statement.snaks or it is neither in params nor in statement.snaks
-- reason: parameters are added to params each iteration of the loop, not before the loop
if ((statement.snaks[aliasesP.author] == nil) == (numAuthorParameters == 0)) and ((statement.snaks[aliasesP.authorNameString] == nil) == (numAuthorNameStringParameters == 0)) then
for k=1, numAuthorParameters + numAuthorNameStringParameters do
if k <= numAuthorParameters then -- now handling the authors from the "author" property
citeParams[j][i18n['cite'][j][aliasesP.author]..k] = label .. params[aliasesP.author][k]
else -- now handling the authors from "author name string"
citeParams[j][i18n['cite'][j][aliasesP.authorNameString]..k] = label .. params[aliasesP.authorNameString][k - numAuthorParameters]
end
end
end
end
end
else
citeMismatch[j] = true
end
end
end
end
end
-- use additional properties
for i in pairs(additionalRefProperties) do
for j in pairs(citeParams) do
if not citeMismatch[j] and i18n["cite"][j][i] then
citeParams[j][i18n["cite"][j][i]] = additionalRefProperties[i]
else
citeMismatch[j] = true
end
end
end
-- get title of general template for citing web references
citeWeb = split(mw.wikibase.getSitelink(aliasesQ.citeWeb) or "", ":")[2] -- split off namespace from front
-- get title of template that expands stated-in references into citations
citeQ = split(mw.wikibase.getSitelink(aliasesQ.citeQ) or "", ":")[2] -- split off namespace from front
-- (1) use the general template for citing web references if there is a match and if at least both "reference URL" and "title" are present
if citeWeb and not citeMismatch['web'] and citeParams['web'][i18n['cite']['web'][aliasesP.referenceURL]] and citeParams['web'][i18n['cite']['web'][aliasesP.title]] then
useCite = citeWeb
useParams = citeParams['web']
-- (2) use the template that expands stated-in references into citations if there is a match and if at least "stated in" is present
elseif citeQ and not citeMismatch['q'] and citeParams['q'][i18n['cite']['q'][aliasesP.statedIn]] then
-- we need the raw "stated in" Q-identifier for the this template
citeParams['q'][i18n['cite']['q'][aliasesP.statedIn]] = self:getReferenceDetail(statement.snaks, aliasesP.statedIn, true) -- raw = true
useCite = citeQ
useParams = citeParams['q']
end
if useCite and useParams then
-- if this module is being substituted then build a regular template call, otherwise expand the template
if mw.isSubsting() then
for i, v in pairs(useParams) do
value = value .. "|" .. i .. "=" .. v
end
value = "{{" .. useCite .. value .. "}}"
else
value = mw.getCurrentFrame():expandTemplate{title=useCite, args=useParams}
end
-- (3) if the citation couldn't be displayed using Cite web or Cite Q, but has properties other than the removed ones, throw an error
elseif not referenceEmpty then
value = "<span style=\"color:#dd3333\">" .. errorText("malformed-reference") .. "</span>"
end
if value ~= "" then
value = {value} -- create one value object
if not self.rawValue then
-- this should become a <ref> tag, so save the reference's hash for later
value.refHash = "wikidata-" .. statement.hash .. "-v" .. (tonumber(i18n['cite']['version']) + version)
end
ref = {value} -- wrap the value object in an array
end
end
return ref
end
-- gets a detail of one particular type for a reference
function State:getReferenceDetail(snaks, dType, raw, link, anyLang)
local switchLang = anyLang
local value = nil
if not snaks[dType] then
return nil
end
-- if anyLang, first try the local language and otherwise any language
repeat
for _, v in ipairs(snaks[dType]) do
value = self.conf:getValue(v, raw, link, false, anyLang and not switchLang, false, true) -- noSpecial = true
if value then
break
end
end
if value or not anyLang then
break
end
switchLang = not switchLang
until anyLang and switchLang
return value
end
-- gets the details of one particular type for a reference
function State:getReferenceDetails(snaks, dType, raw, link, anyLang)
local values = {}
if not snaks[dType] then
return {}
end
for _, v in ipairs(snaks[dType]) do
-- if nil is returned then it will not be added to the table
values[#values + 1] = self.conf:getValue(v, raw, link, false, anyLang, false, true) -- noSpecial = true
end
return values
end
-- level 1 hook
function State:getAlias(object)
local value = object.value
local title = nil
if value and self.linked then
if self.conf.entityID:sub(1,1) == "Q" then
title = mw.wikibase.getSitelink(self.conf.entityID)
elseif self.conf.entityID:sub(1,1) == "P" then
title = "d:Property:" .. self.conf.entityID
end
if title then
value = buildWikilink(title, value)
end
end
value = {value} -- create one value object
if #value > 0 then
return {value} -- wrap the value object in an array and return it
else
return {} -- return empty array if there was no value
end
end
-- level 1 hook
function State:getBadge(value)
value = self.conf:getLabel(value, self.rawValue, self.linked, self.shortName)
if value == "" then
value = nil
end
value = {value} -- create one value object
if #value > 0 then
return {value} -- wrap the value object in an array and return it
else
return {} -- return empty array if there was no value
end
end
function State:callHook(param, hooks, statement, result)
local valuesArray, refHash
-- call a parameter's hook if it has been defined and if it has not been called before
if not result[param] and hooks[param] then
valuesArray = self[hooks[param]](self, statement, param, result, hooks) -- array with value objects
-- add to the result
if #valuesArray > 0 then
result[param] = valuesArray
result.count = result.count + 1
else
result[param] = {} -- an empty array to indicate that we've tried this hook already
return true -- miss == true
end
end
return false
end
-- iterate through claims, claim's qualifiers or claim's references to collect values
function State:iterate(statements, hooks, matchHook)
matchHook = matchHook or alwaysTrue
local matches = false
local rankPos = nil
local result, gotRequired
for _, v in ipairs(statements) do
-- rankPos will be nil for non-claim statements (e.g. qualifiers, references, etc.)
matches, rankPos = matchHook(self, v)
if matches then
result = {count = 0} -- collection of arrays with value objects
local function walk(formatTable)
local miss
for i2, v2 in pairs(formatTable.req) do
-- call a hook, adding its return value to the result
miss = self:callHook(i2, hooks, v, result)
if miss then
-- we miss a required value for this level, so return false
return false
end
if result.count == hooks.count then
-- we're done if all hooks have been called;
-- returning at this point breaks the loop
return true
end
end
for _, v2 in ipairs(formatTable) do
if result.count == hooks.count then
-- we're done if all hooks have been called;
-- returning at this point prevents further childs from being processed
return true
end
if v2.child then
walk(v2.child)
end
end
return true
end
gotRequired = walk(self.parsedFormat)
-- only append the result if we got values for all required parameters on the root level
if gotRequired then
-- if we have a rankPos (only with matchHook() for complete claims), then update the foundRank
if rankPos and self.conf.foundRank > rankPos then
self.conf.foundRank = rankPos
end
-- append the result
self.results[#self.results + 1] = result
-- break if we only need a single value
if self.singleValue then
break
end
end
end
end
return self:out()
end
local function getEntityId(arg, eid, page, allowOmitPropPrefix, globalSiteId)
local id = nil
local prop = nil
if arg then
if arg:sub(1,1) == ":" then
page = arg
eid = nil
elseif arg:sub(1,1):upper() == "Q" or arg:sub(1,9):lower() == "property:" or allowOmitPropPrefix then
eid = arg
page = nil
else
prop = arg
end
end
if eid then
if eid:sub(1,9):lower() == "property:" then
id = replaceAlias(mw.text.trim(eid:sub(10)))
if id:sub(1,1):upper() ~= "P" then
id = ""
end
else
id = replaceAlias(eid)
end
elseif page then
if page:sub(1,1) == ":" then
page = mw.text.trim(page:sub(2))
end
id = mw.wikibase.getEntityIdForTitle(page, globalSiteId) or ""
end
if not id then
id = mw.wikibase.getEntityIdForCurrentPage() or ""
end
id = id:upper()
if not mw.wikibase.isValidEntityId(id) then
id = ""
end
return id, prop
end
local function nextArg(args)
local arg = args[args.pointer]
if arg then
args.pointer = args.pointer + 1
return mw.text.trim(arg)
else
return nil
end
end
local function claimCommand(args, funcName)
local cfg = Config:new()
cfg:processFlagOrCommand(funcName) -- process first command (== function name)
local lastArg, parsedFormat, formatParams, claims, value
local hooks = {count = 0}
-- set the date if given;
-- must come BEFORE processing the flags
if args[p.args.date] then
cfg.atDate = {parseDate(args[p.args.date])}
cfg.periods = {false, true, false} -- change default time constraint to 'current'
end
-- process flags and commands
repeat
lastArg = nextArg(args)
until not cfg:processFlagOrCommand(lastArg)
-- get the entity ID from either the positional argument, the eid argument or the page argument
cfg.entityID, cfg.propertyID = getEntityId(lastArg, args[p.args.eid], args[p.args.page], false, args[p.args.globalSiteId])
if cfg.entityID == "" then
return "" -- we cannot continue without a valid entity ID
end
cfg.entity = mw.wikibase.getEntity(cfg.entityID)
if not cfg.propertyID then
cfg.propertyID = nextArg(args)
end
cfg.propertyID = replaceAlias(cfg.propertyID)
if not cfg.entity or not cfg.propertyID then
return "" -- we cannot continue without an entity or a property ID
end
cfg.propertyID = cfg.propertyID:upper()
if not cfg.entity.claims or not cfg.entity.claims[cfg.propertyID] then
return "" -- there is no use to continue without any claims
end
claims = cfg.entity.claims[cfg.propertyID]
if cfg.states.qualifiersCount > 0 then
-- do further processing if "qualifier(s)" command was given
if #args - args.pointer + 1 > cfg.states.qualifiersCount then
-- claim ID or literal value has been given
cfg.propertyValue = nextArg(args)
end
for i = 1, cfg.states.qualifiersCount do
-- check if given qualifier ID is an alias and add it
cfg.qualifierIDs[parameters.qualifier..i] = replaceAlias(nextArg(args) or ""):upper()
end
elseif cfg.states[parameters.reference] then
-- do further processing if "reference(s)" command was given
cfg.propertyValue = nextArg(args)
end
-- check for special property value 'somevalue' or 'novalue'
if cfg.propertyValue then
cfg.propertyValue = replaceSpecialChars(cfg.propertyValue)
if cfg.propertyValue ~= "" and mw.text.trim(cfg.propertyValue) == "" then
cfg.propertyValue = " " -- single space represents 'somevalue', whereas empty string represents 'novalue'
else
cfg.propertyValue = mw.text.trim(cfg.propertyValue)
end
end
-- parse the desired format, or choose an appropriate format
if args["format"] then
parsedFormat, formatParams = parseFormat(args["format"])
elseif cfg.states.qualifiersCount > 0 then -- "qualifier(s)" command given
if cfg.states[parameters.property] then -- "propert(y|ies)" command given
parsedFormat, formatParams = parseFormat(formats.propertyWithQualifier)
else
parsedFormat, formatParams = parseFormat(formats.qualifier)
end
elseif cfg.states[parameters.property] then -- "propert(y|ies)" command given
parsedFormat, formatParams = parseFormat(formats.property)
else -- "reference(s)" command given
parsedFormat, formatParams = parseFormat(formats.reference)
end
-- if a "qualifier(s)" command and no "propert(y|ies)" command has been given, make the movable separator a semicolon
if cfg.states.qualifiersCount > 0 and not cfg.states[parameters.property] then
cfg.separators["sep"..parameters.separator][1] = {";"}
end
-- if only "reference(s)" has been given, set the default separator to none (except when raw)
if cfg.states[parameters.reference] and not cfg.states[parameters.property] and cfg.states.qualifiersCount == 0
and not cfg.states[parameters.reference].rawValue then
cfg.separators["sep"][1] = nil
end
-- if exactly one "qualifier(s)" command has been given, make "sep%q" point to "sep%q1" to make them equivalent
if cfg.states.qualifiersCount == 1 then
cfg.separators["sep"..parameters.qualifier] = cfg.separators["sep"..parameters.qualifier.."1"]
end
-- process overridden separator values;
-- must come AFTER tweaking the default separators
cfg:processSeparators(args)
-- define the hooks that should be called (getProperty, getQualifiers, getReferences);
-- only define a hook if both its command ("propert(y|ies)", "reference(s)", "qualifier(s)") and its parameter ("%p", "%r", "%q1", "%q2", "%q3") have been given
for i, v in pairs(cfg.states) do
-- e.g. 'formatParams["%q1"] or formatParams["%q"]' to define hook even if "%q1" was not defined to be able to build a complete value for "%q"
if formatParams[i] or formatParams[i:sub(1, 2)] then
hooks[i] = getHookName(i, 1)
hooks.count = hooks.count + 1
end
end
-- the "%q" parameter is not attached to a state, but is a collection of the results of multiple states (attached to "%q1", "%q2", "%q3", ...);
-- so if this parameter is given then this hook must be defined separately, but only if at least one "qualifier(s)" command has been given
if formatParams[parameters.qualifier] and cfg.states.qualifiersCount > 0 then
hooks[parameters.qualifier] = getHookName(parameters.qualifier, 1)
hooks.count = hooks.count + 1
end
-- create a state for "properties" if it doesn't exist yet, which will be used as a base configuration for each claim iteration;
-- must come AFTER defining the hooks
if not cfg.states[parameters.property] then
cfg.states[parameters.property] = State:new(cfg, parameters.property)
-- if the "single" flag has been given then this state should be equivalent to "property" (singular)
if cfg.singleClaim then
cfg.states[parameters.property].singleValue = true
end
end
-- if the "sourced" flag has been given then create a state for "reference" if it doesn't exist yet, using default values,
-- which must exist in order to be able to determine if a claim has any references;
-- must come AFTER defining the hooks
if cfg.sourcedOnly and not cfg.states[parameters.reference] then
cfg:processFlagOrCommand(p.claimCommands.reference) -- use singular "reference" to minimize overhead
end
-- set the parsed format and the separators (and optional punctuation mark);
-- must come AFTER creating the additonal states
cfg:setFormatAndSeparators(cfg.states[parameters.property], parsedFormat)
-- process qualifier matching values, analogous to cfg.propertyValue
for i, v in pairs(args) do
i = tostring(i)
if i:match('^[Pp]%d+$') or aliasesP[i] then
v = replaceSpecialChars(v)
-- check for special qualifier value 'somevalue'
if v ~= "" and mw.text.trim(v) == "" then
v = " " -- single space represents 'somevalue'
end
cfg.qualifierIDsAndValues[replaceAlias(i):upper()] = v
end
end
-- first sort the claims on rank to pre-define the order of output (preferred first, then normal, then deprecated)
claims = sortOnRank(claims)
-- then iterate through the claims to collect values
value = cfg:concatValues(cfg.states[parameters.property]:iterate(claims, hooks, State.claimMatches)) -- pass property state with level 1 hooks and matchHook
-- if desired, add a clickable icon that may be used to edit the returned values on Wikidata
if cfg.editable and value ~= "" then
value = value .. cfg:getEditIcon()
end
return value
end
local function generalCommand(args, funcName)
local cfg = Config:new()
cfg.curState = State:new(cfg)
local lastArg
local value = nil
repeat
lastArg = nextArg(args)
until not cfg:processFlag(lastArg)
-- get the entity ID from either the positional argument, the eid argument or the page argument
cfg.entityID = getEntityId(lastArg, args[p.args.eid], args[p.args.page], true, args[p.args.globalSiteId])
if cfg.entityID == "" or not mw.wikibase.entityExists(cfg.entityID) then
return "" -- we cannot continue without an entity
end
-- serve according to the given command
if funcName == p.generalCommands.label then
value = cfg:getLabel(cfg.entityID, cfg.curState.rawValue, cfg.curState.linked, cfg.curState.shortName)
elseif funcName == p.generalCommands.title then
cfg.inSitelinks = true
if cfg.entityID:sub(1,1) == "Q" then
value = mw.wikibase.getSitelink(cfg.entityID)
end
if cfg.curState.linked and value then
value = buildWikilink(value)
end
elseif funcName == p.generalCommands.description then
value = mw.wikibase.getDescription(cfg.entityID)
else
local parsedFormat, formatParams
local hooks = {count = 0}
cfg.entity = mw.wikibase.getEntity(cfg.entityID)
if funcName == p.generalCommands.alias or funcName == p.generalCommands.badge then
cfg.curState.singleValue = true
end
if funcName == p.generalCommands.alias or funcName == p.generalCommands.aliases then
if not cfg.entity.aliases or not cfg.entity.aliases[cfg.langCode] then
return "" -- there is no use to continue without any aliasses
end
local aliases = cfg.entity.aliases[cfg.langCode]
-- parse the desired format, or parse the default aliases format
if args["format"] then
parsedFormat, formatParams = parseFormat(args["format"])
else
parsedFormat, formatParams = parseFormat(formats.alias)
end
-- process overridden separator values;
-- must come AFTER tweaking the default separators
cfg:processSeparators(args)
-- define the hook that should be called (getAlias);
-- only define the hook if the parameter ("%a") has been given
if formatParams[parameters.alias] then
hooks[parameters.alias] = getHookName(parameters.alias, 1)
hooks.count = hooks.count + 1
end
-- set the parsed format and the separators (and optional punctuation mark)
cfg:setFormatAndSeparators(cfg.curState, parsedFormat)
-- iterate to collect values
value = cfg:concatValues(cfg.curState:iterate(aliases, hooks))
elseif funcName == p.generalCommands.badge or funcName == p.generalCommands.badges then
if not cfg.entity.sitelinks or not cfg.entity.sitelinks[cfg.siteID] or not cfg.entity.sitelinks[cfg.siteID].badges then
return "" -- there is no use to continue without any badges
end
local badges = cfg.entity.sitelinks[cfg.siteID].badges
cfg.inSitelinks = true
-- parse the desired format, or parse the default aliases format
if args["format"] then
parsedFormat, formatParams = parseFormat(args["format"])
else
parsedFormat, formatParams = parseFormat(formats.badge)
end
-- process overridden separator values;
-- must come AFTER tweaking the default separators
cfg:processSeparators(args)
-- define the hook that should be called (getBadge);
-- only define the hook if the parameter ("%b") has been given
if formatParams[parameters.badge] then
hooks[parameters.badge] = getHookName(parameters.badge, 1)
hooks.count = hooks.count + 1
end
-- set the parsed format and the separators (and optional punctuation mark)
cfg:setFormatAndSeparators(cfg.curState, parsedFormat)
-- iterate to collect values
value = cfg:concatValues(cfg.curState:iterate(badges, hooks))
end
end
value = value or ""
if cfg.editable and value ~= "" then
-- if desired, add a clickable icon that may be used to edit the returned value on Wikidata
value = value .. cfg:getEditIcon()
end
return value
end
-- modules that include this module should call the functions with an underscore prepended, e.g.: p._property(args)
local function establishCommands(commandList, commandFunc)
for _, commandName in pairs(commandList) do
local function wikitextWrapper(frame)
local args = copyTable(frame.args)
args.pointer = 1
loadI18n(aliasesP, frame)
return commandFunc(args, commandName)
end
p[commandName] = wikitextWrapper
local function luaWrapper(args)
args = copyTable(args)
args.pointer = 1
loadI18n(aliasesP)
return commandFunc(args, commandName)
end
p["_" .. commandName] = luaWrapper
end
end
establishCommands(p.claimCommands, claimCommand)
establishCommands(p.generalCommands, generalCommand)
-- main function that is supposed to be used by wrapper templates
function p.main(frame)
if not mw.wikibase then return nil end
local f, args
loadI18n(aliasesP, frame)
-- get the parent frame to take the arguments that were passed to the wrapper template
frame = frame:getParent() or frame
if not frame.args[1] then
throwError("no-function-specified")
end
f = mw.text.trim(frame.args[1])
if f == "main" then
throwError("main-called-twice")
end
assert(p["_"..f], errorText('no-such-function', f))
-- copy arguments from immutable to mutable table
args = copyTable(frame.args)
-- remove the function name from the list
table.remove(args, 1)
return p["_"..f](args)
end
return p
1ca0c98a70b8bfc8ac5dc6df005800c159e457e8
File:1965 House of Representatives Partisan Control.svg
6
2
4
2023-12-23T00:24:48Z
Floopymichael
2
Partisan makeup of the LTET 4.0 House of Representatives at sim start, in 1965.
wikitext
text/x-wiki
== Summary ==
Partisan makeup of the LTET 4.0 House of Representatives at sim start, in 1965.
3acfa8c89be004725b67115ad2f57f7745be1a76
File:1965 Senate Partisan Control.svg
6
3
5
2023-12-23T00:25:20Z
Floopymichael
2
Partisan control of the LTET Senate chamber at sim start, in 1965.
wikitext
text/x-wiki
== Summary ==
Partisan control of the LTET Senate chamber at sim start, in 1965.
d3b3f39a7036ef2052c46517015f7b35b28b935c
File:Number-one.png
6
4
8
2023-12-23T02:29:19Z
Floopymichael
2
Icon provided by Flaticon, created by High Quality Icons; https://flaticon.com
wikitext
text/x-wiki
== Summary ==
Icon provided by Flaticon, created by High Quality Icons; https://flaticon.com
b5c7a369ae27bf7907264b328cc8a05ebfa69e8a
File:Black-number-2.png
6
5
9
2023-12-23T02:29:58Z
Floopymichael
2
Icon provided by Flaticon, created by High Quality Icons; https://flaticon.com
wikitext
text/x-wiki
== Summary ==
Icon provided by Flaticon, created by High Quality Icons; https://flaticon.com
b5c7a369ae27bf7907264b328cc8a05ebfa69e8a
File:Black-number-3.png
6
6
10
2023-12-23T02:30:14Z
Floopymichael
2
Icon provided by Flaticon, created by High Quality Icons; https://flaticon.com
wikitext
text/x-wiki
== Summary ==
Icon provided by Flaticon, created by High Quality Icons; https://flaticon.com
b5c7a369ae27bf7907264b328cc8a05ebfa69e8a
File:Black-number-four.png
6
7
11
2023-12-23T02:30:36Z
Floopymichael
2
Icon provided by Flaticon, created by High Quality Icons; https://flaticon.com
wikitext
text/x-wiki
== Summary ==
Icon provided by Flaticon, created by High Quality Icons; https://flaticon.com
b5c7a369ae27bf7907264b328cc8a05ebfa69e8a
File:Black-number-5.png
6
9
13
2023-12-23T02:32:36Z
Floopymichael
2
Icon provided by Flaticon, created by High Quality Icons; https://flaticon.com
wikitext
text/x-wiki
== Summary ==
Icon provided by Flaticon, created by High Quality Icons; https://flaticon.com
b5c7a369ae27bf7907264b328cc8a05ebfa69e8a
Module:Political party/G
828
240
472
2023-12-23T02:49:16Z
wikipedia>Pppery
0
Per request
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["GABRIELA Women's Party"] = "Gabriela Women's Party",
["Galician National-Popular Bloc"] = "Galician Nationalist Bloc",
["Galician Nationalist Convergence"] = "Galician Coalition",
["Galician Progressive Coalition"] = "Galician Coalition",
["Galician Workers' Party"] = "Galician Left",
["Ganatantra Parishad"] = "All India Ganatantra Parishad",
["Génération.s, le mouvement"] = "Génération.s",
["Genzei Nippon"] = "Tax Cuts Japan",
["Georgia Republican Party"] = "Republican Party (United States)",
["German Centre"] = "Centre Party (Germany)",
["German Minority (political party)"] = "German Minority Electoral Committee",
["German Minority"] = "German Minority Electoral Committee",
["German Pirate Party"] = "Pirate Party Germany",
["German Reich Party"] = "Free Conservative Party",
["Girondin"] = "Girondins",
["Girondist"] = "Girondins",
["Go Peru"] = "Let’s Go Peru",
["Golongan Karya"] = "Golkar",
["Good Choice"] = "Good Choice and Moderates",
["Good Choice (Slovakia)"] = "Good Choice and Moderates",
["Good Party"] = "İYİ Party",
["Government by the People Green Party"] = "Green Party of South Africa",
["Grand Alliance (Bangladesh)"] = "Awami League",
["Grassroots-Legalize Cannabis Party"] = "Grassroots—Legalize Cannabis Party",
["Grassroots–Legalize Cannabis Party"] = "Grassroots—Legalize Cannabis Party", -- dash difference
["Grassroots Party (US)"] = "Grassroots Party",
["Great Indonesia Movement Party"] = "Gerindra Party",
["Great Union Party"] = "Great Unity Party",
["Greek politics/party colours/Panhellenic Sociali"] = "PASOK",
["Green (political party)"] = "Groen (political party)",
["Green Alliance"] = "Green Party (Ireland)",
["Green Alliance (Ireland)"] = "Green Party (Ireland)",
["Green Alternative Alliance"] = "The Greens (Luxembourg)",
["Green Alternative Party"] = "The Greens (Luxembourg)",
["Green List (Spain)"] = "Confederation of the Greens",
["Green Mountain Peace and Justice"] = "Green Mountain Peace and Justice Party",
["Green Movement (Israel)"] = "Green Party (Israel)",
["Green Party - Save Our Green Space"] = "Green Party of England and Wales",
["Green Party (Colombia)"] = "Green Alliance (Colombia)",
["Green Party (Poland)"] = "The Greens (Poland)",
["Green Party (United States)"] = "Green Party (US)",
["Green Party in Northern Ireland"] = "Green Party Northern Ireland",
["Green Party of Alaska"] = "Green Party (US)",
["Green Party of Arkansas"] = "Green Party (US)",
["Green Party of California"] = "Green Party (US)",
["Green Party of Colorado"] = "Green Party (US)",
["Green Party of Connecticut"] = "Green Party (US)",
["Green Party of Hawaii"] = "Green Party (US)",
["Green Party of Michigan"] = "Green Party (US)",
["Green Party of Minnesota"] = "Green Party (US)",
["Green Party of Montana"] = "Green Party (US)",
["Green Party of New York"] = "Green Party (US)",
["Green Party of Northern Ireland"] = "Green Party Northern Ireland",
["Green Party of Ohio"] = "Green Party (US)",
["Green Party of Pennsylvania"] = "Green Party (US)",
["Green Party of Texas"] = "Green Party (US)",
["Green Party (Arizona)"] = "Green Party (US)",
["Green Party (Arkansas)"] = "Green Party (US)",
["Green Party (California)"] = "Green Party (US)",
["Green Party (Colorado)"] = "Green Party (US)",
["Green Party (Connecticut)"] = "Green Party (US)",
["Green Party (Hawaii)"] = "Green Party (US)",
["Green Party (Iowa)"] = "Green Party (US)",
["Green Party (Michigan)"] = "Green Party (US)",
["Green Party (New York)"] = "Green Party (US)",
["Green Party of the United States"] = "Green Party (US)",
["Green!"] = "Groen (political party)",
["Greenback Party (United States)"] = "Greenback Party",
["GreenLeft"] = "GroenLinks",
["Greens 2004"] = "The Greens (Poland)",
["Greens-European Free Alliance"] = "Greens–European Free Alliance",
["Gregor Virant's Civic List"] = "Civic List (Slovenia)",
["Groen!"] = "Groen (political party)",
["Group of Independent Citizens"] = "Independent Solution",
["Group of the Alliance of Liberals and Democrats for Europe"] = "Alliance of Liberals and Democrats for Europe group",
["GSD"] = "Gibraltar Social Democrats",
["GSLP"] = "Gibraltar Socialist Labour Party",
["Guanyar Alacant"] = "Acord Ciutadà",
["Guanyar Alcoi"] = "Acord Ciutadà",
["Guanyem Sant Josep de sa Talaia"] = "Guanyem Eivissa",
["Guanyem Santa Eulària des Riu"] = "Guanyem Eivissa",
["Guatemalan Republican Front"] = "Institutional Republican Party",
["Gwlad - The Welsh Independence Party"] = "Gwlad",
}
local full = {
["G17 Plus"] = {abbrev = "G17+", color = "#545AA7", shortname = "",},
["G99"] = {abbrev = "", color = "red", shortname = "",},
["Gabonese Democratic and Social Union"] = {abbrev = "", color = "red", shortname = "",},
["Gabonese Democratic Bloc"] = {abbrev = "", color = "#008800", shortname = "",},
["Gabonese Democratic Party"] = {abbrev = "PDG", color = "#006533", shortname = "",},
["Gabonese Progress Party"] = {abbrev = "PGP", color = "red", shortname = "",},
["Gabonese Socialist Party"] = {abbrev = "", color = "red", shortname = "",},
["Gabonese Socialist Union"] = {abbrev = "", color = "red", shortname = "",},
["Gabriela Women's Party"] = {abbrev = "", color = "#800080", shortname = "Gabriela",},
["Gabungan Parti Sarawak"] = {abbrev = "GPS", color = "#FF6060", shortname = "",},
["Gabungan Rakyat Sabah"] = {abbrev = "GRS", color = "#4682B4", shortname = "",},
["Gagasan Rakyat"] = {abbrev = "GR", color = "#ADD8E6", shortname = "",},
["Gagasan Sejahtera"] = {abbrev = "", color = "#008800", shortname = "",},
["Gahal"] = {abbrev = "", color = "#143997", shortname = "",},
["Galeusca–Peoples of Europe"] = {abbrev = "", color = "#2C3294", shortname = "Galeusca",},
["Galicia en Común"] = {abbrev = "", color = "#5D2C75", shortname = "Podemos–EU–Anova",},
["Galicia New Way"] = {abbrev = "", color = "#6FA7B6", shortname = "",},
["Galicia Sempre"] = {abbrev = "", color = "#8EC81E", shortname = "",},
["Galician Alternative"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Galician Coalition"] = {abbrev = "CG", color = "#002C9C", shortname = "",},
["Galician Convergence"] = {abbrev = "", color = "#087608", shortname = "",},
["Galician Democracy"] = {abbrev = "", color = "#81DAF5", shortname = "",},
["Galician Democratic Candidacy"] = {abbrev = "", color = "#15EAEA", shortname = "",},
["Galician Democratic Party"] = {abbrev = "", color = "#20ACE1", shortname = "",},
["Galician Identity"] = {abbrev = "", color = "#0579FC", shortname = "",},
["Galician Initiative"] = {abbrev = "", color = "#D54D13", shortname = "",},
["Galician Left Alternative"] = {abbrev = "AGE", color = "#62A3CA", shortname = "",},
["Galician Left"] = {abbrev = "EG", color = "#522998", shortname = "",},
["Galician Movement for Socialism"] = {abbrev = "", color = "#003F77", shortname = "",},
["Galician Nationalist Bloc"] = {abbrev = "BNG", color = "#ADCFEF", shortname = "",},
["Galician Nationalist Group of Narón"] = {abbrev = "", color = "#AA4CAA", shortname = "",},
["Galician Nationalist Party–Galicianist Party"] = {abbrev = "", color = "#639E00", shortname = "",},
["Galician Party of the Country"] = {abbrev = "", color = "#66BB66", shortname = "",},
["Galician People's Front"] = {abbrev = "", color = "#3920DE", shortname = "",},
["Galician People's Union"] = {abbrev = "", color = "#CF1B15", shortname = "",},
["Galician Progressive Democracy"] = {abbrev = "", color = "#C66900", shortname = "",},
["Galician Socialist Party (1963)"] = {abbrev = "", color = "#D73D2A", shortname = "",},
["Galician Socialist Party–Galician Left"] = {abbrev = "PSG–EG", color = "#2AAC24", shortname = "",},
["Galician Socialist Space"] = {abbrev = "", color = "#28AC90", shortname = "",},
["Galician Socialist Unity"] = {abbrev = "", color = "#FF3300", shortname = "",},
["Galician Unity"] = {abbrev = "", color = "#00CCF1", shortname = "",},
["Galician Workers' Front"] = {abbrev = "", color = "#3B96BB", shortname = "",},
["Galicianist Party (1931)"] = {abbrev = "", color = "#57ABB3", shortname = "",},
["Galicianist Party (1978)"] = {abbrev = "", color = "#E46D2B", shortname = "",},
["Galicianist Party–Centrists of Orense"] = {abbrev = "", color = "#986968", shortname = "",},
["Galicianist Party–Convergence of Independents of Galicia"] = {abbrev = "", color = "#726887", shortname = "",},
["Galiza Ceibe"] = {abbrev = "", color = "#29AEEF", shortname = "",},
["Gamacists"] = {abbrev = "", color = "#599F25", shortname = "Gamacist",},
["Gambela People's Democratic Movement"] = {abbrev = "", color = "#AC1538", shortname = "",},
["Gambia Democratic Congress"] = {abbrev = "GDC", color = "#771C7C", shortname = "",},
["Gambia Party for Democracy and Progress"] = {abbrev = "", color = "#FB7F00", shortname = "",},
["Gamonie i Krasnoludki"] = {abbrev = "", color = "orange", shortname = "",},
["Gana Fuerteventura"] = {abbrev = "", color = "#FFC000", shortname = "",},
["Gana Suraksha Party"] = {abbrev = "", color = "#E74C3C", shortname = "",},
["Gana Zamora"] = {abbrev = "", color = "#146612", shortname = "",},
["Ganar Alcorcón"] = {abbrev = "", color = "#B507A6", shortname = "",},
["Ganar Cádiz en Común"] = {abbrev = "", color = "#187669", shortname = "",},
["Ganar Fuenlabrada"] = {abbrev = "", color = "#C63903", shortname = "",},
["Ganar Humanes"] = {abbrev = "", color = "#8A64A5", shortname = "",},
["Ganar la Región de Murcia"] = {abbrev = "", color = "#BB0017", shortname = "",},
["Ganar Móstoles"] = {abbrev = "", color = "#AAB93C", shortname = "",},
["Ganar Teruel"] = {abbrev = "", color = "#A91C30", shortname = "",},
["Ganar Torrejón"] = {abbrev = "", color = "#930B71", shortname = "",},
["Gandhi Kamaraj National Congress"] = {abbrev = "", color = "#187669", shortname = "GKC",},
["Ganatantri Dal"] = {abbrev = "", color = "blue", shortname = "",},
["Ganatantri Party"] = {abbrev = "", color = "#6a9a62", shortname = "",},
["Ganemos (2015)"] = {abbrev = "", color = "#3EADB9", shortname = "",},
["Ganemos (2019)"] = {abbrev = "", color = "#C2272D", shortname = "",},
["Ganemos al Fracking"] = {abbrev = "", color = "#D3CA23", shortname = "",},
["Ganemos Albacete"] = {abbrev = "", color = "#A30A40", shortname = "",},
["Ganemos Almería Sí Se Puede"] = {abbrev = "", color = "#D7C01A", shortname = "",},
["Ganemos Avilés en Común"] = {abbrev = "", color = "#FB0000", shortname = "",},
["Ganemos Cambre"] = {abbrev = "", color = "#02460B", shortname = "",},
["Ganemos Cantabria"] = {abbrev = "", color = "#A91515", shortname = "",},
["Ganemos Castilla–La Mancha"] = {abbrev = "", color = "#CC1A4E", shortname = "",},
["Ganemos Chiclana"] = {abbrev = "", color = "#7B0C2C", shortname = "",},
["Ganemos Ciudad Real"] = {abbrev = "", color = "#AB0D14", shortname = "",},
["Ganemos Córdoba"] = {abbrev = "", color = "#18A383", shortname = "",},
["Ganemos Culleredo"] = {abbrev = "", color = "#DD2E44", shortname = "",},
["Ganemos Elche"] = {abbrev = "", color = "#CD00A3", shortname = "",},
["Ganemos Euskadi"] = {abbrev = "", color = "#BA1652", shortname = "",},
["Gañemos Galicia"] = {abbrev = "", color = "#009ACF", shortname = "",},
["Ganemos Jerez"] = {abbrev = "", color = "#00BEB1", shortname = "",},
["Ganemos Madrid"] = {abbrev = "", color = "#009DBC", shortname = "",},
["Ganemos Orihuela"] = {abbrev = "", color = "#D83927", shortname = "",},
["Ganemos País Valencià"] = {abbrev = "", color = "#613041", shortname = "",},
["Ganemos Palencia"] = {abbrev = "", color = "#795EAC", shortname = "",},
["Ganemos Pinto"] = {abbrev = "", color = "#69388A", shortname = "",},
["Ganemos Ronda"] = {abbrev = "", color = "#8D1F20", shortname = "",},
["Ganemos Salamanca"] = {abbrev = "", color = "#9F3122", shortname = "",},
["Ganemos Santander Sí Puede"] = {abbrev = "", color = "#7F286D", shortname = "",},
["Ganemos Sevilla"] = {abbrev = "", color = "#0C7C18", shortname = "",},
["Ganemos Talavera"] = {abbrev = "", color = "#00679C", shortname = "",},
["Ganemos Toledo"] = {abbrev = "", color = "#32A59A", shortname = "",},
["Gañemos Vigo"] = {abbrev = "", color = "#D3122C", shortname = "",},
["Gano Azadi League"] = {abbrev = "GAL", color = "#BFAC00", shortname = "",},
["Gano Forum"] = {abbrev = "", color = "#47C187", shortname = "",},
["Gano Front"] = {abbrev = "", color = "#64a470", shortname = "",},
["Garforth and Swillington Independents"] = {abbrev = "", color = "#52F72E", shortname = "",},
["Garib Raj Party"] = {abbrev = "GRP", color = "#e7d18b", shortname = "",},
["Garo National Council"] = {abbrev = "", color = "#d492b9", shortname = "",},
["Garuda Party"] = {abbrev = "", color = "#B3282B", shortname = "",},
["Gassetists"] = {abbrev = "", color = "#548D54", shortname = "Gassetist",},
["Gastoria VG"] = {abbrev = "", color = "#F29301", shortname = "",},
["Gather Sustainable Canaries"] = {abbrev = "", color = "#0DC0E0", shortname = "",},
["Gaullist"] = {abbrev = "", color = "#0066CC", shortname = "",},
["Gaumee Itthihaad"] = {abbrev = "GIP", color = "#00A651", shortname = "",},
["Gay Party"] = {abbrev = "", color = "#562E75", shortname = "",},
["Gazankulu Liberation Congress"] = {abbrev = "", color = "#E9F294", shortname = "",},
["General Elderly Alliance"] = {abbrev = "AOV", color = "#972C95", shortname = "",},
["General Electoral League"] = {abbrev = "", color = "#00529C", shortname = "Electoral League",},
["General League of Roman Catholic Caucuses"] = {abbrev = "ABRKK", color = "#000000", shortname = "",},
["General Liberation and Development Party"] = {abbrev = "", color = "#F1C40F", shortname = "",},
["General People's Congress (Yemen)"] = {abbrev = "GPC", color = "#FFCD00", shortname = "",},
["General Popular Radical Union"] = {abbrev = "GLRE", color = "grey", shortname = "",},
["General Union for the Good of Macau"] = {abbrev = "UBM", color = "#800080", shortname = "",},
["General Union of Neighbourhood Associations of Macau"] = {abbrev = "", color = "#183B7D", shortname = "",},
["General Union Party"] = {abbrev = "PUGEN", color = "#DAA520", shortname = "",},
["General Water Board Party"] = {abbrev = "AWP", color = "#021373", shortname = "",},
["General Zionists"] = {abbrev = "", color = "#00ADCC", shortname = "",},
["Generation Citizens"] = {abbrev = "", color = "#312883", shortname = "",},
["Generation for a National Encounter"] = {abbrev = "", color = "#E9242B", shortname = "",},
["Generation of Independence Party (Armenia)"] = {abbrev = "", color = "#FFCB00", shortname = "",},
["Génération.s"] = {abbrev = "G.s", color = "#CC1E54", shortname = "",},
["Geneva Citizens' Movement"] = {abbrev = "", color = "#CE9D24", shortname = "Geneva Citizens'",},
["Gent de Canals"] = {abbrev = "", color = "#514D30", shortname = "",},
["Gent de Dénia"] = {abbrev = "", color = "#3CA48D", shortname = "",},
["Gent de Gramenet"] = {abbrev = "", color = "#D9951C", shortname = "",},
["Gent per Ciutadella"] = {abbrev = "", color = "#C50D1E", shortname = "",},
["Gent per Eivissa"] = {abbrev = "", color = "#04877D", shortname = "",},
["Gent per Formentera"] = {abbrev = "", color = "#96104E", shortname = "",},
["Gent per Santa María"] = {abbrev = "", color = "#FFF509", shortname = "",},
["Gente del Pueblo"] = {abbrev = "", color = "#6EA4B9", shortname = "",},
["Gente"] = {abbrev = "", color = "#B48EDB", shortname = "",},
["Genuine Opposition"] = {abbrev = "GO", color = "#ffa500", shortname = "",},
["Genuine Republican Party"] = {abbrev = "", color = "#FFA500", shortname = "",},
["George's Day Movement"] = {abbrev = "", color = "#EEB600", shortname = "",},
["Georgian Dream"] = {abbrev = "", color = "#27509C", shortname = "",},
["Georgian Labour Party"] = {abbrev = "SLP", color = "#346FAB", shortname = "",},
["Georgian Socialist-Federalist Revolutionary Party"] = {abbrev = "SSPSP", color = "#483D8B", shortname = "",},
["Georgian Troupe"] = {abbrev = "", color = "red", shortname = "",},
["Georgios Papandreou Party"] = {abbrev = "KGP", color = "khaki", shortname = "",},
["Gerakan Tanah Air"] = {abbrev = "GTA", color = "black", shortname = "",},
["Gerindra Party"] = {abbrev = "", color = "#342B29", shortname = "Gerindra",},
["GERB"] = {abbrev = "", color = "#0054A6", shortname = "",},
["GERB—SDS"] = {abbrev = "", color = "#226ABA", shortname = "",},
["German Agrarian League"] = {abbrev = "", color = "#008B45", shortname = "",},
["German Christian Social People's Party"] = {abbrev = "DCVP", color = "#AA98A9", shortname = "",},
["German Communist Party"] = {abbrev = "DKP", color = "#ED1C24", shortname = "",},
["German Conservative Party"] = {abbrev = "DKP", color = "#0781E5", shortname = "",},
["German Democratic Party"] = {abbrev = "DDP", color = "#DCCA4A", shortname = "",},
["German Electoral Coalition"] = {abbrev = "", color = "#00693E", shortname = "German Coalition",},
["German Farmers' Party"] = {abbrev = "", color = "#007A00", shortname = "",},
["German Free-minded Party"] = {abbrev = "DFP", color = "#FFD800", shortname = "",},
["German Minority Electoral Committee"] = {abbrev = "KWMN", color = "#237FC2", shortname = "",},
["German National People's Party"] = {abbrev = "DNVP", color = "#3F7BC1", shortname = "",},
["German National Party"] = {abbrev = "DNP", color = "#00008B", shortname = "",},
["German National Socialist Workers' Party"] = {abbrev = "DNSAP", color = "#8A3324", shortname = "",},
["German National Socialist Workers' Party (Czechoslovakia)"] = {abbrev = "DNSAP", color = "#8A3324", shortname = "",},
["German Party (1947)"] = {abbrev = "DP", color = "#66B67F", shortname = "",},
["German Party (Romania)"] = {abbrev = "DPR", color = "black", shortname = "",},
["German Party"] = {abbrev = "", color = "#63B8FF", shortname = "",},
["German People's Party (1868)"] = {abbrev = "", color = "#FFAB00", shortname = "",},
["German People's Party (Austria)"] = {abbrev = "DVP", color = "#63C3D0", shortname = "",},
["German People's Party"] = {abbrev = "DVP", color = "#D5AC27", shortname = "",},
["German People's Union"] = {abbrev = "DVU", color = "#AA4422", shortname = "",},
["German Progress Party (Austria)"] = {abbrev = "DSP", color = "#EEEEEE", shortname = "",},
["German Progress Party"] = {abbrev = "DFP", color = "#FFD700", shortname = "",},
["German Right Party"] = {abbrev = "DRP", color = "#85553D", shortname = "",},
["German Social Democratic Workers' Party in the Czechoslovak Republic"] = {abbrev = "DSAP", color = "#FA5A42", shortname = "",},
["German Social Party (Weimar Republic)"] = {abbrev = "", color = "#A46A44", shortname = "",},
["German Social Union (East Germany)"] = {abbrev = "DSU", color = "#6495ED", shortname = "",},
["German State Party"] = {abbrev = "DStP", color = "#DBC94B", shortname = "",},
["German Völkisch Freedom Party"] = {abbrev = "", color = "black", shortname = "",},
["German Workers' Party"] = {abbrev = "DAP", color = "#096300", shortname = "",},
["German Workers' Party (Austria-Hungary)"] = {abbrev = "DAP", color = "#6495ED", shortname = "",},
["German-Hanoverian Party"] = {abbrev = "DHP", color = "#C5DC74", shortname = "",},
["German-National Party"] = {abbrev = "DNP", color = "#63B8FF", shortname = "",},
["Geroa Bai"] = {abbrev = "GBai", color = "#F75E42", shortname = "",},
["Geroa Socialverdes"] = {abbrev = "", color = "#6B8F36", shortname = "",},
["Gesher (2019 political party)"] = {abbrev = "", color = "#ED0963", shortname = "",},
["Gesher"] = {abbrev = "", color = "#252CAE", shortname = "",},
["Getxoko Udal Kandidatura"] = {abbrev = "", color = "#622D63", shortname = "",},
["Ghana Freedom Party"] = {abbrev = "", color = "#094715", shortname = "",},
["Ghana Union Movement"] = {abbrev = "", color = "#8B0021", shortname = "",},
["Għarb First"] = {abbrev = "GĦ1", color = "black", shortname = "Għarb First",},
["Ghibellines"] = {abbrev = "", color = "#E34234", shortname = "",},
["Gibraltar National Party"] = {abbrev = "", color = "#DF424D", shortname = "National",},
["Gibraltar Social Democrats"] = {abbrev = "", color = "#043967", shortname = "Social Democrats",},
["Gibraltar Socialist Labour Party"] = {abbrev = "", color = "#F5053C", shortname = "Socialist Labour",},
["Gijonese Unity"] = {abbrev = "", color = "#8D6E63", shortname = "",},
["Girchi - More Freedom"] = {abbrev = "", color = "#359239", shortname = "",},
["Girondins"] = {abbrev = "", color = "#6082B6", shortname = "",},
["Glasgow First"] = {abbrev = "", color = "#ff0000", shortname = "",},
["Go on Country – Social Integration Party"] = {abbrev = "", color = "#E62171", shortname = "Go on Country",},
["Go on Country"] = {abbrev = "", color = "#E62171", shortname = "",},
["Goa Forward Party"] = {abbrev = "GFP", color = "#353982", shortname = "",},
["Goa Rajiv Congress Party"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Goa Suraksha Manch"] = {abbrev = "", color = "#E1A95F", shortname = "",},
["Goa Vikas Party"] = {abbrev = "", color = "orange", shortname = "",},
["Goazen Bilbao"] = {abbrev = "", color = "#B90DBB", shortname = "",},
["Golden Dawn (Greece)"] = {abbrev = "ΧΑ", color = "#00022D", shortname = "",},
["Golden Dawn"] = {abbrev = "", color = "black", shortname = "",},
["Golden India Party"] = {abbrev = "", color = "#330000", shortname = "",},
["Golfitenean Action Party"] = {abbrev = "PAGOL", color = "#7DC9FF", shortname = "",},
["Golkar"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Gomera Group of Independents"] = {abbrev = "", color = "#0C1C94", shortname = "",},
["Gomera Socialist Group"] = {abbrev = "ASG", color = "#B61414", shortname = "",},
["Gondwana Ganatantra Party"] = {abbrev = "GGP", color = "purple", shortname = "",},
["Good (political party)"] = {abbrev = "", color = "#F36900", shortname = "Good",},
["Good Choice and Moderates"] = {abbrev = "", color = "#FF002B", shortname = "",},
["Good Governance Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Good Morning Serbia"] = {abbrev = "DJS", color = "#C4B34E", shortname = "",},
["Good Movement"] = {abbrev = "DR", color = "#F6B331", shortname = "",},
["Good Old Democratic Party"] = {abbrev = "", color = "#365476", shortname = "",},
["Good Right"] = {abbrev = "BD", color = "#2C6DB3", shortname = "",},
["Good State (Slovenia)"] = {abbrev = "", color = "#015F9C", shortname = "",},
["Gorkha Janmukti Morcha (G)"] = {abbrev = "", color = "#FF6600", shortname = "",},
["Gorkha Janmukti Morcha (T)"] = {abbrev = "", color = "#FF2561", shortname = "",},
["Gorkha Janmukti Morcha"] = {abbrev = "GJM", color = "#049747", shortname = "",},
["Gorkha National Liberation Front"] = {abbrev = "GNLF", color = "#347C17", shortname = "",},
["Gorkha Rashtriya Congress"] = {abbrev = "GRC", color = "#FF0130", shortname = "",},
["Gorkhaland Rajya Nirman Morcha"] = {abbrev = "", color = "#FF0274", shortname = "",},
["Gorran Movement"] = {abbrev = "", color = "#1F1C50", shortname = "Gorran",},
["Government Disciplined Services General Union"] = {abbrev = "", color = "#0000CC", shortname = "",},
["Government of South Korea"] = {abbrev = "", color = "#003865", shortname = "",},
["Government"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Governors of British Ceylon"] = {abbrev = "", color = "#000000", shortname = "",},
["Granada Truth and Democracy"] = {abbrev = "", color = "#E5349E", shortname = "",},
["Grand Alliance for Democracy"] = {abbrev = "GAD", color = "#4169E1", shortname = "",},
["Grand Alliance for National Unity"] = {abbrev = "GANA", color = "#F28900", shortname = "",},
["Grand Democratic Alliance"] = {abbrev = "GDA", color = "#199153", shortname = "",},
["Grand Dream Development Party"] = {abbrev = "", color = "#113673", shortname = "",},
["Grand National Alliance (Dominican Republic)"] = {abbrev = "", color = "#F88379", shortname = "",},
["Grand National Alliance (Guatemala)"] = {abbrev = "GANA", color = "#0047AB", shortname = "",},
["Grand National Party"] = {abbrev = "", color = "#0994DC", shortname = "Grand National",},
["Grand National Party (1997)"] = {abbrev = "", color = "#0000A8", shortname = "Grand National",},
["Grand National Union of Kenya"] = {abbrev = "GNU", color = "Orange", shortname = "",},
["Grand Slam"] = {abbrev = "", color = "#f3e6d7", shortname = "",},
["Grand Unified Democratic New Party"] = {abbrev = "", color = "#FF8200", shortname = "New Democratic",},
["Grassroots Democratic Party (Cambodia)"] = {abbrev = "GDP", color = "#269721", shortname = "",},
["Grassroots Democratic Party of Germany"] = {abbrev = "", color = "#4AA79D", shortname = "dieBasis",},
["Grassroots—Legalize Cannabis Party"] = {abbrev = "", color = "#50C878", shortname = "Grassroots—LC",},
["Grassroots Party"] = {abbrev = "", color = "#50C878", shortname = "Grassroots",},
["Grau Unit"] = {abbrev = "", color = "#078930", shortname = "",},
["Great Azerbaijan Party"] = {abbrev = "BAP", color = "#C72127", shortname = "",},
["Great Consolidated Popular Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Great Fatherland Party"] = {abbrev = "", color = "#B00000", shortname = "Great Fatherland",},
["Great Indonesia Unity Party"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Great Nigeria People's Party"] = {abbrev = "", color = "yellow", shortname = "",},
["Great North"] = {abbrev = "", color = "#0045AA", shortname = "",},
["Great Order Party"] = {abbrev = "BQP", color = "#ff101a", shortname = "",},
["Great Patriotic Pole"] = {abbrev = "GPP", color = "#F0001C", shortname = "",},
["Great Renewed National Alliance"] = {abbrev = "", color = "orange", shortname = "",},
["Great Unity Party"] = {abbrev = "", color = "#CC5252", shortname = "Büyük Birlik",},
["Greater Dunedin"] = {abbrev = "", color = "#2690C4", shortname = "",},
["Greater German People's Party"] = {abbrev = "GDVP", color = "#0E428E", shortname = "",},
["Greater Moldova Party"] = {abbrev = "", color = "purple", shortname = "",},
["Greater Romania Party"] = {abbrev = "PRM", color = "#0258A4", shortname = "",},
["Greek Ecologists"] = {abbrev = "EO", color = "aquamarine", shortname = "",},
["Greek Radical Movement"] = {abbrev = "", color = "#1E90FF", shortname = "",},
["Greek Rally"] = {abbrev = "", color = "#1935D0", shortname = "",},
["Greek Socialist Party"] = {abbrev = "ESK", color = "#007D44", shortname = "",},
["Greek Solution"] = {abbrev = "EL", color = "#3576CC", shortname = "",},
["Greeks for the Fatherland"] = {abbrev = "", color = "#124285", shortname = "",},
["Green Actions"] = {abbrev = "", color = "#4A7729", shortname = "",},
["Green Algeria Alliance"] = {abbrev = "", color = "#009900", shortname = "Green Alliance",},
["Green Alliance (Colombia)"] = {abbrev = "", color = "#07d400", shortname = "Green Alliance",},
["Green Alliance (Russia)"] = {abbrev = "", color = "#64A20C", shortname = "",},
["Green Alliance (Spain)"] = {abbrev = "", color = "#57AC48", shortname = "",},
["Green Alliance (Switzerland)"] = {abbrev = "", color = "#11BB44", shortname = "Green Alliance",},
["Green Alternative (Hungary)"] = {abbrev = "ZA", color = "#00FF7F", shortname = "",},
["Green Alternative (Russia)"] = {abbrev = "", color = "#00A200", shortname = "",},
["Green Alternative–Ecologist Movement of Catalonia"] = {abbrev = "", color = "#009966", shortname = "",},
["Green Alternative - Sustainable Development of Croatia"] = {abbrev = "ORaH", color = "#869B20", shortname = "",},
["Green and Independent group (Braintree)"] = {abbrev = "G&I", color = "#B2D58F", shortname = "",},
["Green and Liberal Alliance"] = {abbrev = "", color = "#99FF66", shortname = "",},
["Green and Red Canaries"] = {abbrev = "", color = "#CADC0B", shortname = "",},
["Green Animalist Party"] = {abbrev = "", color = "#3B9945", shortname = "Green Animalist",},
["Green Assembly"] = {abbrev = "", color = "#008000", shortname = "",},
["Green Breeze Party"] = {abbrev = "", color = "#008000", shortname = "",},
["Green Coalition"] = {abbrev = "", color = "#18BF89", shortname = "",},
["Green Coalition–Citizen Europe"] = {abbrev = "", color = "#099E40", shortname = "",},
["Green Confederation"] = {abbrev = "", color = "#61BC5F", shortname = "",},
["Green Ecologist Party (Chile)"] = {abbrev = "", color = "#03BF00", shortname = "Green",},
["Green Europe"] = {abbrev = "", color = "#54C160", shortname = "",},
["Green Humane City"] = {abbrev = "", color = "#059948", shortname = "",},
["Green independents"] = {abbrev = "", color = "#10C25B", shortname = "Ind. Green",},
["Green League"] = {abbrev = "VIHR", color = "#006845", shortname = "",},
["Green Left (Catalonia)"] = {abbrev = "EV", color = "#6DB152", shortname = "",},
["Green Left (Denmark)"] = {abbrev = "", color = "#eb94d1", shortname = "Green Left",},
["Green–Left Front"] = {abbrev = "ZLF", color = "#015E50", shortname = "",},
["Green Left Party"] = {abbrev = "YSP", color = "#388537", shortname = "",},
["Green Left Party (Morocco)"] = {abbrev = "", color = "green", shortname = "",},
["Green Left–Initiative for the Valencian Country"] = {abbrev = "", color = "#00A354", shortname = "",},
["Green Liberal Party of Switzerland"] = {abbrev = "", color = "#b4dc00", shortname = "Green Liberals",},
["Green List"] = {abbrev = "", color = "green", shortname = "",},
["Green List Ecological Initiative"] = {abbrev = "", color = "#8DB600", shortname = "",},
["Green Melilla Platform"] = {abbrev = "", color = "#9CFE67", shortname = "",},
["Green Mountain Peace and Justice Party"] = {abbrev = "", color = "#D6FF33", shortname = "Green Mountain Peace and Justice",},
["Green Movement (Bulgaria)"] = {abbrev = "", color = "#63A83D", shortname = "Green Movement",},
["Green North Regional Force"] = {abbrev = "", color = "#32A12A", shortname = "",},
["Green Party (Brazil)"] = {abbrev = "PV", color = "#006600", shortname = "",},
["Green Party (Czech Republic)"] = {abbrev = "SZ", color = "#60B44C", shortname = "",},
["Green Party (Dominican Republic)"] = {abbrev = "", color = "#008000", shortname = "",},
["Green Party (Ireland)"] = {abbrev = "GP", color = "#22AC6F", shortname = "Green",},
["Green Party (Israel)"] = {abbrev = "", color = "#59E059", shortname = "",},
["Green Party (Norway)"] = {abbrev = "", color = "#6A9325", shortname = "Green",},
["Green Party (Romania)"] = {abbrev = "", color = "#198A3A", shortname = "",},
["Green Party (Serbia)"] = {abbrev = "", color = "#016830", shortname = "",},
["Green Party (Slovakia)"] = {abbrev = "SZ", color = "#00FF00", shortname = "",},
["Green Party (Sweden)"] = {abbrev = "MP", color = "#2B912C", shortname = "Green",},
["Green Party (Thailand)"] = {abbrev = "", color = "#309B4B", shortname = "Green",},
["Green Party (Trinidad and Tobago)"] = {abbrev = "", color = "#377D22", shortname = "Green",},
["Green Party (Turkey)"] = {abbrev = "", color = "#009245", shortname = "",},
["Green Party (UK)"] = {abbrev = "GPUK", color = "#528D6B", shortname = "Green",},
["Green Party (US)"] = {abbrev = "G", color = "#17aa5c", shortname = "Green",},
["Green Party for Progress"] = {abbrev = "", color = "#8CD901", shortname = "",},
["Green Party Korea"] = {abbrev = "", color = "#59B224", shortname = "Green",},
["Green Party Northern Ireland"] = {abbrev = "", color = "#8dc63f", shortname = "Green (NI)",},
["Green Party of Albania"] = {abbrev = "", color = "green", shortname = "",},
["Green Party of Aotearoa New Zealand"] = {abbrev = "", color = "#098137", shortname = "Green",},
["Green Party of Bolivia"] = {abbrev = "PVB", color = "#027E42", shortname = "",},
["Green Party of Bulgaria"] = {abbrev = "", color = "#337E2C", shortname = "",},
["Green Party of Canada"] = {abbrev = "", color = "#99C955", shortname = "Green",},
["Green Party of England and Wales"] = {abbrev = "", color = "#02A95B", shortname = "Green",},
["Green Party of Hong Kong"] = {abbrev = "", color = "#64aa4b", shortname = "Green",},
["Green Party of Hungary"] = {abbrev = "MZP", color = "#58AB27", shortname = "",},
["Green Party of South Africa"] = {abbrev = "", color = "green", shortname = "Green Party",},
["Green Party of Switzerland"] = {abbrev = "", color = "#84B414", shortname = "Greens",},
["Green Party of Timor"] = {abbrev = "", color = "#02A75B", shortname = "Os Verdes",},
["Green Party Solomon Islands"] = {abbrev = "", color = "#00AA4D", shortname = "",},
["Green Party Taiwan"] = {abbrev = "", color = "#3AB483", shortname = "Green",},
["Green Progressive Accord"] = {abbrev = "GPA", color = "#76EE00", shortname = "",},
["Green Regionalist Coalition"] = {abbrev = "", color = "#008000", shortname = "",},
["Green Socialist Party"] = {abbrev = "", color = "green", shortname = "",},
["Green Society"] = {abbrev = "", color = "#74B249", shortname = "",},
["Green Tunisia Party"] = {abbrev = "", color = "green", shortname = "",},
["Green Wind"] = {abbrev = "", color = "green", shortname = "",},
["Green-Rainbow Party"] = {abbrev = "", color = "#17aa5c", shortname = "Green-Rainbow",},
["Green–Left Coalition"] = {abbrev = "", color = "#B31224", shortname = "",},
["Green"] = {abbrev = "", color = "#99CC33", shortname = "Greens",},
["Greenback Party"] = {abbrev = "GB", color = "#0BDA51", shortname = "Greenback",},
["Greens – Solidarity"] = {abbrev = "", color = "#32cd32", shortname = "Greens",},
["Greens (South Tyrol)"] = {abbrev = "", color = "#6B8E23", shortname = "Greens",},
["Greens (Ukraine)"] = {abbrev = "", color = "#228B22", shortname = "Greens",},
["Greens and Castilians"] = {abbrev = "", color = "#5A9C30", shortname = "",},
["Greens and Eco-pacifists"] = {abbrev = "", color = "#36A119", shortname = "",},
["Greens and Left Alliance"] = {abbrev = "", color = "#BE3457", shortname = "Greens and Left",},
["Greens Equo of the Valencian Country"] = {abbrev = "", color = "#36A119", shortname = "",},
["Greens Equo"] = {abbrev = "", color = "#46922B", shortname = "",},
["Greens Greens"] = {abbrev = "", color = "green", shortname = "",},
["Greens Japan"] = {abbrev = "", color = "#52af45", shortname = "Greens",},
["Greens New South Wales"] = {abbrev = "", color = "#10C25B", shortname = "Greens",},
["Greens of Andorra"] = {abbrev = "Vd'A", color = "#ADFF2F", shortname = "",},
["Greens of Bosnia and Herzegovina"] = {abbrev = "", color = "green", shortname = "",},
["Greens of Burkina"] = {abbrev = "", color = "green", shortname = "",},
["Greens of Serbia"] = {abbrev = "ZS", color = "#059649", shortname = "",},
["Greens of Slovenia"] = {abbrev = "", color = "green", shortname = "",},
["Greens on Åland"] = {abbrev = "", color = "#008000", shortname = "",},
["Greens Party of Georgia"] = {abbrev = "", color = "#26884A", shortname = "Greens",},
["Greens Party of Mozambique"] = {abbrev = "", color = "#64BC44", shortname = "",},
["Greens South Australia"] = {abbrev = "", color = "#00a651", shortname = "Greens",},
["Greens Western Australia"] = {abbrev = "", color = "#00a651", shortname = "Greens",},
["Greens–European Free Alliance"] = {abbrev = "", color = "#57B45F", shortname = "Greens/EFA",},
["Grenada National Party"] = {abbrev = "", color = "green", shortname = "",},
["Grenada Renaissance Party"] = {abbrev = "", color = "#4BACC6", shortname = "",},
["Grenada United Labour Party"] = {abbrev = "", color = "#D50000", shortname = "",},
["Groen (political party)"] = {abbrev = "", color = "#01796F", shortname = "Groen",},
["GroenLinks"] = {abbrev = "GL", color = "#5BC422", shortname = "",},
["GroenLinks–PvdA"] = {abbrev = "GL/PvdA", color = "#DC1F26", shortname = "",},
["Group and Union for the Progress of Almeria"] = {abbrev = "", color = "#005121", shortname = "",},
["Group for La Laguna"] = {abbrev = "", color = "#9F2362", shortname = "",},
["Group of 89"] = {abbrev = "", color = "#0d3b68", shortname = "",},
["Group of Independents of Marratxí"] = {abbrev = "", color = "#6E7096", shortname = "",},
["Group of Independents, Progressives and Nationalists"] = {abbrev = "", color = "#F8C902", shortname = "",},
["Group of Transylvanian Saxons"] = {abbrev = "GST", color = "black", shortname = "",},
["Group Otten"] = {abbrev = "GO", color = "#FAE704", shortname = "",},
["Grouped Independent Neighbors"] = {abbrev = "", color = "#ECD060", shortname = "",},
["Grouped Independents of Ponferrada"] = {abbrev = "", color = "#F78513", shortname = "",},
["Grouped Rural Citizens"] = {abbrev = "", color = "#52CA6B", shortname = "",},
["Grouping to the Service of the Republic"] = {abbrev = "", color = "#6B1F7C", shortname = "",},
["Grup Independent de Son Carrió"] = {abbrev = "", color = "#E46668", shortname = "",},
["Grupo Común da Esquerda"] = {abbrev = "", color = "#6D52C1", shortname = "",},
["Grütli Union"] = {abbrev = "", color = "#FA1360", shortname = "",},
["GSLP–Liberal Alliance"] = {abbrev = "", color = "#D20D13", shortname = "Alliance",},
["Guadeloupe Communist Party"] = {abbrev = "", color = "#DD0000", shortname = "",},
["Guanyant Torrent"] = {abbrev = "", color = "#9A297E", shortname = "",},
["Guanyem Badalona–Badalona En Comú"] = {abbrev = "", color = "#D51D50", shortname = "",},
["Guanyem Catalunya (2020)"] = {abbrev = "", color = "#ED174B", shortname = "",},
["Guanyem Catalunya"] = {abbrev = "", color = "#9F1B3F", shortname = "",},
["Guanyem Eivissa"] = {abbrev = "", color = "#940000", shortname = "",},
["Guanyem Gandia"] = {abbrev = "", color = "#EE1F25", shortname = "",},
["Guanyem Girona"] = {abbrev = "", color = "#B41062", shortname = "",},
["Guanyem L'Hospitalet"] = {abbrev = "", color = "#7B0012", shortname = "",},
["Guanyem les Illes Balears"] = {abbrev = "", color = "#BD0E15", shortname = "",},
["Guanyem Sabadell"] = {abbrev = "", color = "#91030F", shortname = "",},
["Guanyem Tarragona"] = {abbrev = "", color = "#F93620", shortname = "",},
["Guanyem–L'Esquerra Unitària"] = {abbrev = "", color = "#D42B15", shortname = "",},
["Guasú Front"] = {abbrev = "", color = "#BA55D3", shortname = "",},
["Guatemalan Christian Democracy"] = {abbrev = "DCG", color = "#046637", shortname = "",},
["Guatemalan National Revolutionary Unity"] = {abbrev = "URNG", color = "#D79E2D", shortname = "",},
["Guatemalan People's Party"] = {abbrev = "PPG", color = "#2b65af", shortname = "People's Party",},
["Guatemalan Party of Labour"] = {abbrev = "", color = "#DD0000", shortname = "",},
["Guelphs"] = {abbrev = "", color = "#000000", shortname = "",},
["Guianese Socialist Party"] = {abbrev = "PSG", color = "#EA8B9B", shortname = "",},
["Guildford Greenbelt Group"] = {abbrev = "GGG", color = "#006633", shortname = "",},
["Guinea for All"] = {abbrev = "", color = "#299D58", shortname = "",},
["Guinean Patriotic Union"] = {abbrev = "", color = "#2C2F74", shortname = "",},
["Guinean Workers' Party"] = {abbrev = "PTG", color = "#C4272A", shortname = "",},
["Gujarat Parivartan Party"] = {abbrev = "GPP", color = "#FADA5E", shortname = "",},
["Guldborgsundlisten"] = {abbrev = "", color = "#00ffff", shortname = "",},
["Gure Aukera"] = {abbrev = "", color = "#DB005F", shortname = "",},
["Guxo"] = {abbrev = "", color = "#14B0A7", shortname = "",},
["Guyana Action Party"] = {abbrev = "", color = "red", shortname = "",},
["Gwlad Gwlad"] = {abbrev = "", color = "#FF8000", shortname = "",},
["Gwlad"] = {abbrev = "", color = "#FF8000", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
8c0976c05e137559a18430d084f63a60b0852df6
Module:Political party/R
828
229
450
2023-12-23T12:42:23Z
wikipedia>Mahesh Chhanga 78
0
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["Radical and Radical-Socialist Party"] = "Radical Party (France)",
["Radical Democracy Party (Chile)"] = "Radical Democracy (Chile)",
["Radical List"] = "Liberal League (Luxembourg)",
["Radical Party (Italy, 1877)"] = "Italian Radical Party",
["Radical Party (UK)"] = "Radicals (UK)",
["Radical Party (Ukraine)"] = "Radical Party of Oleh Liashko",
["Radical Party (Chile)"] = "Radical Party of Chile",
["Radical Party of Oleh Lyashko"] = "Radical Party of Oleh Liashko",
["Rainbow Group (1984-1989)"] = "Rainbow Group (1984–1989)",
["Rainbow Group"] = "Greens–European Free Alliance",
["Rally Wallonia France"] = "Rassemblement Wallonie France",
["Rassemblement bleu Marine"] = "National Rally",
["Resurgence Party"] = "Rastakhiz Party",
["Ratepayers Association"] = "Ratepayers' Association",
["Ratepayers Associations"] = "Ratepayers' Association",
["Razem"] = "Left Together",
["Reason of the Polish Left"] = "Reason Party (Poland)",
["Readjuster Party (United States)"] = "Readjuster Party",
["Red-Green Alliance (Denmark)"] = "Red–Green Alliance (Denmark)",
["Referendum Party (UK)"] = "Referendum Party",
["Reform and Development Misruna Party"] = "Reform and Development Party (Egypt)",
["Reform Party (Iceland, 2016)"] = "Reform Party (Iceland)",
["Reform Party (United States)"] = "Reform Party (US)",
["Reform Party of New York State"] = "Reform Party (New York State)",
["Reform Party of the United States of America"] = "Reform Party (US)",
["Reform Party"] = "Reform Party (Southern Rhodesia)",
["Reform"] = "Estonian Reform Party",
["Reformed Political Party - Reformatory Political Federation - Reformed Political League"] = "Reformed Political Party – Reformatory Political Federation – Reformed Political League",
["Regionalist"] = "Regionalism (politics)",
["Regionalists"] = "Regionalism (politics)",
["Regionalists and separatists"] = "Regionalism (politics)",
["Regionalist Aragonese Party"] = "Aragonese Party",
["Régions et Peuples Solidaires"] = "Regionalism (politics)",
["Renaissance Party"] = "Ennahda Movement",
["Renew Britain"] = "Renew Party",
["Renewal (Transnistria)"] = "Obnovlenie",
["Renua Ireland"] = "Renua",
["REPUBLIC (Slovakia)"] = "Republic (Slovakia)",
["Republic Arise"] = "Debout la République",
["Republic Party"] = "Party of the Republic",
["Republican Coalition (Spain, 1891)"] = "Republican Fusion",
["Republican Coalition (Spain, 1996)"] = "Alliance for the Republic (Spain)",
["Republican Left of Catalonia-Sovereigntists"] = "Republican Left of Catalonia",
["Republican Left of Catalonia–Catalonia Yes"] = "Republican Left of Catalonia",
["Republican Left of Catalonia–Sovereigntists"] = "Republican Left of Catalonia", -- dash difference
["Republican Left of the Valencian Country"] = "Republican Left of Catalonia",
["Republican Moderate Party of Alaska"] = "Republican Moderate Party (Alaska)",
["Republican Party (Chile)"] = "Republican Party (Chile, 2019)",
["Republican Party (Faroe Islands)"] = "Republic (Faroe Islands)",
["Republican Party (Poland)"] = "The Republicans (Poland)",
["Republican Party (US)"] = "Republican Party (United States)",
["Republican Party (Alabama)"] = "Republican Party (United States)",
["Republican Party (Alaska)"] = "Republican Party (United States)",
["Republican Party (Arizona)"] = "Republican Party (United States)",
["Republican Party (Arkansas)"] = "Republican Party (United States)",
["Republican Party (California)"] = "Republican Party (United States)",
["Republican Party (Colorado)"] = "Republican Party (United States)",
["Republican Party (Connecticut)"] = "Republican Party (United States)",
["Republican Party (Delaware)"] = "Republican Party (United States)",
["Republican Party (Georgia, US)"] = "Republican Party (United States)",
["Republican Party (Guam)"] = "Republican Party (United States)",
["Republican Party (Hawaii)"] = "Republican Party (United States)",
["Republican Party (Idaho)"] = "Republican Party (United States)",
["Republican Party (Illinois)"] = "Republican Party (United States)",
["Republican Party (Iowa)"] = "Republican Party (United States)",
["Republican Party (Maryland)"] = "Republican Party (United States)",
["Republican Party (Massachusetts)"] = "Republican Party (United States)",
["Republican Party (Michigan)"] = "Republican Party (United States)",
["Republican Party (Minnesota)"] = "Republican Party (United States)",
["Republican Party (Missouri)"] = "Republican Party (United States)",
["Republican Party (Nevada)"] = "Republican Party (United States)",
["Republican Party (New Mexico)"] = "Republican Party (United States)",
["Republican Party (New York)"] = "Republican Party (United States)",
["Republican Party (North Dakota)"] = "Republican Party (United States)",
["Republican Party (Northern Mariana Islands)"] = "Republican Party (United States)",
["Republican Party (Pennsylvania)"] = "Republican Party (United States)",
["Republican Party (Rhode Island)"] = "Republican Party (United States)",
["Republican Party (Utah)"] = "Republican Party (United States)",
["Republican Party (Vermont)"] = "Republican Party (United States)",
["Republican Party (Virginia)"] = "Republican Party (United States)",
["Republican Party (Washington State)"] = "Republican Party (United States)",
["Republican Party (Washington)"] = "Republican Party (United States)",
["Republican Party (West Virginia)"] = "Republican Party (United States)",
["Republican Party of Alaska"] = "Republican Party (United States)",
["Republican Party of Arkansas"] = "Republican Party (United States)",
["Republican Party of Florida"] = "Republican Party (United States)",
["Republican Party of Georgia"] = "Republican Party (United States)",
["Republican Party of India (A)"] = "Republican Party of India (Athawale)",
["Republican Party of India (Athvale)"] = "Republican Party of India (Athawale)",
["Republican Party of Iowa"] = "Republican Party (United States)",
["Republican Party of Kentucky"] = "Republican Party (United States)",
["Republican Party of Louisiana"] = "Republican Party (United States)",
["Republican Party of Minnesota"] = "Republican Party (United States)",
["Republican Party of New Mexico"] = "Republican Party (United States)",
["Republican Party of São Paulo"] = "Paulista Republican Party",
["Republican Party of Texas"] = "Republican Party (United States)",
["Republican Party of Virginia"] = "Republican Party (United States)",
["Republican Party of Wisconsin"] = "Republican Party (United States)",
["Republican People's Party (Turkey)"] = "Republican People's Party",
["Republican Pole"] = "Citizen and Republican Movement",
["Republican Popular Unity"] = "Communist Party of Spain (Marxist–Leninist) (historical)",
["Republican Statehood Party"] = "Partido Estadista Republicano",
["Republican Union (Spain, 1886)"] = "Republican Fusion",
["Republican Union (Spain, 1893)"] = "Republican Fusion",
["Republican, Radical and Radical-Socialist Party (historical)"] = "Radical Party (France)",
["Republican, Radical and Radical-Socialist Party"] = "Radical Party (France)",
["Reconquête (political party)"] = "Reconquête",
["Respect - The Unity Coalition"] = "Respect Party",
["Respect – The Unity Coalition"] = "Respect Party",
["RESPECT The Unity Coalition"] = "Respect Party",
["Respublika Party of Kyrgyzstan"] = "Respublika (political party)",
["Restoration Political Party - New Wind"] = "Ishin Seito Shimpu",
["Reunited National Party"] = "Herenigde Nasionale Party",
["Revival (Moldova)"] = "Revival Party (Moldova)",
["Revolution Continues"] = "The Revolution Continues Alliance",
["Revolutionary Committee of the Kuomintang"] = "Revolutionary Committee of the Chinese Kuomintang",
["Revolutionary Communist Party (Furedi)"] = "Revolutionary Communist Party (UK, 1978)",
["Revolutionary Front for an Independent East Timor"] = "Fretilin",
["Revolutionary Nationalist Movement-Alliance"] = "Revolutionary Nationalist Movement",
["Revolutionary Nationalist Movement–Alliance"] = "Revolutionary Nationalist Movement", -- dash difference
["Revolutionary Nationalist Movement – Vanguard"] = "9 April Revolutionary Vanguard",
["Revolutionary Communist League (Luxembourg)"] = "Revolutionary Socialist Party (Luxembourg)",
["Revolutionary Workers Party (United States)"] = "Revolutionary Workers Party (US)",
["Rhode Island Democratic Party"] = "Democratic Party (United States)",
["Rhode Island Republican Party"] = "Republican Party (United States)",
["Right Cause (political party)"] = "Right Cause",
["Right to Life Party (US)"] = "New York State Right to Life Party",
["Right to Life Party (New York)"] = "New York State Right to Life Party",
["Rightist Party"] = "Moderate Party",
["Rightist Socialist Party of Japan"] = "Right Socialist Party of Japan",
["Rikken Seiyukai"] = "Rikken Seiyūkai",
["Rikken Minseito"] = "Constitutional Democratic Party (Japan)",
["Rikken Minseitō"] = "Constitutional Democratic Party (Japan)",
["Ring of Independents"] = "Alliance of Independents",
["Riojan Party (1990–2012)"] = "Riojan Party",
["RISE - Scotland's Left Alliance"] = "RISE – Scotland's Left Alliance",
["Rivers State People's Democratic Party"] = "Rivers State Peoples Democratic Party",
["Rodina"] = "Rodina (political party)",
["Romandy Citizens' Movement"] = "Geneva Citizens' Movement",
["Romanian National Party (Moldova)"] = "New Historical Option",
["Romanian Socialist Party (present day)"] = "Romanian Socialist Party (2003)",
["RSP Against Racism and Fascism"] = "Revolutionary Socialist Party (Luxembourg)",
["Rule of Law (Armenia)"] = "Orinats Yerkir",
["Runnymede Independent Residents Group"] = "Runnymede Independent Residents' Group",
["Runnymede Residents Association"] = "Runnymede Independent Residents' Group",
}
local full = {
["Radcliffe First"] = {abbrev = "", color = "#F86204", shortname = "",},
["Radical Cause"] = {abbrev = "LCR", color = "#1E90FF", shortname = "",},
["Radical Change"] = {abbrev = "", color = "#FB656F", shortname = "",},
["Radical Civic Union"] = {abbrev = "UCR", color = "#E10019", shortname = "",},
["Radical Democracy (Chile)"] = {abbrev = "", color = "#00E2C8", shortname = "",},
["Radical Democratic Party (Bulgaria)"] = {abbrev = "", color = "#1C4482", shortname = "",},
["Radical Democratic Party (Spain)"] = {abbrev = "", color = "#DD6284", shortname = "Radical",},
["Radical Doctrinaire Party"] = {abbrev = "", color = "lightseagreen", shortname = "",},
["Radical League"] = {abbrev = "RL", color = "#FFFF00", shortname = "",},
["Radical Left (Luxembourg)"] = {abbrev = "", color = "#800080", shortname = "",},
["Radical Left Front"] = {abbrev = "MERA", color = "indianred", shortname = "",},
["Radical Left Party (Chile)"] = {abbrev = "", color = "yellow", shortname = "",},
["Radical Liberal Party (Luxembourg)"] = {abbrev = "", color = "#F4EE00", shortname = "",},
["Radical Liberal Party (Paraguay)"] = {abbrev = "", color = "#808080", shortname = "Radical Liberal",},
["Radical Movement"] = {abbrev = "MR", color = "#E0B0FF", shortname = "",},
["Radical Party of Chile"] = {abbrev = "", color = "#CD5C5C", shortname = "Radical",},
["Radical Party of Chile (2018)"] = {abbrev = "", color = "#CD5C5C", shortname = "Radical",},
["Radical Party (Belgium)"] = {abbrev = "", color = "#800080", shortname = "Radical",},
["Radical Party (France)"] = {abbrev = "PRV", color = "#E0B0FF", shortname = "",},
["Radical Party (Italy)"] = {abbrev = "PR", color = "#FFD700", shortname = "Radical Party",},
["Radical Party (Luxembourg)"] = {abbrev = "", color = "#F3C400", shortname = "",},
["Radical Party of Oleh Liashko"] = {abbrev = "RPOL", color = "#D64541", shortname = "",},
["Radical Party of Republika Srpska"] = {abbrev = "", color = "Darkblue", shortname = "RS RS",},
["Radical Party of the Left"] = {abbrev = "PRG", color = "#F0C200", shortname = "",},
["Radical Peasant Party"] = {abbrev = "CSR", color = "#33452D", shortname = "",},
["Radical People's Party (Finland)"] = {abbrev = "", color = "Red", shortname = "",},
["Radical People's Party (Norway)"] = {abbrev = "", color = "#59A421", shortname = "Radical People's",},
["Radical Republican Party"] = {abbrev = "PRR", color = "#A871A8", shortname = "",},
["Radical Socialist Catalan Left"] = {abbrev = "", color = "#AF2A88", shortname = "",},
["Radical Socialist Party (Luxembourg)"] = {abbrev = "", color = "#F3C400", shortname = "",},
["Radical Socialist Republican Party"] = {abbrev = "PRRS", color = "#9A0DBC", shortname = "",},
["Radical Union (Cuba)"] = {abbrev = "", color = "#FA8072", shortname = "",},
["Radicals (UK)"] = {abbrev = "", color = "#FF3333", shortname = "Radical",},
["Rafi (political party)"] = {abbrev = "", color = "#1935D0", shortname = "Rafi",},
["Rafidain List"] = {abbrev = "", color = "#5f21a9", shortname = "",},
["Rah-e-Haq Party"] = {abbrev = "RHP", color = "#A9A9A9", shortname = "",},
["Rahanweyn Resistance Army"] = {abbrev = "RRA", color = "#DC143C", shortname = "",},
["Raijor Dal"] = {abbrev = "RD", color = "#FEE502", shortname = "",},
["Rainbow (Greece)"] = {abbrev = "", color = "#E2725B", shortname = "Rainbow",},
["Rainbow (Iceland)"] = {abbrev = "", color = "#CC0000", shortname = "Rainbow",},
["Rainbow (Netherlands)"] = {abbrev = "", color = "#76EE00", shortname = "Rainbow",},
["Rainbow Greens (Italy)"] = {abbrev = "", color = "#4B6F44", shortname = "Rainbow Greens",},
["Rainbow Group (1984–1989)"] = {abbrev = "RBW", color = "#ADFF2F", shortname = "",},
["Rainbow Group (1989–1994)"] = {abbrev = "RBW", color = "#ADFF2F", shortname = "",},
["Rainbow Party (Zambia)"] = {abbrev = "", color = "#E3001B", shortname = "",},
["Rainham & Wennington Independent Residents Group"] = {abbrev = "", color = "#dddddd", shortname = "",},
["RAIZ"] = {abbrev = "", color = "#2d3e4e", shortname = "",},
["Raise Extremadura"] = {abbrev = "", color = "#169744", shortname = "",},
["Rajasthan Vikas Party"] = {abbrev = "RJVP", color = "#FF3366", shortname = "",},
["Rajyadhikara Party"] = {abbrev = "", color = "#DDD", shortname = "",},
["Rak Santi Party"] = {abbrev = "", color = "green", shortname = "Rak Santi",},
["Rak Thailand Party"] = {abbrev = "", color = "#0000FF", shortname = "Rak Thailand",},
["Rakhine Nationalities Development Party"] = {abbrev = "RNDP", color = "#EB1D27", shortname = "",},
["Ralliement citoyen pour la patrie"] = {abbrev = "", color = "#7FFFD4", shortname = "",},
["Rally & Issues"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Rally for an Alternative of Harmonious and Integrated Development"] = {abbrev = "RADHI", color = "#A31124", shortname = "",},
["Rally for Caledonia"] = {abbrev = "RPC", color = "#1270C2", shortname = "",},
["Rally for Congolese Democracy"] = {abbrev = "", color = "green", shortname = "",},
["Rally for Culture and Democracy"] = {abbrev = "RCD", color = "#264989", shortname = "",},
["Rally for Democracy and Progress (Namibia)"] = {abbrev = "RDP", color = "#166B37", shortname = "",},
["Rally for Democracy and Progress (Niger)"] = {abbrev = "", color = "#FBD127", shortname = "RDP-Jama'a",},
["Rally for Democracy and Renewal"] = {abbrev = "RDR", color = "", shortname = "",},
["Rally for Democracy and Social Progress"] = {abbrev = "RDPS", color = "#00B100", shortname = "",},
["Rally for Democracy and Unity"] = {abbrev = "RDU", color = "#4D92F1", shortname = "",},
["Rally for France"] = {abbrev = "RPF", color = "#003399", shortname = "",},
["Rally for Hope for Algeria"] = {abbrev = "TAJ", color = "#8C71FA", shortname = "",},
["Rally for Mali"] = {abbrev = "RPM", color = "#FCD116", shortname = "",},
["Rally for the Independence of France"] = {abbrev = "", color = "#003399", shortname = "",},
["Rally for the Monegasque Family"] = {abbrev = "", color = "#AB7141", shortname = "",},
["Rally for the Republic – Republican Party of Czechoslovakia"] = {abbrev = "SPR–RSČ", color = "#3E3E3E", shortname = "",},
["Rally for the Republic"] = {abbrev = "RPR", color = "#08206F", shortname = "",},
["Rally of Congolese Ecologists – The Greens"] = {abbrev = "", color = "green", shortname = "",},
["Rally of Democratic Forces"] = {abbrev = "RFD", color = "#000000", shortname = "",},
["Rally of Democrats, Progressive and Independent"] = {abbrev = "RDPI", color = "#08A1E3", shortname = "",},
["Rally of Houphouëtists for Democracy and Peace"] = {abbrev = "RHDP", color = "#FF7900", shortname = "",},
["Rally of Progressive National Democrats"] = {abbrev = "RPND", color = "#008000", shortname = "",},
["Rally of Republican Lefts"] = {abbrev = "RGR", color = "#FFBF00", shortname = "",},
["Rally of the Ecologists of Burkina"] = {abbrev = "", color = "green", shortname = "",},
["Rally of the Ecologists of Senegal"] = {abbrev = "", color = "green", shortname = "",},
["Rally of the French People"] = {abbrev = "RPF", color = "#25038E", shortname = "",},
["Rally of the Guinean People"] = {abbrev = "RPG", color = "#FEF200", shortname = "",},
["Rally of the Republicans"] = {abbrev = "RDR", color = "#FF9933", shortname = "",},
["Rally of the Togolese People"] = {abbrev = "RPT", color = "#037338", shortname = "",},
["Rally Responsibility Success"] = {abbrev = "", color = "red", shortname = "",},
["Ramgavar"] = {abbrev = "", color = "#2554C7", shortname = "",},
["RAŚ"] = {abbrev = "", color = "yellow", shortname = "",},
["Rashtra Bhakt Dal"] = {abbrev = "RBD", color = "#F75808", shortname = "",},
["Rashtravadi Bahujan Hitay Party"] = {abbrev = "RBHP", color = "#81F7F3", shortname = "",},
["Rashtravadi Janata Party"] = {abbrev = "RJP", color = "#cdfecd", shortname = "",},
["Rashtrawadi Labour Party"] = {abbrev = "RALP", color = "#BCA9F5", shortname = "",},
["Rashtrawadi Sena"] = {abbrev = "RWS", color = "blue", shortname = "",},
["Rashtriya Aadiwasi Bahujan Party"] = {abbrev = "RABP", color = "#cc0066", shortname = "",},
["Rashtriya Aikta Manch Party"] = {abbrev = "RAM", color = "#81F781", shortname = "",},
["Rashtriya Ali Sena"] = {abbrev = "RAS", color = "#0F6433", shortname = "",},
["Rashtriya Bahujan Congress Party"] = {abbrev = "RBCP", color = "#afeeee", shortname = "",},
["Rashtriya Bahujan Hitay Party"] = {abbrev = "RBHP", color = "#ffb5da", shortname = "",},
["Rashtriya Hith Congress"] = {abbrev = "RHC", color = "#5FB404", shortname = "",},
["Rashtriya Janadhikar Suraksha Party"] = {abbrev = "RJSP", color = "#ffdacc", shortname = "",},
["Rashtriya Janasachetan Party"] = {abbrev = "RJP", color = "orange", shortname = "",},
["Rashtriya Janata Dal"] = {abbrev = "RJD", color = "#056D05", shortname = "",},
["Rashtriya Janata Party"] = {abbrev ="RJP", color = "#FFC0CB" , shortname= "",},
["Rashtriya Janmorcha"] = {abbrev = "", color = "#CA7EE4", shortname = "",},
["Rashtriya Kamgar Party"] = {abbrev = "RKAP", color = "#1E76D5", shortname = "",},
["Rashtriya Kranti Party"] = {abbrev = "RTKP", color = "#B47011", shortname = "",},
["Rashtriya Krantikari Janata Party"] = {abbrev = "RKJP", color = "#a8e4bc", shortname = "",},
["Rashtriya Krantikari Samajwadi Party"] = {abbrev = "RKSP", color = "#8A0886", shortname = "",},
["Rashtriya Lok Dal"] = {abbrev = "RLD", color = "#006400", shortname = "",},
["Rashtriya Lok Janshakti Party"] = {abbrev = "RLJP", color = "#39833C", shortname = "",},
["Rashtriya Lok Samata Party"] = {abbrev = "RLSP", color = "#999966", shortname = "",},
["Rashtriya Lok Samta Party"] = {abbrev = "RLSP", color = "#999966", shortname = "",},
["Rashtriya Loktantrik Party"] = {abbrev = "RLP", color = "#FFD42A", shortname = "",},
["Rashtriya Manav Samman Party"] = {abbrev = "RMSP", color = "#BDDC9D", shortname = "",},
["Rashtriya Matrabhoomi Party"] = {abbrev = "RMP", color = "#CA8610", shortname = "",},
["Rashtriya Mazdoor Ekta Party"] = {abbrev = "RMEP", color = "#5E610B", shortname = "",},
["Rashtriya Muslim Mujhahid Party"] = {abbrev = "RMMP", color = "#1F9E1D", shortname = "",},
["Rashtriya Parivartan Dal"] = {abbrev = "RPD", color = "#66FFCC", shortname = "",},
["Rashtriya Raksha Dal"] = {abbrev = "RRD", color = "#F79F81", shortname = "",},
["Rashtriya Samaj Paksha"] = {abbrev = "RSPS", color = "yellow", shortname = "",},
["Rashtriya Samajwadi Party (United)"] = {abbrev = "RSP(U)", color = "#A9F5F2", shortname = "",},
["Rashtriya Samanta Dal"] = {abbrev = "RSMD", color = "#D0FA58", shortname = "",},
["Rashtriya Samata Party (Secular)"] = {abbrev = "RSP(S)", color = "Brown", shortname = "",},
["Rashtriya Sawarn Shakti Party"] = {abbrev = "RSSHP", color = "#647E81", shortname = "",},
["Rashtriya Secular Majlis Party"] = {abbrev = "", color = "Green", shortname = "",},
["Rashtriya Swabhimaan Party"] = {abbrev = "RSBP", color = "#F5D0A9", shortname = "",},
["Rashtriya Swabhiman Party"] = {abbrev = "RSBP", color = "#2c2c8a", shortname = "",},
["Rashtriya Ulama Council"] = {abbrev = "RUC", color = "#ACFA58", shortname = "",},
["Rashtriya Unnatisheel Dal"] = {abbrev = "RUD", color = "#26B062", shortname = "",},
["Rashtriya Vikas Party"] = {abbrev = "RVP", color = "#D0A9F5", shortname = "",},
["Rassemblement Wallonie France"] = {abbrev = "", color = "blue", shortname = "",},
["Rastakhiz Party"] = {abbrev = "", color = "Blue", shortname = "",},
["Rastriya Janamorcha"] = {abbrev = "", color = "firebrick", shortname = "",},
["Rastriya Janamukti Party"] = {abbrev = "", color = "DodgerBlue", shortname = "Janamukti",},
["Rastriya Janata Dal Nepal"] = {abbrev = "", color = "#E6DBCF", shortname = "RJD Nepal",},
["Rastriya Janata Party Nepal"] = {abbrev = "RJPN", color = "#FFb300", shortname = "",},
["Rastriya Janshakti Party"] = {abbrev = "", color = "khaki", shortname = "Janashakti",},
["Rastriya Prajatantra Party (Chand)"] = {abbrev = "", color = "yellow", shortname = "RPP (Chand)",},
["Rastriya Prajatantra Party (Samyukta)"] = {abbrev = "", color = "#4682B4", shortname = "",},
["Rastriya Prajatantra Party Nepal"] = {abbrev = "", color = "orange", shortname = "RPP-Nepal",},
["Rastriya Prajatantra Party"] = {abbrev = "RPP", color = "gold", shortname = "",},
["Rastriya Swatantra Party"] = {abbrev = "RSP", color = "#0095DA", shortname = "RSP",},
["Rat Withi Party"] = {abbrev = "", color = "#1C359A", shortname = "",},
["Ratana"] = {abbrev = "", color = "#A52A2A", shortname = "",},
["Ratepayers and Residents Associations"] = {abbrev = "", color = "#dddddd", shortname = "Ratepayers & Residents",},
["Ratepayers' Association"] = {abbrev = "", color = "#dddddd", shortname = "Ratepayers",},
["Ratepayers' and Citizens' Association"] = {abbrev = "", color = "#dddddd", shortname = "Ratepayers & Citizens",},
["Ratz (political party)"] = {abbrev = "", color = "#C80004", shortname = "Ratz",},
["Ravah Party"] = {abbrev = "", color = "#E7EB16", shortname = "",},
["Raving Loony Green Giant Party"] = {abbrev = "", color = "green", shortname = "Raving Loony Green Giant",},
["Rayalaseema Parirakshana Samithi"] = {abbrev = "", color = "red", shortname = "",},
["Rayyithunge Muthagaddim Party"] = {abbrev = "RMP", color = "#CC0000", shortname = "",},
["Raza Unida Party"] = {abbrev = "", color = "#CC853F", shortname = "Raza Unida",},
["Re-open Nominations"] = {abbrev = "RON", color = "Black", shortname = "",},
["Readjuster Party"] = {abbrev = "", color = "Black", shortname = "Readjuster",},
["Reagrupament"] = {abbrev = "", color = "#841039", shortname = "",},
["Real Alternative Party"] = {abbrev = "PAR", color = "#FECD0B", shortname = "",},
["Real Alternative Party (Botswana)"] = {abbrev = "RAP", color = "#76402b", shortname = "",},
["Real Democracy Movement"] = {abbrev = "", color = "#BFFF00", shortname = "Real Democracy",},
["Real Democracy"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Real Democratic Party"] = {abbrev = "", color = "#0CB14B", shortname = "Real Democratic",},
["Real NZ"] = {abbrev = "", color = "#72bfe8", shortname = "",},
["Real Politics Union"] = {abbrev = "UPR", color = "#151a3a", shortname = "",},
["Realists (political party)"] = {abbrev = "", color = "#013888", shortname = "",},
["Reality Party"] = {abbrev = "", color = "Grey", shortname = "Reality",},
["Realizing Goals"] = {abbrev = "", color = "#0B76C0", shortname = "",},
["Reason Party (Australia)"] = {abbrev = "", color = "#4BB8B3", shortname = "Reason",},
["Reason Party (Poland)"] = {abbrev = "RACJA", color = "#000000", shortname = "Reason Party",},
["Rebel Almería"] = {abbrev = "", color = "#981403", shortname = "",},
["Rebirth Party (Northern Cyprus)"] = {abbrev = "YDP", color = "#00CCFF", shortname = "",},
["Reborn Armenia"] = {abbrev = "", color = "#1E4277", shortname = "",},
["Reclaim Australia: Reduce Immigration"] = {abbrev = "RARI", color = "#734812", shortname = "Reclaim Australia"},
["Reclaim Party"] = {abbrev = "", color = "#C03F31", shortname = "Reclaim",},
["Reconciliation and Liberation Bloc"] = {abbrev = "", color = "black", shortname = "",},
["Reconquête"] = {abbrev = "REC", color = "#170066", shortname = "",},
["Reconstitution Party"] = {abbrev = "", color = "#00FFFF", shortname = "",},
["Recover Madrid"] = {abbrev = "RM", color = "#E9AE12", shortname = "",},
["Recrear"] = {abbrev = "", color = "#35649C", shortname = "",},
["Recreate Greece"] = {abbrev = "DX", color = "#F19914", shortname = "",},
["Recuperar Badajoz"] = {abbrev = "", color = "#6A1E5E", shortname = "",},
["Recuperemos El Ejido"] = {abbrev = "", color = "#01781E", shortname = "",},
["Red Current"] = {abbrev = "", color = "#CE1000", shortname = "",},
["Red Dot United"] = {abbrev = "RDU", color = "#DC6698", shortname = "",},
["Red Electoral Alliance"] = {abbrev = "", color = "#d4001a", shortname = "Red",},
["Red Flag Party"] = {abbrev = "", color = "red", shortname = "",},
["Red Front (UK)"] = {abbrev = "", color = "Red", shortname = "Red Front",},
["Red Lions (political party)"] = {abbrev = "", color = "#DC143C", shortname = "Red Lions",},
["Red Party (Dominican Republic)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Red Party (Norway)"] = {abbrev = "", color = "#EA0000", shortname = "Red",},
["Red-Green Alliance"] = {abbrev = "", color = "#D30B55", shortname = "",},
["Red-Greens (Sweden)"] = {abbrev = "", color = "#F0002D", shortname = "Red-Greens",},
["Red–Green Alliance (Denmark)"] = {abbrev = "", color = "#F7660D", shortname = "Red–Green",},
["Redondela Electors' Group"] = {abbrev = "", color = "#9A2428", shortname = "",},
["Redondela Pode"] = {abbrev = "", color = "#3C0C40", shortname = "",},
["Referendum Party"] = {abbrev = "", color = "#bf475c", shortname = "Referendum",},
["Reform and Development Party (Egypt)"] = {abbrev = "", color = "#C7A317", shortname = "",},
["Reform and Development Party (Morocco)"] = {abbrev = "", color = "#8CB803", shortname = "",},
["Reform Club of Hong Kong"] = {abbrev = "", color = "#D04627", shortname = "Reform",},
["Reform Front Party"] = {abbrev = "", color = "DodgerBlue", shortname = "",},
["Reform Group (Finland)"] = {abbrev = "", color = "#E6E600", shortname = "Reform",},
["Reform Jersey"] = {abbrev = "", color = "#01547C", shortname = "",},
["Reform Party (19th-century Wisconsin)"] = {abbrev = "", color = "#3333FF", shortname = "Reform",},
["Reform Party (Iceland)"] = {abbrev = "", color = "#FF7D14", shortname = "Reform",},
["Reform Party (Latvia)"] = {abbrev = "", color = "#10A5DF", shortname = "Reform",},
["Reform Party (Mauritania)"] = {abbrev = "", color = "#715331", shortname = "El Islah",},
["Reform Party (Minnesota)"] = {abbrev = "", color = "#6A287E", shortname = "Reform",},
["Reform Party (Mississippi)"] = {abbrev = "", color = "#6A287E", shortname = "Reform",},
["Reform Party (New York State)"] = {abbrev = "", color = "#6A287E", shortname = "Reform",},
["Reform Party (New Zealand)"] = {abbrev = "", color = "#00BB00", shortname = "Reform",},
["Reform Party (Philippines)"] = {abbrev = "", color = "#0000CD", shortname = "Reform",},
["Reform Party (Singapore)"] = {abbrev = "RP", color = "#FFC000", shortname = "",},
["Reform Party (Southern Rhodesia)"] = {abbrev = "", color = "#99FF99", shortname = "Reform",},
["Reform Party (US)"] = {abbrev = "RE", color = "#6A287E", shortname = "Reform",},
["Reform Party of Canada"] = {abbrev = "", color = "#3CB371", shortname = "Reform",},
["Reform PH - People's Party"] = {abbrev = "RP", color = "#800000", shortname = "",},
["Reform Progressive Party"] = {abbrev = "PPR", color = "#0000FF", shortname = "",},
["Reform Star Party"] = {abbrev = "PBR", color = "#BCDA00", shortname = "",},
["Reform UK"] = {abbrev = "", color = "#12B6CF", shortname = "",},
["Reformatory Political Federation"] = {abbrev = "RPF", color = "#7FD3E9", shortname = "",},
["Reformed Congress of Lesotho"] = {abbrev = "RCL", color = "#067a3e", shortname = "",},
["Reformed Democratic Party"] = {abbrev = "", color = "#F0E68C", shortname = "",},
["Reformed Political Alliance"] = {abbrev = "", color = "#f7af20", shortname = "",},
["Reformed Political League"] = {abbrev = "GPV", color = "#6CBFD9", shortname = "",},
["Reformed Political Party – Reformatory Political Federation – Reformed Political League"] = {abbrev = "SGP/RPF/GPV", color = "#00a7eb", shortname = "",},
["Reformed Political Party"] = {abbrev = "SGP", color = "#EA5B0B", shortname = "",},
["Reformers (Hungarian political party)"] = {abbrev = "", color = "#D19E33", shortname = "",},
["Reformist Bloc"] = {abbrev = "RB", color = "#2A3A79", shortname = "",},
["Reformist Canarian Centre"] = {abbrev = "", color = "#FDBB4A", shortname = "",},
["Reformist Coalition"] = {abbrev = "", color = "#00B1F0", shortname = "",},
["Reformist Movement"] = {abbrev = "MR", color = "#0047AB", shortname = "",},
["Reformist Party (Dominican Republic)"] = {abbrev = "", color = "#ff0000", shortname = "",},
["Reformist Party (Costa Rica)"] = {abbrev = "", color = "#8B0000", shortname = "Reformist",},
["Reformist Party (Portugal)"] = {abbrev = "", color = "#FB607F", shortname = "",},
["Reformist Party (Serbia)"] = {abbrev = "RS", color = "#FF6600", shortname = "",},
["Reformist Party (Spain)"] = {abbrev = "", color = "#F28500", shortname = "Reformist",},
["Reformist Party ORA"] = {abbrev = "", color = "#29106B", shortname = "",},
["Reformists of Vojvodina"] = {abbrev = "RV", color = "#E46713", shortname = "",},
["Reforms and Freedom"] = {abbrev = "", color = "red", shortname = "",},
["Reforms and Order Party"] = {abbrev = "PRP", color = "#2581CC", shortname = "",},
["Reform the Legal System"] = {abbrev = "RLS", color = "#FF6900", shortname = "Legal System Reform",},
["Regenerator Party"] = {abbrev = "", color = "#0054A5", shortname = "",},
["Regional Citizens' Coalition"] = {abbrev = "", color = "#CE1244", shortname = "",},
["Regional Murcianist Party"] = {abbrev = "", color = "#FAE800", shortname = "",},
["Regional Integration Movement"] = {abbrev = "MIR", color = "#ADEEF7", shortname = "",},
["Regional Unity Party"] = {abbrev = "", color = "#0066FF", shortname = "",},
["Regionalism (politics)"] = {abbrev = "REG", color = "#DDDD00", shortname = "Regionalists",},
["Regionalist (Restoration)"] = {abbrev = "", color = "#B4E0CA", shortname = "",},
["Regionalist Action Party of Chile"] = {abbrev = "", color = "#FDFA2F", shortname = "",},
["Regionalist Alicantine Party"] = {abbrev = "", color = "#095387", shortname = "",},
["Regionalist Call for Andalusia"] = {abbrev = "", color = "#08B618", shortname = "",},
["Regionalist Democracy of Castile and León"] = {abbrev = "", color = "#5DA923", shortname = "",},
["Regionalist Independent Party"] = {abbrev = "", color = "purple", shortname = "",},
["Regionalist League of Catalonia"] = {abbrev = "LRC", color = "#D5AD0F", shortname = "",},
["Regionalist League of the Balearic Islands"] = {abbrev = "", color = "#834098", shortname = "",},
["Regionalist Local Party"] = {abbrev = "", color = "#82CF05", shortname = "",},
["Regionalist Party for Eastern Andalusia"] = {abbrev = "", color = "#A6004D", shortname = "",},
["Regionalist Party of Cantabria"] = {abbrev = "PRC", color = "#C2CE0C", shortname = "",},
["Regionalist Party of Castilla-La Mancha"] = {abbrev = "", color = "#DC143C", shortname = "",},
["Regionalist Party of Castilla–La Mancha"] = {abbrev = "", color = "#DC143C", shortname = "",},
["Regionalist Party of El Bierzo"] = {abbrev = "", color = "#005DA1", shortname = "",},
["Regionalist Party of Guadalajara"] = {abbrev = "", color = "#7310AD", shortname = "",},
["Regionalist Party of Independents"] = {abbrev = "", color = "green", shortname = "",},
["Regionalist Party of the Independents"] = {abbrev = "", color = "#00FF00", shortname = "Regionalist",},
["Regionalist Party of the Leonese Country"] = {abbrev = "", color = "#D20062", shortname = "",},
["Regionalist Union of Castile and León"] = {abbrev = "", color = "#1E4D79", shortname = "",},
["Regionalist Unitary Party"] = {abbrev = "", color = "#882222", shortname = "",},
["Regionalist Unity of Castile and León"] = {abbrev = "", color = "#FE0000", shortname = "",},
["Regionalist Unity"] = {abbrev = "", color = "#C9286B", shortname = "",},
["Reich Party for Civil Rights and Deflation"] = {abbrev = "", color = "#0075EB", shortname = "",},
["Reich Party of the German Middle Class"] = {abbrev = "WP", color = "#CCAA7A", shortname = "",},
["Reigate and Banstead Residents Association"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Reinicia Sant Antoni"] = {abbrev = "", color = "#570D9E", shortname = "",},
["Reiwa Shinsengumi"] = {abbrev = "", color = "#ED008C", shortname = "Reiwa",},
["Rejoin EU"] = {abbrev = "", color = "#003399", shortname = "",},
["Religious Torah Front"] = {abbrev = "", color = "#000", shortname = "",},
["Religious Zionist Party"] = {abbrev = "", color = "#214785", shortname = "Religious Zionist",},
["Reload Bulgaria"] = {abbrev = "", color = "black", shortname = "",},
["Renaissance (French political party)"] = {abbrev = "RE", color = "#03215A", shortname = "",},
["Renaissance (Italian political party)"] = {abbrev = "", color = "#56A5EC", shortname = "Renaissance",},
["Renaissance and Union of Europe Party"] = {abbrev = "", color = "#000000", shortname = "",},
["Renaissance group"] = {abbrev = "RE", color = "#0089BF", shortname = "",},
["RENAMO"] = {abbrev = "", color = "#113077", shortname = "",},
["Renew Europe"] = {abbrev = "RE", color = "gold", shortname = "",},
["Renew Party"] = {abbrev = "", color = "#16C0D7", shortname = "Renew",},
["Renewal Bloc"] = {abbrev = "RB", color = "#092f56", shortname = "Renewal Bloc",},
["Renewal (Greece)"] = {abbrev = "", color = "#FAFF5F", shortname = "",},
["Renewal (political party)"] = {abbrev = "", color = "#2B4F32", shortname = "",},
["Renewal Crusade"] = {abbrev = "", color = "SkyBlue", shortname = "",},
["Renewal Front"] = {abbrev = "FR", color = "#0E3C61", shortname = "",},
["Renewal Liberal Centre"] = {abbrev = "", color = "#BD782D", shortname = "",},
["Renewal Party of Ibiza and Formentera"] = {abbrev = "", color = "#354B84", shortname = "",},
["Renewal–Nationalist Brotherhood"] = {abbrev = "", color = "#3EA3D2", shortname = "",},
["Renewed Caledonian Union"] = {abbrev = "UC-R", color = "green", shortname = "",},
["Renewed Democratic Liberty"] = {abbrev = "LIDER", color = "#E20A17", shortname = "",},
["Renewed United Democratic Centre"] = {abbrev = "", color = "#009191", shortname = "",},
["Renewing Romania's European Project"] = {abbrev = "REPER", color = "#c40075", shortname = "",},
["Renewing Communist Ecological Left"] = {abbrev = "", color = "#FF4900", shortname = "",},
["Renmen Ayiti"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Renovating Action Party"] = {abbrev = "PAR", color = "#FDF38E", shortname = "",},
["Renovator Labour Party"] = {abbrev = "", color = "#E7393D", shortname = "",},
["Rent Is Too Damn High Party"] = {abbrev = "", color = "#703642", shortname = "Rent Is Too Damn High",},
["Renua"] = {abbrev = "Ren", color = "#FFA500", shortname = "Renua",},
["Repeal Association"] = {abbrev = "", color = "#DDFFDD", shortname = "Irish Repeal",},
["Repons Peyizan"] = {abbrev = "", color = "#009A17", shortname = "",},
["Republic (Faroe Islands)"] = {abbrev = "", color = "#BED630", shortname = "Republic",},
["Republic (Latvia)"] = {abbrev = "", color = "#075895", shortname = "",},
["Republic (Slovakia)"] = {abbrev = "", color = "#e30512", shortname = "Republic",},
["Republic (Transnistria)"] = {abbrev = "", color = "#990000", shortname = "Republic",},
["Republic National Independent Party"] = {abbrev = "RNIP", color = "#30347B", shortname = "",},
["Republic of Fiji Military Forces"] = {abbrev = "RFMF", color = "#C3B091", shortname = "",},
["Republican (Ireland, 1923)"] = {abbrev = "Rep", color = "#008800", shortname = "Republican",},
["Republican (Ireland)"] = {abbrev = "", color = "#66BB66", shortname = "",},
["Republican Action (Spain)"] = {abbrev = "AR", color = "#FF7028", shortname = "",},
["Republican Alternative (Spain)"] = {abbrev = "", color = "#75246C", shortname = "",},
["Republican Alternative Party (Azerbaijan)"] = {abbrev = "", color = "#EF3340", shortname = "",},
["Republican and Socialist Front"] = {abbrev = "FRS", color = "#FF2E3F", shortname = "",},
["Republican and Socialist Left (2018)"] = {abbrev = "", color = "#D23150", shortname = "",},
["Republican and Socialist Left"] = {abbrev = "", color = "#D53150", shortname = "",},
["Republican Bicentennial Vanguard"] = {abbrev = "", color = "#BE4736", shortname = "",},
["Republican Bloc"] = {abbrev = "BR", color = "", shortname = "",},
["Republican Candidacy"] = {abbrev = "", color = "#6C3E89", shortname = "",},
["Republican Catalan Action"] = {abbrev = "", color = "#E2A554", shortname = "",},
["Republican Clubs"] = {abbrev = "", color = "#EE0000", shortname = "",},
["Republican Coalition (Spain, 1901)"] = {abbrev = "CR", color = "#7A1B6A", shortname = "",},
["Republican Coalition (Spain, 1914)"] = {abbrev = "", color = "#864891", shortname = "",},
["Republican Constitutional Union"] = {abbrev = "UCR", color = "#A352A3", shortname = "",},
["Republican Democratic Movement"] = {abbrev = "", color = "#808080", shortname = "",},
["Republican Democratic Union"] = {abbrev = "UDR", color = "#0000BB", shortname = "",},
["Republican Equality Front"] = {abbrev = "FER", color = "#B9E16F", shortname = "",},
["Republican Fascist Party"] = {abbrev = "", color = "#000000", shortname = "",},
["Republican Federation (Spain)"] = {abbrev = "", color = "#804AB5", shortname = "",},
["Republican Federation"] = {abbrev = "", color = "#005ACA", shortname = "",},
["Republican Force"] = {abbrev = "", color = "#0070B8", shortname = "",},
["Republican Front (Catalonia)"] = {abbrev = "", color = "#EB2071", shortname = "",},
["Republican Front for Unity and Democracy"] = {abbrev = "FRUD", color = "#3080B7", shortname = "",},
["Republican Fusion"] = {abbrev = "", color = "#711A5B", shortname = "Republican",},
["Republican Group of Coslada"] = {abbrev = "", color = "#82177F", shortname = "",},
["Republican Labour Party"] = {abbrev = "RepLab", color = "#85de59", shortname = "Republican Labour",},
["Republican Left (Spain, 1977)"] = {abbrev = "", color = "#B5047B", shortname = "",},
["Republican Left (Spain)"] = {abbrev = "IR", color = "#E25822", shortname = "",},
["Republican Left of Catalonia"] = {abbrev = "ERC", color = "#FFB232", shortname = "",},
["Republican Liberal Party (Panama)"] = {abbrev = "PLR", color = "pink", shortname = "",},
["Republican Liberal Party (Portugal)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Republican Moderate Party (Alaska)"] = {abbrev = "", color = "#DD4444", shortname = "Republican Moderate",},
["Republican Movement (Mauritius)"] = {abbrev = "", color = "red", shortname = "",},
["Republican Movement (Switzerland)"] = {abbrev = "", color = "#61380B", shortname = "Republican",},
["Republican Nation Party"] = {abbrev = "CMP", color = "#6F4E37", shortname = "",},
["Republican Nationalist Centre"] = {abbrev = "", color = "#CC9933", shortname = "",},
["Republican Nationalist Federal Union"] = {abbrev = "", color = "#993366", shortname = "Nationalist Federal",},
["Republican Nationalist Party of Ourense"] = {abbrev = "", color = "#4040C0", shortname = "",},
["Republican Network for Unity"] = {abbrev = "", color = "#004400", shortname = "Republican Network",},
["Republican Party (Belarus)"] = {abbrev = "", color = "#811F20", shortname = "Republican",},
["Republican Party (Bolivia)"] = {abbrev = "", color = "#3CB371", shortname = "",},
["Republican Party (Bosnia and Herzegovina)"] = {abbrev = "", color = "Lightblue", shortname = "",},
["Republican Party (Brazil)"] = {abbrev = "PR", color = "#009F3C", shortname = "",},
["Republican Party (Cambodia)"] = {abbrev = "", color = "#0000FF", shortname = "Republican",},
["Republican Party (Chile, 2019)"] = {abbrev = "", color = "#22446D", shortname = "",},
["Republican Party (China)"] = {abbrev = "", color = "#FFC500", shortname = "Republican",},
["Republican Party (Costa Rica)"] = {abbrev = "", color = "#0018A8", shortname = "Republican",},
["Republican Party (East Timor)"] = {abbrev = "", color = "#24A236", shortname = "",},
["Republican Party (France)"] = {abbrev = "", color = "#00CCCC", shortname = "",},
["Republican Party (Guatemala)"] = {abbrev = "PR", color = "#243467", shortname = "Republican Party",},
["Republican Party (Hungary)"] = {abbrev = "KP", color = "#0067A5", shortname = "",},
["Republican Party (Liberia)"] = {abbrev = "", color = "#FF0000", shortname = "Republican",},
["Republican Party (Maldives)"] = {abbrev = "", color = "#DC0A0A", shortname = "",},
["Republican Party (Namibia)"] = {abbrev = "RP", color = "#FFF100", shortname = "",},
["Republican Party (Pakistan)"] = {abbrev = "", color = "#6495ED", shortname = "Republican Party",},
["Republican Party (Panama)"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Republican Party (Philippines)"] = {abbrev = "", color = "#191970", shortname = "Republican",},
["Republican Party (Serbia)"] = {abbrev = "", color = "#c2121d", shortname = "",},
["Republican Party (Spain)"] = {abbrev = "", color = "#D69652", shortname = "",},
["Republican Party (Spain, 1913)"] = {abbrev = "", color = "#A83E90", shortname = "",},
["Republican Party (Tunisia)"] = {abbrev = "", color = "#CF171F", shortname = "",},
["Republican Party (United States)"] = {abbrev = "R", color = "#E81B23", shortname = "Republican",},
["Republican Party for Democracy and Renewal"] = {abbrev = "PRDS", color = "#981c24", shortname = "",},
["Republican Party for Independence and Development"] = {abbrev = "PRID", color = "#f8d568", shortname = "",},
["Republican Party of Afghanistan"] = {abbrev = "", color = "skyblue", shortname = "",},
["Republican Party of Agricultural and Smallholder People"] = {abbrev = "", color = "#008000", shortname = "",},
["Republican Party of Albania"] = {abbrev = "PR", color = "#20267A", shortname = "",},
["Republican Party of Armenia"] = {abbrev = "", color = "#D2691E", shortname = "Republican",},
["Republican Party of Dahomey"] = {abbrev = "", color = "#F38C22", shortname = "",},
["Republican Party of Farmers and Peasants"] = {abbrev = "RSZML", color = "#008000", shortname = "",},
["Republican Party of Havana"] = {abbrev = "", color = "#CD5C5C", shortname = "Republican",},
["Republican Party of India (Athawale)"] = {abbrev = "RPI(A)", color = "#000080", shortname = "",},
["Republican Party of India (Gavai)"] = {abbrev = "RPI(G)", color = "#6633EE", shortname = "",},
["Republican Party of India (Khobragade)"] = {abbrev = "RPI(K)", color = "darkblue", shortname = "",},
["Republican Party of India Ektavadi"] = {abbrev = "RPIE", color = "#BFFF00", shortname = "",},
["Republican Party of India"] = {abbrev = "RPI", color = "#000066", shortname = "",},
["Republican Party of Labour and Justice"] = {abbrev = "RPTS", color = "#DE7673", shortname = "",},
["Republican Party of Liberty"] = {abbrev = "PRL", color = "#4CA2E7", shortname = "",},
["Republican Party of Paraná"] = {abbrev = "", color = "#768000", shortname = "PR Paraná",},
["Republican Party of Puerto Rico"] = {abbrev = "", color = "#E81B23", shortname = "Republican",},
["Republican Party of Russia"] = {abbrev = "RPR", color = "#FE4801", shortname = "",},
["Republican Party of Russia – People's Freedom Party"] = {abbrev = "RPR–PARNAS", color = "#8A1739", shortname = "",},
["Republican Party of the Social Order"] = {abbrev = "PROS", color = "#F68F22", shortname = "",},
["Republican Patriotic Rally"] = {abbrev = "RPR", color = "", shortname = "",},
["Republican People's Party (Egypt)"] = {abbrev = "RPP", color = "#B7800B", shortname = "Republican People's",},
["Republican People's Party"] = {abbrev = "CHP", color = "#ED1C24", shortname = "",},
["Republican Peronism"] = {abbrev = "", color = "#007FFF", shortname = "",},
["Republican Platform"] = {abbrev = "", color = "#0066FF", shortname = "",},
["Republican Progressive Democratic Front"] = {abbrev = "FDPR", color = "#EE2C21", shortname = "",},
["Republican Proposal"] = {abbrev = "PRO", color = "#ffd700", shortname = "",},
["Republican Reliance Party"] = {abbrev = "CGP", color = "#FF4500", shortname = "",},
["Republican Sinn Féin"] = {abbrev = "RSF", color = "#008800", shortname = "Republican Sinn Féin",},
["Republican Social Movement"] = {abbrev = "", color = "#313439", shortname = "",},
["Republican Socialist Unity Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Republican Turkish Party"] = {abbrev = "CTP", color = "#008000", shortname = "",},
["Republican Union (France)"] = {abbrev = "", color = "#C0504D", shortname = "",},
["Republican Union (Portugal)"] = {abbrev = "PUR", color = "#A52A2A", shortname = "Republican Union",},
["Republican Union (Puerto Rico)"] = {abbrev = "", color = " ", shortname = "Republican Union",},
["Republican Union (Spain, 1934)"] = {abbrev = "", color = "#672F6C", shortname = "",},
["Republican Union (Guatemala)"] = {abbrev = "UR", color = "#2c3592", shortname = "Republican Union",},
["Republican Union Party (Colombia)"] = {abbrev = "", color = "#FBCEB1", shortname = "",},
["Republican Union Party (Ecuador)"] = {abbrev = "PUR", color = "#D0FF14", shortname = "",},
["Republican Union Party (Spain)"] = {abbrev = "PUR", color = "#931585", shortname = "",},
["Republican Union Party"] = {abbrev = "", color = "#ADD8E6", shortname = "",},
["Republican Unity Party"] = {abbrev = "", color = "#D0FF14", shortname = "",},
["Republican Villagers Nation Party"] = {abbrev = "CKMP", color = "#DF7401", shortname = "",},
["Republican-Socialist Party"] = {abbrev = "PRS", color = "#DE3163", shortname = "",},
["Republican–Socialist Conjunction"] = {abbrev = "", color = "#C11956", shortname = "Republican–Socialist",},
["Republican, Ecologist and Social Alliance"] = {abbrev = "ARES", color = "#4169E1", shortname = "",},
["Republican/Hold"] = {abbrev = "", color = "#FFF1EE", shortname = "",},
["Republicans (Brazil)"] = {abbrev = "", color = "#0070C5", shortname = "Republicanos",},
["Republicans for Bulgaria"] = {abbrev = "RzB", color = "#2B4A99", shortname = "",},
["Republicans"] = {abbrev = "", color = "#AB0EA7", shortname = "",},
["Res Publica Party"] = {abbrev = "", color = "#04427C", shortname = "Res Publica",},
["Residents Action Movement"] = {abbrev = "RAM", color = "#467CFA", shortname = "",},
["Residents Association of London"] = {abbrev = "", color = "teal", shortname = "Residents",},
["Residents Association"] = {abbrev = "", color = "#d3d3d3", shortname = "Residents",},
["Residents Associations of Epsom and Ewell"] = {abbrev = "", color = "pink", shortname = "Residents Association",},
["Residents for Guildford and Villages"] = {abbrev = "R4GV", color = "#CA1F7B", shortname = "",},
["Residents for Uttlesford"] = {abbrev = "R4U", color = "#00a88f", shortname = "",},
["Residents' Association of Barnet"] = {abbrev = "", color = "#669966", shortname = "Residents' Association",},
["Residents' Association of London"] = {abbrev = "", color = "gray", shortname = "",},
["Residents' association"] = {abbrev = "RA", color = "#666666", shortname = "",},
["RESIST (electoral list)"] = {abbrev = "", color = "#00A94F", shortname = "",},
["Resistance Front of Islamic Iran"] = {abbrev = "RFII", color = "#23aba1", shortname = "",},
["Resistance of Guinea-Bissau-Bafatá Movement"] = {abbrev = "", color = "#0A86F8", shortname = "",},
["Resistance Party (France)"] = {abbrev = "", color = "#0072BB", shortname = "",},
["Résistons!"] = {abbrev = "", color = "#034EA1", shortname = "",},
["Resni.ca"] = {abbrev = "", color = "#67359A", shortname = "",},
["Résoatao Party"] = {abbrev = "", color = "#154FE6", shortname = "",},
["Respect (Haiti)"] = {abbrev = "", color = "#0000FF", shortname = "Respect",},
["Respect Party"] = {abbrev = "", color = "#46801c", shortname = "Respect",},
["Respeto"] = {abbrev = "", color = "#8E1919", shortname = "",},
["Responsibility – Social Democratic Alliance of Political Parties"] = {abbrev = "", color = "#ADD8E6", shortname = "",},
["Responsible Future (Iceland)"] = {abbrev = "", color = "#322757", shortname = "",},
["Responsible Government Association"] = {abbrev = "", color = "#FF7F00", shortname = "",},
["Respublica (Kazakh political party)"] = {abbrev = "", color = "#4A78EC", shortname = "Respublica",},
["Respublika (political party)"] = {abbrev = "", color = "#20959E", shortname = "Respublika",},
["Respublika–Ata Zhurt"] = {abbrev = "", color = "#FFCF06", shortname = "",},
["Restart Coalition"] = {abbrev = "", color = "#e00f20", shortname = "Restart",},
["Restoration of Ukraine"] = {abbrev = "", color = "#FFDD00", shortname = "Restoration",},
["Restore and Build Kenya"] = {abbrev = "", color = "#0000ff", shortname = "",},
["Restore Democracy Sack Dan Andrews Party"] = {abbrev = "RDSD", color = "#C72C32", shortname = "Restore Democracy",},
["Restore Scotland"] = {abbrev = "", color = "#006EB6", shortname = "",},
["Restore the Family for Children's Sake"] = {abbrev = "", color = "Goldenrod", shortname = "",},
["RETE Movement"] = {abbrev = "RETE", color = "#275956", shortname = "",},
["Retirees Party for the Future"] = {abbrev = "", color = "#59A35A", shortname = "",},
["RETO Movement"] = {abbrev = "RETO", color = "#012F71", shortname = "",},
["Reunification Democratic Party"] = {abbrev = "RDP", color = "#E60026", shortname = "Reunification Democratic",},
["Reunification Movement for Change"] = {abbrev = "RMC", color = "#F16A26", shortname = "",},
["Reus Independent Coordinator"] = {abbrev = "", color = "#A71F21", shortname = "",},
["Revenue Tariff Party (Tasmania)"] = {abbrev = "", color = "#FFDB58", shortname = "Revenue Tariff",},
["Revival (Bulgarian political party)"] = {abbrev = "", color = "#C09F62", shortname = "Revival",},
["Revival (Ukraine)"] = {abbrev = "", color = "#90BEDC", shortname = "Revival",},
["Revival Party"] = {abbrev = "", color = "Crimson", shortname = "",},
["Revival Party (Moldova)"] = {abbrev = "Revival", color = "#FF0000", shortname = "",},
["Revolutionary Action Party"] = {abbrev = "PAR", color = "#4682b4", shortname = "",},
["Revolutionary Anticapitalist Left"] = {abbrev = "", color = "#B41E17", shortname = "",},
["Revolutionary Civic Union"] = {abbrev = "UCR", color = "#6B8E23", shortname = "",},
["Revolutionary Agrarian Movement of the Bolivian Peasantry"] = {abbrev = "MARC", color = "#D29D7D", shortname = "",},
["Revolutionary Committee of the Chinese Kuomintang"] = {abbrev = "RCCK", color = "#1b65af", shortname = "",},
["Revolutionary Communist League (France)"] = {abbrev = "LCR", color = "#C41E3A", shortname = "",},
["Revolutionary Communist League (Spain)"] = {abbrev = "", color = "#DF0101", shortname = "",},
["Revolutionary Communist Movement of Greece"] = {abbrev = "EKKE", color = "red", shortname = "",},
["Revolutionary Communist Party (Argentina)"] = {abbrev = "PCR", color = "#E00000", shortname = "Revolutionary Communist Party",},
["Revolutionary Communist Party (Spain)"] = {abbrev = "", color = "#DF0101", shortname = "Revolutionary Communist Party",},
["Revolutionary Communist Party (UK, 1978)"] = {abbrev = "", color = "#880000", shortname = "Revolutionary Communist",},
["Revolutionary Communist Party of Britain (Marxist-Leninist)"] = {abbrev = "", color = "red", shortname = "",},
["Revolutionary Communist Party of Britain (Marxist–Leninist)"] = {abbrev = "RCP (GB) (ML)", color = "#660000", shortname = "",},
["Revolutionary Communist Party of India"] = {abbrev = "RCPI", color = "Red", shortname = "",},
["Revolutionary Communist Party, USA"] = {abbrev = "", color = "#C80815", shortname = "",},
["Revolutionary Democratic Coalition"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Revolutionary Democratic Party of India"] = {abbrev = "RDP(I)", color = "#F78181", shortname = "",},
["Revolutionary Febrerista Party"] = {abbrev = "PRF", color = "#01a755", shortname = "",},
["Revolutionary Goans Party"] = {abbrev = "RGP", color = "#E3C773", shortname = "",},
["Revolutionary Left Front (Bolivia)"] = {abbrev = "", color = "red", shortname = "",},
["Revolutionary Left Front"] = {abbrev = "", color = "#0500BE", shortname = "",},
["Revolutionary Left Movement (Bolivia)"] = {abbrev = "", color = "#FF8000", shortname = "",},
["Revolutionary Left Movement (Venezuela)"] = {abbrev = "", color = "red", shortname = "",},
["Revolutionary Left Party"] = {abbrev = "", color = "darkred", shortname = "",},
["Revolutionary Liberation Movement Túpac Katari"] = {abbrev = "MRTKL", color = "#A57DAD", shortname = "",},
["Revolutionary Marxist Party of India"] = {abbrev = "RMPI", color = "red", shortname = "",},
["Revolutionary Middle Class"] = {abbrev = "", color = "Black", shortname = "",},
["Revolutionary Nationalist Movement"] = {abbrev = "MNR", color = "#F19CBB", shortname = "",},
["Revolutionary Organization"] = {abbrev = "RO", color = "#ee1c25", shortname = "",},
["Revolutionary Party (Guatemala)"] = {abbrev = "", color = "#964B00", shortname = "",},
["Revolutionary Party of Democratic Unification"] = {abbrev = "PRUD", color = "#FAAFBE", shortname = "",},
["Revolutionary Party of the Nationalist Left"] = {abbrev = "", color = "#D62222", shortname = "",},
["Revolutionary People's Liberation Party/Front"] = {abbrev = "DHKP-C", color = "#D40000", shortname = "",},
["Revolutionary Social Democratic Party"] = {abbrev = "", color = "#200040", shortname = "",},
["Revolutionary Socialist Party (Bolshevik)"] = {abbrev = "RSP(B)", color = "#FF0000", shortname = "",},
["Revolutionary Socialist Party (India)"] = {abbrev = "RSP", color = "#FF4A4A", shortname = "",},
["Revolutionary Socialist Party (Leninist)"] = {abbrev = "RSP(L)", color = "#FF0000", shortname = "",},
["Revolutionary Socialist Party (Luxembourg)"] = {abbrev = "", color = "#960018", shortname = "",},
["Revolutionary Socialist Party (Netherlands)"] = {abbrev = "", color = "#990000", shortname = "",},
["Revolutionary Socialist Party (Peru)"] = {abbrev = "", color = "Red", shortname = "",},
["Revolutionary Socialist Party of Kerala (Bolshevik)"] = {abbrev = "", color = "red", shortname = "",},
["Revolutionary Socialist Workers' Party (Turkey)"] = {abbrev = "DSİP", color = "#000000", shortname = "",},
["Revolutionary Socialists (Egypt)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Revolutionary Union (Peru)"] = {abbrev = "", color = "black", shortname = "",},
["Revolutionary United Front"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Revolutionary Workers Party (Chile)"] = {abbrev = "", color = "#BE0411", shortname = "",},
["Revolutionary Workers Party (US)"] = {abbrev = "", color = "#aa0000", shortname = "Revolutionary Workers",},
["Revolutionary Workers Party of Bangladesh"] = {abbrev = "BRWP", color = "#E38B9F", shortname = "",},
["Revolutionary Workers' Party (Bolivia)"] = {abbrev = "", color = "#8B0000", shortname = "",},
["Revolutionary Workers' Party (Russia)"] = {abbrev = "", color = "#DE0403", shortname = "",},
["Revolutionary Workers' Party (Spain)"] = {abbrev = "", color = "#B22222", shortname = "",},
["Revolutionary Workers' Party (Uruguay)"] = {abbrev = "POR", color = "#fff44f", shortname = "",},
["Revolution for Prosperity"] = {abbrev = "RFP", color = "#411144", shortname = "",},
["Rewmi"] = {abbrev = "", color = "#E68F3F", shortname = "",},
["Rex Patrick Team"] = {abbrev = "", color = "#16b7cd", shortname = "",},
["Rexist Party"] = {abbrev = "", color = "#D31212", shortname = "Rexist",},
["Rezistans ek Alternativ"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Rhinoceros Party"] = {abbrev = "", color = "#D8BFD8", shortname = "Rhinoceros",},
["Rhodesia Labour Party"] = {abbrev = "", color = "#DC241f", shortname = "Labour",},
["Rhodesia Party"] = {abbrev = "", color = "#FF7F00", shortname = "",},
["Rhodesian Action Party"] = {abbrev = "RAP", color = "#ffd700", shortname = "",},
["Rhodesian Front"] = {abbrev = "RF", color = "#C247C2", shortname = "",},
["Rhodesian Party"] = {abbrev = "", color = "Orange", shortname = "",},
["Rhuddlan Debt Protest Campaign"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Right Alliance (Belarus)"] = {abbrev = "", color = "#959492", shortname = "",},
["Right Bloc"] = {abbrev = "PB", color = "#8DB600", shortname = "",},
["Right Cause"] = {abbrev = "", color = "#F0BD48", shortname = "",},
["Right-Green People's Party"] = {abbrev = "", color = "#008000", shortname = "",},
["Right Person Electorate Coalition"] = {abbrev = "RPEC", color = "#6D3290", shortname = "",},
["Right Romania Alliance"] = {abbrev = "ARD", color = "#318CE7", shortname = "",},
["Right Sector"] = {abbrev = "", color = "#110C17", shortname = "",},
["Right to Change"] = {abbrev = "RTOC", color = "#EE4035", shortname = "",},
["Right Wing of the Republic"] = {abbrev = "", color = "#BE282D", shortname = "",},
["Right-wing independent"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Righteous Party"] = {abbrev = "", color = "#901380", shortname = "",},
["Rightist Opposition"] = {abbrev = "", color = "#7C1F3C", shortname = "Right Opposition",},
["Right Socialist Party of Japan"] = {abbrev = "", color = "#EE5807", shortname = "Right Socialist",},
["Right to Recall Party"] = {abbrev = "RRP", color = "#FFFF00", shortname = "",},
["Rights and Equality Party"] = {abbrev = "HEPAR", color = "#000000", shortname = "",},
["Rights and Freedoms Party (Turkey)"] = {abbrev = "", color = "#FFDB4D", shortname = "",},
["Rights and Freedoms Party"] = {abbrev = "HAK-PAR", color = "#E6E600", shortname = "",},
["Rights and Justice Party"] = {abbrev = "HAP", color = "#996633", shortname = "",},
["Rights and Liberties Party"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Rights Party"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Rikken Doshikai"] = {abbrev = "", color = "#DA7B8B", shortname = "",},
["Rikken Kaishintō"] = {abbrev = "", color = "#cd5c5c", shortname = "",},
["Rikken Kakushintō"] = {abbrev = "", color = "#00AE9D", shortname = "",},
["Rikken Kokumintō"] = {abbrev = "", color = "#A090E0", shortname = "",},
["Rikken Seiyūkai"] = {abbrev = "", color = "#2E980F", shortname = "",},
["Rikken Yōseikai"] = {abbrev = "", color = "#B0313F", shortname = "",},
["Rio-grandense Republican Party"] = {abbrev = "PRR", color = "#DE2910", shortname = "",},
["Rinnovu"] = {abbrev = "", color = "#500F0B", shortname = "",},
["Riojan Party"] = {abbrev = "PR+", color = "#00AA42", shortname = "",},
["Rionegrin Provincial Party"] = {abbrev = "", color = "#EB3721", shortname = "",},
["RISE – Scotland's Left Alliance"] = {abbrev = "RISE", color = "#f15723", shortname = "",},
["RISE (Ireland)"] = {abbrev = "", color = "#ED161F", shortname = "RISE",},
["Rise Party"] = {abbrev = "", color = "#2E127D", shortname = "",},
["Rise Up Australia Party"] = {abbrev = "RUA", color = "#0080FF", shortname = "Rise Up",},
["Rising Sun Party"] = {abbrev = "RIS", color = "#FFB040", shortname = "",},
["Ritō (government supporters)"] = {abbrev = "", color = "#009933", shortname = "",},
["Rivas Puede"] = {abbrev = "", color = "#812868", shortname = "",},
["Rivers State Peoples Democratic Party"] = {abbrev = "PDP", color = "#FF0000", shortname = "",},
["Robbie the Pict (Independent)"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Rochford District Residents"] = {abbrev = "", color = "#930000", shortname = "Rochford Resident",},
["Rock 'n' Roll Loony Party"] = {abbrev = "", color = "#c71585", shortname = "Rock 'n' Roll Loony",},
["Rock The Vote NZ"] = {abbrev = "", color = "#012268", shortname = "",},
["Rockingham Whigs"] = {abbrev = "", color = "#F0DC82", shortname = "",},
["Rodina (political party)"] = {abbrev = "", color = "#E61B23", shortname = "Rodina",},
["Rodney First"] = {abbrev = "", color = "#009999", shortname = "",},
["Rodrigues Movement"] = {abbrev = "", color = "#21FF21", shortname = "",},
["Rodrigues People's Organisation"] = {abbrev = "OPR", color = "#8B664B", shortname = "",},
["Roma Civic Initiative"] = {abbrev = "ROI", color = "brown", shortname = "",},
["Roma Party"] = {abbrev = "RP", color = "#016830", shortname = "",},
["Roma Union of Serbia"] = {abbrev = "URS", color = "#A3C5EA", shortname = "",},
["Roman Catholic Party of the Netherlands"] = {abbrev = "RKPN", color = "#0033BB", shortname = "",},
["Roman Catholic People's Party"] = {abbrev = "RKVP", color = "#7F7F99", shortname = "",},
["Roman Catholic State Party"] = {abbrev = "RKSP", color = "#003319", shortname = "",},
["Romanian Communist Party"] = {abbrev = "PCR", color = "#CC0000", shortname = "",},
["Romanian Democratic Convention"] = {abbrev = "CDR", color = "#004A92", shortname = "",},
["Romanian ethnic minority parties"] = {abbrev = "", color = "#000000", shortname = "Minority parties",},
["Romanian National Party"] = {abbrev = "PNR", color = "#5087B2", shortname = "",},
["Romanian National Unity Party"] = {abbrev = "PUNR", color = "#1BB0E8", shortname = "",},
["Romanian Nationhood Party"] = {abbrev = "NR", color = "#F7D117", shortname = "",},
["Romanian People's Party"] = {abbrev = "VNS", color = "#FFFF00", shortname = "",},
["Romanian Popular Party"] = {abbrev = "PPR", color = "#FFFF00", shortname = "",},
["Romanian Social Democratic Party (1927–1948)"] = {abbrev = "PSD", color = "#D40000", shortname = "",},
["Romanian Social Democratic Party (1990–2001)"] = {abbrev = "", color = "pink", shortname = "PSDR (Social)",},
["Romanian Social Party"] = {abbrev = "", color = "#ff0000", shortname = "",},
["Romanian Socialist Democratic Party"] = {abbrev = "", color = "#ED2128", shortname = "PSDR (Socialist)",},
["Romanian Socialist Party (1992–2015)"] = {abbrev = "PSR", color = "#CC0000", shortname = "",},
["Romanian Socialist Party (2003)"] = {abbrev = "", color = "#E30615", shortname = "",},
["Romantic Mutual Support Party"] = {abbrev = "", color = "#FFC0CB", shortname = "",},
["Ronda Green Space"] = {abbrev = "", color = "#52886E", shortname = "",},
["Ronda Sí Se Puede"] = {abbrev = "", color = "#63376A", shortname = "",},
["Rondeños por Ronda"] = {abbrev = "", color = "#7F7F7F", shortname = "",},
["Roos Party"] = {abbrev = "", color = "#FFD700", shortname = "Roos",},
["Roots in Macau"] = {abbrev = "", color = "#33FF00", shortname = "",},
["Roots Party of Kenya"] = {abbrev = "", color = "#EC3237", shortname = "",},
["Roque Aguayro"] = {abbrev = "", color = "#D93224", shortname = "",},
["Roque de Gando"] = {abbrev = "", color = "#FFF200", shortname = "",},
["Rose in the Fist"] = {abbrev = "", color = "gold", shortname = "",},
["ROSSEM"] = {abbrev = "", color = "#B7007D", shortname = "",},
["Rother Association of Independent Councillors"] = {abbrev = "RAOIC", color = "#BD8E00", shortname = "",},
["Round Table—Free Georgia"] = {abbrev = "", color = "#BA2B27", shortname = "Round Table",},
["Roundhead"] = {abbrev = "", color = "white", shortname = "",},
["Roundtable (Hong Kong)"] = {abbrev = "", color = "#509ccd", shortname = "Roundtable",},
["Royalist"] = {abbrev = "", color = "#66023C", shortname = "",},
["Royal Italy"] = {abbrev = "IR", color = "#0C0066", shortname = "",},
["RPR-UDF"] = {abbrev = "", color = "#0066CC", shortname = "",},
["Ruam Jai Thai Party"] = {abbrev = "", color = "#F07F07", shortname = "",},
["Ruiz-Mateos Group"] = {abbrev = "", color = "#28365D", shortname = "Ruiz-Mateos",},
["Rukhaniyat Party"] = {abbrev = "", color = "green", shortname = "Rukhaniyat",},
["Ruktam Party"] = {abbrev = "", color = "#799C44", shortname = "Ruktam",},
["Runnymede Independent Residents' Group"] = {abbrev = "RIRG", color = "#264404", shortname = "",},
["Rural Development Party"] = {abbrev = "RDP", color = "", shortname = "",},
["Rural Development Party (Vanuatu)"] = {abbrev = "RDP", color = "#000000", shortname = "Rural Development",},
["Rural Independents Group"] = {abbrev = "", color = "#CCFFCC", shortname = "",},
["Rural Nationalist Bloc"] = {abbrev = "", color = "#048043", shortname = "",},
["Rural Party"] = {abbrev = "", color = "#808000", shortname = "",},
["Rural Party (Iceland)"] = {abbrev = "", color = "purple", shortname = "",},
["Rurality Movement"] = {abbrev = "LMR", color = "#0049A1", shortname = "",},
["Rushcliffe Independents"] = {abbrev = "RI", color = "pink", shortname = "Rushcliffe Ind."},
["Russellite Unionist"] = {abbrev = "", color = "orange", shortname = "",},
["Russia of the Future"] = {abbrev = "", color = "#44B4E3", shortname = "",},
["Russian All-National Union"] = {abbrev = "RONS", color = "#322E2E", shortname = "",},
["Russian All-People's Union"] = {abbrev = "ROS", color = "#FF9C00", shortname = "",},
["Russian Communist Workers Party"] = {abbrev = "", color = "#D50000", shortname = "",},
["Russian Communist Workers' Party of the Communist Party of the Soviet Union"] = {abbrev = "", color = "#A9231B", shortname = "",},
["Russian Democratic Reform Movement"] = {abbrev = "RDDR", color = "#E9E26E", shortname = "",},
["Russian Ecological Party \"The Greens\""] = {abbrev = "", color = "#00953B", shortname = "The Greens",},
["Russian Labour Front"] = {abbrev = "RTF", color = "#34499A", shortname = "",},
["Russian National Party"] = {abbrev = "RNP", color = "blue", shortname = "",},
["Russian Opposition Coordination Council"] = {abbrev = "KSO", color = "#737587", shortname = "",},
["Russian Party (Serbia)"] = {abbrev = "RS", color = "#0D3B66", shortname = "",},
["Russian Party in Estonia"] = {abbrev = "", color = "#2b677f", shortname = "",},
["Russian Party of Freedom and Justice"] = {abbrev = "RPSS", color = "#AC0907", shortname = "",},
["Russian Party of Life"] = {abbrev = "RPL", color = "#D82828", shortname = "",},
["Russian Party of Pensioners for Social Justice"] = {abbrev = "RPPSJ", color = "#C52030", shortname = "",},
["Russian Party of Social Democracy"] = {abbrev = "", color = "#D51F76", shortname = "",},
["Russian Party"] = {abbrev = "", color = "#3CB371", shortname = "",},
["Russian People's Democratic Union"] = {abbrev = "", color = "#D00032", shortname = "",},
["Russian Social Democratic Labour Party"] = {abbrev = "RSDLP", color = "#D40000", shortname = "",},
["Russian Social Democratic Labour Party (Mensheviks)"] = {abbrev = "", color = "#ED1B34", shortname = "Mensheviks",},
["Russian Socialist Movement"] = {abbrev = "", color = "#D62B24", shortname = "",},
["Russian Socialist Party"] = {abbrev = "", color = "#020266", shortname = "",},
["Ruthenian Peasants Party"] = {abbrev = "PKP", color = "#36454F", shortname = "",},
["Russian Bloc (party)"] = {abbrev = "", color = "#0A347C", shortname = "",},
["Russian Unity"] = {abbrev = "", color = "#054C9F", shortname = "",},
["Russophiles for the Revival of the Fatherland"] = {abbrev = "", color = "#3EB149", shortname = "",},
["Rwandan Patriotic Front"] = {abbrev = "RPF", color = "#0087DC", shortname = "",},
["Rwandan Socialist Party"] = {abbrev = "", color = "#FFC0CB", shortname = "",},
["Ryokufūkai (1947–1960)"] = {abbrev = "", color = "#9ACBAB", shortname = "Ryokufūkai",},
}
return {
full = full,
alternate = alternate,
}
5a4e80f6c06079d25c9e66aa66bad2a7e63d0458
Module:Political party/D
828
228
448
2023-12-23T19:34:28Z
wikipedia>ValenciaThunderbolt
0
Changed to customary party.
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["Direct Democracy New Zealand"] = "Direct Democracy Party of New Zealand",
["DAB"] = "Democratic Alliance for the Betterment and Progress of Hong Kong",
["DABHK"] = "Democratic Alliance for the Betterment and Progress of Hong Kong",
["Delaware Democratic Party"] = "Democratic Party (United States)",
["Demócrata Party"] = "Democrata Party",
["Democratic Agrarian Party of Moldova"] = "Agrarian Party of Moldova",
["Democratic Alliance for the Betterment of Hong Kong"] = "Democratic Alliance for the Betterment and Progress of Hong Kong",
["Democratic and Social Centre – People's Party"] = "CDS – People's Party",
["Democratic and Social Centre – People´s Party"] = "CDS – People's Party", -- acute accent difference
["Democratic Awakening"] = "Democratic Beginning",
["Democratic Center Party of Latvia"] = "Democratic Party \"Saimnieks\"",
["Democratic Centre Union (Greece)"] = "Centre Union",
["Democratic Coalition"] = "Democratic Coalition (Hungary)",
["Democratic Front (France)"] = "Democratic Movement (France)",
["Democratic Front for the Reunification of the Fatherland"] = "Democratic Front for the Reunification of Korea",
["Democratic Front of the Francophones"] = "DéFI",
["Democratic Group"] = "Democratic Party (Luxembourg)",
["Democratic Group (Luxembourg)"] = "Democratic Party (Luxembourg)",
["Democratic Labour Party (UK)"] = "Democratic Labour Party (UK, 1998)",
["Democratic Labour Party"] = "Lincoln Democratic Labour Association",
["Democratic Liberal Party (Italy)"] = "Italian Democratic Liberal Party",
["Democratic Modernist Pole"] = "Ettajdid Movement",
["Democratic National Alliance"] = "Democratic National Alliance (Sri Lanka)",
["Democratic Obedience Party"] = "Democratic Conviction",
["Democratic Party - demokraci.pl"] = "Democratic Party – demokraci.pl",
["Democratic Party (Burma)"] = "Democratic Party (Myanmar)",
["Democratic Party (Japan)"] = "Democratic Party (Japan, 2016)",
["Democratic Party (Slovakia)"] = "Democratic Party (Slovakia, 1989)",
["Democratic Party (Turkey, historical)"] = "Democrat Party (Turkey, 1946–1961)",
["Democratic Party (US)"] = "Democratic Party (United States)",
["Democratic Party (Alabama)"] = "Democratic Party (United States)",
["Democratic Party (Alaska)"] = "Democratic Party (United States)",
["Democratic Party (Arizona)"] = "Democratic Party (United States)",
["Democratic Party (Arkansas)"] = "Democratic Party (United States)",
["Democratic Party (California)"] = "Democratic Party (United States)",
["Democratic Party (Colorado)"] = "Democratic Party (United States)",
["Democratic Party (Connecticut)"] = "Democratic Party (United States)",
["Democratic Party (Delaware)"] = "Democratic Party (United States)",
["Democratic Party (Georgia, US)"] = "Democratic Party (United States)",
["Democratic Party (Guam)"] = "Democratic Party (United States)",
["Democratic Party (Hawaii)"] = "Democratic Party (United States)",
["Democratic Party (Idaho)"] = "Democratic Party (United States)",
["Democratic Party (Illinois)"] = "Democratic Party (United States)",
["Democratic Party (Iowa)"] = "Democratic Party (United States)",
["Democratic Party (Maryland)"] = "Democratic Party (United States)",
["Democratic Party (Massachusetts)"] = "Democratic Party (United States)",
["Democratic Party (Michigan)"] = "Democratic Party (United States)",
["Democratic Party (Minnesota)"] = "Minnesota Democratic–Farmer–Labor Party",
["Democratic Party (Missouri)"] = "Democratic Party (United States)",
["Democratic Party (Nevada)"] = "Democratic Party (United States)",
["Democratic Party (New Mexico)"] = "Democratic Party (United States)",
["Democratic Party (New York)"] = "Democratic Party (United States)",
["Democratic Party (North Dakota)"] = "North Dakota Democratic–Nonpartisan League Party",
["Democratic Party (Northern Mariana Islands)"] = "Democratic Party (United States)",
["Democratic Party (Pennsylvania)"] = "Democratic Party (United States)",
["Democratic Party (Rhode Island)"] = "Democratic Party (United States)",
["Democratic Party (Turkey, current)"] = "Democrat Party (Turkey, current)",
["Democratic Party (Utah)"] = "Democratic Party (United States)",
["Democratic Party (Vermont)"] = "Democratic Party (United States)",
["Democratic Party (Virginia)"] = "Democratic Party (United States)",
["Democratic Party (Washington State)"] = "Democratic Party (United States)",
["Democratic Party (Washington)"] = "Democratic Party (United States)",
["Democratic Party (West Virginia)"] = "Democratic Party (United States)",
["Democratic Party of Arkansas"] = "Democratic Party (United States)",
["Democratic Party of Connecticut"] = "Democratic Party (United States)",
["Democratic Party of Côte d'Ivoire – African Democratic Rally"] = "Democratic Party of Ivory Coast – African Democratic Rally",
["Democratic Party of Georgia"] = "Democratic Party (United States)",
["Democratic Party of Guam"] = "Democratic Party (United States)",
["Democratic Party of Hawaii"] = "Democratic Party (United States)",
["Democratic Party of Illinois"] = "Democratic Party (United States)",
["Democratic Party of Japan (1996)"] = "Democratic Party (Japan, 1996)",
["Democratic Party of Japan"] = "Democratic Party (Japan, 1998)",
["Democratic Party of Minnesota"] = "Democratic Party (United States)",
["Democratic Party of New Mexico"] = "Democratic Party (United States)",
["Democratic Party of Oregon"] = "Democratic Party (United States)",
["Democratic Party of the Virgin Islands"] = "Democratic Party (United States)",
["Democratic Party of Virginia"] = "Democratic Party (United States)",
["Democratic Party of Wisconsin"] = "Democratic Party (United States)",
["Democratic Patriots' Movement"] = "Democratic Patriots' Unified Party",
["Democratic People's Liberation Front"] = "People's Liberation Organisation of Tamil Eelam",
["Democratic Popular Party (Spain)"] = "People's Democratic Party (Spain)",
["Democratic Socialist Party (Nepal)"] = "Loktantrik Samajwadi Party, Nepal",
["Democratic Turnhalle Alliance"] = "Popular Democratic Movement",
["Democratic Union of the Greek Minority"] = "Omonoia (organization)",
["Democratic Union"] = "Democratic Union (Poland)",
["Democratic Unity Coalition"] = "Unitary Democratic Coalition",
["Democratic Workers' Congress"] = "Democratic People's Front",
["Democratic-Farmer-Labor Party (Minnesota)"] = "Minnesota Democratic–Farmer–Labor Party",
["Democratic-NPL Party"] = "North Dakota Democratic–Nonpartisan League Party",
["Democratic-Republican Party (United States)"] = "Democratic-Republican Party",
["Democratic-Republican Party (US)"] = "Democratic-Republican Party",
["Democratic-Republican"] = "Democratic-Republican Party",
["Democratic–Farmer–Labor Party (Minnesota)"] = "Minnesota Democratic–Farmer–Labor Party",
["Democratic–Nonpartisan League Party (North Dakota)"] = "North Dakota Democratic–Nonpartisan League Party",
["Democratic–NPL Party"] = "North Dakota Democratic–Nonpartisan League Party",
["Democratic–Republican Party (United States)"] = "Democratic-Republican Party",
["Democrats (Norway)"] = "Norway Democrats",
["Democrats and Progressives"] = "Article One (political party)",
["Democrats for Social Credit"] = "New Zealand Democratic Party for Social Credit",
["Democrats in Norway"] = "Norway Democrats",
["Demokraatit"] = "Democrats (Greenland)",
["Denk (Dutch political party)"] = "DENK (political party)",
["Denk (political party)"] = "DENK (political party)",
["DENK"] = "DENK (political party)",
["Deutsche Rechtspartei"] = "German Right Party",
["Dignity and Truth Platform Party"] = "Dignity and Truth Platform",
["Direction – Social Democracy"] = "Direction – Slovak Social Democracy",
["Direction (Slovakia)"] = "Direction – Slovak Social Democracy",
["District of Columbia Democratic State Committee"] = "Democratic Party (United States)",
["District of Columbia Republican Party"] = "Republican Party (United States)",
["Dixiecrat Party (United States)"] = "Dixiecrat",
["DMK"] = "Dravida Munnetra Kazhagam",
["Dodd Independent Party"] = "Independent (US)",
["DPHK"] = "Democratic Party (Hong Kong)",
["Dutch Labour Party"] = "Labour Party (Netherlands)",
}
local full = {
["D.C. Statehood Green Party"] = {abbrev = "", color = "#17AA5C", shortname = "DC Statehood Green",},
["D.C. Statehood Party"] = {abbrev = "", color = "#0BDA51", shortname = "DC Statehood",},
["Da'am Workers Party"] = {abbrev = "", color = "#C60408", shortname = "",},
["Dabalorivhuwa Patriotic Front"] = {abbrev = "", color = "#FF8000", shortname = "",},
["Dad, This is for You"] = {abbrev = "ĆOJZT", color = "#000000", shortname = "",},
["Dai Le and Frank Carbone Network"] = {abbrev = "DLFCN", color = "#FF7F7F", shortname = "",},
["Đại Việt National Socialist Party"] = {abbrev = "ĐVQXĐ", color = "#DC143C", shortname = "",},
["Dagga Party"] = {abbrev = "", color = "#009245", shortname = "",},
["Dahomeyan Democratic Movement"] = {abbrev = "", color = "#91ADBC", shortname = "",},
["Dahomeyan Democratic Union"] = {abbrev = "", color = "#5CBB72", shortname = "",},
["Dahomeyan Progressive Union"] = {abbrev = "UPD", color = "#5CBB72", shortname = "",},
["Dainiin Club"] = {abbrev = "", color = "#587dab", shortname = "",},
["Dalit Janajati Party"] = {abbrev = "", color = "blue", shortname = "",},
["Dalit Mazdoor Kisan Party"] = {abbrev = "DMKP", color = "#A5CBFA", shortname = "",},
["Dalit Muslim Vikas Party"] = {abbrev = "DMVP", color = "#293A03", shortname = "",},
["Dalmatian Action"] = {abbrev = "", color = "darkblue", shortname = "",},
["Danish Party"] = {abbrev = "", color = "#CE1126", shortname = "",},
["Danish People's Party"] = {abbrev = "DPP", color = "#FCD03B", shortname = "",},
["Danish Social Liberal Party"] = {abbrev = "", color = "#733280", shortname = "Social Liberals",},
["Danish Unity"] = {abbrev = "", color = "#002366", shortname = "",},
["Dawn – National Coalition"] = {abbrev = "", color = "#004071", shortname = "Dawn",},
["Dawn (Iceland)"] = {abbrev = "", color = "#eab943", shortname = "",},
["Dawn of Direct Democracy"] = {abbrev = "", color = "#66BDFF", shortname = "Dawn",},
["Dayak Unity Party"] = {abbrev = "PPD", color = "#0093dd", shortname = "",},
["Daylight Saving"] = {abbrev = "", color = "#FFFD7A", shortname = "",},
["Daylight Saving Party"] = {abbrev = "", color = "#FFFD7A", shortname = "Daylight Savings",},
["DCIDE"] = {abbrev = "", color = "#3B9F40", shortname = "",},
["De Basis"] = {abbrev = "", color = "#DDDC05", shortname = "Basis",},
["De Nou Reus"] = {abbrev = "", color = "#5CBACC", shortname = "",},
["Death to the System (Spain)"] = {abbrev = "", color = "#0A0A0A", shortname = "",},
["Deák Party"] = {abbrev = "", color = "#AAD8E6", shortname = "",},
["Debout la France"] = {abbrev = "DLF", color = "#0087CD", shortname = "",},
["Debout la République"] = {abbrev = "DLR", color = "#8040C0", shortname = "",},
["Debout Les Belges!"] = {abbrev = "", color = "#CA232B", shortname = "",},
["Decentralist Social Force Party"] = {abbrev = "", color = "#82BC1C", shortname = "",},
["DecideT–EligeT"] = {abbrev = "", color = "#21297C", shortname = "",},
["Decidix"] = {abbrev = "", color = "#DC4868", shortname = "",},
["Decolonization and Social Emancipation Movement"] = {abbrev = "", color = "#AA0000", shortname = "",},
["Defense of the Andalusian People's Interests"] = {abbrev = "", color = "#40903B", shortname = "",},
["DéFI"] = {abbrev = "", color = "#DD0081", shortname = "",},
["Degel HaTorah"] = {abbrev = "", color = "#3E3E3E", shortname = "",},
["Degrowth Party"] = {abbrev = "", color = "#BB0000", shortname = "",},
["Delhi Janata Party"] = {abbrev = "DJP", color = "#CEF6EC", shortname = "",},
["Delhi Poorvanchal Party"] = {abbrev = "DPP", color = "#BCA9F5", shortname = "",},
["Deliberation Tsuen Wan"] = {abbrev = "", color = "#7CBECC", shortname = "Deliberation TW",},
["Demo-Social 12"] = {abbrev = "", color = "#4D955D", shortname = "",},
["Demo-Social 60"] = {abbrev = "", color = "#F58025", shortname = "",},
["Demochristian Party of Albania"] = {abbrev = "PDK", color = "orange", shortname = "",},
["Democracy (Thailand)"] = {abbrev = "", color = "#EE82EE", shortname = "Democracy",},
["Democracy and Catalonia"] = {abbrev = "", color = "#F6BA1B", shortname = "",},
["Democracy and Freedom"] = {abbrev = "DiL", color = "#212765", shortname = "",},
["Democracy and Human Rights Party"] = {abbrev = "", color = "#2E3492", shortname = "",},
["Democracy and Progress Party"] = {abbrev = "", color = "#0069A7", shortname = "",},
["Democracy at Home Party"] = {abbrev = "PPDA", color = "#003399", shortname = "",},
["Democracy First"] = {abbrev = "", color = "#ff8c00", shortname = "",},
["Democracy Groundwork"] = {abbrev = "", color = "#FEED59", shortname = "",},
["Democracy in Europe Movement 2025"] = {abbrev = "DiEM25", color = "#ec5122", shortname = "",},
["Democracy in Motion"] = {abbrev = "DiB", color = "#263d80", shortname = "",},
["Democracy is Freedom – The Daisy"] = {abbrev = "", color = "#3CB371", shortname = "The Daisy",},
["DemocracyNZ"] = {abbrev = "", color = "#30B6C1", shortname = "",},
["Democracy Power Party"] = {abbrev = "", color = "#BC1D2D", shortname = "",},
["Democracy Yes"] = {abbrev = "", color = "#B713C5", shortname = "",},
["Democracy and Development through Unity"] = {abbrev = "DOE", color = "#C8ED69", shortname = "",},
["Democracy, Citizenry and Republic"] = {abbrev = "", color = "#FCDB10", shortname = "",},
["Democrat Party (Chile)"] = {abbrev = "", color = "#E3431F", shortname = "Democrat",},
["Democrat Party (Thailand)"] = {abbrev = "", color = "#00A1F1", shortname = "Democrat",},
["Democrat Party (Turkey, 1946–1961)"] = {abbrev = "", color = "#F7819F", shortname = "Democrat",},
["Democrat Party (Turkey, current)"] = {abbrev = "DP", color = "#CC0000", shortname = "",},
["Democrat Party of Iran"] = {abbrev = "", color = "#093", shortname = "Democrat Party",},
["Democrat Social Movement"] = {abbrev = "", color = "#4CBB17", shortname = "",},
["Democrat Turkey Party"] = {abbrev = "DTP", color = "#DA7766", shortname = "",},
["Democrata Party"] = {abbrev = "", color = "#1434A4", shortname = "Democrata",},
["Democratic Accountants"] = {abbrev = "", color = "#47954E", shortname = "",},
["Democratic Action (El Salvador)"] = {abbrev = "AD", color = "#F95400", shortname = "",},
["Democratic Action (Thailand)"] = {abbrev = "", color = "#BA55D3", shortname = "Democratic Action",},
["Democratic Action (Venezuela)"] = {abbrev = "", color = "#C0C0C0", shortname = "Democratic Action",},
["Democratic Action Congress"] = {abbrev = "DAC", color = "#aa00d4", shortname = "",},
["Democratic Action Party (Spain)"] = {abbrev = "", color = "#3E4E3E", shortname = "",},
["Democratic Action Party"] = {abbrev = "DAP", color = "#ED1C24", shortname = "",},
["Democratic Agrarian Party of Romania"] = {abbrev = "PDAR", color = "yellow", shortname = "",},
["Democratic Action"] = {abbrev = "", color = "#C0C0C0", shortname = "",},
["Democratic Alignment (2015)"] = {abbrev = "", color = "#2D902D", shortname = "",},
["Democratic Alliance (Bulgaria)"] = {abbrev = "", color = "gray", shortname = "",},
["Democratic Alliance (France)"] = {abbrev = "", color = "#FFBF00", shortname = "",},
["Democratic Alliance (Greece)"] = {abbrev = "", color = "#6D85CB", shortname = "",},
["Democratic Alliance (Italy)"] = {abbrev = "", color = "#228B22", shortname = "",},
["Democratic Alliance (New Zealand)"] = {abbrev = "", color = "#FFE802", shortname = "Democratic Alliance",},
["Democratic Alliance (Philippines)"] = {abbrev = "DA", color = "#DC143C", shortname = "Democratic Alliance",},
["Democratic Alliance (Portugal)"] = {abbrev = "AD", color = "#2A52BE", shortname = "",},
["Democratic Alliance (South Africa)"] = {abbrev = "DA", color = "#005BA6", shortname = "Democratic Alliance",},
["Democratic Alliance (Ukraine)"] = {abbrev = "DA", color = "#193695", shortname = "",},
["Democratic Alliance (Venezuela)"] = {abbrev = "", color = "#0F52BA", shortname = "",},
["Democratic Alliance for Niger"] = {abbrev = "", color = "#337585", shortname = "",},
["Democratic Alliance for the Betterment and Progress of Hong Kong"] = {abbrev = "DAB", color = "#1861AC", shortname = "",},
["Democratic Alliance of Croats in Vojvodina"] = {abbrev = "DSHV", color = "#EE1C25", shortname = "",},
["Democratic Alliance of Hungarians in Romania"] = {abbrev = "UDMR", color = "#296633", shortname = "",},
["Democratic Alliance of Wales"] = {abbrev = "DAW", color = "#CCCCCC", shortname = "",},
["Democratic Alliance Party (Albania)"] = {abbrev = "AD", color = "#1369B2", shortname = "",},
["Democratic Alliance Party (Solomon Islands)"] = {abbrev = "", color = "#68C76D", shortname = "Democratic Alliance",},
["Democratic Alliance Party (Tunisia)"] = {abbrev = "", color = "Salmon", shortname = "",},
["Democratic Alternative '91"] = {abbrev = "DA'91", color = "#FFF212", shortname = "",},
["Democratic Alternative (Chile)"] = {abbrev = "", color = "#9ACD32", shortname = "",},
["Democratic Alternative (Finland)"] = {abbrev = "", color = "#FF4D00", shortname = "",},
["Democratic Alternative (Malta)"] = {abbrev = "", color = "#7AC143", shortname = "",},
["Democratic Alternative (North Macedonia)"] = {abbrev = "DA", color = "#800080", shortname = "",},
["Democratic Alternative (Serbia)"] = {abbrev = "DA", color = "#FA8383", shortname = "",},
["Democratic Alternative Party"] = {abbrev = "", color = "#EF7619", shortname = "",},
["Democratic Angola – Coalition"] = {abbrev = "AD–C", color = "#FF0000", shortname = "AD–Coligação",},
["Democratic and Independent Cape Verdean Union"] = {abbrev = "", color = "#0066ff", shortname = "",},
["Democratic and Popular Union"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Democratic and Progressive Union"] = {abbrev = "UDP/DPU", color = "#DAA520", shortname = "",},
["Democratic and Republican Alliance"] = {abbrev = "ADERE", color = "#1935D0", shortname = "",},
["Democratic and Social Centre (Spain)"] = {abbrev = "CDS", color = "#049456", shortname = "",},
["Democratic and Social Convention"] = {abbrev = "", color = "#679A6C", shortname = "CDS-Rahama",},
["Democratic and Social Movement (Algeria)"] = {abbrev = "MDS", color = "#006FB6", shortname = "",},
["Democratic and Social Movement (Morocco)"] = {abbrev = "", color = "#9AAD35", shortname = "",},
["Democratic and Social Party of Ceuta"] = {abbrev = "", color = "#29806D", shortname = "",},
["Democratic and Socialist Union of the Resistance"] = {abbrev = "UDSR", color = "#EF5327", shortname = "",},
["Democratic Ashkali Party of Kosovo"] = {abbrev = "", color = "#01B965", shortname = "",},
["Democratic Axe"] = {abbrev = "", color = "#84171C", shortname = "",},
["Democratic Azad Party"] = {abbrev = "DAP", color = "#FEF01E", shortname = "",},
["Democratic Beginning"] = {abbrev = "DA", color = "#000000", shortname = "",},
["Democratic Bloc (Poland)"] = {abbrev = "BD", color = "#F02F2A", shortname = "",},
["Democratic Bloc (Ukraine)"] = {abbrev = "", color = "#0087DC", shortname = "Democratic Bloc",},
["Democratic Bloc"] = {abbrev = "", color = "blue", shortname = "",},
["Democratic Bulgaria"] = {abbrev = "DB", color = "#004A80", shortname = "",},
["Democratic Center (Colombia)"] = {abbrev = "", color = "#1E90FF", shortname = "Democratic Center",},
["Democratic Center (Ecuador)"] = {abbrev = "", color = "#FF4500", shortname = "",},
["Democratic Centre of Macau"] = {abbrev = "CDM", color = "#DD0000", shortname = "Democratic",},
["Democratic Centre (Croatia)"] = {abbrev = "DC", color = "#006bb3", shortname = "",},
["Democratic Centre (France)"] = {abbrev = "CD", color = "#00CCCC", shortname = "",},
["Democratic Centre (Italy, 2013)"] = {abbrev = "", color = "#FF9900", shortname = "",},
["Democratic Centre (Italy)"] = {abbrev = "", color = "#E86055", shortname = "",},
["Democratic Centre (Latvia)"] = {abbrev = "", color = "blue", shortname = "Democratic Centre",},
["Democratic Centre (Serbia)"] = {abbrev = "DC", color = "#FFFF99", shortname = "",},
["Democratic Centre Coalition"] = {abbrev = "", color = "#4CB034", shortname = "",},
["Democratic Change (El Salvador)"] = {abbrev = "CD", color = "#FFFF00", shortname = "",},
["Democratic Change (Panama)"] = {abbrev = "CD", color = "#2A889B", shortname = "",},
["Democratic Change (South Sudan)"] = {abbrev = "", color = "#FB2026", shortname = "",},
["Democratic Choice of Kazakhstan"] = {abbrev = "", color = "#0083cd", shortname = "",},
["Democratic Choice of Russia – United Democrats"] = {abbrev = "DVR–OD", color = "#3A46CE", shortname = "",},
["Democratic Choice of Russia"] = {abbrev = "", color = "#29166F", shortname = "",},
["Democratic Coalition (Hungary)"] = {abbrev = "DK", color = "#0067AA", shortname = "",},
["Democratic Coalition (Spain)"] = {abbrev = "CD", color = "#8E9629", shortname = "",},
["Democratic Coalition for DC Election"] = {abbrev = "", color = "#D38D4F", shortname = "Democratic Coalition",},
["Democratic Committee of Human Rights"] = {abbrev = "DCHR", color = "#691F6C", shortname = "",},
["Democratic Community of Welfare and Freedom"] = {abbrev = "JESZ", color = "#80BB3D", shortname = "",},
["Democratic Confederation of Labour (Morocco)"] = {abbrev = "", color = "#020202", shortname = "",},
["Democratic Congress"] = {abbrev = "DC", color = "#B70002", shortname = "",},
["Democratic Consent–Republican Party"] = {abbrev = "ID–PR", color = "#317C41", shortname = "",},
["Democratic Conservative Party"] = {abbrev = "PCD", color = "#0000FF", shortname = "",},
["Democratic Constitutional Rally"] = {abbrev = "RCD", color = "FireBrick", shortname = "",},
["Democratic Convention of African Peoples"] = {abbrev = "", color = "red", shortname = "",},
["Democratic Convention of Moldova"] = {abbrev = "CDM", color = "#0061D4", shortname = "",},
["Democratic Convergence (El Salvador)"] = {abbrev = "CVD", color = "#DC241F", shortname = "",},
["Democratic Convergence of Catalonia"] = {abbrev = "CDC", color = "#232D7B", shortname = "",},
["Democratic Convergence Party (Guinea-Bissau)"] = {abbrev = "", color = "#0099FF", shortname = "",},
["Democratic Convergence Party (São Tomé and Príncipe)"] = {abbrev = "", color = "#1102DE", shortname = "",},
["Democratic Conviction"] = {abbrev = "", color = "#0098D8", shortname = "",},
["Democratic Current"] = {abbrev = "", color = "#FE6500", shortname = "",},
["Democratic Development Forum"] = {abbrev = "FDD", color = "#F0F040", shortname = "",},
["Democratic Development Party"] = {abbrev = "DDP", color = "red", shortname = "",},
["Democratic Electoral Commission"] = {abbrev = "", color = "darkred", shortname = "",},
["Democratic European Force"] = {abbrev = "", color = "#00CCCC", shortname = "",},
["Democratic Farmers' Party of Germany"] = {abbrev = "DBD", color = "#006600", shortname = "",},
["Democratic Fellowship of Vojvodina Hungarians"] = {abbrev = "VMDK", color = "green", shortname = "",},
["Democratic Force (Costa Rica)"] = {abbrev = "PFD", color = "#EB6109", shortname = "",},
["Democratic Force Party"] = {abbrev = "", color = "#CA3634", shortname = "Democratic Force",},
["Democratic Forces of Guiana"] = {abbrev = "", color = "#A71585", shortname = "",},
["Democratic Forum (Spain)"] = {abbrev = "", color = "#1C5530", shortname = "",},
["Democratic Forum for Labour and Liberties"] = {abbrev = "", color = "#660000", shortname = "Ettakatol",},
["Democratic Forum for Modernity"] = {abbrev = "", color = "purple", shortname = "",},
["Democratic Forum of Germans in Romania"] = {abbrev = "", color = "#AA2421", shortname = "",},
["Democratic Front (Bosnia and Herzegovina)"] = {abbrev = "DF", color = "#F16822", shortname = "",},
["Democratic Front (Cyprus)"] = {abbrev = "DIPA", color = "#26ACE2", shortname = "",},
["Democratic Front (Montenegro)"] = {abbrev = "DF", color = "#00008B", shortname = "",},
["Democratic Front (Peru)"] = {abbrev = "FREDEMO", color = "#50a7f7", shortname = "",},
["Democratic Front (Thailand)"] = {abbrev = "", color = "#FE9059", shortname = "Democratic Front",},
["Democratic Front for the Liberation of Palestine"] = {abbrev = "DFLP", color = "#D10A2B", shortname = "",},
["Democratic Front for the Reunification of Korea"] = {abbrev = "FF", color = "#FF3333", shortname = "Fatherland Front",},
["Democratic Front of Albania"] = {abbrev = "", color = "#EF4A2E", shortname = "Democratic Front",},
["Democratic Front Party"] = {abbrev = "", color = "#87CEFA", shortname = "",},
["Democratic Galicianist Party"] = {abbrev = "", color = "#3886AC", shortname = "",},
["Democratic Generation Party"] = {abbrev = "", color = "#A9A5B4", shortname = "",},
["Democratic Green Party of Rwanda"] = {abbrev = "", color = "#00FA9A", shortname = "",},
["Democratic Groundwork"] = {abbrev = "", color = "#FEED59", shortname = "",},
["Democratic Group of Albacete"] = {abbrev = "ADA", color = "#4F836A", shortname = "",},
["Democratic Group of the Centre"] = {abbrev = "GDC", color = "yellow", shortname = "",},
["Democratic Hygiene"] = {abbrev = "", color = "#4F6179", shortname = "",},
["Democratic Independence Party"] = {abbrev = "", color = "#AE872A", shortname = "",},
["Democratic Independent Party"] = {abbrev = "", color = "gold", shortname = "",},
["Democratic Independent Regionalist Party"] = {abbrev = "", color = "#4A1C51", shortname = "",},
["Democratic Indira Congress (Karunakaran)"] = {abbrev = "DIC", color = "darkblue", shortname = "",},
["Democratic Initiative for Benalmádena"] = {abbrev = "", color = "#22305E", shortname = "",},
["Democratic Innovation Party"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Democratic Israel"] = {abbrev = "", color = "#0E0348", shortname = "",},
["Democratic Jewish Union"] = {abbrev = "ŽDS", color = "#7F51C7", shortname = "",},
["Democratic Justice Party"] = {abbrev = "DJP", color = "#004C97", shortname = "Democratic Justice",},
["Democratic Justice Party (1987)"] = {abbrev = "DJP", color = "#0A84E9", shortname = "Democratic Justice",},
["Democratic Korea Party"] = {abbrev = "DKP", color = "#ED2939", shortname = "Democratic Korea",},
["Democratic Labor Party (historical)"] = {abbrev = "DLP", color = "#008080", shortname = "",},
["Democratic Labor Party (South Korea)"] = {abbrev = "DLP", color = "#FF6600", shortname = "Democratic Labor",},
["Democratic Labor Party"] = {abbrev = "", color = "#FF9C00", shortname = "",},
["Democratic Labour Party (Australia)"] = {abbrev = "DLP", color = "#EEAF30", shortname = "",},
["Democratic Labour Party (Barbados)"] = {abbrev = "DLP", color = "#FFD700", shortname = "",},
["Democratic Labour Party (Brazil)"] = {abbrev = "PDT", color = "#DC143C", shortname = "",},
["Democratic Labour Party (New Zealand)"] = {abbrev = "", color = "#FFA500", shortname = "Democratic Labour",},
["Democratic Labour Party (Trinidad and Tobago)"] = {abbrev = "DLP", color = "#e25822", shortname = "",},
["Democratic Labour Party (UK, 1972)"] = {abbrev = "", color = "#FF6600", shortname = "Democratic Labour",},
["Democratic Labour Party (UK, 1998)"] = {abbrev = "", color = "#E32636", shortname = "Democratic Labour",},
["Democratic Labour Party of Lithuania"] = {abbrev = "LDDP", color = "#E75480", shortname = "",},
["Democratic League (Catalonia)"] = {abbrev = "", color = "#002D70", shortname = "",},
["Democratic League in Montenegro"] = {abbrev = "DSCG", color = "cornflowerblue", shortname = "",},
["Democratic League of Dardania"] = {abbrev = "", color = "#005CA7", shortname = "",},
["Democratic League of Kosovo"] = {abbrev = "LDK", color = "#F37476", shortname = "",},
["Democratic League/Movement for the Labour Party"] = {abbrev = "", color = "#E392B6", shortname = "",},
["Democratic Left (Ecuador)"] = {abbrev = "ID", color = "#FFA500", shortname = "",},
["Democratic Left (Greece)"] = {abbrev = "DIMAR", color = "#FF4100", shortname = "",},
["Democratic Left (Ireland)"] = {abbrev = "DL", color = "#C700C7", shortname = "Democratic Left",},
["Democratic Left (Spain)"] = {abbrev = "", color = "#DB0000", shortname = "",},
["Democratic Left (UK)"] = {abbrev = "", color = "#CC0033", shortname = "Democratic Left",},
["Democratic Left Alliance – Labour Union"] = {abbrev = "SLD-UP", color = "#CA2021", shortname = "",},
["Democratic Left Alliance (Poland)"] = {abbrev = "SLD", color = "#E2001A", shortname = "",},
["Democratic Left Association"] = {abbrev = "SLD", color = "#E30A15", shortname = "",},
["Democratic Left Front (Spain)"] = {abbrev = "", color = "#7F517C", shortname = "",},
["Democratic Left Front (Sri Lanka)"] = {abbrev = "", color = "#F90818", shortname = "",},
["Democratic Left Movement (Lebanon)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Democratic Left of Catalonia"] = {abbrev = "", color = "#FFE507", shortname = "",},
["Democratic Left Party (Turkey)"] = {abbrev = "DSP", color = "#0087DC", shortname = "",},
["Democratic Left Scotland"] = {abbrev = "", color = "#CC0033", shortname = "Democratic Left",},
["Democratic Leftwing Republican Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Democratic Liberal Congress"] = {abbrev = "", color = "#F70000", shortname = "",},
["Democratic Liberal Party (Japan)"] = {abbrev = "DLP", color = "#42A46B", shortname = "Democratic Liberal",},
["Democratic Liberal Party (Romania)"] = {abbrev = "PDL", color = "#FF6633", shortname = "",},
["Democratic Liberal Party (South Korea)"] = {abbrev = "DLP", color = "#003990", shortname = "Democratic Liberal",},
["Democratic List"] = {abbrev = "", color = "#FDFF46", shortname = "",},
["Democratic List for Israeli Arabs"] = {abbrev = "", color = "#AF0000", shortname = "",},
["Democratic List of Nazareth"] = {abbrev = "", color = "#AF0000", shortname = "",},
["Democratic Majority (Spain)"] = {abbrev = "", color = "#0086D6", shortname = "",},
["Democratic Montenegro"] = {abbrev = "DCG", color = "#F5911D", shortname = "",},
["Democratic Movement – United Georgia"] = {abbrev = "", color = "#0067A5", shortname = "",},
["Democratic Movement (France)"] = {abbrev = "", color = "#EF5327", shortname = "MoDem",},
["Democratic Movement (San Marino)"] = {abbrev = "MD", color = "#F80000", shortname = "",},
["Democratic Movement for Change"] = {abbrev = "", color = "#253EFE", shortname = "Dash",},
["Democratic Movement of Mozambique"] = {abbrev = "MDM", color = "#F9B63C", shortname = "",},
["Democratic Movement of Serbia"] = {abbrev = "DEPOS", color = "#1A4A96", shortname = "",},
["Democratic Municipal Action"] = {abbrev = "", color = "#FF610F", shortname = "",},
["Democratic Nasserist Party"] = {abbrev = "", color = "green", shortname = "",},
["Democratic National Alliance (Antigua & Barbuda)"] = {abbrev = "DNA", color = "#EB8123", shortname = "",},
["Democratic National Alliance (Bahamas)"] = {abbrev = "DNA", color = "#419b41", shortname = "",},
["Democratic National Alliance (Sri Lanka)"] = {abbrev = "", color = "#CCCC33", shortname = "Democratic National Alliance",},
["Democratic National Assembly"] = {abbrev = "", color = "#add8e6", shortname = "",},
["Democratic National Association"] = {abbrev = "", color = "#00008B", shortname = "",},
["Democratic National Front Party"] = {abbrev = "", color = "#BA0E00", shortname = "",},
["Democratic National Front"] = {abbrev = "", color = "#EB6F53", shortname = "",},
["Democratic National Initiative"] = {abbrev = "IDN", color = "#FF00D4", shortname = "",},
["Democratic National Party (Cyprus)"] = {abbrev = "DEK", color = "#783B12", shortname = "",},
["Democratic National Rally"] = {abbrev = "RND", color = "#003153", shortname = "",},
["Democratic National Salvation Front"] = {abbrev = "FDSN", color = "#cc3333", shortname = "",},
["Democratic Nationalist Party (Malta, 1959–1966)"] = {abbrev = "PDN", color = "#A02C2C", shortname = "",},
["Democratic Nationalist Party (Romania)"] = {abbrev = "PND", color = "#000000", shortname = "",},
["Democratic Nationalist Party (South Korea)"] = {abbrev = "DNP", color = "#9acd32", shortname = "Democratic Nationalist",},
["Democratic Nationalists"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Democratic Nationhood Party"] = {abbrev = "PDK", color = "#054C30", shortname = "",},
["Democratic Network"] = {abbrev = "", color = "white", shortname = "",},
["Democratic Non-Partisan Alliance"] = {abbrev = "DNPA", color = "#FF0D6C", shortname = "",},
["Democratic New Macau Association"] = {abbrev = "", color = "#008000", shortname = "",},
["Democratic Opposition of Serbia"] = {abbrev = "DOS", color = "#C0C0C0", shortname = "",},
["Democratic Pact for Catalonia"] = {abbrev = "PDC", color = "#FFC400", shortname = "",},
["Democratic Partnership"] = {abbrev = "", color = "khaki", shortname = "",},
["Democratic Party – demokraci.pl"] = {abbrev = "", color = "#FF9900", shortname = "",},
["Democratic Party (1912)"] = {abbrev = "", color = "#008000", shortname = "Democratic",},
["Democratic Party (1943)"] = {abbrev = "", color = "#6482BF", shortname = "",},
["Democratic Party (Argentina)"] = {abbrev = "PD", color = "#192B6B", shortname = "Democratic Party",},
["Democratic Party (Brazil, 1925-1934)"] = {abbrev = "PD", color = "#191198", shortname= "",},
["Democratic Party (Bulgaria)"] = {abbrev = "", color = "gold", shortname = "",},
["Democratic Party (Cambodia)"] = {abbrev = "", color = "#800080", shortname = "Democratic",},
["Democratic Party (Chile)"] = {abbrev = "", color = "#00FF00", shortname = "",},
["Democratic Party (Cook Islands)"] = {abbrev = "", color = "#1E90FF", shortname = "Democratic",},
["Democratic Party (Costa Rica)"] = {abbrev = "", color = "#2136C2", shortname = "Democratic",},
["Democratic Party (Cuba)"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Democratic Party (Curaçao)"] = {abbrev = "", color = "#E41E2A", shortname = "",},
["Democratic Party (Cyprus)"] = {abbrev = "DIKO", color = "#E07C00", shortname = "",},
["Democratic Party (East Timor)"] = {abbrev = "PD", color = "#004080", shortname = "Democratic",},
["Democratic Party (Georgia)"] = {abbrev = "", color = "#8F8FBF", shortname = "",},
["Democratic Party (Hong Kong)"] = {abbrev = "", color = "#5FB04A", shortname = "Democratic",},
["Democratic Party (Hungary)"] = {abbrev = "DEMP", color = "#1560BD", shortname = "",},
["Democratic Party (Indonesia)"] = {abbrev = "", color = "#2643A3", shortname = "Demokrat",},
["Democratic Party (Italy)"] = {abbrev = "", color = "#EF1C27", shortname = "Democratic Party",},
["Democratic Party (Japan, 1947)"] = {abbrev = "", color = "#EC9502", shortname = "Democratic",},
["Democratic Party (Japan, 1954)"] = {abbrev = "", color = "#A49E05", shortname = "Democratic",},
["Democratic Party (Japan, 1996)"] = {abbrev = "", color = "#E60000", shortname = "Democratic",},
["Democratic Party (Japan, 1998)"] = {abbrev = "", color = "#CE2029", shortname = "Democratic",},
["Democratic Party (Japan, 2016)"] = {abbrev = "", color = "#02217b", shortname = "Democratic",},
["Democratic Party (Kenya)"] = {abbrev = "", color = "#336600", shortname = "Democratic",},
["Democratic Party (Laos)"] = {abbrev = "", color = "#FFCD00", shortname = "",},
["Democratic Party (Luxembourg)"] = {abbrev = "DP", color = "#002C4F", shortname = "",},
["Democratic Party (Macedonia)"] = {abbrev = "DP", color = "#3016C8", shortname = "",},
["Democratic Party (Malta)"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Democratic Party (Mendoza)"] = {abbrev = "", color = "#192B6B", shortname = "Democratic Party",},
["Democratic Party (Mongolia)"] = {abbrev = "DP", color = "#11479E", shortname = "",},
["Democratic Party (Montenegro)"] = {abbrev = "", color = "#09B2ED", shortname = "",},
["Democratic Party (Myanmar)"] = {abbrev = "DP", color = "#FFB00D", shortname = "",},
["Democratic Party (Nicaragua)"] = {abbrev = "", color = "#800000", shortname = "Democratic",},
["Democratic Party (Northern Cyprus)"] = {abbrev = "DP", color = "#DC241f", shortname = "",},
["Democratic Party (Peru)"] = {abbrev = "", color = "#FF3333", shortname = "",},
["Democratic Party (Philippines)"] = {abbrev = "", color = "#1E90FF", shortname = "Democratic",},
["Democratic Party (Poland)"] = {abbrev = "SD", color = "#6495ED", shortname = "",},
["Democratic Party (Portugal)"] = {abbrev = "PD", color = "#FF69B4", shortname = "Democratic",},
["Democratic Party (Romania)"] = {abbrev = "PD", color = "#FF6633", shortname = "",},
["Democratic Party (Serbia)"] = {abbrev = "DS", color = "#FFE000", shortname = "",},
["Democratic Party (Singapore)"] = {abbrev = "DP", color = "#DD6777", shortname = "",},
["Democratic Party (Sint Eustatius)"] = {abbrev = "DP", color = "#C00000", shortname = "",},
["Democratic Party (SL)"] = {abbrev = "", color = "#800080", shortname = "",},
["Democratic Party (Slovakia, 1944)"] = {abbrev = "DS", color = "#002FA7", shortname = "",},
["Democratic Party (Slovakia, 1989)"] = {abbrev = "DS", color = "#002FA7", shortname = "",},
["Democratic Party (Solomon Islands)"] = {abbrev = "", color = "#FFEB33", shortname = "Democratic Party",},
["Democratic Party (South Africa)"] = {abbrev = "DP", color = "#6699CC", shortname = "",},
["Democratic Party (South Korea, 1955)"] = {abbrev = "DP", color = "#000080", shortname = "Democratic",},
["Democratic Party (South Korea, 1990)"] = {abbrev = "DP", color = "#DA2C43", shortname = "Democratic",},
["Democratic Party (South Korea, 1991)"] = {abbrev = "DP", color = "#D82634", shortname = "Democratic",},
["Democratic Party (South Korea, 1995)"] = {abbrev = "DP", color = "#009D68", shortname = "Democratic",},
["Democratic Party (South Korea, 2005)"] = {abbrev = "DP", color = "#00736D", shortname = "Democratic",},
["Democratic Party (South Korea, 2008)"] = {abbrev = "DP", color = "#019E33", shortname = "Democratic",},
["Democratic Party (South Korea, 2011)"] = {abbrev = "DP", color = "#FAC71A", shortname = "Democratic",},
["Democratic Party (South Korea, May 2013)"] = {abbrev = "DP", color = "#28A54A", shortname = "Democratic",},
["Democratic Party (South Korea, September 2013)"] = {abbrev = "DP", color = "#015DA9", shortname = "Democratic",},
["Democratic Party (Sri Lanka)"] = {abbrev = "", color = "#800080", shortname = "Democratic",},
["Democratic Party (Switzerland)"] = {abbrev = "", color = "#0B3861", shortname = "Democratic",},
["Democratic Party (Tajikistan)"] = {abbrev = "", color = "#0080FF", shortname = "",},
["Democratic Party (Tanzania)"] = {abbrev = "", color = "black", shortname = "",},
["Democratic Party (Turkey, 1970)"] = {abbrev = "DP", color = "#ffa500", shortname = "",},
["Democratic Party (Turkey, 1992)"] = {abbrev = "DP", color = "#341D47", shortname = "",},
["Democratic Party (Uganda)"] = {abbrev = "DP", color = "#0C713A", shortname = "",},
["Democratic Party (UK, 1942)"] = {abbrev = "", color = "lightyellow", shortname = "Democratic",},
["Democratic Party (UK, 1969)"] = {abbrev = "", color = "#ffffff", shortname = "Democratic Party",},
["Democratic Party (United States)"] = {abbrev = "D", color = "#3333FF", shortname = "Democratic",},
["Democratic Party (Yugoslavia)"] = {abbrev = "DS", color = "#FFD300", shortname = "",},
["Democratic Party (Zambia)"] = {abbrev = "", color = "#ff338c", shortname = "",},
["Democratic Party \"Saimnieks\""] = {abbrev = "", color = "#861623", shortname = "",},
["Democratic Party – Democratic and Progressive Italy"] = {abbrev = "", color = "#E30613", shortname = "Democratic Party – IDP",},
["Democratic Party Adilet"] = {abbrev = "", color = "#0085fc", shortname = "",},
["Democratic Party for a British Gibraltar"] = {abbrev = "DPBG", color = "", shortname = "",},
["Democratic Party for Progress – Angolan National Alliance"] = {abbrev = "PDP–ANA", color = "#009900", shortname = "",},
["Democratic Party for the People"] = {abbrev = "DPP", color = "#FFBA00", shortname = "",},
["Democratic Party of Albania"] = {abbrev = "PD", color = "#00529C", shortname = "",},
["Democratic Party of Albanians"] = {abbrev = "PDSh", color = "black", shortname = "",},
["Democratic Party of Armenia"] = {abbrev = "", color = "#EC1B24", shortname = "",},
["Democratic Party of Artsakh"] = {abbrev = "", color = "#0072B9", shortname = "Democratic Party",},
["Democratic Party of Chile (1988)"] = {abbrev = "", color = "#000080", shortname = "",},
["Democratic Party of Equatorial Guinea"] = {abbrev = "PDGE", color = "#3051A3", shortname = "",},
["Democratic Party of Greens"] = {abbrev = "DSZ", color = "#007b33", shortname = "",},
["Democratic Party of Guinea – African Democratic Rally"] = {abbrev = "PDG-RDA", color = "#000000", shortname = "",},
["Democratic Party of India (Ambedkar)"] = {abbrev = "DPIA (A)", color = "", shortname = "",},
["Democratic Party of Iranian Kurdistan"] = {abbrev = "KDPI", color = "#FC0000", shortname = "",},
["Democratic Party of Ivory Coast – African Democratic Rally"] = {abbrev = "PDCI–RDA", color = "#0FAF32", shortname = "",},
["Democratic Party of Kazakhstan"] = {abbrev = "", color = "#01AEF3", shortname = "",},
["Democratic Party of Korea"] = {abbrev = "DPK", color = "#004EA2", shortname = "Democratic",},
["Democratic Party of Kosovo"] = {abbrev = "PDK", color = "#2E96D2", shortname = "",},
["Democratic Party of Labour"] = {abbrev = "PDM", color = "#ED2128", shortname = "",},
["Democratic Party of Lesotho"] = {abbrev = "DPL", color = "#4c196e", shortname = "",},
["Democratic Party of Macedonia"] = {abbrev = "DPM", color = "blue", shortname = "",},
["Democratic Party of Macedonians"] = {abbrev = "DPM", color = "#F7D10C", shortname = "",},
["Democratic Party of Moldova"] = {abbrev = "PDM", color = "#264B9D", shortname = "",},
["Democratic Party of Nauru"] = {abbrev = "", color = "#002B7F", shortname = "",},
["Democratic Party of Pensioners of Slovenia"] = {abbrev = "DeSUS", color = "#8DC63F", shortname = "",},
["Democratic Party of Pensioners"] = {abbrev = "", color = "grey", shortname = "",},
["Democratic Party of Republika Srpska"] = {abbrev = "", color = "blue", shortname = "",},
["Democratic Party of Russia"] = {abbrev = "DPR", color = "#DBB726", shortname = "",},
["Democratic Party of Serbia"] = {abbrev = "DSS", color = "#126180", shortname = "",},
["Democratic Party of Serbs in Macedonia"] = {abbrev = "DPSM", color = "#DE0000", shortname = "",},
["Democratic Party of Slovenia"] = {abbrev = "", color = "#3300B2", shortname = "",},
["Democratic Party of Socialists of Montenegro (2021)"] = {abbrev = "DPS", color = "#524FA1", shortname = "",},
["Democratic Party of Socialists of Montenegro"] = {abbrev = "DPS", color = "#F58634", shortname = "",},
["Democratic Party of the Atlantic"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Democratic Party of the Friendly Islands"] = {abbrev = "DPFI", color = "#C20100", shortname = "",},
["Democratic Party of the Left"] = {abbrev = "PDS", color = "#C72F35", shortname = "",},
["Democratic Party of the New Left"] = {abbrev = "", color = "#FD3C0B", shortname = "",},
["Democratic Party of the Philippines"] = {abbrev = "DPP", color = "#0054A5", shortname = "",},
["Democratic Party of Trinidad and Tobago"] = {abbrev = "DPTT", color = "#2A3A8C", shortname = "",},
["Democratic Party of Turkmenistan"] = {abbrev = "TDP", color = "#1CC858", shortname = "",},
["Democratic Party of Turks"] = {abbrev = "DPTM", color = "red", shortname = "",},
["Democratic Party of Ukraine"] = {abbrev = "DPU", color = "#025BAB", shortname = "",},
["Democratic Party of Vietnam"] = {abbrev = "", color = "#0055A4", shortname = "",},
["Democratic Party of Vojvodina Hungarians"] = {abbrev = "", color = "#5c7b59", shortname = "",},
["Democratic Party of Zagorje"] = {abbrev = "", color = "#70bd5d", shortname = "",},
["Democratic Party Sint Maarten"] = {abbrev = "DP", color = "#e21c1a", shortname = "",},
["Democratic Patriotic Alliance of Kurdistan"] = {abbrev = "DPAK", color = "#CCFF33", shortname = "",},
["Democratic Patriots' Unified Party"] = {abbrev = "", color = "#D80100", shortname = "",},
["Democratic Peace Party"] = {abbrev = "", color = "#8DB7E9", shortname = "",},
["Democratic Peasants' Party–Lupu"] = {abbrev = "", color = "#B7D749", shortname = "PȚD–Lupu",},
["Democratic People (Spain)"] = {abbrev = "DP", color = "#5BB829", shortname = "",},
["Democratic People's Alliance"] = {abbrev = "DNS", color = "#2B0E72", shortname = "",},
["Democratic People's Front"] = {abbrev = "DPF", color = "#FF0000", shortname = "",},
["Democratic People's Movement"] = {abbrev = "DPM", color = "#FF4500", shortname = "",},
["Democratic People's Party (Ghana)"] = {abbrev = "DPP", color = "#FF0000", shortname = "",},
["Democratic People's Party (Montenegro)"] = {abbrev = "DPP", color = "#005DA3", shortname = "",},
["Democratic People's Party (San Marino)"] = {abbrev = "PDP", color = "#0068C1", shortname = "",},
["Democratic People's Party (South Korea)"] = {abbrev = "DPP", color = "#353F9C", shortname = "Democratic People's",},
["Democratic People's Party (Turkey)"] = {abbrev = "DEHAP", color = "#984A03", shortname = "Democratic People's",},
["Democratic People's Union"] = {abbrev = "DNZ", color = "#048AEB", shortname = "",},
["Democratic People"] = {abbrev = "DP", color = "#5AC2C5", shortname = "",},
["Democratic Progress Party"] = {abbrev = "DGP", color = "#FF0000", shortname = "",},
["Democratic Progressive Party (Argentina)"] = {abbrev = "PDP", color = "#005C9E", shortname = "Democratic Progressive Party",},
["Democratic Progressive Party (Austria)"] = {abbrev = "DFP", color = "#FFE500", shortname = "",},
["Democratic Progressive Party (Malawi)"] = {abbrev = "DPP", color = "#1E90FF", shortname = "",},
["Democratic Progressive Party (Singapore)"] = {abbrev = "DPP", color = "#FF9900", shortname = "",},
["Democratic Progressive Party (Spain)"] = {abbrev = "", color = "#C92B7D", shortname = "Democratic",},
["Democratic Progressive Party"] = {abbrev = "DPP", color = "#1B9431", shortname = "",},
["Democratic Prosperous Macau Association"] = {abbrev = "", color = "#006400", shortname = "",},
["Democratic Rally of the Comorian People"] = {abbrev = "RDPC", color = "#FFFFFF", shortname = "",},
["Democratic Rally of the Comoros"] = {abbrev = "RDC", color = "#32CD32", shortname = "",},
["Democratic Rally"] = {abbrev = "DISY", color = "#1569C7", shortname = "",},
["Democratic Reform Party (Japan)"] = {abbrev = "", color = "#FF0000", shortname = "Democratic Reform",},
["Democratic Reform"] = {abbrev = "", color = "#2A52BE", shortname = "",},
["Democratic Reform Party of Muslims"] = {abbrev = "DRSM", color = "#74C365", shortname = "",},
["Democratic Reformist Party"] = {abbrev = "", color = "#D13C21", shortname = "",},
["Democratic Reforms Party (Azerbaijan)"] = {abbrev = "", color = "#333399", shortname = "",},
["Democratic Regional Union"] = {abbrev = "DPE", color = "darkorange", shortname = "",},
["Democratic Regions Party"] = {abbrev = "DBP", color = "#30A13E", shortname = "",},
["Democratic Renewal (Andorra)"] = {abbrev = "", color = "orange", shortname = "",},
["Democratic Renewal of Macedonia"] = {abbrev = "", color = "#8DC73F", shortname = "",},
["Democratic Renewal Party (Angola)"] = {abbrev = "PRD", color = "#662531", shortname = "",},
["Democratic Renewal Party (Brazil)"] = {abbrev = "PRD", color = "#008000", shortname = "",},
["Democratic Renewal Party (Benin)"] = {abbrev = "PRD", color = "#FFFA00", shortname = "",},
["Democratic Renewal Party (Cape Verde)"] = {abbrev = "", color = "#02569F", shortname = "",},
["Democratic Renewal Party (Portugal)"] = {abbrev = "PRD", color = "#008000", shortname = "",},
["Democratic Renewal"] = {abbrev = "DIANA", color = "#007FFF", shortname = "",},
["Democratic Renewal Party (Costa Rica)"] = {abbrev = "PRD", color = "#2C93FB", shortname = "",},
["Democratic Renovation"] = {abbrev = "", color = "orange", shortname = "",},
["Democratic Republic of Timor-Leste Party"] = {abbrev = "PDRT", color = "#DE5D83", shortname = "",},
["Democratic Republican Party (South Korea)"] = {abbrev = "", color = "#835B38", shortname = "Democratic Republican",},
["Democratic Republican Party (South Korea, 1997)"] = {abbrev = "", color = "#0D90D6", shortname = "Democratic Republican",},
["Democratic Republican Union"] = {abbrev = "", color = "#feed01", shortname = "",},
["Democratic Revival"] = {abbrev = "DA", color = "darkblue", shortname = "",},
["Democratic Revolution"] = {abbrev = "", color = "#1D4C4F", shortname = "",},
["Democratic Revolutionary Alliance (Bolivia)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Democratic Revolutionary Front – New Alternative"] = {abbrev = "FDR", color = "#1FA045", shortname = "",},
["Democratic Revolutionary Nationalist Party"] = {abbrev = "", color = "#bb0000", shortname = "",},
["Democratic Revolutionary Party"] = {abbrev = "PRD", color = "#003F87", shortname = "",},
["Democratic Revolutionary Peoples Party"] = {abbrev = "DRPP", color = "#006400", shortname = "",},
["Democratic Rioja"] = {abbrev = "", color = "#FFFF6F", shortname = "",},
["Democratic Senate"] = {abbrev = "", color = "#DB64DB", shortname = "",},
["Democratic Serb Party (Montenegro)"] = {abbrev = "DSS", color = "Darkblue", shortname = "",},
["Democratic Social Christian Party"] = {abbrev = "", color = "#556627", shortname = "",},
["Democratic Social Justice Party"] = {abbrev = "DSJP", color = "#A91B0D", shortname = "",},
["Democratic Social Movement"] = {abbrev = "DIKKI", color = "#FF7F00", shortname = "",},
["Democratic Social Party"] = {abbrev = "PDS", color = "#0067A5", shortname = "",},
["Democratic Social-Revolutionary Party of Cuba"] = {abbrev = "", color = "#D21F1B", shortname = "",},
["Democratic Socialism (Chile)"] = {abbrev = "SD", color = "#B7051F", shortname = "",},
["Democratic Socialist Alliance (Spain)"] = {abbrev = "", color = "#EE3507", shortname = "",},
["Democratic Socialist Alliance"] = {abbrev = "", color = "#CC4E5C", shortname = "",},
["Democratic Socialist Coalition"] = {abbrev = "CSD", color = "#00BFFF", shortname = "",},
["Democratic Socialist Left"] = {abbrev = "", color = "#D2323A", shortname = "",},
["Democratic Socialist Party (Argentina)"] = {abbrev = "PSD", color = "#FF9900", shortname = "Democratic Socialist Party",},
["Democratic Socialist Party (Ireland)"] = {abbrev = "DSP", color = "#FF0099", shortname = "Democratic Socialist",},
["Democratic Socialist Party (Japan)"] = {abbrev = "", color = "#FF4F4F", shortname = "Democratic Socialist",},
["Democratic Socialist Party (Morocco)"] = {abbrev = "", color = "#188410", shortname = "",},
["Democratic Socialist Party (Prabodh Chandra)"] = {abbrev = "DSP(PC)", color = "#FF033E", shortname = "",},
["Democratic Socialist Party (South Korea)"] = {abbrev = "", color = "#FF8000", shortname = "Democratic Socialist",},
["Democratic Socialist Party of Greece"] = {abbrev = "", color = "Yellow", shortname = "",},
["Democratic Socialist Radical Party"] = {abbrev = "", color = "#800080", shortname = "",},
["Democratic Socialist Unionist Party"] = {abbrev = "", color = "red", shortname = "",},
["Democratic Socialists '70"] = {abbrev = "DS'70", color = "#A21756", shortname = "",},
["Democratic Socialists of America"] = {abbrev = "", color = "#EB2128", shortname = "",},
["Democratic Society Alliance"] = {abbrev = "", color = "#74C365", shortname = "",},
["Democratic Society Congress"] = {abbrev = "DTK", color = "#029E4A", shortname = "",},
["Democratic Society Party"] = {abbrev = "DTP", color = "#008000", shortname = "",},
["Democratic swaraj party"] = {abbrev = "DSP", color = "#000000", shortname = "",},
["Democratic Tamil National Alliance"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Democratic Tumu Party"] = {abbrev = "", color = "#C8102E", shortname = "Democratic Tumu",},
["Democratic Turkish Union of Romania"] = {abbrev = "RDTB", color = "#E30A17", shortname = "",},
["Democratic Unification Party (South Korea)"] = {abbrev = "", color = "#c93", shortname = "Democratic Unification",},
["Democratic Unification Party"] = {abbrev = "UD", color = "#FEF100", shortname = "",},
["Democratic Union (Czech Republic)"] = {abbrev = "DEU", color = "#6D051C", shortname = "",},
["Democratic Union (Greece)"] = {abbrev = "DE", color = "#FFC0CB", shortname = "",},
["Democratic Union (Greece, 1956)"] = {abbrev = "DE", color = "#FFA500", shortname = "",},
["Democratic Union (Guatemala)"] = {abbrev = "UD", color = "#4fadea", shortname = "",},
["Democratic Union (Israel)"] = {abbrev = "", color = "#029A3D", shortname = "Democratic Union",},
["Democratic Union (Italy)"] = {abbrev = "", color = "#800080", shortname = "",},
["Democratic Union (Bosnia and Herzegovina)"] = {abbrev = "DEMOS", color = "#ED1C24", shortname = "",},
["Democratic Union (Poland)"] = {abbrev = "UD", color = "#DB812E", shortname = "",},
["Democratic Union Coalition (1996–2000)"] = {abbrev = "", color = "#074DA9", shortname = "Democratic Union",},
["Democratic Union for Integration"] = {abbrev = "BDI", color = "#344b9b", shortname = "",},
["Democratic Union for Revival"] = {abbrev = "DAK", color = "#1F2563", shortname = "",},
["Democratic Union for the Respect of Labour"] = {abbrev = "UDRT/RAD", color = "black", shortname = "",},
["Democratic Union for the Republic"] = {abbrev = "", color = "#FF7F00", shortname = "",},
["Democratic Union Movement"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Democratic Union of Albanians"] = {abbrev = "UDSH", color = "#E65532", shortname = "",},
["Democratic Union of Catalonia"] = {abbrev = "", color = "#0053A1", shortname = "",},
["Democratic Union of Croats"] = {abbrev = "DZH", color = "#E5111D", shortname = "",},
["Democratic Union of Hungarians in Romania"] = {abbrev = "", color = "#15803C", shortname = "",},
["Democratic Union of Hungarians of Croatia"] = {abbrev = "DZMH", color = "#15803C", shortname = "",},
["Democratic Union of Slovakia"] = {abbrev = "DEÚS", color = "#007BA7", shortname = "",},
["Democratic Union of Slovaks and Czechs of Romania"] = {abbrev = "UDSCR", color = "#1136F2", shortname = "",},
["Democratic Union of Taiwan"] = {abbrev = "", color = "#FF9826", shortname = "Democratic Union",},
["Democratic Union of the Malian People"] = {abbrev = "UDPM", color = "#008000", shortname = "",},
["Democratic Union of the Region of Murcia"] = {abbrev = "", color = "#039C06", shortname = "",},
["Democratic Union of the Rwandan People"] = {abbrev = "", color = "#344EA3", shortname = "",},
["Democratic Union of the Vlachs of Macedonia"] = {abbrev = "DSVM", color = "", shortname = "",},
["Democratic Union of Turkish-Muslim Tatars of Romania"] = {abbrev = "RMTTDB", color = "yellow", shortname = "",},
["Democratic Union Party (Romania)"] = {abbrev = "PDU", color = "blue", shortname = "",},
["Democratic Union–Broad Centre"] = {abbrev = "", color = "#F6643D", shortname = "",},
["Democratic Unionist Party (Sudan)"] = {abbrev = "DUP", color = "#00A6EF", shortname = "",},
["Democratic Unionist Party"] = {abbrev = "DUP", color = "#D46A4C", shortname = "",},
["Democratic United National Front"] = {abbrev = "", color = "green", shortname = "",},
["Democratic United Party"] = {abbrev = "", color = "#FFD400", shortname = "Democratic United",},
["Democratic Unity Alliance"] = {abbrev = "", color = "#F8A718", shortname = "",},
["Democratic Unity Roundtable"] = {abbrev = "MUD", color = "#0F52BA", shortname = "",},
["Democratic Way (Spain)"] = {abbrev = "", color = "#FFAE00", shortname = "",},
["Democratic Way Party"] = {abbrev = "", color = "#87a1fe", shortname = "",},
["Democratic Women's League of Germany"] = {abbrev = "", color = "#3d61d6", shortname = "",},
["Democratic-Independent Party (North Dakota)"] = {abbrev = "", color = "#66CCFF", shortname = "",},
["Democratic-People's Party"] = {abbrev = "", color = "#3333FF", shortname = "Democratic-People's",},
["Democratic-Republican (Adams)"] = {abbrev = "", color = "#68C468", shortname = "",},
["Democratic-Republican (Jackson)"] = {abbrev = "", color = "#698DC5", shortname = "",},
["Democratic-Republican (Crawford)"] = {abbrev = "", color = "#FF9955", shortname = "",},
["Democratic-Republican Party (1844)"] = {abbrev = "", color = "#808000", shortname = "",},
["Democratic-Republican Party"] = {abbrev = "", color = "#008000", shortname = "Democratic-Republican",},
["Democratic-Social Movement (Poland)"] = {abbrev = "RDS", color = "#FAAA49", shortname = "",},
["Democratic/Country coalition"] = {abbrev = "", color = "#6495ED", shortname = "",},
["Democratic/Hold"] = {abbrev = "", color = "#EEF6FF", shortname = "",},
["Democrats (Brazil)"] = {abbrev = "DEM", color = "#8CC63E", shortname = "",},
["Democrats (Chile)"] = {abbrev = "", color = "#DA1764", shortname = "",},
["Democrats (Croatia)"] = {abbrev = "", color = "#B00F1F", shortname = "",},
["Democrats (Greece)"] = {abbrev = "", color = "midnightblue", shortname = "Democrats",},
["Democrats (Greenland)"] = {abbrev = "", color = "#152D49", shortname = "Democrats",},
["Democrats (Slovakia)"] = {abbrev = "", color = "#50168E", shortname = "Democrats",},
["Democrats 66"] = {abbrev = "D66", color = "#00CD67", shortname = "",},
["Democrats and Veterans"] = {abbrev = "", color = "#000000", shortname = "",},
["Democrats for a Strong Bulgaria"] = {abbrev = "DSB", color = "#02528A", shortname = "",},
["Democrats for Andorra"] = {abbrev = "DA", color = "#EA7A28", shortname = "",},
["Democrats for Liechtenstein"] = {abbrev = "", color = "#005EA8", shortname = "DpL",},
["Democrats for Responsibility, Solidarity and Tolerance"] = {abbrev = "", color = "#1A70B8", shortname = "",},
["Democrats of Catalonia"] = {abbrev = "DC", color = "#1375CE", shortname = "",},
["Democrats of the Left"] = {abbrev = "DS", color = "#C72F35", shortname = "",},
["DEMOS (Montenegro)"] = {abbrev = "DEMOS", color = "#89CFF0", shortname = "",},
["Demos+"] = {abbrev = "", color = "#F97D19", shortname = "",},
["Demosisto"] = {abbrev = "", color = "#37C8B4", shortname = "",},
["Demosistō"] = {abbrev = "", color = "#37C8B4", shortname = "",},
["DENK (political party)"] = {abbrev = "DENK", color = "#00B7B2", shortname = "",},
["Denmark Democrats"] = {abbrev = "", color = "#1273FF", shortname = "Denmark Democrats",},
["Denok Hiritar"] = {abbrev = "", color = "#FEF900", shortname = "",},
["Der Wandel"] = {abbrev = "", color = "#D32C0B", shortname = "Wandel",},
["Derekh Eretz (political faction)"] = {abbrev = "", color = "#277EE5", shortname = "",},
["Derryn Hinch's Justice Party"] = {abbrev = "", color = "#002F5D", shortname = "Justice",},
["Derwentside Independents"] = {abbrev = "", color = "#9F009F", shortname = "",},
["Derzhava (Russian party)"] = {abbrev = "", color = "#959698", shortname = "",},
["Derzhava (Ukrainian party)"] = {abbrev = "", color = "#FF0000", shortname = "Derzhava",},
["Des de Baix"] = {abbrev = "", color = "#EF7D00", shortname = "",},
["Desh Bhakt Party"] = {abbrev = "DBP", color = "#B404AE", shortname = "",},
["Desire the Right Party"] = {abbrev = "", color = "#0087DC", shortname = "Desire the Right",},
["Desiya Murpokku Dravida Kazhagam"] = {abbrev = "DMDK", color = "#FFEA19", shortname = "",},
["Destiny New Zealand"] = {abbrev = "", color = "#FFFF00", shortname = "Destiny",},
["Destour"] = {abbrev = "", color = "#7F1A03", shortname = "",},
["Destourian Movement"] = {abbrev = "", color = "RebeccaPurple", shortname = "",},
["Deutsche Mitte"] = {abbrev = "DM", color = "#284f8d", shortname = "",},
["Deutsche Reichspartei"] = {abbrev = "", color = "#8B4726", shortname = "",},
["Development and Peace (political party)"] = {abbrev = "", color = "#6A287E", shortname = "Flatto-Sharon",},
["Development Movement"] = {abbrev = "", color = "#8F188F", shortname = "",},
["Development/For!"] = {abbrev = "AP!", color = "#FFEC00", shortname = "",},
["Devizes Guardians"] = {abbrev = "", color = "#9A114F", shortname = "",},
["Dharmacracy Party"] = {abbrev = "DP", color = "#F46A26", shortname = "",},
["Dharmacracy Party (Thailand)"] = {abbrev = "", color = "#C8BCA7", shortname = "Dharmacracy",},
["Dhivehi Rayyithunge Party"] = {abbrev = "DRP", color = "#3F89C0", shortname = "",},
["Diàleg Republicà"] = {abbrev = "", color = "#CD2E33", shortname = "",},
["Dialogue – The Greens' Party"] = {abbrev = "PZ", color = "#39B54A", shortname = "",},
["Dialogue for Hungary"] = {abbrev = "PM", color = "#3CB34D", shortname = "",},
["Dialogue Party"] = {abbrev = "", color = "#D32270", shortname = "",},
["Dibyojyoti Singh Deo"] = {abbrev = "", color = "#DD4561", shortname = "",},
["Die PARTEI"] = {abbrev = "PARTEI", color = "#B5152B", shortname = "",},
["Die Urbane. Eine HipHop Partei"] = {abbrev = "du.", color = "#E66346", shortname = "",},
["DierAnimal"] = {abbrev = "", color = "#148C8B", shortname = "",},
["Different Cantabria"] = {abbrev = "", color = "#96D351", shortname = "",},
["Digital Party"] = {abbrev = "", color = "#F36F21", shortname = "Digital",},
["Dignidad Ahora"] = {abbrev = "", color = "#EC8431", shortname = "",},
["Dignity and Charity"] = {abbrev = "DM", color = "#0BC3AD", shortname = "",},
["Dignity and Truth Platform"] = {abbrev = "PPDA", color = "#409FD9", shortname = "",},
["Dignity Coalition"] = {abbrev = "", color = "#3D7254", shortname = "",},
["Dignity Now!"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Dignity Party (Algeria)"] = {abbrev = "", color = "#008000", shortname = "Dignity",},
["Dignity Party (Egypt)"] = {abbrev = "", color = "#008000", shortname = "",},
["Dignity Party (South Australia)"] = {abbrev = "", color = "#69359C", shortname = "Dignity",},
["Dikwankwetla Party of South Africa"] = {abbrev = "", color = "#4B393B", shortname = "Dikwankwetla Party",},
["Direct Democracy (Peru)"] = {abbrev = "", color = "yellow", shortname = "",},
["Direct Democracy (Poland)"] = {abbrev = "DB", color = "#00FFFF", shortname = "Direct Democracy",},
["Direct Democracy Ireland"] = {abbrev = "", color = "#87CEFA", shortname = "Direct Democracy",},
["Direct Democracy Party of New Zealand"] = {abbrev = "", color = "#F28317", shortname = "Direct Democracy",},
["Direct Democratic Participation of Galicia"] = {abbrev = "", color = "#4FAECD", shortname = "",},
["Direct Democrats (Sweden)"] = {abbrev = "DD", color = "orange", shortname = "",},
["Direction – Slovak Social Democracy"] = {abbrev = "SMER–SD", color = "#d82222", shortname = "",},
["Dissident Left"] = {abbrev = "", color = "#66CC99", shortname = "Dissident Left",},
["Dixiecrat"] = {abbrev = "", color = "#FF9955", shortname = "",},
["Do not let Belgrade drown"] = {abbrev = "NDB", color = "#276030", shortname = "",},
["Doctrinaires"] = {abbrev = "", color = "#87CEFA", shortname = "",},
["Domani Motus Liberi"] = {abbrev = "DML", color = "#039ADA", shortname = "",},
["Dōmei Seisha"] = {abbrev = "", color = "#825C8C", shortname = "",},
["Dominica Freedom Party"] = {abbrev = "DFP", color = "#008000", shortname = "",},
["Dominica Labour Party"] = {abbrev = "DLP", color = "#F0001C", shortname = "",},
["Dominica United People's Party"] = {abbrev = "", color = "orange", shortname = "",},
["Dominican Communist Party"] = {abbrev = "", color = "#CE2029", shortname = "",},
["Dominican Humanist Party"] = {abbrev = "", color = "#FFEF52", shortname = "",},
["Dominican Liberation Party"] = {abbrev = "PLD", color = "#870B9C", shortname = "",},
["Dominican Party"] = {abbrev = "", color = "#964B00", shortname = "",},
["Dominican Revolutionary Party"] = {abbrev = "PRD", color = "#ADD8E6", shortname = "",},
["Dominicans for Change"] = {abbrev = "", color = "#12e3ff", shortname = "",},
["Dominion Labor Party (Alberta)"] = {abbrev = "", color = "transparent", shortname = "Labor",},
["Dominion Party (South Africa)"] = {abbrev = "", color = "#50C878", shortname = "Dominion",},
["Donegal Progressive Party"] = {abbrev = "", color = "#FF7F00", shortname = "",},
["Donetsk Republic (political party)"] = {abbrev = "", color = "#005087", shortname = "",},
["Doordarshi Party"] = {abbrev = "", color = "#00FF99", shortname = "",},
["Dor (political party)"] = {abbrev = "", color = "#409199", shortname = "",},
["Dōshi Club (1900s)"] = {abbrev = "", color = "#0018ED", shortname = "",},
["Dōshi Seisha"] = {abbrev = "", color = "#4D5269", shortname = "",},
["Dovira"] = {abbrev = "", color = "#1A9DAA", shortname = "Dovira",},
["Downlands Resident Group"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Dr. A. P. J. Abdul Kalam"] = {abbrev = "", color = "#DB7099", shortname = "",},
["Drago Project"] = {abbrev = "", color = "#232323", shortname = "",},
["Drassi"] = {abbrev = "", color = "#f37021", shortname = "",},
["Dravida Munnetra Kazhagam"] = {abbrev = "DMK", color = "#FF0D0D", shortname = "",},
["Druk Chirwang Tshogpa"] = {abbrev = "", color = "#FCB116", shortname = "",},
["Druk Nyamrup Tshogpa"] = {abbrev = "DNT", color = "#F9C6D9", shortname = "",},
["Druk Phuensum Tshogpa"] = {abbrev = "DPT", color = "#E48400", shortname = "",},
["Druk Thuendrel Tshogpa"] = {abbrev = "DTT", color = "#4a85c4", shortname = "",},
["Dublin Trades Council"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Duma Polska"] = {abbrev = "", color = "#E04A4B", shortname = "",},
["Dutch People's Union"] = {abbrev = "", color = "red", shortname = "",},
["Dveri"] = {abbrev = "", color = "#E32636", shortname = "",},
["Dynastic Left"] = {abbrev = "", color = "#5FA082", shortname = "Leftist",},
["Džemijet"] = {abbrev = "", color = "black", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
3cd0a7dc0bb4a4b108493fadc38e3404795bd873
Supreme Court of the United States
0
10
16
2023-12-24T01:42:30Z
Floopymichael
2
Created page with "The '''Supreme Court of the United States''' (also referred to as SCOTUS) is the highest federal court in the United States. Established in Article Three of the Constitution, it functions as the final interpreter and arbiter of federal law, including the Constitution itself. The Court ensures that federal law is applied uniformly across the nation, and additionally resolves disputes between states and lower courts as they arise. The court consists of a Chief Justice and..."
wikitext
text/x-wiki
The '''Supreme Court of the United States''' (also referred to as SCOTUS) is the highest federal court in the United States. Established in Article Three of the Constitution, it functions as the final interpreter and arbiter of federal law, including the Constitution itself. The Court ensures that federal law is applied uniformly across the nation, and additionally resolves disputes between states and lower courts as they arise. The court consists of a Chief Justice and various Associate Justices. The exact number and composition of the court is not set by the Constitution, although it has stayed unchanged at 9 justices since the passage of the Judiciary Act of 1869.
== Composition ==
=== Current justices of the Supreme Court ===
There are currently nine justices serving on the Supreme Court: Chief Justice Earl Warren and eight additional associate justices. The longest-serving member of the current court is Justice Hugo Black, who has served for over 27 years. The shortest-serving member of the current court is Justice Arthur Goldberg, who has served for just under 3 years.
{| class="wikitable sortable" style="text-align:center"
|+ Current justices of the Supreme Court
|-
! rowspan=2 colspan=2 style="min-width: 150px | Justice /<br />birthdate and place
! rowspan=2 | Appointed by (party)
! colspan=2 | Age at
! rowspan=2 | Start date
! rowspan=2 | Succeeded
|-
! Start !! Present
|-
| [[File:Earl Warren.jpg|100px]]
| (Chief Justice)<br />'''Earl Warren'''<br />March 19, 1891<br />Los Angeles, California
| Dwight D. Eisenhower <br />([[Republican Party|R]])
| 63
| 73
| March 1, 1954
| Vinson
|-
| [[File:HugoLaFayetteBlack.jpg|100px]]
| '''Hugo Black'''<br />February 27, 1887<br />Harlan, Alabama
| Franklin D. Roosevelt <br />([[Democratic Party|D]])
| 49
| 77
| August 19, 1937
| Devanter
|-
| [[File:Justice William O Douglas.jpg|100px]]
| '''William O. Douglas'''<br />October 16, 1898<br />Maine Township, Minnesota
| Franklin D. Roosevelt <br />([[Democratic Party|D]])
| 40
| 66
| April 17, 1939
| Brandeis
|-
| [[File:Official portrait of Associate Justice Tom C. Clark, Supreme Court of the United States (cropped).jpg|100px]]
| '''Tom C. Clark'''<br />September 23, 1899<br />Dallas, TX
| Harry S. Truman <br />([[Democratic Party|D]])
| 49
| 65
| August 24, 1949
| Murphy
|-
| [[File:John Marshall Harlan II official.jpg|100px]]
| '''John Marshall Harlan II'''<br />May 20, 1899<br />Chicago, Illinois
| Dwight D. Eisenhower <br />([[Republican Party|R]])
| 56
| 65
| March 28, 1955
| R. Jackson
|-
| [[File:US Supreme Court Justice William Brennan - 1972 official portrait.jpg|100px]]
| '''William J. Brennan'''<br />April 25, 1906<br />Newark, New Jersey
| Dwight D. Eisenhower <br />([[Republican Party|R]])
| 51
| 59
| October 16, 1956
| Minton
|-
| [[File:US Supreme Court Justice Potter Stewart - 1976 official portrait.jpg|100px]]
| '''Potter Stewart'''<br />January 23, 1915<br />Jackson, Michigan
| Dwight D. Eisenhower <br />([[Republican Party|R]])
| 43
| 50
| October 14, 1958
| Burton
|-
| [[File:US Supreme Court Justice Byron White - 1976 official portrait.jpg|100px]]
| '''Byron White'''<br />June 18, 1917<br />Fort Collins, Colorado
| John F. Kennedy <br />([[Democratic Party|D]])
| 44
| 47
| April 16, 1962
| Whittaker
|-
| [[File:Arthur goldberg.jpg|100px]]
| '''Arthur Goldberg'''<br />August 8, 1908<br />Chicago, Illinois
| John F. Kennedy <br />([[Democratic Party|D]])
| 53
| 56
| October 1, 1962
| Ball
|}
== Notable Decisions ==
When notable court cases are decided in-sim, they will appear here.
4fd83e965224f5591de5de2b65c12ed4493d2a64
Infobox
0
11
18
17
2023-12-24T02:00:55Z
Floopymichael
2
1 revision imported from [[:wikipedia:Infobox]]
wikitext
text/x-wiki
{{short description|Template used to collect and present a subset of information about a subject}}
{{Self-reference|For information about infoboxes on Wikipedia, see [[Help:Infobox]].}}
[[File:43185 infobox.jpg|thumb|right|A real-life infobox from [[British Rail Class 43 (HST)|British Rail Class 43]] car 43185 operated by [[First Great Western]]]]
An '''infobox''' is a digital or physical [[Table (information)|table]] used to collect and present a subset of information about its subject, such as a [[document]]. It is a [[structured document]] containing a set of [[attribute–value pair]]s,{{sfn|Baeza-Yates|King|2009|p=31}} and in [[Wikipedia]] represents a summary of information about the subject of an [[Article (publishing)|article]].{{sfn|Liyang|2011|p=385}} In this way, they are comparable to data [[table (information)|tables]] in some aspects. When presented within the larger document it summarizes, an infobox is often presented in a [[sidebar (publishing)|sidebar]] format.
An infobox may be implemented in another document by [[transclusion|transcluding]] it into that document and specifying some or all of the attribute–value pairs associated with that infobox, known as [[parameterization]]{{dn|date=October 2023}}.
==Wikipedia==
{{See also|Template:Infobox}}
An infobox may be used to summarize the information of an article on [[Wikipedia]].{{sfn|Broughton|2008|p=357}} They are used on similar articles to ensure consistency of presentation by using a common format.{{sfn|Broughton|2008|p=17}}{{sfn|Liyang|2011|p=385}} Originally, infoboxes (and templates in general) were used for [[page layout]] purposes.{{sfn|Liyang|2011|p=385}} An infobox may be transcluded into an article by specifying the [[Value (computer science)|value]] for some or all of its [[Parameter (computer programming)|parameters]].{{sfn|Broughton|2008|p=18}} The parameter name used must be the same as that specified in the infobox template, but any value may be associated to it.{{sfn|Broughton|2008|p=18}} The name is [[delimiter|delimited]] from the value by an [[equals sign]].{{sfn|Broughton|2008|p=18}} The parameter name may be regarded as an attribute of the article's subject.{{sfn|Baeza-Yates|King|2009|p=30}}
<!-- this table is used for examples in the text; please update the text when changing contents in the table -->
{|class="wikitable"
|-
| style="vertical-align: top; width:250px" |
<syntaxhighlight lang="wikitext">
{{Infobox prepared food
| name =
| image =
| image_size =
| caption =
| alternate_name =
| country =
| region =
| creator =
| course =
| type =
| served =
| main_ingredient =
| variations =
| calories =
| other =
}}
</syntaxhighlight>
| style="vertical-align: top;" |
<syntaxhighlight lang="wikitext">
{{Infobox prepared food
| name = Crostata
| image = Crostata limone e zenzero 3.jpg
| image_size =
| caption = Crostata with lemon ginger filling
| alternate_name =
| country = [[Italy]]
| region = [[Lombardia]]
| creator =
| course = [[Dessert]]
| type = [[Tart]]
| served =
| main_ingredient = Pastry crust, [[jam]] or [[ricotta]], fruit
| variations = ''Crostata di frutta'', ''crostata di ricotta'', many other sweet or savoury variations
| calories =
| other =
}}
</syntaxhighlight>
|-
| style="vertical-align: top;" |The infobox ''[[Template:Infobox prepared food|Infobox prepared food]]'' used on Wikipedia food-related articles, with no [[Value (computer science)|values]] specified for its [[Parameter (computer programming)|parameters]] (attributes).
| style="vertical-align: top;" |The same infobox as implemented in the article ''[[crostata]]''. Values are to the right of the [[equals sign]] (=), and that the parameter names are the same as those in the specification for the infobox template. The values are in [[wiki markup]]: entries enclosed in square brackets (e.g. <nowiki>[[Tart]]</nowiki>) will be rendered as a link to the respective Wikipedia article (e.g. [[Tart]]), and the linked file will be transcluded into the article in place of its markup.
|}
[[File:Crostata infobox, February 2018.png|thumb|right|The infobox for the Wikipedia article ''[[Crostata]]'' rendered by a [[web browser engine]] on a [[desktop computer]]]]
[[File:Xuanhanosaurus taxobox, June 2020.png|thumb|200px|left|The taxobox (short for [[Taxonomy (biology)|taxonomy]] infobox) for the Wikipedia article ''[[Xuanhanosaurus]]'' rendered by a [[web browser engine]] (on [[Safari (web browser)|Safari]]) on a [[desktop computer]] ([[iMac]]). A taxobox is a type of infobox which details the taxonomy of a specific [[life form]] or [[animal]]]]
On Wikipedia, an infobox is transcluded into an article by enclosing its name and attribute–value pairs within a double set of [[Curly bracket|braces]]. The [[MediaWiki]] software on which Wikipedia operates then [[Parsing|parses]] the document, for which the infobox and other templates are processed by a [[template processor]]. This is a [[Web template system|template engine]] which produces a [[web document]] and a [[Style sheet (web development)|style sheet]] used for presentation of the document. This enables the design of the infobox to be separated from the content it manipulates;{{sfn|Liyang|2011|p=385}} that is, the design of the template may be updated without affecting the information within it, and the new design will automatically propagate to all articles that transclude the infobox.{{sfn|Broughton|2008|p=17}} Usually, infoboxes are [[Typesetting|formatted]] to appear in the top-right corner of a Wikipedia article in the desktop view,{{sfn|Broughton|2008|p=357}} or at the top in the mobile view.
Placement of an infobox within the [[Wiki markup|wikitext]] of an article is important for [[Web accessibility|accessibility]].{{sfn|Broughton|2008|p=234}} A [[best practice]] is to place them following ''disambiguation'' templates (those that direct readers to articles about topics with similar names) and maintenance templates (such as that marking an article as unreferenced), but before all other [[Content (media)|content]].{{sfn|Broughton|2008|p=235}}<ref>The [[English Wikipedia]] policy about accessibility is specified in the [[Wikipedia:Manual of Style/Accessibility]]. The policy about [[Wiki markup|wikitext]] layout is specified at [[Wikipedia:Manual of Style/Layout]] and [[Wikipedia:Manual of Style/Layout|Wikipedia:Manual of Style/Lead section]].</ref>
[[Ricardo Baeza-Yates|Baeza-Yates]] and King say that some editors find templates such as infoboxes complicated,{{sfn|Baeza-Yates|King|2009|p=345}} as the template may hide text about a property or resource that the editor wishes to change; this is exacerbated by chained templates, that is templates transcluded within other templates.{{sfn|Baeza-Yates|King|2009|p=345}}
As of August 2009, English Wikipedia used about {{formatnum:3000}} infobox templates that collectively used more than {{formatnum:20000}} attributes.{{sfn|Lange|Böhm|Naumann|2010|page=7}} Since then, many have been merged, to reduce redundancy. As of June 2013, there were at least {{formatnum:1345446}} transclusions of the parent [[Template:Infobox|Infobox template]],<ref name="Jarry">{{cite web|url=http://toolserver.org/~jarry/templatecount/index.php?lang=en&name=Infobox&namespace=10|title=Jarry1250's Toolserver Tools - Template transclusion count|date=7 June 2013|work=[[List of Wikimedia projects]]|access-date=7 June 2013}}</ref> used by some, but not all, infoboxes, on {{formatnum:4251127}} articles.
The name of an Infobox is typically "Infobox [genre]"; however, widely used infoboxes may be assigned shorter names, such as "taxobox" for taxonomy.{{sfn|Broughton|2008|p=235}}
===Machine learning===
About 44.2% of Wikipedia articles contained an infobox in 2008,{{sfn|Baeza-Yates|King|2009|p=28}} and about 33% in 2010.{{sfn|Lange|Böhm|Naumann|2010|page=5}} Automated [[Semantic data model|semantic knowledge extraction]] using [[machine learning]] algorithms is used to "extract machine-processable information at a relatively low complexity cost".{{sfn|Baeza-Yates|King|2009|p=31}} However, the low coverage makes it more difficult, though this can be partially overcome by complementing article data with that in [[Categorization|categories]] in which the article is included.{{sfn|Baeza-Yates|King|2009|p=28}} The [[French Wikipedia]] initiated the project ''Infobox Version 2'' in May 2011.{{sfn|Geertman|Reinhardt|Toppen|2011|p=493}}<ref>The project is hosted on the [[French Wikipedia]] page [[:fr:Projet:Infobox/V2|Infobox/V2]].</ref>
Knowledge obtained by machine learning can be used to improve an article, such as by using automated software suggestions to editors for adding infobox data.{{sfn|Baeza-Yates|King|2009|p=28}} The iPopulator project created a system to add a value to an article's infobox parameter via an automated parsing of the text of that article.{{sfn|Lange|Böhm|Naumann|2010|page=7}}
[[DBpedia]] uses [[structured content]] extracted from infoboxes{{sfn|Liyang|2011|p=385}} by machine learning algorithms to create a resource of [[linked data]] in the [[Semantic Web]]; it has been described by [[Tim Berners-Lee]] as "one of the more famous" components of the linked data project.{{sfn|Miller|2008}}
Machine extraction creates a triple consisting of a subject, predicate or relation, and object.{{sfn|Baeza-Yates|King|2009|p=31}} Each attribute-value pair of the infobox is used to create an [[Resource Description Framework|RDF]] statement using an [[Ontology (information science)|ontology]].{{sfn|Liyang|2011|p=387}} This is facilated by the narrower gap between Wikipedia and an ontology than exists between unstructured or free text and an ontology.
{{sfn|Virvou|Matsuura|2012|p=315}}
The [[Ontology components|semantic relationship]] between the subject and object is established by the predicate.{{sfn|Baeza-Yates|King|2009|p=31}} In the example infobox, the triple ("crostata", type, "tart") indicates that a [[crostata]] is a type of [[tart]]. The article's topic is used as the subject, the parameter name is used as the predicate, and the parameter's value as the object.{{sfn|Liyang|2011|p=387}}{{sfn|Baeza-Yates|King|2009|p=31}} Each type of infobox is mapped to an ontology class, and each property (parameter) within an infobox is mapped to an ontology property.{{sfn|Liyang|2011|p=395}} These mappings are used when parsing a Wikipedia article to extract data.
==Metadata==
[[File:Link to infobox article posted into teams.png|alt=Screenshot of a Link to this article posting into Microsoft's application teams|thumb|Link to this article posting into Microsoft Teams and the application using the metadata from the infobox to make the link fuller by adding an image and summary text]]
By presenting the basic facts of an article within an infobox, also allows the facts to be presented in a machine-friendly way allowing extra functionality such as when a link to a wikipedia is pasted into a compatible program, instead of just the link itself being posted other information such as the articles image is posted too.
== Citations ==
{{Reflist|30em}}
== Works cited ==
{{refbegin|2}}
* {{cite book|title=Weaving services and people on the World Wide Web|editor1-last=Baeza-Yates|editor1-first=Ricardo|editor2-last=King|editor-first2=Irwin|publisher=Springer|year=2009|isbn=9783642005695|lccn=2009926100}}
* {{cite book|title=[[Wikipedia – The Missing Manual]]|last=Broughton|first=John|editor1-last=Barber|editor1-first=Nan|editor2-last=Meyers|editor2-first=Peter|publisher=[[O'Reilly Media]]|date=2008-07-14|isbn=9780596553777}}
* {{cite book|title=Advancing geoinformation science for a changing world|series=Lecture Notes in Geoinformation and Cartography|volume=1|editor1-last=Geertman|editor1-first=Stan|editor2-last=Reinhardt|editor2-first=Wolfgang|editor3-last=Toppen|editor3-first=Fred|publisher=Springer|year=2011|isbn=9783642197888|issn=1863-2246|doi=10.1007/978-3-642-19789-5|lccn=2011925152}}
* {{cite book|url=http://opus.kobv.de/ubp/volltexte/2010/4571/|title=Extracting Structured Information from Wikipedia Articles to Populate Infoboxes|work=Technische Berichte des Hasso-Plattner-Instituts für Softwaresystemtechnik an der Universität Potsdam, Hasso-Plattner-Institut für Softwaresystemtechnik Potsdam|last1=Lange|first1=Dustin|last2=Böhm|first2=Christoph|last3=Naumann|first3=Felix|issue=38|publisher=Universitätsverlag Potsdam|year=2010|isbn=9783869560816|access-date=2013-06-02|archive-date=2014-06-06|archive-url=https://web.archive.org/web/20140606211144/http://opus.kobv.de/ubp/volltexte/2010/4571/|url-status=live}}
* {{cite book|title=A Developer's Guide to the Semantic Web|last=Yu|first=Liyang|publisher=Springer|year=2011|isbn=9783642159695|doi=10.1007/978-3-642-15970-1|bibcode=2011adgt.book.....Y|ref={{sfnRef|Liyang|2011}}}}
* {{cite web |url=http://talis-podcasts.s3.amazonaws.com/twt20080207_TimBL.html |title=Sir Tim Berners-Lee Talks with Talis about the Semantic Web |last=Miller |first=Paul |others=Transcription by CastingWords |publisher=Talis Group |date=2008-02-07 |access-date=2013-06-02 |url-status=dead |archive-url=https://web.archive.org/web/20130510134842/http://talis-podcasts.s3.amazonaws.com/twt20080207_TimBL.html |archive-date=2013-05-10 }}
* {{cite book|title=Knowledge-based Software Engineering: Proceedings of the Tenth Joint Conference on Knowledge-Based Software Engineering|work=Frontiers and Artificial Intelligence and Applications|editor1-last=Virvou|editor1-first=Maria|editor2-last=Matsuura|editor2-first=Saeko|volume=240|publisher=IOS Press|year=2012|isbn=9781614990932|lccn=2012943674}}
{{refend}}
==Further reading==
* {{cite book|last1=Kiran|first1=Kumar N.|last2=Santosh|first2=G.S.K.|last3=Varma|first3=Vasudeva|title=Multidisciplinary Information Retrieval |volume=6653|publisher=Springer Berlin Heidelberg|date=June 2011|doi=10.1007/978-3-642-21353-3|isbn=9783642213533|issn=0302-9743|series=Lecture Notes in Computer Science|s2cid=9901886|url-access=registration|url=https://archive.org/details/multidisciplinar0000info}}
* {{cite book|title=The Semantic Web: 3rd Asian Semantic Web Conference, ASWC 2008, Bangkok, Thailand, December 8-11, 2008. Proceedings|series=Lecture Notes in Computer Science|editor1-last=Chutiporn|editor1-first=Anutariya|editor2-last=Domingue|editor2-first=John|volume=5367|publisher=Springer|year=2008|isbn=9783540897033|issn=0302-9743}}
* {{cite book|last1=Wu|first1=Fei|last2=Hoffmann|first2=Ralph|last3=Weld|first3=Daniel s.|title=Proceedings of the 14th ACM SIGKDD international conference on Knowledge discovery and data mining |chapter=Information extraction from Wikipedia |publisher=[[Association for Computing Machinery]]|year=2008|pages=731–739|isbn=9781605581934|doi=10.1145/1401890.1401978|s2cid=7781746}}
[[Category:Semantic Web]]
[[Category:Wikipedia]]
e5e29fe9ed21e3b7c22d5d35fabd9b5b1a79b5fe
Module:Yesno
828
12
20
19
2023-12-24T02:00:58Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Yesno]]
Scribunto
text/plain
-- Function allowing for consistent treatment of boolean-like wikitext input.
-- It works similarly to the template {{yesno}}.
return function (val, default)
-- If your wiki uses non-ascii characters for any of "yes", "no", etc., you
-- should replace "val:lower()" with "mw.ustring.lower(val)" in the
-- following line.
val = type(val) == 'string' and val:lower() or val
if val == nil then
return nil
elseif val == true
or val == 'yes'
or val == 'y'
or val == 'true'
or val == 't'
or val == 'on'
or tonumber(val) == 1
then
return true
elseif val == false
or val == 'no'
or val == 'n'
or val == 'false'
or val == 'f'
or val == 'off'
or tonumber(val) == 0
then
return false
else
return default
end
end
f767643e7d12126d020d88d662a3dd057817b9dc
Module:Arguments
828
13
22
21
2023-12-24T02:01:00Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Arguments]]
Scribunto
text/plain
-- This module provides easy processing of arguments passed to Scribunto from
-- #invoke. It is intended for use by other Lua modules, and should not be
-- called from #invoke directly.
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local arguments = {}
-- Generate four different tidyVal functions, so that we don't have to check the
-- options every time we call it.
local function tidyValDefault(key, val)
if type(val) == 'string' then
val = val:match('^%s*(.-)%s*$')
if val == '' then
return nil
else
return val
end
else
return val
end
end
local function tidyValTrimOnly(key, val)
if type(val) == 'string' then
return val:match('^%s*(.-)%s*$')
else
return val
end
end
local function tidyValRemoveBlanksOnly(key, val)
if type(val) == 'string' then
if val:find('%S') then
return val
else
return nil
end
else
return val
end
end
local function tidyValNoChange(key, val)
return val
end
local function matchesTitle(given, title)
local tp = type( given )
return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title
end
local translate_mt = { __index = function(t, k) return k end }
function arguments.getArgs(frame, options)
checkType('getArgs', 1, frame, 'table', true)
checkType('getArgs', 2, options, 'table', true)
frame = frame or {}
options = options or {}
--[[
-- Set up argument translation.
--]]
options.translate = options.translate or {}
if getmetatable(options.translate) == nil then
setmetatable(options.translate, translate_mt)
end
if options.backtranslate == nil then
options.backtranslate = {}
for k,v in pairs(options.translate) do
options.backtranslate[v] = k
end
end
if options.backtranslate and getmetatable(options.backtranslate) == nil then
setmetatable(options.backtranslate, {
__index = function(t, k)
if options.translate[k] ~= k then
return nil
else
return k
end
end
})
end
--[[
-- Get the argument tables. If we were passed a valid frame object, get the
-- frame arguments (fargs) and the parent frame arguments (pargs), depending
-- on the options set and on the parent frame's availability. If we weren't
-- passed a valid frame object, we are being called from another Lua module
-- or from the debug console, so assume that we were passed a table of args
-- directly, and assign it to a new variable (luaArgs).
--]]
local fargs, pargs, luaArgs
if type(frame.args) == 'table' and type(frame.getParent) == 'function' then
if options.wrappers then
--[[
-- The wrappers option makes Module:Arguments look up arguments in
-- either the frame argument table or the parent argument table, but
-- not both. This means that users can use either the #invoke syntax
-- or a wrapper template without the loss of performance associated
-- with looking arguments up in both the frame and the parent frame.
-- Module:Arguments will look up arguments in the parent frame
-- if it finds the parent frame's title in options.wrapper;
-- otherwise it will look up arguments in the frame object passed
-- to getArgs.
--]]
local parent = frame:getParent()
if not parent then
fargs = frame.args
else
local title = parent:getTitle():gsub('/sandbox$', '')
local found = false
if matchesTitle(options.wrappers, title) then
found = true
elseif type(options.wrappers) == 'table' then
for _,v in pairs(options.wrappers) do
if matchesTitle(v, title) then
found = true
break
end
end
end
-- We test for false specifically here so that nil (the default) acts like true.
if found or options.frameOnly == false then
pargs = parent.args
end
if not found or options.parentOnly == false then
fargs = frame.args
end
end
else
-- options.wrapper isn't set, so check the other options.
if not options.parentOnly then
fargs = frame.args
end
if not options.frameOnly then
local parent = frame:getParent()
pargs = parent and parent.args or nil
end
end
if options.parentFirst then
fargs, pargs = pargs, fargs
end
else
luaArgs = frame
end
-- Set the order of precedence of the argument tables. If the variables are
-- nil, nothing will be added to the table, which is how we avoid clashes
-- between the frame/parent args and the Lua args.
local argTables = {fargs}
argTables[#argTables + 1] = pargs
argTables[#argTables + 1] = luaArgs
--[[
-- Generate the tidyVal function. If it has been specified by the user, we
-- use that; if not, we choose one of four functions depending on the
-- options chosen. This is so that we don't have to call the options table
-- every time the function is called.
--]]
local tidyVal = options.valueFunc
if tidyVal then
if type(tidyVal) ~= 'function' then
error(
"bad value assigned to option 'valueFunc'"
.. '(function expected, got '
.. type(tidyVal)
.. ')',
2
)
end
elseif options.trim ~= false then
if options.removeBlanks ~= false then
tidyVal = tidyValDefault
else
tidyVal = tidyValTrimOnly
end
else
if options.removeBlanks ~= false then
tidyVal = tidyValRemoveBlanksOnly
else
tidyVal = tidyValNoChange
end
end
--[[
-- Set up the args, metaArgs and nilArgs tables. args will be the one
-- accessed from functions, and metaArgs will hold the actual arguments. Nil
-- arguments are memoized in nilArgs, and the metatable connects all of them
-- together.
--]]
local args, metaArgs, nilArgs, metatable = {}, {}, {}, {}
setmetatable(args, metatable)
local function mergeArgs(tables)
--[[
-- Accepts multiple tables as input and merges their keys and values
-- into one table. If a value is already present it is not overwritten;
-- tables listed earlier have precedence. We are also memoizing nil
-- values, which can be overwritten if they are 's' (soft).
--]]
for _, t in ipairs(tables) do
for key, val in pairs(t) do
if metaArgs[key] == nil and nilArgs[key] ~= 'h' then
local tidiedVal = tidyVal(key, val)
if tidiedVal == nil then
nilArgs[key] = 's'
else
metaArgs[key] = tidiedVal
end
end
end
end
end
--[[
-- Define metatable behaviour. Arguments are memoized in the metaArgs table,
-- and are only fetched from the argument tables once. Fetching arguments
-- from the argument tables is the most resource-intensive step in this
-- module, so we try and avoid it where possible. For this reason, nil
-- arguments are also memoized, in the nilArgs table. Also, we keep a record
-- in the metatable of when pairs and ipairs have been called, so we do not
-- run pairs and ipairs on the argument tables more than once. We also do
-- not run ipairs on fargs and pargs if pairs has already been run, as all
-- the arguments will already have been copied over.
--]]
metatable.__index = function (t, key)
--[[
-- Fetches an argument when the args table is indexed. First we check
-- to see if the value is memoized, and if not we try and fetch it from
-- the argument tables. When we check memoization, we need to check
-- metaArgs before nilArgs, as both can be non-nil at the same time.
-- If the argument is not present in metaArgs, we also check whether
-- pairs has been run yet. If pairs has already been run, we return nil.
-- This is because all the arguments will have already been copied into
-- metaArgs by the mergeArgs function, meaning that any other arguments
-- must be nil.
--]]
if type(key) == 'string' then
key = options.translate[key]
end
local val = metaArgs[key]
if val ~= nil then
return val
elseif metatable.donePairs or nilArgs[key] then
return nil
end
for _, argTable in ipairs(argTables) do
local argTableVal = tidyVal(key, argTable[key])
if argTableVal ~= nil then
metaArgs[key] = argTableVal
return argTableVal
end
end
nilArgs[key] = 'h'
return nil
end
metatable.__newindex = function (t, key, val)
-- This function is called when a module tries to add a new value to the
-- args table, or tries to change an existing value.
if type(key) == 'string' then
key = options.translate[key]
end
if options.readOnly then
error(
'could not write to argument table key "'
.. tostring(key)
.. '"; the table is read-only',
2
)
elseif options.noOverwrite and args[key] ~= nil then
error(
'could not write to argument table key "'
.. tostring(key)
.. '"; overwriting existing arguments is not permitted',
2
)
elseif val == nil then
--[[
-- If the argument is to be overwritten with nil, we need to erase
-- the value in metaArgs, so that __index, __pairs and __ipairs do
-- not use a previous existing value, if present; and we also need
-- to memoize the nil in nilArgs, so that the value isn't looked
-- up in the argument tables if it is accessed again.
--]]
metaArgs[key] = nil
nilArgs[key] = 'h'
else
metaArgs[key] = val
end
end
local function translatenext(invariant)
local k, v = next(invariant.t, invariant.k)
invariant.k = k
if k == nil then
return nil
elseif type(k) ~= 'string' or not options.backtranslate then
return k, v
else
local backtranslate = options.backtranslate[k]
if backtranslate == nil then
-- Skip this one. This is a tail call, so this won't cause stack overflow
return translatenext(invariant)
else
return backtranslate, v
end
end
end
metatable.__pairs = function ()
-- Called when pairs is run on the args table.
if not metatable.donePairs then
mergeArgs(argTables)
metatable.donePairs = true
end
return translatenext, { t = metaArgs }
end
local function inext(t, i)
-- This uses our __index metamethod
local v = t[i + 1]
if v ~= nil then
return i + 1, v
end
end
metatable.__ipairs = function (t)
-- Called when ipairs is run on the args table.
return inext, t, 0
end
return args
end
return arguments
3134ecce8429b810d445e29eae115e2ae4c36c53
Module:Redirect
828
14
24
23
2023-12-24T02:01:01Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Redirect]]
Scribunto
text/plain
-- This module provides functions for getting the target of a redirect page.
local p = {}
-- Gets a mw.title object, using pcall to avoid generating script errors if we
-- are over the expensive function count limit (among other possible causes).
local function getTitle(...)
local success, titleObj = pcall(mw.title.new, ...)
if success then
return titleObj
else
return nil
end
end
-- Gets the name of a page that a redirect leads to, or nil if it isn't a
-- redirect.
function p.getTargetFromText(text)
local target = string.match(
text,
"^%s*#[Rr][Ee][Dd][Ii][Rr][Ee][Cc][Tt]%s*:?%s*%[%[([^%[%]|]-)%]%]"
) or string.match(
text,
"^%s*#[Rr][Ee][Dd][Ii][Rr][Ee][Cc][Tt]%s*:?%s*%[%[([^%[%]|]-)|[^%[%]]-%]%]"
)
return target and mw.uri.decode(target, 'PATH')
end
-- Gets the target of a redirect. If the page specified is not a redirect,
-- returns nil.
function p.getTarget(page, fulltext)
-- Get the title object. Both page names and title objects are allowed
-- as input.
local titleObj
if type(page) == 'string' or type(page) == 'number' then
titleObj = getTitle(page)
elseif type(page) == 'table' and type(page.getContent) == 'function' then
titleObj = page
else
error(string.format(
"bad argument #1 to 'getTarget'"
.. " (string, number, or title object expected, got %s)",
type(page)
), 2)
end
if not titleObj then
return nil
end
local targetTitle = titleObj.redirectTarget
if targetTitle then
if fulltext then
return targetTitle.fullText
else
return targetTitle.prefixedText
end
else
return nil
end
end
--[[
-- Given a single page name determines what page it redirects to and returns the
-- target page name, or the passed page name when not a redirect. The passed
-- page name can be given as plain text or as a page link.
--
-- Returns page name as plain text, or when the bracket parameter is given, as a
-- page link. Returns an error message when page does not exist or the redirect
-- target cannot be determined for some reason.
--]]
function p.luaMain(rname, bracket, fulltext)
if type(rname) ~= "string" or not rname:find("%S") then
return nil
end
bracket = bracket and "[[%s]]" or "%s"
rname = rname:match("%[%[(.+)%]%]") or rname
local target = p.getTarget(rname, fulltext)
local ret = target or rname
ret = getTitle(ret)
if ret then
if fulltext then
ret = ret.fullText
else
ret = ret.prefixedText
end
return bracket:format(ret)
else
return nil
end
end
-- Provides access to the luaMain function from wikitext.
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {frameOnly = true})
return p.luaMain(args[1], args.bracket, args.fulltext) or ''
end
-- Returns true if the specified page is a redirect, and false otherwise.
function p.luaIsRedirect(page)
local titleObj = getTitle(page)
if not titleObj then
return false
end
if titleObj.isRedirect then
return true
else
return false
end
end
-- Provides access to the luaIsRedirect function from wikitext, returning 'yes'
-- if the specified page is a redirect, and the blank string otherwise.
function p.isRedirect(frame)
local args = require('Module:Arguments').getArgs(frame, {frameOnly = true})
if p.luaIsRedirect(args[1]) then
return 'yes'
else
return ''
end
end
return p
a224c45940343d66f49a78b0a39b2045e2c45d20
Module:Unsubst
828
15
26
25
2023-12-24T02:01:02Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Unsubst]]
Scribunto
text/plain
local checkType = require('libraryUtil').checkType
local p = {}
local BODY_PARAM = '$B'
local specialParams = {
['$params'] = 'parameter list',
['$aliases'] = 'parameter aliases',
['$flags'] = 'flags',
['$B'] = 'template content',
['$template-name'] = 'template invocation name override',
}
function p.main(frame, body)
-- If we are substing, this function returns a template invocation, and if
-- not, it returns the template body. The template body can be specified in
-- the body parameter, or in the template parameter defined in the
-- BODY_PARAM variable. This function can be called from Lua or from
-- #invoke.
-- Return the template body if we aren't substing.
if not mw.isSubsting() then
if body ~= nil then
return body
elseif frame.args[BODY_PARAM] ~= nil then
return frame.args[BODY_PARAM]
else
error(string.format(
"no template content specified (use parameter '%s' from #invoke)",
BODY_PARAM
), 2)
end
end
-- Sanity check for the frame object.
if type(frame) ~= 'table'
or type(frame.getParent) ~= 'function'
or not frame:getParent()
then
error(
"argument #1 to 'main' must be a frame object with a parent " ..
"frame available",
2
)
end
-- Find the invocation name.
local mTemplateInvocation = require('Module:Template invocation')
local name
if frame.args['$template-name'] and '' ~= frame.args['$template-name'] then
name = frame.args['$template-name'] -- override whatever the template name is with this name
else
name = mTemplateInvocation.name(frame:getParent():getTitle())
end
-- Combine passed args with passed defaults
local args = {}
if string.find( ','..(frame.args['$flags'] or '')..',', ',%s*override%s*,' ) then
for k, v in pairs( frame:getParent().args ) do
args[k] = v
end
for k, v in pairs( frame.args ) do
if not specialParams[k] then
if v == '__DATE__' then
v = mw.getContentLanguage():formatDate( 'F Y' )
end
args[k] = v
end
end
else
for k, v in pairs( frame.args ) do
if not specialParams[k] then
if v == '__DATE__' then
v = mw.getContentLanguage():formatDate( 'F Y' )
end
args[k] = v
end
end
for k, v in pairs( frame:getParent().args ) do
args[k] = v
end
end
-- Trim parameters, if not specified otherwise
if not string.find( ','..(frame.args['$flags'] or '')..',', ',%s*keep%-whitespace%s*,' ) then
for k, v in pairs( args ) do args[k] = mw.ustring.match(v, '^%s*(.*)%s*$') or '' end
end
-- Pull information from parameter aliases
local aliases = {}
if frame.args['$aliases'] then
local list = mw.text.split( frame.args['$aliases'], '%s*,%s*' )
for k, v in ipairs( list ) do
local tmp = mw.text.split( v, '%s*>%s*' )
aliases[tonumber(mw.ustring.match(tmp[1], '^[1-9][0-9]*$')) or tmp[1]] = ((tonumber(mw.ustring.match(tmp[2], '^[1-9][0-9]*$'))) or tmp[2])
end
end
for k, v in pairs( aliases ) do
if args[k] and ( not args[v] or args[v] == '' ) then
args[v] = args[k]
end
args[k] = nil
end
-- Remove empty parameters, if specified
if string.find( ','..(frame.args['$flags'] or '')..',', ',%s*remove%-empty%s*,' ) then
local tmp = 0
for k, v in ipairs( args ) do
if v ~= '' or ( args[k+1] and args[k+1] ~= '' ) or ( args[k+2] and args[k+2] ~= '' ) then
tmp = k
else
break
end
end
for k, v in pairs( args ) do
if v == '' then
if not (type(k) == 'number' and k < tmp) then args[k] = nil end
end
end
end
-- Order parameters
if frame.args['$params'] then
local params, tmp = mw.text.split( frame.args['$params'], '%s*,%s*' ), {}
for k, v in ipairs(params) do
v = tonumber(mw.ustring.match(v, '^[1-9][0-9]*$')) or v
if args[v] then tmp[v], args[v] = args[v], nil end
end
for k, v in pairs(args) do tmp[k], args[k] = args[k], nil end
args = tmp
end
return mTemplateInvocation.invocation(name, args)
end
p[''] = p.main -- For backwards compatibility
return p
7f01ffc8aa2ac4a4772f14c12e0b77e384ecabb6
Module:Citation/CS1/Utilities
828
19
34
33
2023-12-24T02:01:04Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Citation/CS1/Utilities]]
Scribunto
text/plain
local z = {
error_cats_t = {}; -- for categorizing citations that contain errors
error_ids_t = {}; -- list of error identifiers; used to prevent duplication of certain errors; local to this module
error_msgs_t = {}; -- sequence table of error messages
maint_cats_t = {}; -- for categorizing citations that aren't erroneous per se, but could use a little work
prop_cats_t = {}; -- for categorizing citations based on certain properties, language of source for instance
prop_keys_t = {}; -- for adding classes to the citation's <cite> tag
};
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
]]
local cfg; -- table of tables imported from selected Module:Citation/CS1/Configuration
--[[--------------------------< I S _ S E T >------------------------------------------------------------------
Returns true if argument is set; false otherwise. Argument is 'set' when it exists (not nil) or when it is not an empty string.
]]
local function is_set (var)
return not (var == nil or var == '');
end
--[[--------------------------< I N _ A R R A Y >--------------------------------------------------------------
Whether needle is in haystack
]]
local function in_array (needle, haystack)
if needle == nil then
return false;
end
for n, v in ipairs (haystack) do
if v == needle then
return n;
end
end
return false;
end
--[[--------------------------< H A S _ A C C E P T _ A S _ W R I T T E N >------------------------------------
When <str> is wholly wrapped in accept-as-written markup, return <str> without markup and true; return <str> and false else
with allow_empty = false, <str> must have at least one character inside the markup
with allow_empty = true, <str> the markup frame can be empty like (()) to distinguish an empty template parameter from the specific condition "has no applicable value" in citation-context.
After further evaluation the two cases might be merged at a later stage, but should be kept separated for now.
]]
local function has_accept_as_written (str, allow_empty)
if not is_set (str) then
return str, false;
end
local count;
if true == allow_empty then
str, count = str:gsub ('^%(%((.*)%)%)$', '%1'); -- allows (()) to be an empty set
else
str, count = str:gsub ('^%(%((.+)%)%)$', '%1');
end
return str, 0 ~= count;
end
--[[--------------------------< S U B S T I T U T E >----------------------------------------------------------
Populates numbered arguments in a message string using an argument table. <args> may be a single string or a
sequence table of multiple strings.
]]
local function substitute (msg, args)
return args and mw.message.newRawMessage (msg, args):plain() or msg;
end
--[[--------------------------< E R R O R _ C O M M E N T >----------------------------------------------------
Wraps error messages with CSS markup according to the state of hidden. <content> may be a single string or a
sequence table of multiple strings.
]]
local function error_comment (content, hidden)
return substitute (hidden and cfg.presentation['hidden-error'] or cfg.presentation['visible-error'], content);
end
--[[--------------------------< H Y P H E N _ T O _ D A S H >--------------------------------------------------
Converts a hyphen to a dash under certain conditions. The hyphen must separate
like items; unlike items are returned unmodified. These forms are modified:
letter - letter (A - B)
digit - digit (4-5)
digit separator digit - digit separator digit (4.1-4.5 or 4-1-4-5)
letterdigit - letterdigit (A1-A5) (an optional separator between letter and
digit is supported – a.1-a.5 or a-1-a-5)
digitletter - digitletter (5a - 5d) (an optional separator between letter and
digit is supported – 5.a-5.d or 5-a-5-d)
any other forms are returned unmodified.
str may be a comma- or semicolon-separated list
]]
local function hyphen_to_dash (str)
if not is_set (str) then
return str;
end
local accept; -- boolean
str = str:gsub ("(%(%(.-%)%))", function(m) return m:gsub(",", ","):gsub(";", ";") end) -- replace commas and semicolons in accept-as-written markup with similar unicode characters so they'll be ignored during the split
str = str:gsub ('&[nm]dash;', {['–'] = '–', ['—'] = '—'}); -- replace — and – entities with their characters; semicolon mucks up the text.split
str = str:gsub ('-', '-'); -- replace HTML numeric entity with hyphen character
str = str:gsub (' ', ' '); -- replace entity with generic keyboard space character
local out = {};
local list = mw.text.split (str, '%s*[,;]%s*'); -- split str at comma or semicolon separators if there are any
for _, item in ipairs (list) do -- for each item in the list
item, accept = has_accept_as_written (item); -- remove accept-this-as-written markup when it wraps all of item
if not accept and mw.ustring.match (item, '^%w*[%.%-]?%w+%s*[%-–—]%s*%w*[%.%-]?%w+$') then -- if a hyphenated range or has endash or emdash separators
if item:match ('^%a+[%.%-]?%d+%s*%-%s*%a+[%.%-]?%d+$') or -- letterdigit hyphen letterdigit (optional separator between letter and digit)
item:match ('^%d+[%.%-]?%a+%s*%-%s*%d+[%.%-]?%a+$') or -- digitletter hyphen digitletter (optional separator between digit and letter)
item:match ('^%d+[%.%-]%d+%s*%-%s*%d+[%.%-]%d+$') or -- digit separator digit hyphen digit separator digit
item:match ('^%d+%s*%-%s*%d+$') or -- digit hyphen digit
item:match ('^%a+%s*%-%s*%a+$') then -- letter hyphen letter
item = item:gsub ('(%w*[%.%-]?%w+)%s*%-%s*(%w*[%.%-]?%w+)', '%1–%2'); -- replace hyphen, remove extraneous space characters
else
item = mw.ustring.gsub (item, '%s*[–—]%s*', '–'); -- for endash or emdash separated ranges, replace em with en, remove extraneous whitespace
end
end
table.insert (out, item); -- add the (possibly modified) item to the output table
end
local temp_str = ''; -- concatenate the output table into a comma separated string
temp_str, accept = has_accept_as_written (table.concat (out, ', ')); -- remove accept-this-as-written markup when it wraps all of concatenated out
if accept then
temp_str = has_accept_as_written (str); -- when global markup removed, return original str; do it this way to suppress boolean second return value
return temp_str:gsub(",", ","):gsub(";", ";");
else
return temp_str:gsub(",", ","):gsub(";", ";"); -- else, return assembled temp_str
end
end
--[=[-------------------------< M A K E _ W I K I L I N K >----------------------------------------------------
Makes a wikilink; when both link and display text is provided, returns a wikilink in the form [[L|D]]; if only
link is provided (or link and display are the same), returns a wikilink in the form [[L]]; if neither are
provided or link is omitted, returns an empty string.
]=]
local function make_wikilink (link, display)
if not is_set (link) then return '' end
if is_set (display) and link ~= display then
return table.concat ({'[[', link, '|', display, ']]'});
else
return table.concat ({'[[', link, ']]'});
end
end
--[[--------------------------< S E T _ M E S S A G E >----------------------------------------------------------
Sets an error message using the ~/Configuration error_conditions{} table along with arguments supplied in the function
call, inserts the resulting message in z.error_msgs_t{} sequence table, and returns the error message.
<error_id> – key value for appropriate error handler in ~/Configuration error_conditions{} table
<arguments> – may be a single string or a sequence table of multiple strings to be subsititued into error_conditions[error_id].message
<raw> – boolean
true – causes this function to return the error message not wrapped in visible-error, hidden-error span tag;
returns error_conditions[error_id].hidden as a second return value
does not add message to z.error_msgs_t sequence table
false, nil – adds message wrapped in visible-error, hidden-error span tag to z.error_msgs_t
returns the error message wrapped in visible-error, hidden-error span tag; there is no second return value
<prefix> – string to be prepended to <message> -- TODO: remove support for these unused(?) arguments?
<suffix> – string to be appended to <message>
TODO: change z.error_cats_t and z.maint_cats_t to have the form cat_name = true? this to avoid dups without having to have an extra table
]]
local added_maint_cats = {} -- list of maintenance categories that have been added to z.maint_cats_t; TODO: figure out how to delete this table
local function set_message (error_id, arguments, raw, prefix, suffix)
local error_state = cfg.error_conditions[error_id];
prefix = prefix or '';
suffix = suffix or '';
if error_state == nil then
error (cfg.messages['undefined_error'] .. ': ' .. error_id); -- because missing error handler in Module:Citation/CS1/Configuration
elseif is_set (error_state.category) then
if error_state.message then -- when error_state.message defined, this is an error message
table.insert (z.error_cats_t, error_state.category);
else
if not added_maint_cats[error_id] then
added_maint_cats[error_id] = true; -- note that we've added this category
table.insert (z.maint_cats_t, substitute (error_state.category, arguments)); -- make cat name then add to table
end
return; -- because no message, nothing more to do
end
end
local message = substitute (error_state.message, arguments);
message = table.concat (
{
message,
' (',
make_wikilink (
table.concat (
{
cfg.messages['help page link'],
'#',
error_state.anchor
}),
cfg.messages['help page label']),
')'
});
z.error_ids_t[error_id] = true;
if z.error_ids_t['err_citation_missing_title'] and -- if missing-title error already noted
in_array (error_id, {'err_bare_url_missing_title', 'err_trans_missing_title'}) then -- and this error is one of these
return '', false; -- don't bother because one flavor of missing title is sufficient
end
message = table.concat ({prefix, message, suffix});
if true == raw then
return message, error_state.hidden; -- return message not wrapped in visible-error, hidden-error span tag
end
message = error_comment (message, error_state.hidden); -- wrap message in visible-error, hidden-error span tag
table.insert (z.error_msgs_t, message); -- add it to the messages sequence table
return message; -- and done; return value generally not used but is used as a flag in various functions of ~/Identifiers
end
--[[-------------------------< I S _ A L I A S _ U S E D >-----------------------------------------------------
This function is used by select_one() to determine if one of a list of alias parameters is in the argument list
provided by the template.
Input:
args – pointer to the arguments table from calling template
alias – one of the list of possible aliases in the aliases lists from Module:Citation/CS1/Configuration
index – for enumerated parameters, identifies which one
enumerated – true/false flag used to choose how enumerated aliases are examined
value – value associated with an alias that has previously been selected; nil if not yet selected
selected – the alias that has previously been selected; nil if not yet selected
error_list – list of aliases that are duplicates of the alias already selected
Returns:
value – value associated with alias we selected or that was previously selected or nil if an alias not yet selected
selected – the alias we selected or the alias that was previously selected or nil if an alias not yet selected
]]
local function is_alias_used (args, alias, index, enumerated, value, selected, error_list)
if enumerated then -- is this a test for an enumerated parameters?
alias = alias:gsub ('#', index); -- replace '#' with the value in index
else
alias = alias:gsub ('#', ''); -- remove '#' if it exists
end
if is_set (args[alias]) then -- alias is in the template's argument list
if value ~= nil and selected ~= alias then -- if we have already selected one of the aliases
local skip;
for _, v in ipairs (error_list) do -- spin through the error list to see if we've added this alias
if v == alias then
skip = true;
break; -- has been added so stop looking
end
end
if not skip then -- has not been added so
table.insert (error_list, alias); -- add error alias to the error list
end
else
value = args[alias]; -- not yet selected an alias, so select this one
selected = alias;
end
end
return value, selected; -- return newly selected alias, or previously selected alias
end
--[[--------------------------< A D D _ M A I N T _ C A T >------------------------------------------------------
Adds a category to z.maint_cats_t using names from the configuration file with additional text if any.
To prevent duplication, the added_maint_cats table lists the categories by key that have been added to z.maint_cats_t.
]]
local function add_maint_cat (key, arguments)
if not added_maint_cats [key] then
added_maint_cats [key] = true; -- note that we've added this category
table.insert (z.maint_cats_t, substitute (cfg.maint_cats [key], arguments)); -- make name then add to table
end
end
--[[--------------------------< A D D _ P R O P _ C A T >--------------------------------------------------------
Adds a category to z.prop_cats_t using names from the configuration file with additional text if any.
foreign_lang_source and foreign_lang_source_2 keys have a language code appended to them so that multiple languages
may be categorized but multiples of the same language are not categorized.
added_prop_cats is a table declared in page scope variables above
]]
local added_prop_cats = {}; -- list of property categories that have been added to z.prop_cats_t
local function add_prop_cat (key, arguments, key_modifier)
local key_modified = key .. ((key_modifier and key_modifier) or ''); -- modify <key> with <key_modifier> if present and not nil
if not added_prop_cats [key_modified] then
added_prop_cats [key_modified] = true; -- note that we've added this category
table.insert (z.prop_cats_t, substitute (cfg.prop_cats [key], arguments)); -- make name then add to table
table.insert (z.prop_keys_t, 'cs1-prop-' .. key); -- convert key to class for use in the citation's <cite> tag
end
end
--[[--------------------------< S A F E _ F O R _ I T A L I C S >----------------------------------------------
Protects a string that will be wrapped in wiki italic markup '' ... ''
Note: We cannot use <i> for italics, as the expected behavior for italics specified by ''...'' in the title is that
they will be inverted (i.e. unitalicized) in the resulting references. In addition, <i> and '' tend to interact
poorly under Mediawiki's HTML tidy.
]]
local function safe_for_italics (str)
if not is_set (str) then return str end
if str:sub (1, 1) == "'" then str = "<span></span>" .. str; end
if str:sub (-1, -1) == "'" then str = str .. "<span></span>"; end
return str:gsub ('\n', ' '); -- Remove newlines as they break italics.
end
--[[--------------------------< W R A P _ S T Y L E >----------------------------------------------------------
Applies styling to various parameters. Supplied string is wrapped using a message_list configuration taking one
argument; protects italic styled parameters. Additional text taken from citation_config.presentation - the reason
this function is similar to but separate from wrap_msg().
]]
local function wrap_style (key, str)
if not is_set (str) then
return "";
elseif in_array (key, {'italic-title', 'trans-italic-title'}) then
str = safe_for_italics (str);
end
return substitute (cfg.presentation[key], {str});
end
--[[--------------------------< M A K E _ S E P _ L I S T >------------------------------------------------------------
make a separated list of items using provided separators.
<sep_list> - typically '<comma><space>'
<sep_list_pair> - typically '<space>and<space>'
<sep_list_end> - typically '<comma><space>and<space>' or '<comma><space>&<space>'
defaults to cfg.presentation['sep_list'], cfg.presentation['sep_list_pair'], and cfg.presentation['sep_list_end']
if <sep_list_end> is specified, <sep_list> and <sep_list_pair> must also be supplied
]]
local function make_sep_list (count, list_seq, sep_list, sep_list_pair, sep_list_end)
local list = '';
if not sep_list then -- set the defaults
sep_list = cfg.presentation['sep_list'];
sep_list_pair = cfg.presentation['sep_list_pair'];
sep_list_end = cfg.presentation['sep_list_end'];
end
if 2 >= count then
list = table.concat (list_seq, sep_list_pair); -- insert separator between two items; returns list_seq[1] then only one item
elseif 2 < count then
list = table.concat (list_seq, sep_list, 1, count - 1); -- concatenate all but last item with plain list separator
list = table.concat ({list, list_seq[count]}, sep_list_end); -- concatenate last item onto end of <list> with final separator
end
return list;
end
--[[--------------------------< S E L E C T _ O N E >----------------------------------------------------------
Chooses one matching parameter from a list of parameters to consider. The list of parameters to consider is just
names. For parameters that may be enumerated, the position of the numerator in the parameter name is identified
by the '#' so |author-last1= and |author1-last= are represented as 'author-last#' and 'author#-last'.
Because enumerated parameter |<param>1= is an alias of |<param>= we must test for both possibilities.
Generates an error if more than one match is present.
]]
local function select_one (args, aliases_list, error_condition, index)
local value = nil; -- the value assigned to the selected parameter
local selected = ''; -- the name of the parameter we have chosen
local error_list = {};
if index ~= nil then index = tostring(index); end
for _, alias in ipairs (aliases_list) do -- for each alias in the aliases list
if alias:match ('#') then -- if this alias can be enumerated
if '1' == index then -- when index is 1 test for enumerated and non-enumerated aliases
value, selected = is_alias_used (args, alias, index, false, value, selected, error_list); -- first test for non-enumerated alias
end
value, selected = is_alias_used (args, alias, index, true, value, selected, error_list); -- test for enumerated alias
else
value, selected = is_alias_used (args, alias, index, false, value, selected, error_list); -- test for non-enumerated alias
end
end
if #error_list > 0 and 'none' ~= error_condition then -- for cases where this code is used outside of extract_names()
for i, v in ipairs (error_list) do
error_list[i] = wrap_style ('parameter', v);
end
table.insert (error_list, wrap_style ('parameter', selected));
set_message (error_condition, {make_sep_list (#error_list, error_list)});
end
return value, selected;
end
--[=[-------------------------< R E M O V E _ W I K I _ L I N K >----------------------------------------------
Gets the display text from a wikilink like [[A|B]] or [[B]] gives B
The str:gsub() returns either A|B froma [[A|B]] or B from [[B]] or B from B (no wikilink markup).
In l(), l:gsub() removes the link and pipe (if they exist); the second :gsub() trims whitespace from the label
if str was wrapped in wikilink markup. Presumably, this is because without wikimarkup in str, there is no match
in the initial gsub, the replacement function l() doesn't get called.
]=]
local function remove_wiki_link (str)
return (str:gsub ("%[%[([^%[%]]*)%]%]", function(l)
return l:gsub ("^[^|]*|(.*)$", "%1" ):gsub ("^%s*(.-)%s*$", "%1");
end));
end
--[=[-------------------------< I S _ W I K I L I N K >--------------------------------------------------------
Determines if str is a wikilink, extracts, and returns the wikilink type, link text, and display text parts.
If str is a complex wikilink ([[L|D]]):
returns wl_type 2 and D and L from [[L|D]];
if str is a simple wikilink ([[D]])
returns wl_type 1 and D from [[D]] and L as empty string;
if not a wikilink:
returns wl_type 0, str as D, and L as empty string.
trims leading and trailing whitespace and pipes from L and D ([[L|]] and [[|D]] are accepted by MediaWiki and
treated like [[D]]; while [[|D|]] is not accepted by MediaWiki, here, we accept it and return D without the pipes).
]=]
local function is_wikilink (str)
local D, L
local wl_type = 2; -- assume that str is a complex wikilink [[L|D]]
if not str:match ('^%[%[[^%]]+%]%]$') then -- is str some sort of a wikilink (must have some sort of content)
return 0, str, ''; -- not a wikilink; return wl_type as 0, str as D, and empty string as L
end
L, D = str:match ('^%[%[([^|]+)|([^%]]+)%]%]$'); -- get L and D from [[L|D]]
if not is_set (D) then -- if no separate display
D = str:match ('^%[%[([^%]]*)|*%]%]$'); -- get D from [[D]] or [[D|]]
wl_type = 1;
end
D = mw.text.trim (D, '%s|'); -- trim white space and pipe characters
return wl_type, D, L or '';
end
--[[--------------------------< S T R I P _ A P O S T R O P H E _ M A R K U P >--------------------------------
Strip wiki italic and bold markup from argument so that it doesn't contaminate COinS metadata.
This function strips common patterns of apostrophe markup. We presume that editors who have taken the time to
markup a title have, as a result, provided valid markup. When they don't, some single apostrophes are left behind.
Returns the argument without wiki markup and a number; the number is more-or-less meaningless except as a flag
to indicate that markup was replaced; do not rely on it as an indicator of how many of any kind of markup was
removed; returns the argument and nil when no markup removed
]]
local function strip_apostrophe_markup (argument)
if not is_set (argument) then
return argument, nil; -- no argument, nothing to do
end
if nil == argument:find ( "''", 1, true ) then -- Is there at least one double apostrophe? If not, exit.
return argument, nil;
end
local flag;
while true do
if argument:find ("'''''", 1, true) then -- bold italic (5)
argument, flag = argument:gsub ("%'%'%'%'%'", ""); -- remove all instances of it
elseif argument:find ("''''", 1, true) then -- italic start and end without content (4)
argument, flag=argument:gsub ("%'%'%'%'", "");
elseif argument:find ("'''", 1, true) then -- bold (3)
argument, flag=argument:gsub ("%'%'%'", "");
elseif argument:find ("''", 1, true) then -- italic (2)
argument, flag = argument:gsub ("%'%'", "");
else
break;
end
end
return argument, flag; -- done
end
--[[--------------------------< S E T _ S E L E C T E D _ M O D U L E S >--------------------------------------
Sets local cfg table to same (live or sandbox) as that used by the other modules.
]]
local function set_selected_modules (cfg_table_ptr)
cfg = cfg_table_ptr;
end
--[[--------------------------< E X P O R T S >----------------------------------------------------------------
]]
return {
add_maint_cat = add_maint_cat, -- exported functions
add_prop_cat = add_prop_cat,
error_comment = error_comment,
has_accept_as_written = has_accept_as_written,
hyphen_to_dash = hyphen_to_dash,
in_array = in_array,
is_set = is_set,
is_wikilink = is_wikilink,
make_sep_list = make_sep_list,
make_wikilink = make_wikilink,
remove_wiki_link = remove_wiki_link,
safe_for_italics = safe_for_italics,
select_one = select_one,
set_message = set_message,
set_selected_modules = set_selected_modules,
strip_apostrophe_markup = strip_apostrophe_markup,
substitute = substitute,
wrap_style = wrap_style,
z = z, -- exported table
}
b006801b48981b2987f20fc09cbe0dfda525e044
Module:Citation/CS1/Date validation
828
20
36
35
2023-12-24T02:01:04Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Citation/CS1/Date_validation]]
Scribunto
text/plain
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
]]
local add_prop_cat, is_set, in_array, set_message, substitute, wrap_style; -- imported functions from selected Module:Citation/CS1/Utilities
local cfg; -- table of tables imported from selected Module:Citation/CS1/Configuration
--[[--------------------------< F I L E - S C O P E D E C L A R A T I O N S >--------------------------------
File-scope variables are declared here
]]
local lang_object = mw.getContentLanguage(); -- used by is_valid_accessdate(), is_valid_year(), date_name_xlate(); TODO: move to ~/Configuration?
local year_limit; -- used by is_valid_year()
--[=[-------------------------< I S _ V A L I D _ A C C E S S D A T E >----------------------------------------
returns true if:
Wikipedia start date <= accessdate < today + 2 days
Wikipedia start date is 2001-01-15T00:00:00 UTC which is 979516800 seconds after 1970-01-01T00:00:00 UTC (the start of Unix time)
accessdate is the date provided in |access-date= at time 00:00:00 UTC
today is the current date at time 00:00:00 UTC plus 48 hours
if today is 2015-01-01T00:00:00 then
adding 24 hours gives 2015-01-02T00:00:00 – one second more than today
adding 24 hours gives 2015-01-03T00:00:00 – one second more than tomorrow
This function does not work if it is fed month names for languages other than English. Wikimedia #time: parser
apparently doesn't understand non-English date month names. This function will always return false when the date
contains a non-English month name because good1 is false after the call to lang.formatDate(). To get around that
call this function with YYYY-MM-DD format dates.
]=]
local function is_valid_accessdate (accessdate)
local good1, good2;
local access_ts, tomorrow_ts; -- to hold Unix time stamps representing the dates
good1, access_ts = pcall (lang_object.formatDate, lang_object, 'U', accessdate ); -- convert accessdate value to Unix timestamp
good2, tomorrow_ts = pcall (lang_object.formatDate, lang_object, 'U', 'today + 2 days' ); -- today midnight + 2 days is one second more than all day tomorrow
if good1 and good2 then -- lang.formatDate() returns a timestamp in the local script which which tonumber() may not understand
access_ts = tonumber (access_ts) or lang_object:parseFormattedNumber (access_ts); -- convert to numbers for the comparison;
tomorrow_ts = tonumber (tomorrow_ts) or lang_object:parseFormattedNumber (tomorrow_ts);
else
return false; -- one or both failed to convert to Unix time stamp
end
if 979516800 <= access_ts and access_ts < tomorrow_ts then -- Wikipedia start date <= accessdate < tomorrow's date
return true;
else
return false; -- accessdate out of range
end
end
--[[--------------------------< G E T _ M O N T H _ N U M B E R >----------------------------------------------
returns a number according to the month in a date: 1 for January, etc. Capitalization and spelling must be correct.
If not a valid month, returns 0
]]
local function get_month_number (month)
return cfg.date_names['local'].long[month] or cfg.date_names['local'].short[month] or -- look for local names first
cfg.date_names['en'].long[month] or cfg.date_names['en'].short[month] or -- failing that, look for English names
0; -- not a recognized month name
end
--[[--------------------------< G E T _ S E A S O N _ N U M B E R >--------------------------------------------
returns a number according to the sequence of seasons in a year: 21 for Spring, etc. Capitalization and spelling
must be correct. If not a valid season, returns 0.
21-24 = Spring, Summer, Autumn, Winter, independent of “Hemisphere”
returns 0 when <param> is not |date=
Season numbering is defined by Extended Date/Time Format (EDTF) specification (https://www.loc.gov/standards/datetime/)
which became part of ISO 8601 in 2019. See '§Sub-year groupings'. The standard defines various divisions using
numbers 21-41. cs1|2 only supports generic seasons. EDTF does support the distinction between north and south
hemisphere seasons but cs1|2 has no way to make that distinction.
These additional divisions not currently supported:
25-28 = Spring - Northern Hemisphere, Summer- Northern Hemisphere, Autumn - Northern Hemisphere, Winter - Northern Hemisphere
29-32 = Spring – Southern Hemisphere, Summer– Southern Hemisphere, Autumn – Southern Hemisphere, Winter - Southern Hemisphere
33-36 = Quarter 1, Quarter 2, Quarter 3, Quarter 4 (3 months each)
37-39 = Quadrimester 1, Quadrimester 2, Quadrimester 3 (4 months each)
40-41 = Semestral 1, Semestral-2 (6 months each)
]]
local function get_season_number (season, param)
if 'date' ~= param then
return 0; -- season dates only supported by |date=
end
return cfg.date_names['local'].season[season] or -- look for local names first
cfg.date_names['en'].season[season] or -- failing that, look for English names
0; -- not a recognized season name
end
--[[--------------------------< G E T _ Q U A R T E R _ N U M B E R >------------------------------------------
returns a number according to the sequence of quarters in a year: 33 for first quarter, etc. Capitalization and spelling
must be correct. If not a valid quarter, returns 0.
33-36 = Quarter 1, Quarter 2, Quarter 3, Quarter 4 (3 months each)
returns 0 when <param> is not |date=
Quarter numbering is defined by Extended Date/Time Format (EDTF) specification (https://www.loc.gov/standards/datetime/)
which became part of ISO 8601 in 2019. See '§Sub-year groupings'. The standard defines various divisions using
numbers 21-41. cs1|2 only supports generic seasons and quarters.
These additional divisions not currently supported:
37-39 = Quadrimester 1, Quadrimester 2, Quadrimester 3 (4 months each)
40-41 = Semestral 1, Semestral-2 (6 months each)
]]
local function get_quarter_number (quarter, param)
if 'date' ~= param then
return 0; -- quarter dates only supported by |date=
end
quarter = mw.ustring.gsub (quarter, ' +', ' '); -- special case replace multiple space chars with a single space char
return cfg.date_names['local'].quarter[quarter] or -- look for local names first
cfg.date_names['en'].quarter[quarter] or -- failing that, look for English names
0; -- not a recognized quarter name
end
--[[--------------------------< G E T _ P R O P E R _ N A M E _ N U M B E R >----------------------------------
returns a non-zero number if date contains a recognized proper-name. Capitalization and spelling must be correct.
returns 0 when <param> is not |date=
]]
local function get_proper_name_number (name, param)
if 'date' ~= param then
return 0; -- proper-name dates only supported by |date=
end
return cfg.date_names['local'].named[name] or -- look for local names dates first
cfg.date_names['en'].named[name] or -- failing that, look for English names
0; -- not a recognized named date
end
--[[--------------------------< G E T _ E L E M E N T _ N U M B E R <------------------------------------------
returns true if month or season or quarter or proper name is valid (properly spelled, capitalized, abbreviated)
]]
local function get_element_number (element, param)
local num;
local funcs = {get_month_number, get_season_number, get_quarter_number, get_proper_name_number}; -- list of functions to execute in order
for _, func in ipairs (funcs) do -- spin through the function list
num = func (element, param); -- call the function and get the returned number
if 0 ~= num then -- non-zero when valid month season quarter
return num; -- return that number
end
end
return nil; -- not valid
end
--[[--------------------------< I S _ V A L I D _ Y E A R >----------------------------------------------------
Function gets current year from the server and compares it to year from a citation parameter. Years more than one
year in the future are not acceptable.
Special case for |pmc-embargo-date=: years more than two years in the future are not acceptable
]]
local function is_valid_year (year, param)
if not is_set (year_limit) then
year_limit = tonumber(os.date("%Y"))+1; -- global variable so we only have to fetch it once
end
year = tonumber (year) or lang_object:parseFormattedNumber (year); -- convert to number for the comparison
if year and (100 > year) then -- years less than 100 not supported
return false;
end
if 'pmc-embargo-date' == param then -- special case for |pmc-embargo-date=
return year and (year <= tonumber(os.date("%Y"))+2) or false; -- years more than two years in the future are not accepted
end
return year and (year <= year_limit) or false;
end
--[[--------------------------< I S _ V A L I D _ D A T E >----------------------------------------------------
Returns true if day is less than or equal to the number of days in month and year is no farther into the future
than next year; else returns false.
Assumes Julian calendar prior to year 1582 and Gregorian calendar thereafter. Accounts for Julian calendar leap
years before 1582 and Gregorian leap years after 1582. Where the two calendars overlap (1582 to approximately
1923) dates are assumed to be Gregorian.
]]
local function is_valid_date (year, month, day, param)
local days_in_month = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
local month_length;
if not is_valid_year (year, param) then -- no farther into the future than next year except |pmc-embargo-date= no more than two years in the future
return false;
end
month = tonumber (month); -- required for YYYY-MM-DD dates
if (2 == month) then -- if February
month_length = 28; -- then 28 days unless
if 1582 > tonumber(year) then -- Julian calendar
if 0 == (year%4) then -- is a leap year?
month_length = 29; -- if leap year then 29 days in February
end
else -- Gregorian calendar
if (0 == (year%4) and (0 ~= (year%100) or 0 == (year%400))) then -- is a leap year?
month_length = 29; -- if leap year then 29 days in February
end
end
else
month_length = days_in_month[month];
end
if tonumber (day) > month_length then
return false;
end
return true;
end
--[[--------------------------< I S _ V A L I D _ M O N T H _ R A N G E _ S T Y L E >--------------------------
Months in a range are expected to have the same style: Jan–Mar or October–December but not February–Mar or Jul–August.
This function looks in cfg.date_names{} to see if both month names are listed in the long subtable or both are
listed in the short subtable. When both have the same style (both are listed in the same table), returns true; false else
]]
local function is_valid_month_range_style (month1, month2)
if (cfg.date_names.en.long[month1] and cfg.date_names.en.long[month2]) or -- are both English names listed in the long subtable?
(cfg.date_names.en.short[month1] and cfg.date_names.en.short[month2]) or -- are both English names listed in the short subtable?
(cfg.date_names['local'].long[month1] and cfg.date_names['local'].long[month2]) or -- are both local names listed in the long subtable?
(cfg.date_names['local'].short[month1] and cfg.date_names['local'].short[month2]) then -- are both local names listed in the short subtable?
return true;
end
return false; -- names are mixed
end
--[[--------------------------< I S _ V A L I D _ M O N T H _ S E A S O N _ R A N G E >------------------------
Check a pair of months or seasons to see if both are valid members of a month or season pair.
Month pairs are expected to be left to right, earliest to latest in time.
All season ranges are accepted as valid because there are publishers out there who have published a Summer–Spring YYYY issue, hence treat as ok
]]
local function is_valid_month_season_range(range_start, range_end, param)
local range_start_number = get_month_number (range_start);
local range_end_number;
if 0 == range_start_number then -- is this a month range?
range_start_number = get_season_number (range_start, param); -- not a month; is it a season? get start season number
range_end_number = get_season_number (range_end, param); -- get end season number
if (0 ~= range_start_number) and (0 ~= range_end_number) and (range_start_number ~= range_end_number) then
return true; -- any season pairing is accepted except when both are the same
end
return false; -- range_start and/or range_end is not a season
end
-- here when range_start is a month
range_end_number = get_month_number (range_end); -- get end month number
if range_start_number < range_end_number and -- range_start is a month; does range_start precede range_end?
is_valid_month_range_style (range_start, range_end) then -- do months have the same style?
return true; -- proper order and same style
end
return false; -- range_start month number is greater than or equal to range end number; or range end isn't a month
end
--[[--------------------------< M A K E _ C O I N S _ D A T E >------------------------------------------------
This function receives a table of date parts for one or two dates and an empty table reference declared in
Module:Citation/CS1. The function is called only for |date= parameters and only if the |date=<value> is
determined to be a valid date format. The question of what to do with invalid date formats is not answered here.
The date parts in the input table are converted to an ISO 8601 conforming date string:
single whole dates: yyyy-mm-dd
month and year dates: yyyy-mm
year dates: yyyy
ranges: yyyy-mm-dd/yyyy-mm-dd
yyyy-mm/yyyy-mm
yyyy/yyyy
Dates in the Julian calendar are reduced to year or year/year so that we don't have to do calendar conversion from
Julian to Proleptic Gregorian.
The input table has:
year, year2 – always present; if before 1582, ignore months and days if present
month, month2 – 0 if not provided, 1-12 for months, 21-24 for seasons; 99 Christmas
day, day2 – 0 if not provided, 1-31 for days
the output table receives:
rftdate: an ISO 8601 formatted date
rftchron: a free-form version of the date, usually without year which is in rftdate (season ranges and proper-name dates)
rftssn: one of four season keywords: winter, spring, summer, fall (lowercase)
rftquarter: one of four values: 1, 2, 3, 4
]]
local function make_COinS_date (input, tCOinS_date)
local date; -- one date or first date in a range
local date2 = ''; -- end of range date
input.year = tonumber (input.year) or lang_object:parseFormattedNumber (input.year); -- language-aware tonumber()
input.year2 = tonumber (input.year2) or lang_object:parseFormattedNumber (input.year2); -- COinS dates are pseudo-ISO 8601 so convert to Arabic numerals
-- start temporary Julian / Gregorian calendar uncertainty detection
local year = input.year; -- this temporary code to determine the extent of sources dated to the Julian/Gregorian
local month = tonumber(input.month); -- interstice 1 October 1582 – 1 January 1926
local day = tonumber (input.day);
if (0 ~= day) and -- day must have a value for this to be a whole date
(((1582 == year) and (10 <= month) and (12 >= month)) or -- any whole 1582 date from 1 October to 31 December or
((1926 == year) and (1 == month) and (1 == input.day)) or -- 1 January 1926 or
((1582 < year) and (1925 >= year))) then -- any date 1 January 1583 – 31 December 1925
tCOinS_date.inter_cal_cat = true; -- set category flag true
end
-- end temporary Julian / Gregorian calendar uncertainty detection
if ((1582 == year) and (10 > month)) or (1582 > year) then -- if a Julian calendar date
tCOinS_date.rftdate = tostring (input.year); -- &rft.date gets year only
return; -- done
end
-- here for all forms of Gregorian dates
if 20 < tonumber (input.month) then -- if season, quarter, or proper-name date
date = input.year; -- &rft.date gets year only
if 0 ~= input.year2 and input.year ~= input.year2 then -- if a range, only the second year portion when not the same as range start year
date = string.format ('%.4d/%.4d', input.year, input.year2) -- assemble the date range
end
local season = {[24] = 'winter', [21] = 'spring', [22] = 'summer', [23] = 'fall', [33] = '1', [34] = '2', [35] = '3', [36] = '4', [98] = 'Easter', [99] = 'Christmas'}; -- seasons lowercase, no autumn; proper-names use title case
if 0 == input.month2 then -- single season, quarter, or proper-name date
if 40 < tonumber(input.month) then
tCOinS_date.rftchron = season[input.month]; -- proper-name date; used in journal metadata only
elseif 30 < tonumber(input.month) then
tCOinS_date.rftquarter = season[input.month]; -- quarter date; used in journal metadata only
else
tCOinS_date.rftssn = season[input.month]; -- season date; used in journal metadata only
end
else -- season ranges are lumped into &rft.chron; &rft.ssn and &rft.quarter are left blank
if input.year ~= input.year2 then -- season year – season year range or season year–year
if 0 ~= input.month2 then
tCOinS_date.rftchron = string.format ('%s %s – %s %s', season[input.month], input.year, season[input.month2], input.year2); -- used in journal metadata only
end
else -- season–season year range
tCOinS_date.rftchron = season[input.month] .. '–' .. season[input.month2]; -- season–season year range; used in journal metadata only
end
end
tCOinS_date.rftdate = tostring (date);
return; -- done
end
-- here for gregorian calendar dates
if 0 ~= input.day then
date = string.format ('%s-%.2d-%.2d', input.year, tonumber(input.month), tonumber(input.day)); -- whole date
elseif 0 ~= input.month then
date = string.format ('%s-%.2d', input.year, tonumber(input.month)); -- year and month
else
date = string.format ('%s', input.year); -- just year
end
if 0 ~= input.year2 then
if 0 ~= input.day2 then
date2 = string.format ('/%s-%.2d-%.2d', input.year2, tonumber(input.month2), tonumber(input.day2)); -- whole date
elseif 0 ~= input.month2 then
date2 = string.format ('/%s-%.2d', input.year2, tonumber(input.month2)); -- year and month
else
date2 = string.format ('/%s', input.year2); -- just year
end
end
tCOinS_date.rftdate = date .. date2; -- date2 has the '/' separator
return;
end
--[[--------------------------< P A T T E R N S >--------------------------------------------------------------
this is the list of patterns for date formats that this module recognizes. Approximately the first half of these
patterns represent formats that might be reformatted into another format. Those that might be reformatted have
'indicator' letters that identify the content of the matching capture: 'd' (day), 'm' (month), 'a' (anchor year),
'y' (year); second day, month, year have a '2' suffix.
These patterns are used for both date validation and for reformatting. This table should not be moved to ~/Configuration
because changes to this table require changes to check_date() and to reformatter() and reformat_date()
]]
local patterns = {
-- year-initial numerical year-month-day
['ymd'] = {'^(%d%d%d%d)%-(%d%d)%-(%d%d)$', 'y', 'm', 'd'},
-- month-initial: month day, year
['Mdy'] = {'^(%D-) +([1-9]%d?), +((%d%d%d%d?)%a?)$', 'm', 'd', 'a', 'y'},
-- month-initial day range: month day–day, year; days are separated by endash
['Md-dy'] = {'^(%D-) +([1-9]%d?)[%-–]([1-9]%d?), +((%d%d%d%d)%a?)$', 'm', 'd', 'd2', 'a', 'y'},
-- day-initial: day month year
['dMy'] = {'^([1-9]%d?) +(%D-) +((%d%d%d%d?)%a?)$', 'd', 'm', 'a', 'y'},
-- year-initial: year month day; day: 1 or 2 two digits, leading zero allowed; not supported at en.wiki
-- ['yMd'] = {'^((%d%d%d%d?)%a?) +(%D-) +(%d%d?)$', 'a', 'y', 'm', 'd'},
-- day-range-initial: day–day month year; days are separated by endash
['d-dMy'] = {'^([1-9]%d?)[%-–]([1-9]%d?) +(%D-) +((%d%d%d%d)%a?)$', 'd', 'd2', 'm', 'a', 'y'},
-- day initial month-day-range: day month - day month year; uses spaced endash
['dM-dMy'] = {'^([1-9]%d?) +(%D-) +[%-–] +([1-9]%d?) +(%D-) +((%d%d%d%d)%a?)$', 'd', 'm', 'd2', 'm2', 'a', 'y'},
-- month initial month-day-range: month day – month day, year; uses spaced endash
['Md-Mdy'] = {'^(%D-) +([1-9]%d?) +[%-–] +(%D-) +([1-9]%d?), +((%d%d%d%d)%a?)$','m', 'd', 'm2', 'd2', 'a', 'y'},
-- day initial month-day-year-range: day month year - day month year; uses spaced endash
['dMy-dMy'] = {'^([1-9]%d?) +(%D-) +(%d%d%d%d) +[%-–] +([1-9]%d?) +(%D-) +((%d%d%d%d)%a?)$', 'd', 'm', 'y', 'd2', 'm2', 'a', 'y2'},
-- month initial month-day-year-range: month day, year – month day, year; uses spaced endash
['Mdy-Mdy'] = {'^(%D-) +([1-9]%d?), +(%d%d%d%d) +[%-–] +(%D-) +([1-9]%d?), +((%d%d%d%d)%a?)$', 'm', 'd', 'y', 'm2', 'd2', 'a', 'y2'},
-- these date formats cannot be converted, per se, but month name can be rendered short or long
-- month/season year - month/season year; separated by spaced endash
['My-My'] = {'^(%D-) +(%d%d%d%d) +[%-–] +(%D-) +((%d%d%d%d)%a?)$', 'm', 'y', 'm2', 'a', 'y2'},
-- month/season range year; months separated by endash
['M-My'] = {'^(%D-)[%-–](%D-) +((%d%d%d%d)%a?)$', 'm', 'm2', 'a', 'y'},
-- month/season year or proper-name year; quarter year when First Quarter YYYY etc.
['My'] = {'^([^%d–]-) +((%d%d%d%d)%a?)$', 'm', 'a', 'y'}, -- this way because endash is a member of %D; %D- will match January–March 2019 when it shouldn't
-- these date formats cannot be converted
['Sy4-y2'] = {'^(%D-) +((%d%d)%d%d)[%-–]((%d%d)%a?)$'}, -- special case Winter/Summer year-year (YYYY-YY); year separated with unspaced endash
['Sy-y'] = {'^(%D-) +(%d%d%d%d)[%-–]((%d%d%d%d)%a?)$'}, -- special case Winter/Summer year-year; year separated with unspaced endash
['y-y'] = {'^(%d%d%d%d?)[%-–]((%d%d%d%d?)%a?)$'}, -- year range: YYY-YYY or YYY-YYYY or YYYY–YYYY; separated by unspaced endash; 100-9999
['y4-y2'] = {'^((%d%d)%d%d)[%-–]((%d%d)%a?)$'}, -- year range: YYYY–YY; separated by unspaced endash
['y'] = {'^((%d%d%d%d?)%a?)$'}, -- year; here accept either YYY or YYYY
}
--[[--------------------------< I S _ V A L I D _ E M B A R G O _ D A T E >------------------------------------
returns true and date value if that value has proper dmy, mdy, ymd format.
returns false and 9999 (embargoed forever) when date value is not proper format; assumes that when |pmc-embargo-date= is
set, the editor intended to embargo a PMC but |pmc-embargo-date= does not hold a single date.
]]
local function is_valid_embargo_date (v)
if v:match (patterns['ymd'][1]) or -- ymd
v:match (patterns['Mdy'][1]) or -- dmy
v:match (patterns['dMy'][1]) then -- mdy
return true, v;
end
return false, '9999'; -- if here not good date so return false and set embargo date to long time in future
end
--[[--------------------------< C H E C K _ D A T E >----------------------------------------------------------
Check date format to see that it is one of the formats approved by WP:DATESNO or WP:DATERANGE. Exception: only
allowed range separator is endash. Additionally, check the date to see that it is a real date: no 31 in 30-day
months; no 29 February when not a leap year. Months, both long-form and three character abbreviations, and seasons
must be spelled correctly. Future years beyond next year are not allowed.
If the date fails the format tests, this function returns false and does not return values for anchor_year and
COinS_date. When this happens, the date parameter is (DEBUG: not?) used in the COinS metadata and the CITEREF identifier gets
its year from the year parameter if present otherwise CITEREF does not get a date value.
Inputs:
date_string - date string from date-holding parameters (date, year, publication-date, access-date, pmc-embargo-date, archive-date, lay-date)
Returns:
false if date string is not a real date; else
true, anchor_year, COinS_date
anchor_year can be used in CITEREF anchors
COinS_date is ISO 8601 format date; see make_COInS_date()
]]
local function check_date (date_string, param, tCOinS_date)
local year; -- assume that year2, months, and days are not used;
local year2 = 0; -- second year in a year range
local month = 0;
local month2 = 0; -- second month in a month range
local day = 0;
local day2 = 0; -- second day in a day range
local anchor_year;
local coins_date;
if date_string:match (patterns['ymd'][1]) then -- year-initial numerical year month day format
year, month, day = date_string:match (patterns['ymd'][1]);
if 12 < tonumber(month) or 1 > tonumber(month) or 1582 > tonumber(year) or 0 == tonumber(day) then return false; end -- month or day number not valid or not Gregorian calendar
anchor_year = year;
elseif mw.ustring.match(date_string, patterns['Mdy'][1]) then -- month-initial: month day, year
month, day, anchor_year, year = mw.ustring.match(date_string, patterns['Mdy'][1]);
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
elseif mw.ustring.match(date_string, patterns['Md-dy'][1]) then -- month-initial day range: month day–day, year; days are separated by endash
month, day, day2, anchor_year, year = mw.ustring.match(date_string, patterns['Md-dy'][1]);
if tonumber(day) >= tonumber(day2) then return false; end -- date range order is left to right: earlier to later; dates may not be the same;
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
month2=month; -- for metadata
year2 = year;
elseif mw.ustring.match(date_string, patterns['dMy'][1]) then -- day-initial: day month year
day, month, anchor_year, year = mw.ustring.match(date_string, patterns['dMy'][1]);
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
--[[ NOT supported at en.wiki
elseif mw.ustring.match(date_string, patterns['yMd'][1]) then -- year-initial: year month day; day: 1 or 2 two digits, leading zero allowed
anchor_year, year, month, day = mw.ustring.match(date_string, patterns['yMd'][1]);
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
-- end NOT supported at en.wiki ]]
elseif mw.ustring.match(date_string, patterns['d-dMy'][1]) then -- day-range-initial: day–day month year; days are separated by endash
day, day2, month, anchor_year, year = mw.ustring.match(date_string, patterns['d-dMy'][1]);
if tonumber(day) >= tonumber(day2) then return false; end -- date range order is left to right: earlier to later; dates may not be the same;
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
month2 = month; -- for metadata
year2 = year;
elseif mw.ustring.match(date_string, patterns['dM-dMy'][1]) then -- day initial month-day-range: day month - day month year; uses spaced endash
day, month, day2, month2, anchor_year, year = mw.ustring.match(date_string, patterns['dM-dMy'][1]);
if (not is_valid_month_season_range(month, month2)) or not is_valid_year(year) then return false; end -- date range order is left to right: earlier to later;
month = get_month_number (month); -- for metadata
month2 = get_month_number (month2);
year2 = year;
elseif mw.ustring.match(date_string, patterns['Md-Mdy'][1]) then -- month initial month-day-range: month day – month day, year; uses spaced endash
month, day, month2, day2, anchor_year, year = mw.ustring.match(date_string, patterns['Md-Mdy'][1]);
if (not is_valid_month_season_range(month, month2, param)) or not is_valid_year(year) then return false; end
month = get_month_number (month); -- for metadata
month2 = get_month_number (month2);
year2 = year;
elseif mw.ustring.match(date_string, patterns['dMy-dMy'][1]) then -- day initial month-day-year-range: day month year - day month year; uses spaced endash
day, month, year, day2, month2, anchor_year, year2 = mw.ustring.match(date_string, patterns['dMy-dMy'][1]);
if tonumber(year2) <= tonumber(year) then return false; end -- must be sequential years, left to right, earlier to later
if not is_valid_year(year2) or not is_valid_month_range_style(month, month2) then return false; end -- year2 no more than one year in the future; months same style
month = get_month_number (month); -- for metadata
month2 = get_month_number (month2);
if 0 == month or 0 == month2 then return false; end -- both must be valid
elseif mw.ustring.match(date_string, patterns['Mdy-Mdy'][1]) then -- month initial month-day-year-range: month day, year – month day, year; uses spaced endash
month, day, year, month2, day2, anchor_year, year2 = mw.ustring.match(date_string, patterns['Mdy-Mdy'][1]);
if tonumber(year2) <= tonumber(year) then return false; end -- must be sequential years, left to right, earlier to later
if not is_valid_year(year2) or not is_valid_month_range_style(month, month2) then return false; end -- year2 no more than one year in the future; months same style
month = get_month_number (month); -- for metadata
month2 = get_month_number(month2);
if 0 == month or 0 == month2 then return false; end -- both must be valid
elseif mw.ustring.match(date_string, patterns['Sy4-y2'][1]) then -- special case Winter/Summer year-year (YYYY-YY); year separated with unspaced endash
local century;
month, year, century, anchor_year, year2 = mw.ustring.match(date_string, patterns['Sy4-y2'][1]);
if 'Winter' ~= month and 'Summer' ~= month then return false end; -- 'month' can only be Winter or Summer
anchor_year = year .. '–' .. anchor_year; -- assemble anchor_year from both years
year2 = century..year2; -- add the century to year2 for comparisons
if 1 ~= tonumber(year2) - tonumber(year) then return false; end -- must be sequential years, left to right, earlier to later
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
month = get_season_number(month, param);
elseif mw.ustring.match(date_string, patterns['Sy-y'][1]) then -- special case Winter/Summer year-year; year separated with unspaced endash
month, year, anchor_year, year2 = mw.ustring.match(date_string, patterns['Sy-y'][1]);
month = get_season_number (month, param); -- <month> can only be winter or summer; also for metadata
if (month ~= cfg.date_names['en'].season['Winter']) and (month ~= cfg.date_names['en'].season['Summer']) then
return false; -- not Summer or Winter; abandon
end
anchor_year = year .. '–' .. anchor_year; -- assemble anchor_year from both years
if 1 ~= tonumber(year2) - tonumber(year) then return false; end -- must be sequential years, left to right, earlier to later
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
elseif mw.ustring.match(date_string, patterns['My-My'][1]) then -- month/season year - month/season year; separated by spaced endash
month, year, month2, anchor_year, year2 = mw.ustring.match(date_string, patterns['My-My'][1]);
anchor_year = year .. '–' .. anchor_year; -- assemble anchor_year from both years
if tonumber(year) >= tonumber(year2) then return false; end -- left to right, earlier to later, not the same
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
if 0 ~= get_month_number(month) and 0 ~= get_month_number(month2) and is_valid_month_range_style(month, month2) then -- both must be month year, same month style
month = get_month_number(month);
month2 = get_month_number(month2);
elseif 0 ~= get_season_number(month, param) and 0 ~= get_season_number(month2, param) then -- both must be season year, not mixed
month = get_season_number(month, param);
month2 = get_season_number(month2, param);
else
return false;
end
elseif mw.ustring.match(date_string, patterns['M-My'][1]) then -- month/season range year; months separated by endash
month, month2, anchor_year, year = mw.ustring.match(date_string, patterns['M-My'][1]);
if (not is_valid_month_season_range(month, month2, param)) or (not is_valid_year(year)) then return false; end
if 0 ~= get_month_number(month) then -- determined to be a valid range so just check this one to know if month or season
month = get_month_number(month);
month2 = get_month_number(month2);
if 0 == month or 0 == month2 then return false; end
else
month = get_season_number(month, param);
month2 = get_season_number(month2, param);
end
year2 = year;
elseif mw.ustring.match(date_string, patterns['My'][1]) then -- month/season/quarter/proper-name year
month, anchor_year, year = mw.ustring.match(date_string, patterns['My'][1]);
if not is_valid_year(year) then return false; end
month = get_element_number(month, param); -- get month season quarter proper-name number or nil
if not month then return false; end -- not valid whatever it is
elseif mw.ustring.match(date_string, patterns['y-y'][1]) then -- Year range: YYY-YYY or YYY-YYYY or YYYY–YYYY; separated by unspaced endash; 100-9999
year, anchor_year, year2 = mw.ustring.match(date_string, patterns['y-y'][1]);
anchor_year = year .. '–' .. anchor_year; -- assemble anchor year from both years
if tonumber(year) >= tonumber(year2) then return false; end -- left to right, earlier to later, not the same
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
elseif mw.ustring.match(date_string, patterns['y4-y2'][1]) then -- Year range: YYYY–YY; separated by unspaced endash
local century;
year, century, anchor_year, year2 = mw.ustring.match(date_string, patterns['y4-y2'][1]);
anchor_year = year .. '–' .. anchor_year; -- assemble anchor year from both years
if 13 > tonumber(year2) then return false; end -- don't allow 2003-05 which might be May 2003
year2 = century .. year2; -- add the century to year2 for comparisons
if tonumber(year) >= tonumber(year2) then return false; end -- left to right, earlier to later, not the same
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
if in_array (param, {'date', 'publication-date', 'year'}) then -- here when 'valid' abbreviated year range; if one of these parameters
add_prop_cat ('year-range-abbreviated'); -- add properties cat
end
elseif mw.ustring.match(date_string, patterns['y'][1]) then -- year; here accept either YYY or YYYY
anchor_year, year = mw.ustring.match(date_string, patterns['y'][1]);
if false == is_valid_year(year) then
return false;
end
else
return false; -- date format not one of the MOS:DATE approved formats
end
if param ~= 'date' then -- CITEREF disambiguation only allowed in |date=; |year= & |publication-date= promote to date
if anchor_year:match ('%l$') then
return false;
end
end
if 'access-date' == param then -- test access-date here because we have numerical date parts
if 0 ~= year and 0 ~= month and 0 ~= day and -- all parts of a single date required
0 == year2 and 0 == month2 and 0 == day2 then -- none of these; access-date must not be a range
if not is_valid_accessdate(year .. '-' .. month .. '-' .. day) then
return false; -- return false when access-date out of bounds
end
else
return false; -- return false when access-date is a range of two dates
end
end
if 'archive-date' == param then -- test archive-date here because we have numerical date parts
if not (0 ~= year and 0 ~= month and 0 ~= day and -- all parts of a single date required
0 == year2 and 0 == month2 and 0 == day2) then -- none of these; archive-date must not be a range
return false; -- return false when archive-date is a range of two dates
end
end
local result=true; -- check whole dates for validity; assume true because not all dates will go through this test
if 0 ~= year and 0 ~= month and 0 ~= day and 0 == year2 and 0 == month2 and 0 == day2 then -- YMD (simple whole date)
result = is_valid_date (year, month, day, param); -- <param> for |pmc-embargo-date=
elseif 0 ~= year and 0 ~= month and 0 ~= day and 0 == year2 and 0 == month2 and 0 ~= day2 then -- YMD-d (day range)
result = is_valid_date (year, month, day);
result = result and is_valid_date (year, month, day2);
elseif 0 ~= year and 0 ~= month and 0 ~= day and 0 == year2 and 0 ~= month2 and 0 ~= day2 then -- YMD-md (day month range)
result = is_valid_date (year, month, day);
result = result and is_valid_date (year, month2, day2);
elseif 0 ~= year and 0 ~= month and 0 ~= day and 0 ~= year2 and 0 ~= month2 and 0 ~= day2 then -- YMD-ymd (day month year range)
result = is_valid_date(year, month, day);
result = result and is_valid_date(year2, month2, day2);
end
if false == result then return false; end
if nil ~= tCOinS_date then -- this table only passed into this function when testing |date= parameter values
make_COinS_date ({year = year, month = month, day = day, year2 = year2, month2 = month2, day2 = day2}, tCOinS_date); -- make an ISO 8601 date string for COinS
end
return true, anchor_year; -- format is good and date string represents a real date
end
--[[--------------------------< D A T E S >--------------------------------------------------------------------
Cycle the date-holding parameters in passed table date_parameters_list through check_date() to check compliance with MOS:DATE. For all valid dates, check_date() returns
true. The |date= parameter test is unique, it is the only date holding parameter from which values for anchor_year (used in CITEREF identifiers) and COinS_date (used in
the COinS metadata) are derived. The |date= parameter is the only date-holding parameter that is allowed to contain the no-date keywords "n.d." or "nd" (without quotes).
Unlike most error messages created in this module, only one error message is created by this function. Because all of the date holding parameters are processed serially,
parameters with errors are added to the <error_list> sequence table as the dates are tested.
]]
local function dates(date_parameters_list, tCOinS_date, error_list)
local anchor_year; -- will return as nil if the date being tested is not |date=
local COinS_date; -- will return as nil if the date being tested is not |date=
local embargo_date; -- if embargo date is a good dmy, mdy, ymd date then holds original value else reset to 9999
local good_date = false;
for k, v in pairs(date_parameters_list) do -- for each date-holding parameter in the list
if is_set(v.val) then -- if the parameter has a value
v.val = mw.ustring.gsub(v.val, '%d', cfg.date_names.local_digits); -- translate 'local' digits to Western 0-9
if v.val:match("^c%. [1-9]%d%d%d?%a?$") then -- special case for c. year or with or without CITEREF disambiguator - only |date= and |year=
local year = v.val:match("c%. ([1-9]%d%d%d?)%a?"); -- get the year portion so it can be tested
if 'date' == k then
anchor_year, COinS_date = v.val:match("((c%. [1-9]%d%d%d?)%a?)"); -- anchor year and COinS_date only from |date= parameter
good_date = is_valid_year(year);
elseif 'year' == k then
good_date = is_valid_year(year);
end
elseif 'date' == k then -- if the parameter is |date=
if v.val:match("^n%.d%.%a?$") then -- ToDo: I18N -- if |date=n.d. with or without a CITEREF disambiguator
good_date, anchor_year, COinS_date = true, v.val:match("((n%.d%.)%a?)"); -- ToDo: I18N -- "n.d."; no error when date parameter is set to no date
elseif v.val:match("^nd%a?$") then -- ToDo: I18N -- if |date=nd with or without a CITEREF disambiguator
good_date, anchor_year, COinS_date = true, v.val:match("((nd)%a?)"); -- ToDo: I18N -- "nd"; no error when date parameter is set to no date
else
good_date, anchor_year, COinS_date = check_date (v.val, k, tCOinS_date); -- go test the date
end
elseif 'year' == k then -- if the parameter is |year= it should hold only a year value
if v.val:match("^[1-9]%d%d%d?%a?$") then -- if |year = 3 or 4 digits only with or without a CITEREF disambiguator
good_date, anchor_year, COinS_date = true, v.val:match("((%d+)%a?)");
end
elseif 'pmc-embargo-date' == k then -- if the parameter is |pmc-embargo-date=
good_date = check_date (v.val, k); -- go test the date
if true == good_date then -- if the date is a valid date
good_date, embargo_date = is_valid_embargo_date (v.val); -- is |pmc-embargo-date= date a single dmy, mdy, or ymd formatted date? yes: returns embargo date; no: returns 9999
end
else -- any other date-holding parameter
good_date = check_date (v.val, k); -- go test the date
end
if false == good_date then -- assemble one error message so we don't add the tracking category multiple times
table.insert (error_list, wrap_style ('parameter', v.name)); -- make parameter name suitable for error message list
end
end
end
return anchor_year, embargo_date; -- and done
end
--[[--------------------------< Y E A R _ D A T E _ C H E C K >------------------------------------------------
Compare the value provided in |year= with the year value(s) provided in |date=. This function sets a local numeric value:
0 - year value does not match the year value in date
1 - (default) year value matches the year value in date or one of the year values when date contains two years
2 - year value matches the year value in date when date is in the form YYYY-MM-DD and year is disambiguated (|year=YYYYx)
the numeric value in <result> determines the 'output' if any from this function:
0 – adds error message to error_list sequence table
1 – adds maint cat
2 – does nothing
]]
local function year_date_check (year_string, year_origin, date_string, date_origin, error_list)
local year;
local date1;
local date2;
local result = 1; -- result of the test; assume that the test passes
year = year_string:match ('(%d%d%d%d?)');
if date_string:match ('%d%d%d%d%-%d%d%-%d%d') and year_string:match ('%d%d%d%d%a') then --special case where both date and year are required YYYY-MM-DD and YYYYx
date1 = date_string:match ('(%d%d%d%d)');
year = year_string:match ('(%d%d%d%d)');
if year ~= date1 then
result = 0; -- years don't match
else
result = 2; -- years match; but because disambiguated, don't add to maint cat
end
elseif date_string:match ("%d%d%d%d?.-%d%d%d%d?") then -- any of the standard range formats of date with two three- or four-digit years
date1, date2 = date_string:match ("(%d%d%d%d?).-(%d%d%d%d?)");
if year ~= date1 and year ~= date2 then
result = 0;
end
elseif mw.ustring.match(date_string, "%d%d%d%d[%-–]%d%d") then -- YYYY-YY date ranges
local century;
date1, century, date2 = mw.ustring.match(date_string, "((%d%d)%d%d)[%-–]+(%d%d)");
date2 = century..date2; -- convert YY to YYYY
if year ~= date1 and year ~= date2 then
result = 0;
end
elseif date_string:match ("%d%d%d%d?") then -- any of the standard formats of date with one year
date1 = date_string:match ("(%d%d%d%d?)");
if year ~= date1 then
result = 0;
end
else -- should never get here; this function called only when no other date errors
result = 0; -- no recognizable year in date
end
if 0 == result then -- year / date mismatch
table.insert (error_list, substitute (cfg.messages['mismatch'], {year_origin, date_origin})); -- add error message to error_list sequence table
elseif 1 == result then -- redundant year / date
set_message ('maint_date_year'); -- add a maint cat
end
end
--[[--------------------------< R E F O R M A T T E R >--------------------------------------------------------
reformat 'date' into new format specified by format_param if pattern_idx (the current format of 'date') can be
reformatted. Does the grunt work for reformat_dates().
The table re_formats maps pattern_idx (current format) and format_param (desired format) to a table that holds:
format string used by string.format()
identifier letters ('d', 'm', 'y', 'd2', 'm2', 'y2') that serve as indexes into a table t{} that holds captures
from mw.ustring.match() for the various date parts specified by patterns[pattern_idx][1]
Items in patterns{} have the general form:
['ymd'] = {'^(%d%d%d%d)%-(%d%d)%-(%d%d)$', 'y', 'm', 'd'}, where:
['ymd'] is pattern_idx
patterns['ymd'][1] is the match pattern with captures for mw.ustring.match()
patterns['ymd'][2] is an indicator letter identifying the content of the first capture
patterns['ymd'][3] ... the second capture etc.
when a pattern matches a date, the captures are loaded into table t{} in capture order using the idemtifier
characters as indexes into t{} For the above, a ymd date is in t{} as:
t.y = first capture (year), t.m = second capture (month), t.d = third capture (day)
To reformat, this function is called with the pattern_idx that matches the current format of the date and with
format_param set to the desired format. This function loads table t{} as described and then calls string.format()
with the format string specified by re_format[pattern_idx][format_param][1] using values taken from t{} according
to the capture identifier letters specified by patterns[pattern_idx][format_param][n] where n is 2..
]]
local re_formats = {
['ymd'] = { -- date format is ymd; reformat to:
['mdy'] = {'%s %s, %s', 'm', 'd', 'y'}, -- |df=mdy
['dmy'] = {'%s %s %s', 'd', 'm', 'y'}, -- |df=dmy
-- ['yMd'] = {'%s %s %s', 'y', 'm', 'd'}, -- |df=yMd; not supported at en.wiki
},
['Mdy'] = { -- date format is Mdy; reformat to:
['mdy'] = {'%s %s, %s', 'm', 'd', 'y'}, -- for long/short reformatting
['dmy'] = {'%s %s %s', 'd', 'm', 'y'}, -- |df=dmy
['ymd'] = {'%s-%s-%s', 'y', 'm', 'd'}, -- |df=ymd
-- ['yMd'] = {'%s %s %s', 'y', 'm', 'd'}, -- |df=yMd; not supported at en.wiki
},
['dMy'] = { -- date format is dMy; reformat to:
['dmy'] = {'%s %s %s', 'd', 'm', 'y'}, -- for long/short reformatting
['mdy'] = {'%s %s, %s', 'm', 'd', 'y'}, -- |df=mdy
['ymd'] = {'%s-%s-%s', 'y', 'm', 'd'}, -- |df=ymd
-- ['yMd'] = {'%s %s %s', 'y', 'm', 'd'}, -- |df=yMd; not supported at en.wiki
},
['Md-dy'] = { -- date format is Md-dy; reformat to:
['mdy'] = {'%s %s–%s, %s', 'm', 'd', 'd2', 'y'}, -- for long/short reformatting
['dmy'] = {'%s–%s %s %s', 'd', 'd2', 'm', 'y'}, -- |df=dmy -> d-dMy
},
['d-dMy'] = { -- date format is d-d>y; reformat to:
['dmy'] = {'%s–%s %s %s', 'd', 'd2', 'm', 'y'}, -- for long/short reformatting
['mdy'] = {'%s %s–%s, %s', 'm', 'd', 'd2', 'y'}, -- |df=mdy -> Md-dy
},
['dM-dMy'] = { -- date format is dM-dMy; reformat to:
['dmy'] = {'%s %s – %s %s %s', 'd', 'm', 'd2', 'm2', 'y'}, -- for long/short reformatting
['mdy'] = {'%s %s – %s %s, %s', 'm', 'd', 'm2', 'd2', 'y'}, -- |df=mdy -> Md-Mdy
},
['Md-Mdy'] = { -- date format is Md-Mdy; reformat to:
['mdy'] = {'%s %s – %s %s, %s', 'm', 'd', 'm2', 'd2', 'y'}, -- for long/short reformatting
['dmy'] = {'%s %s – %s %s %s', 'd', 'm', 'd2', 'm2', 'y'}, -- |df=dmy -> dM-dMy
},
['dMy-dMy'] = { -- date format is dMy-dMy; reformat to:
['dmy'] = {'%s %s %s – %s %s %s', 'd', 'm', 'y', 'd2', 'm2', 'y2'}, -- for long/short reformatting
['mdy'] = {'%s %s, %s – %s %s, %s', 'm', 'd', 'y', 'm2', 'd2', 'y2'}, -- |df=mdy -> Mdy-Mdy
},
['Mdy-Mdy'] = { -- date format is Mdy-Mdy; reformat to:
['mdy'] = {'%s %s, %s – %s %s, %s', 'm', 'd', 'y', 'm2', 'd2', 'y2'}, -- for long/short reformatting
['dmy'] = {'%s %s %s – %s %s %s', 'd', 'm', 'y', 'd2', 'm2', 'y2'}, -- |df=dmy -> dMy-dMy
},
['My-My'] = { -- these for long/short reformatting
['any'] = {'%s %s – %s %s', 'm', 'y', 'm2', 'y2'}, -- dmy/mdy agnostic
},
['M-My'] = { -- these for long/short reformatting
['any'] = {'%s–%s %s', 'm', 'm2', 'y'}, -- dmy/mdy agnostic
},
['My'] = { -- these for long/short reformatting
['any'] = {'%s %s', 'm', 'y'}, -- dmy/mdy agnostic
},
-- ['yMd'] = { -- not supported at en.wiki
-- ['mdy'] = {'%s %s, %s', 'm', 'd', 'y'}, -- |df=mdy
-- ['dmy'] = {'%s %s %s', 'd', 'm', 'y'}, -- |df=dmy
-- ['ymd'] = {'%s-%s-%s', 'y', 'm', 'd'}, -- |df=ymd
-- },
}
local function reformatter (date, pattern_idx, format_param, mon_len)
if not in_array (pattern_idx, {'ymd', 'Mdy', 'Md-dy', 'dMy', 'yMd', 'd-dMy', 'dM-dMy', 'Md-Mdy', 'dMy-dMy', 'Mdy-Mdy', 'My-My', 'M-My', 'My'}) then
return; -- not in this set of date format patterns then not a reformattable date
end
if 'ymd' == format_param and in_array (pattern_idx, {'ymd', 'Md-dy', 'd-dMy', 'dM-dMy', 'Md-Mdy', 'dMy-dMy', 'Mdy-Mdy', 'My-My', 'M-My', 'My'}) then
return; -- ymd date ranges not supported at en.wiki; no point in reformatting ymd to ymd
end
if in_array (pattern_idx, {'My', 'M-My', 'My-My'}) then -- these are not dmy/mdy so can't be 'reformatted' into either
format_param = 'any'; -- so format-agnostic
end
-- yMd is not supported at en.wiki; when yMd is supported at your wiki, uncomment the next line
-- if 'yMd' == format_param and in_array (pattern_idx, {'yMd', 'Md-dy', 'd-dMy', 'dM-dMy', 'Md-Mdy', 'dMy-dMy', 'Mdy-Mdy'}) then -- these formats not convertable; yMd not supported at en.wiki
if 'yMd' == format_param then -- yMd not supported at en.wiki; when yMd is supported at your wiki, remove or comment-out this line
return; -- not a reformattable date
end
local c1, c2, c3, c4, c5, c6, c7; -- these hold the captures specified in patterns[pattern_idx][1]
c1, c2, c3, c4, c5, c6, c7 = mw.ustring.match (date, patterns[pattern_idx][1]); -- get the captures
local t = { -- table that holds k/v pairs of date parts from the captures and patterns[pattern_idx][2..]
[patterns[pattern_idx][2]] = c1; -- at minimum there is always one capture with a matching indicator letter
[patterns[pattern_idx][3] or 'x'] = c2; -- patterns can have a variable number of captures; each capture requires an indicator letter;
[patterns[pattern_idx][4] or 'x'] = c3; -- where there is no capture, there is no indicator letter so n in patterns[pattern_idx][n] will be nil;
[patterns[pattern_idx][5] or 'x'] = c4; -- the 'x' here spoofs an indicator letter to prevent 'table index is nil' error
[patterns[pattern_idx][6] or 'x'] = c5;
[patterns[pattern_idx][7] or 'x'] = c6;
[patterns[pattern_idx][8] or 'x'] = c7;
};
if t.a then -- if this date has an anchor year capture (all convertable date formats except ymd)
if t.y2 then -- for year range date formats
t.y2 = t.a; -- use the anchor year capture when reassembling the date
else -- here for single date formats (except ymd)
t.y = t.a; -- use the anchor year capture when reassembling the date
end
end
if tonumber(t.m) then -- if raw month is a number (converting from ymd)
if 's' == mon_len then -- if we are to use abbreviated month names
t.m = cfg.date_names['inv_local_short'][tonumber(t.m)]; -- convert it to a month name
else
t.m = cfg.date_names['inv_local_long'][tonumber(t.m)]; -- convert it to a month name
end
t.d = t.d:gsub ('0(%d)', '%1'); -- strip leading '0' from day if present
elseif 'ymd' == format_param then -- when converting to ymd
t.y = t.y:gsub ('%a', ''); -- strip CITREF disambiguator if present; anchor year already known so process can proceed; TODO: maint message?
if 1582 > tonumber (t.y) then -- ymd format dates not allowed before 1582
return;
end
t.m = string.format ('%02d', get_month_number (t.m)); -- make sure that month and day are two digits
t.d = string.format ('%02d', t.d);
elseif mon_len then -- if mon_len is set to either 'short' or 'long'
for _, mon in ipairs ({'m', 'm2'}) do -- because there can be two month names, check both
if t[mon] then
t[mon] = get_month_number (t[mon]); -- get the month number for this month (is length agnostic)
if 0 == t[mon] then return; end -- seasons and named dates can't be converted
t[mon] = (('s' == mon_len) and cfg.date_names['inv_local_short'][t[mon]]) or cfg.date_names['inv_local_long'][t[mon]]; -- fetch month name according to length
end
end
end
local new_date = string.format (re_formats[pattern_idx][format_param][1], -- format string
t[re_formats[pattern_idx][format_param][2]], -- named captures from t{}
t[re_formats[pattern_idx][format_param][3]],
t[re_formats[pattern_idx][format_param][4]],
t[re_formats[pattern_idx][format_param][5]],
t[re_formats[pattern_idx][format_param][6]],
t[re_formats[pattern_idx][format_param][7]],
t[re_formats[pattern_idx][format_param][8]]
);
return new_date;
end
--[[-------------------------< R E F O R M A T _ D A T E S >--------------------------------------------------
Reformats existing dates into the format specified by format.
format is one of several manual keywords: dmy, dmy-all, mdy, mdy-all, ymd, ymd-all. The -all version includes
access- and archive-dates; otherwise these dates are not reformatted.
This function allows automatic date formatting. In ~/Configuration, the article source is searched for one of
the {{use xxx dates}} templates. If found, xxx becomes the global date format as xxx-all. If |cs1-dates= in
{{use xxx dates}} has legitimate value then that value determines how cs1|2 dates will be rendered. Legitimate
values for |cs1-dates= are:
l - all dates are rendered with long month names
ls - publication dates use long month names; access-/archive-dates use abbreviated month names
ly - publication dates use long month names; access-/archive-dates rendered in ymd format
s - all dates are rendered with abbreviated (short) month names
sy - publication dates use abbreviated month names; access-/archive-dates rendered in ymd format
y - all dates are rendered in ymd format
the format argument for automatic date formatting will be the format specified by {{use xxx dates}} with the
value supplied by |cs1-dates so one of: xxx-l, xxx-ls, xxx-ly, xxx-s, xxx-sy, xxx-y, or simply xxx (|cs1-dates=
empty, omitted, or invalid) where xxx shall be either of dmy or mdy.
dates are extracted from date_parameters_list, reformatted (if appropriate), and then written back into the
list in the new format. Dates in date_parameters_list are presumed here to be valid (no errors). This function
returns true when a date has been reformatted, false else. Actual reformatting is done by reformatter().
]]
local function reformat_dates (date_parameters_list, format)
local all = false; -- set to false to skip access- and archive-dates
local len_p = 'l'; -- default publication date length shall be long
local len_a = 'l'; -- default access-/archive-date length shall be long
local result = false;
local new_date;
if format:match('%a+%-all') then -- manual df keyword; auto df keyword when length not specified in {{use xxx dates}};
format = format:match('(%a+)%-all'); -- extract the format
all = true; -- all dates are long format dates because this keyword doesn't specify length
elseif format:match('%a+%-[lsy][sy]?') then -- auto df keywords; internal only
all = true; -- auto df applies to all dates; use length specified by capture len_p for all dates
format, len_p, len_a = format:match('(%a+)%-([lsy])([sy]?)'); -- extract the format and length keywords
if 'y' == len_p then -- because allowed by MOS:DATEUNIFY (sort of) range dates and My dates not reformatted
format = 'ymd'; -- override {{use xxx dates}}
elseif (not is_set(len_a)) or (len_p == len_a) then -- no access-/archive-date length specified or same length as publication dates then
len_a = len_p; -- in case len_a not set
end
end -- else only publication dates and they are long
for param_name, param_val in pairs (date_parameters_list) do -- for each date-holding parameter in the list
if is_set (param_val.val) then -- if the parameter has a value
if not (not all and in_array (param_name, {'access-date', 'archive-date'})) then -- skip access- or archive-date unless format is xxx-all; yeah, ugly; TODO: find a better way
for pattern_idx, pattern in pairs (patterns) do
if mw.ustring.match (param_val.val, pattern[1]) then
if all and in_array (param_name, {'access-date', 'archive-date'}) then -- if this date is an access- or archive-date
new_date = reformatter (param_val.val, pattern_idx, (('y' == len_a) and 'ymd') or format, len_a); -- choose ymd or dmy/mdy according to len_a setting
else -- all other dates
new_date = reformatter (param_val.val, pattern_idx, format, len_p);
end
if new_date then -- set when date was reformatted
date_parameters_list[param_name].val = new_date; -- update date in date list
result = true; -- and announce that changes have been made
break;
end
end -- if
end -- for
end -- if
end -- if
end -- for
return result; -- declare boolean result and done
end
--[[--------------------------< D A T E _ H Y P H E N _ T O _ D A S H >----------------------------------------
Loops through the list of date-holding parameters and converts any hyphen to an ndash. Not called if the cs1|2
template has any date errors.
Modifies the date_parameters_list and returns true if hyphens are replaced, else returns false.
]]
local function date_hyphen_to_dash (date_parameters_list)
local result = false;
local n;
for param_name, param_val in pairs(date_parameters_list) do -- for each date-holding parameter in the list
if is_set (param_val.val) and
not mw.ustring.match (param_val.val, patterns.ymd[1]) then -- for those that are not ymd dates (ustring because here digits may not be Western)
param_val.val, n = param_val.val:gsub ('%-', '–'); -- replace any hyphen with ndash
if 0 ~= n then
date_parameters_list[param_name].val = param_val.val; -- update the list
result = true;
end
end
end
return result; -- so we know if any hyphens were replaced
end
--[[-------------------------< D A T E _ N A M E _ X L A T E >------------------------------------------------
Attempts to translate English date names to local-language date names using names supplied by MediaWiki's
date parser function. This is simple name-for-name replacement and may not work for all languages.
if xlat_dig is true, this function will also translate Western (English) digits to the local language's digits.
This will also translate ymd dates.
]]
local function date_name_xlate (date_parameters_list, xlt_dig)
local xlate;
local mode; -- long or short month names
local modified = false;
local date;
local sources_t = {
{cfg.date_names.en.long, cfg.date_names.inv_local_long}, -- for translating long English month names to long local month names
{cfg.date_names.en.short, cfg.date_names.inv_local_short}, -- short month names
{cfg.date_names.en.quarter, cfg.date_names.inv_local_quarter}, -- quarter date names
{cfg.date_names.en.season, cfg.date_names.inv_local_season}, -- season date nam
{cfg.date_names.en.named, cfg.date_names.inv_local_named}, -- named dates
}
local function is_xlateable (month) -- local function to get local date name that replaces existing English-language date name
for _, date_names_t in ipairs (sources_t) do -- for each sequence table in date_names_t
if date_names_t[1][month] then -- if date name is English month (long or short), quarter, season or named and
if date_names_t[2][date_names_t[1][month]] then -- if there is a matching local date name
return date_names_t[2][date_names_t[1][month]]; -- return the local date name
end
end
end
end
for param_name, param_val in pairs(date_parameters_list) do -- for each date-holding parameter in the list
if is_set(param_val.val) then -- if the parameter has a value
date = param_val.val;
for month in mw.ustring.gmatch (date, '[%a ]+') do -- iterate through all date names in the date (single date or date range)
month = mw.text.trim (month); -- this because quarterly dates contain whitespace
xlate = is_xlateable (month); -- get translate <month>; returns translation or nil
if xlate then
date = mw.ustring.gsub (date, month, xlate); -- replace the English with the translation
date_parameters_list[param_name].val = date; -- save the translated date
modified = true;
end
end
if xlt_dig then -- shall we also translate digits?
date = date:gsub ('%d', cfg.date_names.xlate_digits); -- translate digits from Western to 'local digits'
date_parameters_list[param_name].val = date; -- save the translated date
modified = true;
end
end
end
return modified;
end
--[[--------------------------< S E T _ S E L E C T E D _ M O D U L E S >--------------------------------------
Sets local imported functions table to same (live or sandbox) as that used by the other modules.
]]
local function set_selected_modules (cfg_table_ptr, utilities_page_ptr)
add_prop_cat = utilities_page_ptr.add_prop_cat ; -- import functions from selected Module:Citation/CS1/Utilities module
is_set = utilities_page_ptr.is_set;
in_array = utilities_page_ptr.in_array;
set_message = utilities_page_ptr.set_message;
substitute = utilities_page_ptr.substitute;
wrap_style = utilities_page_ptr.wrap_style;
cfg = cfg_table_ptr; -- import tables from selected Module:Citation/CS1/Configuration
end
--[[--------------------------< A R C H I V E _ D A T E _ C H E C K >------------------------------------------
Compare value in |archive-date= with the timestamp in Wayback machine urls. Emits an error message with suggested
date from the |archive-url= timestamp in an appropriate format when the value in |archive-date= does not match
the timestamp.
this function never called when any date in a cs1|2 template has errors
error message suggests new |archive-date= value in an appropriate format specified by <df>. <df> is either
|df= or cfg.global_df in that order. If <df> is nil, suggested date has format from |archive-date=. There is
a caveat: when |df=dmy or |df=mdy, the reformatter leaves |access-date= and |archive-date= formats as they are.
The error message suggested date is passed to the formatter as YYYY-MM-DD so when |df=dmy or |df=mdy, the format
is not changed.
]]
local function archive_date_check (archive_date, archive_url_timestamp, df)
local archive_date_format = 'dmy-y'; -- holds the date format of date in |archive-date; default to ymd; 'dmy' used here to spoof reformat_dates()
for _, v_t in ipairs ({{'dMy', 'dmy-all'}, {'Mdy', 'mdy-all'}}) do -- is |archive-date= format dmy or mdy?
if archive_date:match (patterns[v_t[1]][1]) then -- does the pattern match?
archive_date_format = cfg.keywords_xlate[v_t[2]]; -- get appropriate |df= supported keyword from the i18n translator table
break;
end
end
local dates_t = {};
dates_t['archive-date'] = {val=archive_date, name=''}; -- setup to call reformat_dates(); never called when errors so <name> unset as not needed
reformat_dates (dates_t, 'dmy-y'); -- reformat |archive-date= to ymd; 'dmy' used here to spoof reformat_dates()
local archive_url_date = archive_url_timestamp:gsub ('(%d%d%d%d)(%d%d)(%d%d)%d*', '%1-%2-%3'); -- make ymd format date from timestamp
if dates_t['archive-date'].val == archive_url_date then -- are the two dates the same
return; -- yes, done
else
dates_t['archive-date'] = {val=archive_url_date, name=''}; -- setup to call reformat_dates() with the timestamp date
reformat_dates (dates_t, df or archive_date_format); -- reformat timestamp to format specified by <df> or format used in |archive-date=
archive_url_date = dates_t['archive-date'].val;
set_message ('err_archive_date_url_ts_mismatch', archive_url_date); -- emit an error message
end
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return { -- return exported functions
archive_date_check = archive_date_check,
date_hyphen_to_dash = date_hyphen_to_dash,
date_name_xlate = date_name_xlate,
dates = dates,
reformat_dates = reformat_dates,
set_selected_modules = set_selected_modules,
year_date_check = year_date_check,
}
718d35019893cf90ddadc83b1951cc1c7ad97de5
Module:Citation/CS1/Identifiers
828
22
38
37
2023-12-24T02:01:05Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Citation/CS1/Identifiers]]
Scribunto
text/plain
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
]]
local has_accept_as_written, is_set, in_array, set_message, select_one, -- functions in Module:Citation/CS1/Utilities
substitute, make_wikilink;
local z; -- table of tables defined in Module:Citation/CS1/Utilities
local cfg; -- table of configuration tables that are defined in Module:Citation/CS1/Configuration
--[[--------------------------< P A G E S C O P E V A R I A B L E S >--------------------------------------
declare variables here that have page-wide scope that are not brought in from other modules; that are created here and used here
]]
local auto_link_urls = {}; -- holds identifier URLs for those identifiers that can auto-link |title=
--============================<< H E L P E R F U N C T I O N S >>============================================
--[[--------------------------< W I K I D A T A _ A R T I C L E _ N A M E _ G E T >----------------------------
as an aid to internationalizing identifier-label wikilinks, gets identifier article names from Wikidata.
returns :<lang code>:<article title> when <q> has an <article title> for <lang code>; nil else
for identifiers that do not have q, returns nil
for wikis that do not have mw.wikibase installed, returns nil
]]
local function wikidata_article_name_get (q)
if not is_set (q) or (q and not mw.wikibase) then -- when no q number or when a q number but mw.wikibase not installed on this wiki
return nil; -- abandon
end
local wd_article;
local this_wiki_code = cfg.this_wiki_code; -- Wikipedia subdomain; 'en' for en.wikipedia.org
wd_article = mw.wikibase.getSitelink (q, this_wiki_code .. 'wiki'); -- fetch article title from WD; nil when no title available at this wiki
if wd_article then
wd_article = table.concat ({':', this_wiki_code, ':', wd_article}); -- interwiki-style link without brackets if taken from WD; leading colon required
end
return wd_article; -- article title from WD; nil else
end
--[[--------------------------< L I N K _ L A B E L _ M A K E >------------------------------------------------
common function to create identifier link label from handler table or from Wikidata
returns the first available of
1. redirect from local wiki's handler table (if enabled)
2. Wikidata (if there is a Wikidata entry for this identifier in the local wiki's language)
3. label specified in the local wiki's handler table
]]
local function link_label_make (handler)
local wd_article;
if not (cfg.use_identifier_redirects and is_set (handler.redirect)) then -- redirect has priority so if enabled and available don't fetch from Wikidata because expensive
wd_article = wikidata_article_name_get (handler.q); -- if Wikidata has an article title for this wiki, get it;
end
return (cfg.use_identifier_redirects and is_set (handler.redirect) and handler.redirect) or wd_article or handler.link;
end
--[[--------------------------< E X T E R N A L _ L I N K _ I D >----------------------------------------------
Formats a wiki-style external link
]]
local function external_link_id (options)
local url_string = options.id;
local ext_link;
local this_wiki_code = cfg.this_wiki_code; -- Wikipedia subdomain; 'en' for en.wikipedia.org
local wd_article; -- article title from Wikidata
if options.encode == true or options.encode == nil then
url_string = mw.uri.encode (url_string, 'PATH');
end
if options.auto_link and is_set (options.access) then
auto_link_urls[options.auto_link] = table.concat ({options.prefix, url_string, options.suffix});
end
ext_link = mw.ustring.format ('[%s%s%s %s]', options.prefix, url_string, options.suffix or "", mw.text.nowiki (options.id));
if is_set (options.access) then
ext_link = substitute (cfg.presentation['ext-link-access-signal'], {cfg.presentation[options.access].class, cfg.presentation[options.access].title, ext_link}); -- add the free-to-read / paywall lock
end
return table.concat ({
make_wikilink (link_label_make (options), options.label), -- redirect, Wikidata link, or locally specified link (in that order)
options.separator or ' ',
ext_link
});
end
--[[--------------------------< I N T E R N A L _ L I N K _ I D >----------------------------------------------
Formats a wiki-style internal link
TODO: Does not currently need to support options.access, options.encode, auto-linking and COinS (as in external_link_id),
but may be needed in the future for :m:Interwiki_map custom-prefixes like :arxiv:, :bibcode:, :DOI:, :hdl:, :ISSN:,
:JSTOR:, :Openlibrary:, :PMID:, :RFC:.
]]
local function internal_link_id (options)
local id = mw.ustring.gsub (options.id, '%d', cfg.date_names.local_digits); -- translate 'local' digits to Western 0-9
return table.concat (
{
make_wikilink (link_label_make (options), options.label), -- wiki-link the identifier label
options.separator or ' ', -- add the separator
make_wikilink (
table.concat (
{
options.prefix,
id, -- translated to Western digits
options.suffix or ''
}),
substitute (cfg.presentation['bdi'], {'', mw.text.nowiki (options.id)}) -- bdi tags to prevent Latin script identifiers from being reversed at RTL language wikis
); -- nowiki because MediaWiki still has magic links for ISBN and the like; TODO: is it really required?
});
end
--[[--------------------------< I S _ E M B A R G O E D >------------------------------------------------------
Determines if a PMC identifier's online version is embargoed. Compares the date in |pmc-embargo-date= against
today's date. If embargo date is in the future, returns the content of |pmc-embargo-date=; otherwise, returns
an empty string because the embargo has expired or because |pmc-embargo-date= was not set in this cite.
]]
local function is_embargoed (embargo)
if is_set (embargo) then
local lang = mw.getContentLanguage();
local good1, embargo_date, todays_date;
good1, embargo_date = pcall (lang.formatDate, lang, 'U', embargo);
todays_date = lang:formatDate ('U');
if good1 then -- if embargo date is a good date
if tonumber (embargo_date) >= tonumber (todays_date) then -- is embargo date is in the future?
return embargo; -- still embargoed
else
set_message ('maint_pmc_embargo'); -- embargo has expired; add main cat
return ''; -- unset because embargo has expired
end
end
end
return ''; -- |pmc-embargo-date= not set return empty string
end
--[=[-------------------------< I S _ V A L I D _ R X I V _ D A T E >------------------------------------------
for biorxiv, returns true if:
2019-12-11T00:00Z <= biorxiv_date < today + 2 days
for medrxiv, returns true if:
2020-01-01T00:00Z <= medrxiv_date < today + 2 days
The dated form of biorxiv identifier has a start date of 2019-12-11. The Unix timestamp for that date is {{#time:U|2019-12-11}} = 1576022400
The medrxiv identifier has a start date of 2020-01-01. The Unix timestamp for that date is {{#time:U|2020-01-01}} = 1577836800
<rxiv_date> is the date provided in those |biorxiv= parameter values that are dated and in |medrxiv= parameter values at time 00:00:00 UTC
<today> is the current date at time 00:00:00 UTC plus 48 hours
if today's date is 2023-01-01T00:00:00 then
adding 24 hours gives 2023-01-02T00:00:00 – one second more than today
adding 24 hours gives 2023-01-03T00:00:00 – one second more than tomorrow
inputs:
<y>, <m>, <d> – year, month, day parts of the date from the birxiv or medrxiv identifier
<select> 'b' for biorxiv, 'm' for medrxiv; defaults to 'b'
]=]
local function is_valid_rxiv_date (y, m, d, select)
if 0 == tonumber (m) and 12 < tonumber (m) then -- <m> must be a number 1–12
return false;
end
if 0 == tonumber (d) and 31 < tonumber (d) then -- <d> must be a number 1–31; TODO: account for month length and leap yer?
return false;
end
local rxiv_date = table.concat ({y, m, d}, '-'); -- make ymd date string
local good1, good2;
local rxiv_ts, tomorrow_ts; -- to hold Unix timestamps representing the dates
local lang_object = mw.getContentLanguage();
good1, rxiv_ts = pcall (lang_object.formatDate, lang_object, 'U', rxiv_date); -- convert rxiv_date value to Unix timestamp
good2, tomorrow_ts = pcall (lang_object.formatDate, lang_object, 'U', 'today + 2 days' ); -- today midnight + 2 days is one second more than all day tomorrow
if good1 and good2 then -- lang.formatDate() returns a timestamp in the local script which tonumber() may not understand
rxiv_ts = tonumber (rxiv_ts) or lang_object:parseFormattedNumber (rxiv_ts); -- convert to numbers for the comparison;
tomorrow_ts = tonumber (tomorrow_ts) or lang_object:parseFormattedNumber (tomorrow_ts);
else
return false; -- one or both failed to convert to Unix timestamp
end
local limit_ts = ((select and ('m' == select)) and 1577836800) or 1576022400; -- choose the appropriate limit timesatmp
return ((limit_ts <= rxiv_ts) and (rxiv_ts < tomorrow_ts)) -- limit_ts <= rxiv_date < tomorrow's date
end
--[[--------------------------< IS _ V A L I D _ I S X N >-----------------------------------------------------
ISBN-10 and ISSN validator code calculates checksum across all ISBN/ISSN digits including the check digit.
ISBN-13 is checked in isbn().
If the number is valid the result will be 0. Before calling this function, ISBN/ISSN must be checked for length
and stripped of dashes, spaces and other non-ISxN characters.
]]
local function is_valid_isxn (isxn_str, len)
local temp = 0;
isxn_str = { isxn_str:byte(1, len) }; -- make a table of byte values '0' → 0x30 .. '9' → 0x39, 'X' → 0x58
len = len + 1; -- adjust to be a loop counter
for i, v in ipairs (isxn_str) do -- loop through all of the bytes and calculate the checksum
if v == string.byte ("X" ) then -- if checkdigit is X (compares the byte value of 'X' which is 0x58)
temp = temp + 10 * (len - i); -- it represents 10 decimal
else
temp = temp + tonumber (string.char (v) )*(len-i);
end
end
return temp % 11 == 0; -- returns true if calculation result is zero
end
--[[--------------------------< IS _ V A L I D _ I S X N _ 1 3 >-----------------------------------------------
ISBN-13 and ISMN validator code calculates checksum across all 13 ISBN/ISMN digits including the check digit.
If the number is valid, the result will be 0. Before calling this function, ISBN-13/ISMN must be checked for length
and stripped of dashes, spaces and other non-ISxN-13 characters.
]]
local function is_valid_isxn_13 (isxn_str)
local temp=0;
isxn_str = { isxn_str:byte(1, 13) }; -- make a table of byte values '0' → 0x30 .. '9' → 0x39
for i, v in ipairs (isxn_str) do
temp = temp + (3 - 2*(i % 2)) * tonumber (string.char (v) ); -- multiply odd index digits by 1, even index digits by 3 and sum; includes check digit
end
return temp % 10 == 0; -- sum modulo 10 is zero when ISBN-13/ISMN is correct
end
--[[--------------------------< N O R M A L I Z E _ L C C N >--------------------------------------------------
LCCN normalization (https://www.loc.gov/marc/lccn-namespace.html#normalization)
1. Remove all blanks.
2. If there is a forward slash (/) in the string, remove it, and remove all characters to the right of the forward slash.
3. If there is a hyphen in the string:
a. Remove it.
b. Inspect the substring following (to the right of) the (removed) hyphen. Then (and assuming that steps 1 and 2 have been carried out):
1. All these characters should be digits, and there should be six or less. (not done in this function)
2. If the length of the substring is less than 6, left-fill the substring with zeroes until the length is six.
Returns a normalized LCCN for lccn() to validate. There is no error checking (step 3.b.1) performed in this function.
]]
local function normalize_lccn (lccn)
lccn = lccn:gsub ("%s", ""); -- 1. strip whitespace
if nil ~= string.find (lccn, '/') then
lccn = lccn:match ("(.-)/"); -- 2. remove forward slash and all character to the right of it
end
local prefix
local suffix
prefix, suffix = lccn:match ("(.+)%-(.+)"); -- 3.a remove hyphen by splitting the string into prefix and suffix
if nil ~= suffix then -- if there was a hyphen
suffix = string.rep("0", 6-string.len (suffix)) .. suffix; -- 3.b.2 left fill the suffix with 0s if suffix length less than 6
lccn = prefix..suffix; -- reassemble the LCCN
end
return lccn;
end
--============================<< I D E N T I F I E R F U N C T I O N S >>====================================
--[[--------------------------< A R X I V >--------------------------------------------------------------------
See: https://arxiv.org/help/arxiv_identifier
format and error check arXiv identifier. There are three valid forms of the identifier:
the first form, valid only between date codes 9107 and 0703, is:
arXiv:<archive>.<class>/<date code><number><version>
where:
<archive> is a string of alpha characters - may be hyphenated; no other punctuation
<class> is a string of alpha characters - may be hyphenated; no other punctuation; not the same as |class= parameter which is not supported in this form
<date code> is four digits in the form YYMM where YY is the last two digits of the four-digit year and MM is the month number January = 01
first digit of YY for this form can only 9 and 0
<number> is a three-digit number
<version> is a 1 or more digit number preceded with a lowercase v; no spaces (undocumented)
the second form, valid from April 2007 through December 2014 is:
arXiv:<date code>.<number><version>
where:
<date code> is four digits in the form YYMM where YY is the last two digits of the four-digit year and MM is the month number January = 01
<number> is a four-digit number
<version> is a 1 or more digit number preceded with a lowercase v; no spaces
the third form, valid from January 2015 is:
arXiv:<date code>.<number><version>
where:
<date code> and <version> are as defined for 0704-1412
<number> is a five-digit number
]]
local function arxiv (options)
local id = options.id;
local class = options.Class; -- TODO: lowercase?
local handler = options.handler;
local year, month, version;
local err_msg = false; -- assume no error message
local text; -- output text
if id:match("^%a[%a%.%-]+/[90]%d[01]%d%d%d%d$") or id:match("^%a[%a%.%-]+/[90]%d[01]%d%d%d%dv%d+$") then -- test for the 9107-0703 format with or without version
year, month = id:match("^%a[%a%.%-]+/([90]%d)([01]%d)%d%d%d[v%d]*$");
year = tonumber (year);
month = tonumber (month);
if ((not (90 < year or 8 > year)) or (1 > month or 12 < month)) or -- if invalid year or invalid month
((91 == year and 7 > month) or (7 == year and 3 < month)) then -- if years ok, are starting and ending months ok?
err_msg = true; -- flag for error message
end
elseif id:match("^%d%d[01]%d%.%d%d%d%d$") or id:match("^%d%d[01]%d%.%d%d%d%dv%d+$") then -- test for the 0704-1412 with or without version
year, month = id:match("^(%d%d)([01]%d)%.%d%d%d%d[v%d]*$");
year = tonumber (year);
month = tonumber (month);
if ((7 > year) or (14 < year) or (1 > month or 12 < month)) or -- is year invalid or is month invalid? (doesn't test for future years)
((7 == year) and (4 > month)) then -- when year is 07, is month invalid (before April)?
err_msg = true; -- flag for error message
end
elseif id:match("^%d%d[01]%d%.%d%d%d%d%d$") or id:match("^%d%d[01]%d%.%d%d%d%d%dv%d+$") then -- test for the 1501- format with or without version
year, month = id:match("^(%d%d)([01]%d)%.%d%d%d%d%d[v%d]*$");
year = tonumber (year);
month = tonumber (month);
if ((15 > year) or (1 > month or 12 < month)) then -- is year invalid or is month invalid? (doesn't test for future years)
err_msg = true; -- flag for error message
end
else
err_msg = true; -- not a recognized format; flag for error message
end
if err_msg then
options.coins_list_t['ARXIV'] = nil; -- when error, unset so not included in COinS
end
local err_msg_t = {};
if err_msg then
set_message ('err_bad_arxiv');
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access});
if is_set (class) then
if id:match ('^%d+') then
text = table.concat ({text, ' [[https://arxiv.org/archive/', class, ' ', class, ']]'}); -- external link within square brackets, not wikilink
else
set_message ('err_class_ignored');
end
end
return text;
end
--[[--------------------------< B I B C O D E >--------------------------------------------------------------------
Validates (sort of) and formats a bibcode ID.
Format for bibcodes is specified here: https://adsabs.harvard.edu/abs_doc/help_pages/data.html#bibcodes
But, this: 2015arXiv151206696F is apparently valid so apparently, the only things that really matter are length, 19 characters
and first four digits must be a year. This function makes these tests:
length must be 19 characters
characters in position
1–4 must be digits and must represent a year in the range of 1000 – next year
5 must be a letter
6–8 must be letter, digit, ampersand, or dot (ampersand cannot directly precede a dot; &. )
9–18 must be letter, digit, or dot
19 must be a letter or dot
]]
local function bibcode (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
local ignore_invalid = options.accept;
local err_type;
local err_msg = '';
local year;
local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode,
access = access});
if 19 ~= id:len() then
err_type = cfg.err_msg_supl.length;
else
year = id:match ("^(%d%d%d%d)[%a][%w&%.][%w&%.][%w&%.][%w.]+[%a%.]$");
if not year then -- if nil then no pattern match
err_type = cfg.err_msg_supl.value; -- so value error
else
local next_year = tonumber (os.date ('%Y')) + 1; -- get the current year as a number and add one for next year
year = tonumber (year); -- convert year portion of bibcode to a number
if (1000 > year) or (year > next_year) then
err_type = cfg.err_msg_supl.year; -- year out of bounds
end
if id:find('&%.') then
err_type = cfg.err_msg_supl.journal; -- journal abbreviation must not have '&.' (if it does it's missing a letter)
end
if id:match ('.........%.tmp%.') then -- temporary bibcodes when positions 10–14 are '.tmp.'
set_message ('maint_bibcode');
end
end
end
if is_set (err_type) and not ignore_invalid then -- if there was an error detected and accept-as-written markup not used
set_message ('err_bad_bibcode', {err_type});
options.coins_list_t['BIBCODE'] = nil; -- when error, unset so not included in COinS
end
return text;
end
--[[--------------------------< B I O R X I V >-----------------------------------------------------------------
Format bioRxiv ID and do simple error checking. Before 2019-12-11, biorXiv IDs were 10.1101/ followed by exactly
6 digits. After 2019-12-11, biorXiv IDs retained the six-digit identifier but prefixed that with a yyyy.mm.dd.
date and suffixed with an optional version identifier.
The bioRxiv ID is the string of characters:
https://doi.org/10.1101/078733 -> 10.1101/078733
or a date followed by a six-digit number followed by an optional version indicator 'v' and one or more digits:
https://www.biorxiv.org/content/10.1101/2019.12.11.123456v2 -> 10.1101/2019.12.11.123456v2
see https://www.biorxiv.org/about-biorxiv
]]
local function biorxiv (options)
local id = options.id;
local handler = options.handler;
local err_msg = true; -- flag; assume that there will be an error
local patterns = {
'^10%.1101/%d%d%d%d%d%d$', -- simple 6-digit identifier (before 2019-12-11)
'^10%.1101/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%dv%d+$', -- y.m.d. date + 6-digit identifier + version (after 2019-12-11)
'^10%.1101/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d$', -- y.m.d. date + 6-digit identifier (after 2019-12-11)
}
for _, pattern in ipairs (patterns) do -- spin through the patterns looking for a match
if id:match (pattern) then
local y, m, d = id:match (pattern); -- found a match, attempt to get year, month and date from the identifier
if m then -- m is nil when id is the six-digit form
if not is_valid_rxiv_date (y, m, d, 'b') then -- validate the encoded date; 'b' for biorxiv limit
break; -- date fail; break out early so we don't unset the error message
end
end
err_msg = nil; -- we found a match so unset the error message
break; -- and done
end
end -- err_cat remains set here when no match
if err_msg then
options.coins_list_t['BIORXIV'] = nil; -- when error, unset so not included in COinS
set_message ('err_bad_biorxiv'); -- and set the error message
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator,
encode = handler.encode, access = handler.access});
end
--[[--------------------------< C I T E S E E R X >------------------------------------------------------------
CiteSeerX use their own notion of "doi" (not to be confused with the identifiers resolved via doi.org).
The description of the structure of this identifier can be found at Help_talk:Citation_Style_1/Archive_26#CiteSeerX_id_structure
]]
local function citeseerx (options)
local id = options.id;
local handler = options.handler;
local matched;
local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode,
access = handler.access});
matched = id:match ("^10%.1%.1%.[1-9]%d?%d?%d?%.[1-9]%d?%d?%d?$");
if not matched then
set_message ('err_bad_citeseerx' );
options.coins_list_t['CITESEERX'] = nil; -- when error, unset so not included in COinS
end
return text;
end
--[[--------------------------< D O I >------------------------------------------------------------------------
Formats a DOI and checks for DOI errors.
DOI names contain two parts: prefix and suffix separated by a forward slash.
Prefix: directory indicator '10.' followed by a registrant code
Suffix: character string of any length chosen by the registrant
This function checks a DOI name for: prefix/suffix. If the DOI name contains spaces or endashes, or, if it ends
with a period or a comma, this function will emit a bad_doi error message.
DOI names are case-insensitive and can incorporate any printable Unicode characters so the test for spaces, endash,
and terminal punctuation may not be technically correct but it appears, that in practice these characters are rarely
if ever used in DOI names.
https://www.doi.org/doi_handbook/2_Numbering.html -- 2.2 Syntax of a DOI name
https://www.doi.org/doi_handbook/2_Numbering.html#2.2.2 -- 2.2.2 DOI prefix
]]
local function doi (options)
local id = options.id;
local inactive = options.DoiBroken
local access = options.access;
local ignore_invalid = options.accept;
local handler = options.handler;
local err_flag;
local text;
if is_set (inactive) then
local inactive_year = inactive:match("%d%d%d%d"); -- try to get the year portion from the inactive date
local inactive_month, good;
if is_set (inactive_year) then
if 4 < inactive:len() then -- inactive date has more than just a year (could be anything)
local lang_obj = mw.getContentLanguage(); -- get a language object for this wiki
good, inactive_month = pcall (lang_obj.formatDate, lang_obj, 'F', inactive); -- try to get the month name from the inactive date
if not good then
inactive_month = nil; -- something went wrong so make sure this is unset
end
end
end -- otherwise, |doi-broken-date= has something but it isn't a date
if is_set (inactive_year) and is_set (inactive_month) then
set_message ('maint_doi_inactive_dated', {inactive_year, inactive_month, ' '});
elseif is_set (inactive_year) then
set_message ('maint_doi_inactive_dated', {inactive_year, '', ''});
else
set_message ('maint_doi_inactive');
end
inactive = " (" .. cfg.messages['inactive'] .. ' ' .. inactive .. ')';
end
local registrant = mw.ustring.match (id, '^10%.([^/]+)/[^%s–]-[^%.,]$'); -- registrant set when DOI has the proper basic form
local registrant_err_patterns = { -- these patterns are for code ranges that are not supported
'^[^1-3]%d%d%d%d%.%d+$', -- 5 digits with subcode (0xxxx, 40000+); accepts: 10000–39999
'^[^1-6]%d%d%d%d$', -- 5 digits without subcode (0xxxx, 60000+); accepts: 10000–69999
'^[^1-9]%d%d%d%.%d+$', -- 4 digits with subcode (0xxx); accepts: 1000–9999
'^[^1-9]%d%d%d$', -- 4 digits without subcode (0xxx); accepts: 1000–9999
'^%d%d%d%d%d%d+', -- 6 or more digits
'^%d%d?%d?$', -- less than 4 digits without subcode (3 digits with subcode is legitimate)
'^%d%d?%.[%d%.]+', -- 1 or 2 digits with subcode
'^5555$', -- test registrant will never resolve
'[^%d%.]', -- any character that isn't a digit or a dot
}
if not ignore_invalid then
if registrant then -- when DOI has proper form
for i, pattern in ipairs (registrant_err_patterns) do -- spin through error patterns
if registrant:match (pattern) then -- to validate registrant codes
err_flag = set_message ('err_bad_doi'); -- when found, mark this DOI as bad
break; -- and done
end
end
else
err_flag = set_message ('err_bad_doi'); -- invalid directory or malformed
end
else
set_message ('maint_doi_ignore');
end
if err_flag then
options.coins_list_t['DOI'] = nil; -- when error, unset so not included in COinS
else
if not access and cfg.known_free_doi_registrants_t[registrant] then -- |doi-access=free not set and <registrant> is known to be free
set_message ('maint_doi_unflagged_free'); -- set a maint cat
end
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access,
auto_link = not (err_flag or is_set (inactive) or ignore_invalid) and 'doi' or nil -- do not auto-link when |doi-broken-date= has a value or when there is a DOI error or (to play it safe, after all, auto-linking is not essential) when invalid DOIs are ignored
}) .. (inactive or '');
return text;
end
--[[--------------------------< H D L >------------------------------------------------------------------------
Formats an HDL with minor error checking.
HDL names contain two parts: prefix and suffix separated by a forward slash.
Prefix: character string using any character in the UCS-2 character set except '/'
Suffix: character string of any length using any character in the UCS-2 character set chosen by the registrant
This function checks a HDL name for: prefix/suffix. If the HDL name contains spaces, endashes, or, if it ends
with a period or a comma, this function will emit a bad_hdl error message.
HDL names are case-insensitive and can incorporate any printable Unicode characters so the test for endashes and
terminal punctuation may not be technically correct but it appears, that in practice these characters are rarely
if ever used in HDLs.
Query string parameters are named here: https://www.handle.net/proxy_servlet.html. query strings are not displayed
but since '?' is an allowed character in an HDL, '?' followed by one of the query parameters is the only way we
have to detect the query string so that it isn't URL-encoded with the rest of the identifier.
]]
local function hdl (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
local query_params = { -- list of known query parameters from https://www.handle.net/proxy_servlet.html
'noredirect',
'ignore_aliases',
'auth',
'cert',
'index',
'type',
'urlappend',
'locatt',
'action',
}
local hdl, suffix, param = id:match ('(.-)(%?(%a+).+)$'); -- look for query string
local found;
if hdl then -- when there are query strings, this is the handle identifier portion
for _, q in ipairs (query_params) do -- spin through the list of query parameters
if param:match ('^' .. q) then -- if the query string begins with one of the parameters
found = true; -- announce a find
break; -- and stop looking
end
end
end
if found then
id = hdl; -- found so replace id with the handle portion; this will be URL-encoded, suffix will not
else
suffix = ''; -- make sure suffix is empty string for concatenation else
end
local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, suffix = suffix, separator = handler.separator, encode = handler.encode, access = access})
if nil == id:match("^[^%s–]-/[^%s–]-[^%.,]$") then -- HDL must contain a forward slash, must not contain spaces, endashes, and must not end with period or comma
set_message ('err_bad_hdl' );
options.coins_list_t['HDL'] = nil; -- when error, unset so not included in COinS
end
return text;
end
--[[--------------------------< I S B N >----------------------------------------------------------------------
Determines whether an ISBN string is valid
]]
local function isbn (options)
local isbn_str = options.id;
local ignore_invalid = options.accept;
local handler = options.handler;
local function return_result (check, err_type) -- local function to handle the various returns
local ISBN = internal_link_id ({link = handler.link, label = handler.label, redirect = handler.redirect,
prefix = handler.prefix, id = isbn_str, separator = handler.separator});
if ignore_invalid then -- if ignoring ISBN errors
set_message ('maint_isbn_ignore'); -- add a maint category even when there is no error
else -- here when not ignoring
if not check then -- and there is an error
options.coins_list_t['ISBN'] = nil; -- when error, unset so not included in COinS
set_message ('err_bad_isbn', err_type); -- set an error message
return ISBN; -- return id text
end
end
return ISBN; -- return id text
end
if nil ~= isbn_str:match ('[^%s-0-9X]') then
return return_result (false, cfg.err_msg_supl.char); -- fail if isbn_str contains anything but digits, hyphens, or the uppercase X
end
local id = isbn_str:gsub ('[%s-]', ''); -- remove hyphens and whitespace
local len = id:len();
if len ~= 10 and len ~= 13 then
return return_result (false, cfg.err_msg_supl.length); -- fail if incorrect length
end
if len == 10 then
if id:match ('^%d*X?$') == nil then -- fail if isbn_str has 'X' anywhere but last position
return return_result (false, cfg.err_msg_supl.form);
end
if not is_valid_isxn (id, 10) then -- test isbn-10 for numerical validity
return return_result (false, cfg.err_msg_supl.check); -- fail if isbn-10 is not numerically valid
end
if id:find ('^63[01]') then -- 630xxxxxxx and 631xxxxxxx are (apparently) not valid isbn group ids but are used by amazon as numeric identifiers (asin)
return return_result (false, cfg.err_msg_supl.group); -- fail if isbn-10 begins with 630/1
end
return return_result (true, cfg.err_msg_supl.check); -- pass if isbn-10 is numerically valid
else
if id:match ('^%d+$') == nil then
return return_result (false, cfg.err_msg_supl.char); -- fail if ISBN-13 is not all digits
end
if id:match ('^97[89]%d*$') == nil then
return return_result (false, cfg.err_msg_supl.prefix); -- fail when ISBN-13 does not begin with 978 or 979
end
if id:match ('^9790') then
return return_result (false, cfg.err_msg_supl.group); -- group identifier '0' is reserved to ISMN
end
return return_result (is_valid_isxn_13 (id), cfg.err_msg_supl.check);
end
end
--[[--------------------------< A S I N >----------------------------------------------------------------------
Formats a link to Amazon. Do simple error checking: ASIN must be mix of 10 numeric or uppercase alpha
characters. If a mix, first character must be uppercase alpha; if all numeric, ASINs must be 10-digit
ISBN. If 10-digit ISBN, add a maintenance category so a bot or AWB script can replace |asin= with |isbn=.
Error message if not 10 characters, if not ISBN-10, if mixed and first character is a digit.
|asin=630....... and |asin=631....... are (apparently) not a legitimate ISBN though it checksums as one; these
do not cause this function to emit the maint_asin message
This function is positioned here because it calls isbn()
]]
local function asin (options)
local id = options.id;
local domain = options.ASINTLD;
local err_flag;
if not id:match("^[%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u]$") then
err_flag = set_message ('err_bad_asin'); -- ASIN is not a mix of 10 uppercase alpha and numeric characters
else
if id:match("^%d%d%d%d%d%d%d%d%d[%dX]$") then -- if 10-digit numeric (or 9 digits with terminal X)
if is_valid_isxn (id, 10) then -- see if ASIN value is or validates as ISBN-10
if not id:find ('^63[01]') then -- 630xxxxxxx and 631xxxxxxx are (apparently) not a valid isbn prefixes but are used by amazon as a numeric identifier
err_flag = set_message ('err_bad_asin'); -- ASIN has ISBN-10 form but begins with something other than 630/1 so probably an isbn
end
elseif not is_set (err_flag) then
err_flag = set_message ('err_bad_asin'); -- ASIN is not ISBN-10
end
elseif not id:match("^%u[%d%u]+$") then
err_flag = set_message ('err_bad_asin'); -- asin doesn't begin with uppercase alpha
end
end
if (not is_set (domain)) or in_array (domain, {'us'}) then -- default: United States
domain = "com";
elseif in_array (domain, {'jp', 'uk'}) then -- Japan, United Kingdom
domain = "co." .. domain;
elseif in_array (domain, {'z.cn'}) then -- China
domain = "cn";
elseif in_array (domain, {'au', 'br', 'mx', 'sg', 'tr'}) then -- Australia, Brazil, Mexico, Singapore, Turkey
domain = "com." .. domain;
elseif not in_array (domain, {'ae', 'ca', 'cn', 'de', 'es', 'fr', 'in', 'it', 'nl', 'pl', 'sa', 'se', 'co.jp', 'co.uk', 'com', 'com.au', 'com.br', 'com.mx', 'com.sg', 'com.tr'}) then -- Arabic Emirates, Canada, China, Germany, Spain, France, Indonesia, Italy, Netherlands, Poland, Saudi Arabia, Sweden (as of 2021-03 Austria (.at), Liechtenstein (.li) and Switzerland (.ch) still redirect to the German site (.de) with special settings, so don't maintain local ASINs for them)
err_flag = set_message ('err_bad_asin_tld'); -- unsupported asin-tld value
end
local handler = options.handler;
if not is_set (err_flag) then
options.coins_list_t['ASIN'] = handler.prefix .. domain .. "/dp/" .. id; -- asin for coins
else
options.coins_list_t['ASIN'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix .. domain .. "/dp/",
id = id, encode = handler.encode, separator = handler.separator})
end
--[[--------------------------< I S M N >----------------------------------------------------------------------
Determines whether an ISMN string is valid. Similar to ISBN-13, ISMN is 13 digits beginning 979-0-... and uses the
same check digit calculations. See https://www.ismn-international.org/download/Web_ISMN_Users_Manual_2008-6.pdf
section 2, pages 9–12.
ismn value not made part of COinS metadata because we don't have a url or isn't a COinS-defined identifier (rft.xxx)
or an identifier registered at info-uri.info (info:)
]]
local function ismn (options)
local id = options.id;
local handler = options.handler;
local text;
local valid_ismn = true;
local id_copy;
id_copy = id; -- save a copy because this testing is destructive
id = id:gsub ('[%s-]', ''); -- remove hyphens and white space
if 13 ~= id:len() or id:match ("^9790%d*$" ) == nil then -- ISMN must be 13 digits and begin with 9790
valid_ismn = false;
else
valid_ismn=is_valid_isxn_13 (id); -- validate ISMN
end
-- text = internal_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect, -- use this (or external version) when there is some place to link to
-- prefix = handler.prefix, id = id_copy, separator = handler.separator, encode = handler.encode})
text = table.concat ( -- because no place to link to yet
{
make_wikilink (link_label_make (handler), handler.label),
handler.separator,
id_copy
});
if false == valid_ismn then
options.coins_list_t['ISMN'] = nil; -- when error, unset so not included in COinS; not really necessary here because ismn not made part of COinS
set_message ('err_bad_ismn'); -- create an error message if the ISMN is invalid
end
return text;
end
--[[--------------------------< I S S N >----------------------------------------------------------------------
Validate and format an ISSN. This code fixes the case where an editor has included an ISSN in the citation but
has separated the two groups of four digits with a space. When that condition occurred, the resulting link looked
like this:
|issn=0819 4327 gives: [https://www.worldcat.org/issn/0819 4327 0819 4327] -- can't have spaces in an external link
This code now prevents that by inserting a hyphen at the ISSN midpoint. It also validates the ISSN for length
and makes sure that the checkdigit agrees with the calculated value. Incorrect length (8 digits), characters
other than 0-9 and X, or checkdigit / calculated value mismatch will all cause a check ISSN error message. The
ISSN is always displayed with a hyphen, even if the ISSN was given as a single group of 8 digits.
]]
local function issn (options)
local id = options.id;
local handler = options.handler;
local ignore_invalid = options.accept;
local issn_copy = id; -- save a copy of unadulterated ISSN; use this version for display if ISSN does not validate
local text;
local valid_issn = true;
id = id:gsub ('[%s-]', ''); -- remove hyphens and whitespace
if 8 ~= id:len() or nil == id:match ("^%d*X?$" ) then -- validate the ISSN: 8 digits long, containing only 0-9 or X in the last position
valid_issn = false; -- wrong length or improper character
else
valid_issn = is_valid_isxn (id, 8); -- validate ISSN
end
if true == valid_issn then
id = string.sub (id, 1, 4 ) .. "-" .. string.sub (id, 5 ); -- if valid, display correctly formatted version
else
id = issn_copy; -- if not valid, show the invalid ISSN with error message
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode})
if ignore_invalid then
set_message ('maint_issn_ignore');
else
if false == valid_issn then
options.coins_list_t['ISSN'] = nil; -- when error, unset so not included in COinS
set_message ('err_bad_issn', (options.hkey == 'EISSN') and 'e' or ''); -- create an error message if the ISSN is invalid
end
end
return text;
end
--[[--------------------------< J F M >-----------------------------------------------------------------------
A numerical identifier in the form nn.nnnn.nn
]]
local function jfm (options)
local id = options.id;
local handler = options.handler;
local id_num;
id_num = id:match ('^[Jj][Ff][Mm](.*)$'); -- identifier with jfm prefix; extract identifier
if is_set (id_num) then
set_message ('maint_jfm_format');
else -- plain number without JFM prefix
id_num = id; -- if here id does not have prefix
end
if id_num and id_num:match('^%d%d%.%d%d%d%d%.%d%d$') then
id = id_num; -- jfm matches pattern
else
set_message ('err_bad_jfm' ); -- set an error message
options.coins_list_t['JFM'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});
end
--[[--------------------------< J S T O R >--------------------------------------------------------------------
Format a JSTOR with some error checking
]]
local function jstor (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
if id:find ('[Jj][Ss][Tt][Oo][Rr]') or id:find ('^https?://') or id:find ('%s') then
set_message ('err_bad_jstor'); -- set an error message
options.coins_list_t['JSTOR'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});
end
--[[--------------------------< L C C N >----------------------------------------------------------------------
Format LCCN link and do simple error checking. LCCN is a character string 8-12 characters long. The length of
the LCCN dictates the character type of the first 1-3 characters; the rightmost eight are always digits.
https://oclc-research.github.io/infoURI-Frozen/info-uri.info/info:lccn/reg.html
length = 8 then all digits
length = 9 then lccn[1] is lowercase alpha
length = 10 then lccn[1] and lccn[2] are both lowercase alpha or both digits
length = 11 then lccn[1] is lower case alpha, lccn[2] and lccn[3] are both lowercase alpha or both digits
length = 12 then lccn[1] and lccn[2] are both lowercase alpha
]]
local function lccn (options)
local lccn = options.id;
local handler = options.handler;
local err_flag; -- presume that LCCN is valid
local id = lccn; -- local copy of the LCCN
id = normalize_lccn (id); -- get canonical form (no whitespace, hyphens, forward slashes)
local len = id:len(); -- get the length of the LCCN
if 8 == len then
if id:match("[^%d]") then -- if LCCN has anything but digits (nil if only digits)
err_flag = set_message ('err_bad_lccn'); -- set an error message
end
elseif 9 == len then -- LCCN should be adddddddd
if nil == id:match("%l%d%d%d%d%d%d%d%d") then -- does it match our pattern?
err_flag = set_message ('err_bad_lccn'); -- set an error message
end
elseif 10 == len then -- LCCN should be aadddddddd or dddddddddd
if id:match("[^%d]") then -- if LCCN has anything but digits (nil if only digits) ...
if nil == id:match("^%l%l%d%d%d%d%d%d%d%d") then -- ... see if it matches our pattern
err_flag = set_message ('err_bad_lccn'); -- no match, set an error message
end
end
elseif 11 == len then -- LCCN should be aaadddddddd or adddddddddd
if not (id:match("^%l%l%l%d%d%d%d%d%d%d%d") or id:match("^%l%d%d%d%d%d%d%d%d%d%d")) then -- see if it matches one of our patterns
err_flag = set_message ('err_bad_lccn'); -- no match, set an error message
end
elseif 12 == len then -- LCCN should be aadddddddddd
if not id:match("^%l%l%d%d%d%d%d%d%d%d%d%d") then -- see if it matches our pattern
err_flag = set_message ('err_bad_lccn'); -- no match, set an error message
end
else
err_flag = set_message ('err_bad_lccn'); -- wrong length, set an error message
end
if not is_set (err_flag) and nil ~= lccn:find ('%s') then
err_flag = set_message ('err_bad_lccn'); -- lccn contains a space, set an error message
end
if is_set (err_flag) then
options.coins_list_t['LCCN'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = lccn, separator = handler.separator, encode = handler.encode});
end
--[[--------------------------< M E D R X I V >-----------------------------------------------------------------
Format medRxiv ID and do simple error checking. Similar to later bioRxiv IDs, medRxiv IDs are prefixed with a
yyyy.mm.dd. date and suffixed with an optional version identifier. Ealiest date accepted is 2020.01.01
The medRxiv ID is a date followed by an eight-digit number followed by an optional version indicator 'v' and one or more digits:
https://www.medrxiv.org/content/10.1101/2020.11.16.20232009v2 -> 10.1101/2020.11.16.20232009v2
]]
local function medrxiv (options)
local id = options.id;
local handler = options.handler;
local err_msg_flag = true; -- flag; assume that there will be an error
local patterns = {
'%d%d%d%d%d%d%d%d$', -- simple 8-digit identifier; these should be relatively rare
'^10%.1101/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d%d%dv%d+$', -- y.m.d. date + 8-digit identifier + version (2020-01-01 and later)
'^10%.1101/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d%d%d$', -- y.m.d. date + 8-digit identifier (2020-01-01 and later)
}
for _, pattern in ipairs (patterns) do -- spin through the patterns looking for a match
if id:match (pattern) then
local y, m, d = id:match (pattern); -- found a match, attempt to get year, month and date from the identifier
if m then -- m is nil when id is the 8-digit form
if not is_valid_rxiv_date (y, m, d, 'b') then -- validate the encoded date; 'b' for medrxiv limit
break; -- date fail; break out early so we don't unset the error message
end
end
err_msg_flag = nil; -- we found a match so unset the error message
break; -- and done
end
end -- <err_msg_flag> remains set here when no match
if err_msg_flag then
options.coins_list_t['MEDRXIV'] = nil; -- when error, unset so not included in COinS
set_message ('err_bad_medrxiv'); -- and set the error message
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator,
encode = handler.encode, access = handler.access});
end
--[[--------------------------< M R >--------------------------------------------------------------------------
A seven digit number; if not seven digits, zero-fill leading digits to make seven digits.
]]
local function mr (options)
local id = options.id;
local handler = options.handler;
local id_num;
local id_len;
id_num = id:match ('^[Mm][Rr](%d+)$'); -- identifier with mr prefix
if is_set (id_num) then
set_message ('maint_mr_format'); -- add maint cat
else -- plain number without mr prefix
id_num = id:match ('^%d+$'); -- if here id is all digits
end
id_len = id_num and id_num:len() or 0;
if (7 >= id_len) and (0 ~= id_len) then
id = string.rep ('0', 7-id_len) .. id_num; -- zero-fill leading digits
else
set_message ('err_bad_mr'); -- set an error message
options.coins_list_t['MR'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});
end
--[[--------------------------< O C L C >----------------------------------------------------------------------
Validate and format an OCLC ID. https://www.oclc.org/batchload/controlnumber.en.html {{dead link}}
archived at: https://web.archive.org/web/20161228233804/https://www.oclc.org/batchload/controlnumber.en.html
]]
local function oclc (options)
local id = options.id;
local handler = options.handler;
local number;
if id:match('^ocm%d%d%d%d%d%d%d%d$') then -- ocm prefix and 8 digits; 001 field (12 characters)
number = id:match('ocm(%d+)'); -- get the number
elseif id:match('^ocn%d%d%d%d%d%d%d%d%d$') then -- ocn prefix and 9 digits; 001 field (12 characters)
number = id:match('ocn(%d+)'); -- get the number
elseif id:match('^on%d%d%d%d%d%d%d%d%d%d+$') then -- on prefix and 10 or more digits; 001 field (12 characters)
number = id:match('^on(%d%d%d%d%d%d%d%d%d%d+)$'); -- get the number
elseif id:match('^%(OCoLC%)[1-9]%d*$') then -- (OCoLC) prefix and variable number digits; no leading zeros; 035 field
number = id:match('%(OCoLC%)([1-9]%d*)'); -- get the number
if 9 < number:len() then
number = nil; -- constrain to 1 to 9 digits; change this when OCLC issues 10-digit numbers
end
elseif id:match('^%d+$') then -- no prefix
number = id; -- get the number
if tonumber (id) > handler.id_limit then
number = nil; -- unset when id value exceeds the limit
end
end
if number then -- proper format
id = number; -- exclude prefix, if any, from external link
else
set_message ('err_bad_oclc') -- add an error message if the id is malformed
options.coins_list_t['OCLC'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});
end
--[[--------------------------< O P E N L I B R A R Y >--------------------------------------------------------
Formats an OpenLibrary link, and checks for associated errors.
]]
local function openlibrary (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
local ident, code = id:gsub('^OL', ''):match("^(%d+([AMW]))$"); -- strip optional OL prefix followed immediately by digits followed by 'A', 'M', or 'W';
local err_flag;
local prefix = { -- these are appended to the handler.prefix according to code
['A']='authors/OL',
['M']='books/OL',
['W']='works/OL',
['X']='OL' -- not a code; spoof when 'code' in id is invalid
};
if not ident then
code = 'X'; -- no code or id completely invalid
ident = id; -- copy id to ident so that we display the flawed identifier
err_flag = set_message ('err_bad_ol');
end
if not is_set (err_flag) then
options.coins_list_t['OL'] = handler.prefix .. prefix[code] .. ident; -- experiment for ol coins
else
options.coins_list_t['OL'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix .. prefix[code],
id = ident, separator = handler.separator, encode = handler.encode,
access = access});
end
--[[--------------------------< O S T I >----------------------------------------------------------------------
Format OSTI and do simple error checking. OSTIs are sequential numbers beginning at 1 and counting up. This
code checks the OSTI to see that it contains only digits and is less than test_limit specified in the configuration;
the value in test_limit will need to be updated periodically as more OSTIs are issued.
NB. 1018 is the lowest OSTI number found in the wild (so far) and resolving OK on the OSTI site
]]
local function osti (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
if id:match("[^%d]") then -- if OSTI has anything but digits
set_message ('err_bad_osti'); -- set an error message
options.coins_list_t['OSTI'] = nil; -- when error, unset so not included in COinS
else -- OSTI is only digits
local id_num = tonumber (id); -- convert id to a number for range testing
if 1018 > id_num or handler.id_limit < id_num then -- if OSTI is outside test limit boundaries
set_message ('err_bad_osti'); -- set an error message
options.coins_list_t['OSTI'] = nil; -- when error, unset so not included in COinS
end
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});
end
--[[--------------------------< P M C >------------------------------------------------------------------------
Format a PMC, do simple error checking, and check for embargoed articles.
The embargo parameter takes a date for a value. If the embargo date is in the future the PMC identifier will not
be linked to the article. If the embargo date is today or in the past, or if it is empty or omitted, then the
PMC identifier is linked to the article through the link at cfg.id_handlers['PMC'].prefix.
PMC embargo date testing is done in function is_embargoed () which is called earlier because when the citation
has |pmc=<value> but does not have a |url= then |title= is linked with the PMC link. Function is_embargoed ()
returns the embargo date if the PMC article is still embargoed, otherwise it returns an empty string.
PMCs are sequential numbers beginning at 1 and counting up. This code checks the PMC to see that it contains only digits and is less
than test_limit; the value in local variable test_limit will need to be updated periodically as more PMCs are issued.
]]
local function pmc (options)
local id = options.id;
local embargo = options.Embargo; -- TODO: lowercase?
local handler = options.handler;
local err_flag;
local id_num;
local text;
id_num = id:match ('^[Pp][Mm][Cc](%d+)$'); -- identifier with PMC prefix
if is_set (id_num) then
set_message ('maint_pmc_format');
else -- plain number without PMC prefix
id_num = id:match ('^%d+$'); -- if here id is all digits
end
if is_set (id_num) then -- id_num has a value so test it
id_num = tonumber (id_num); -- convert id_num to a number for range testing
if 1 > id_num or handler.id_limit < id_num then -- if PMC is outside test limit boundaries
err_flag = set_message ('err_bad_pmc'); -- set an error message
else
id = tostring (id_num); -- make sure id is a string
end
else -- when id format incorrect
err_flag = set_message ('err_bad_pmc'); -- set an error message
end
if is_set (embargo) and is_set (is_embargoed (embargo)) then -- is PMC is still embargoed?
text = table.concat ( -- still embargoed so no external link
{
make_wikilink (link_label_make (handler), handler.label),
handler.separator,
id,
});
else
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect, -- no embargo date or embargo has expired, ok to link to article
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access,
auto_link = not err_flag and 'pmc' or nil -- do not auto-link when PMC has error
});
end
if err_flag then
options.coins_list_t['PMC'] = nil; -- when error, unset so not included in COinS
end
return text;
end
--[[--------------------------< P M I D >----------------------------------------------------------------------
Format PMID and do simple error checking. PMIDs are sequential numbers beginning at 1 and counting up. This
code checks the PMID to see that it contains only digits and is less than test_limit; the value in local variable
test_limit will need to be updated periodically as more PMIDs are issued.
]]
local function pmid (options)
local id = options.id;
local handler = options.handler;
if id:match("[^%d]") then -- if PMID has anything but digits
set_message ('err_bad_pmid'); -- set an error message
options.coins_list_t['PMID'] = nil; -- when error, unset so not included in COinS
else -- PMID is only digits
local id_num = tonumber (id); -- convert id to a number for range testing
if 1 > id_num or handler.id_limit < id_num then -- if PMID is outside test limit boundaries
set_message ('err_bad_pmid'); -- set an error message
options.coins_list_t['PMID'] = nil; -- when error, unset so not included in COinS
end
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});
end
--[[--------------------------< R F C >------------------------------------------------------------------------
Format RFC and do simple error checking. RFCs are sequential numbers beginning at 1 and counting up. This
code checks the RFC to see that it contains only digits and is less than test_limit specified in the configuration;
the value in test_limit will need to be updated periodically as more RFCs are issued.
An index of all RFCs is here: https://tools.ietf.org/rfc/
]]
local function rfc (options)
local id = options.id;
local handler = options.handler;
if id:match("[^%d]") then -- if RFC has anything but digits
set_message ('err_bad_rfc'); -- set an error message
options.coins_list_t['RFC'] = nil; -- when error, unset so not included in COinS
else -- RFC is only digits
local id_num = tonumber (id); -- convert id to a number for range testing
if 1 > id_num or handler.id_limit < id_num then -- if RFC is outside test limit boundaries
set_message ('err_bad_rfc'); -- set an error message
options.coins_list_t['RFC'] = nil; -- when error, unset so not included in COinS
end
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access});
end
--[[--------------------------< S 2 C I D >--------------------------------------------------------------------
Format an S2CID, do simple error checking
S2CIDs are sequential numbers beginning at 1 and counting up. This code checks the S2CID to see that it is only
digits and is less than test_limit; the value in local variable test_limit will need to be updated periodically
as more S2CIDs are issued.
]]
local function s2cid (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
local id_num;
local text;
id_num = id:match ('^[1-9]%d*$'); -- id must be all digits; must not begin with 0; no open access flag
if is_set (id_num) then -- id_num has a value so test it
id_num = tonumber (id_num); -- convert id_num to a number for range testing
if handler.id_limit < id_num then -- if S2CID is outside test limit boundaries
set_message ('err_bad_s2cid'); -- set an error message
options.coins_list_t['S2CID'] = nil; -- when error, unset so not included in COinS
end
else -- when id format incorrect
set_message ('err_bad_s2cid'); -- set an error message
options.coins_list_t['S2CID'] = nil; -- when error, unset so not included in COinS
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});
return text;
end
--[[--------------------------< S B N >------------------------------------------------------------------------
9-digit form of ISBN-10; uses same check-digit validation when SBN is prefixed with an additional '0' to make 10 digits
sbn value not made part of COinS metadata because we don't have a url or isn't a COinS-defined identifier (rft.xxx)
or an identifier registered at info-uri.info (info:)
]]
local function sbn (options)
local id = options.id;
local ignore_invalid = options.accept;
local handler = options.handler;
local function return_result (check, err_type) -- local function to handle the various returns
local SBN = internal_link_id ({link = handler.link, label = handler.label, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator});
if not ignore_invalid then -- if not ignoring SBN errors
if not check then
options.coins_list_t['SBN'] = nil; -- when error, unset so not included in COinS; not really necessary here because sbn not made part of COinS
set_message ('err_bad_sbn', {err_type}); -- display an error message
return SBN;
end
else
set_message ('maint_isbn_ignore'); -- add a maint category even when there is no error (ToDo: Possibly switch to separate message for SBNs only)
end
return SBN;
end
if id:match ('[^%s-0-9X]') then
return return_result (false, cfg.err_msg_supl.char); -- fail if SBN contains anything but digits, hyphens, or the uppercase X
end
local ident = id:gsub ('[%s-]', ''); -- remove hyphens and whitespace; they interfere with the rest of the tests
if 9 ~= ident:len() then
return return_result (false, cfg.err_msg_supl.length); -- fail if incorrect length
end
if ident:match ('^%d*X?$') == nil then
return return_result (false, cfg.err_msg_supl.form); -- fail if SBN has 'X' anywhere but last position
end
return return_result (is_valid_isxn ('0' .. ident, 10), cfg.err_msg_supl.check);
end
--[[--------------------------< S S R N >----------------------------------------------------------------------
Format an SSRN, do simple error checking
SSRNs are sequential numbers beginning at 100? and counting up. This code checks the SSRN to see that it is
only digits and is greater than 99 and less than test_limit; the value in local variable test_limit will need
to be updated periodically as more SSRNs are issued.
]]
local function ssrn (options)
local id = options.id;
local handler = options.handler;
local id_num;
local text;
id_num = id:match ('^%d+$'); -- id must be all digits
if is_set (id_num) then -- id_num has a value so test it
id_num = tonumber (id_num); -- convert id_num to a number for range testing
if 100 > id_num or handler.id_limit < id_num then -- if SSRN is outside test limit boundaries
set_message ('err_bad_ssrn'); -- set an error message
options.coins_list_t['SSRN'] = nil; -- when error, unset so not included in COinS
end
else -- when id format incorrect
set_message ('err_bad_ssrn'); -- set an error message
options.coins_list_t['SSRN'] = nil; -- when error, unset so not included in COinS
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = options.access});
return text;
end
--[[--------------------------< U S E N E T _ I D >------------------------------------------------------------
Validate and format a usenet message id. Simple error checking, looks for 'id-left@id-right' not enclosed in
'<' and/or '>' angle brackets.
]]
local function usenet_id (options)
local id = options.id;
local handler = options.handler;
local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode})
if not id:match('^.+@.+$') or not id:match('^[^<].*[^>]$') then -- doesn't have '@' or has one or first or last character is '< or '>'
set_message ('err_bad_usenet_id') -- add an error message if the message id is invalid
options.coins_list_t['USENETID'] = nil; -- when error, unset so not included in COinS
end
return text;
end
--[[--------------------------< Z B L >-----------------------------------------------------------------------
A numerical identifier in the form nnnn.nnnnn - leading zeros in the first quartet optional
format described here: http://emis.mi.sanu.ac.rs/ZMATH/zmath/en/help/search/
temporary format is apparently eight digits. Anything else is an error
]]
local function zbl (options)
local id = options.id;
local handler = options.handler;
if id:match('^%d%d%d%d%d%d%d%d$') then -- is this identifier using temporary format?
set_message ('maint_zbl'); -- yes, add maint cat
elseif not id:match('^%d?%d?%d?%d%.%d%d%d%d%d$') then -- not temporary, is it normal format?
set_message ('err_bad_zbl'); -- no, set an error message
options.coins_list_t['ZBL'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});
end
--============================<< I N T E R F A C E F U N C T I O N S >>==========================================
--[[--------------------------< E X T R A C T _ I D S >------------------------------------------------------------
Populates ID table from arguments using configuration settings. Loops through cfg.id_handlers and searches args for
any of the parameters listed in each cfg.id_handlers['...'].parameters. If found, adds the parameter and value to
the identifier list. Emits redundant error message if more than one alias exists in args
]]
local function extract_ids (args)
local id_list = {}; -- list of identifiers found in args
for k, v in pairs (cfg.id_handlers) do -- k is uppercase identifier name as index to cfg.id_handlers; e.g. cfg.id_handlers['ISBN'], v is a table
v = select_one (args, v.parameters, 'err_redundant_parameters' ); -- v.parameters is a table of aliases for k; here we pick one from args if present
if is_set (v) then id_list[k] = v; end -- if found in args, add identifier to our list
end
return id_list;
end
--[[--------------------------< E X T R A C T _ I D _ A C C E S S _ L E V E L S >--------------------------------------
Fetches custom id access levels from arguments using configuration settings. Parameters which have a predefined access
level (e.g. arxiv) do not use this function as they are directly rendered as free without using an additional parameter.
returns a table of k/v pairs where k is same as the identifier's key in cfg.id_handlers and v is the assigned (valid) keyword
access-level values must match the case used in cfg.keywords_lists['id-access'] (lowercase unless there is some special reason for something else)
]]
local function extract_id_access_levels (args, id_list)
local id_accesses_list = {};
for k, v in pairs (cfg.id_handlers) do
local access_param = v.custom_access; -- name of identifier's access-level parameter
if is_set (access_param) then
local access_level = args[access_param]; -- get the assigned value if there is one
if is_set (access_level) then
if not in_array (access_level, cfg.keywords_lists['id-access']) then -- exact match required
set_message ('err_invalid_param_val', {access_param, access_level});
access_level = nil; -- invalid so unset
end
if not is_set (id_list[k]) then -- identifier access-level must have a matching identifier
set_message ('err_param_access_requires_param', {k:lower()}); -- parameter name is uppercase in cfg.id_handlers (k); lowercase for error message
end
id_accesses_list[k] = cfg.keywords_xlate[access_level]; -- get translated keyword
end
end
end
return id_accesses_list;
end
--[[--------------------------< B U I L D _ I D _ L I S T >----------------------------------------------------
render the identifiers into a sorted sequence table
<ID_list_coins_t> is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value
<options_t> is a table of various k/v option pairs provided in the call to new_build_id_list();
modified by this function and passed to all identifier rendering functions
<access_levels_t> is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value (if valid)
returns a sequence table of sorted (by hkey - 'handler' key) rendered identifier strings
]]
local function build_id_list (ID_list_coins_t, options_t, access_levels_t)
local ID_list_t = {};
local accept;
local func_map = { --function map points to functions associated with hkey identifier
['ARXIV'] = arxiv,
['ASIN'] = asin,
['BIBCODE'] = bibcode,
['BIORXIV'] = biorxiv,
['CITESEERX'] = citeseerx,
['DOI'] = doi,
['EISSN'] = issn,
['HDL'] = hdl,
['ISBN'] = isbn,
['ISMN'] = ismn,
['ISSN'] = issn,
['JFM'] = jfm,
['JSTOR'] = jstor,
['LCCN'] = lccn,
['MEDRXIV'] = medrxiv,
['MR'] = mr,
['OCLC'] = oclc,
['OL'] = openlibrary,
['OSTI'] = osti,
['PMC'] = pmc,
['PMID'] = pmid,
['RFC'] = rfc,
['S2CID'] = s2cid,
['SBN'] = sbn,
['SSRN'] = ssrn,
['USENETID'] = usenet_id,
['ZBL'] = zbl,
}
for hkey, v in pairs (ID_list_coins_t) do
v, accept = has_accept_as_written (v); -- remove accept-as-written markup if present; accept is boolean true when markup removed; false else
-- every function gets the options table with value v and accept boolean
options_t.hkey = hkey; -- ~/Configuration handler key
options_t.id = v; -- add that identifier value to the options table
options_t.accept = accept; -- add the accept boolean flag
options_t.access = access_levels_t[hkey]; -- add the access level for those that have an |<identifier-access= parameter
options_t.handler = cfg.id_handlers[hkey];
options_t.coins_list_t = ID_list_coins_t; -- pointer to ID_list_coins_t; for |asin= and |ol=; also to keep erroneous values out of the citation's metadata
options_t.coins_list_t[hkey] = v; -- id value without accept-as-written markup for metadata
if options_t.handler.access and not in_array (options_t.handler.access, cfg.keywords_lists['id-access']) then
error (cfg.messages['unknown_ID_access'] .. options_t.handler.access); -- here when handler access key set to a value not listed in list of allowed id access keywords
end
if func_map[hkey] then
local id_text = func_map[hkey] (options_t); -- call the function to get identifier text and any error message
table.insert (ID_list_t, {hkey, id_text}); -- add identifier text to the output sequence table
else
error (cfg.messages['unknown_ID_key'] .. hkey); -- here when func_map doesn't have a function for hkey
end
end
local function comp (a, b) -- used by following table.sort()
return a[1]:lower() < b[1]:lower(); -- sort by hkey
end
table.sort (ID_list_t, comp); -- sequence table of tables sort
for k, v in ipairs (ID_list_t) do -- convert sequence table of tables to simple sequence table of strings
ID_list_t[k] = v[2]; -- v[2] is the identifier rendering from the call to the various functions in func_map{}
end
return ID_list_t;
end
--[[--------------------------< O P T I O N S _ C H E C K >----------------------------------------------------
check that certain option parameters have their associated identifier parameters with values
<ID_list_coins_t> is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value
<ID_support_t> is a sequence table of tables created in citation0() where each subtable has four elements:
[1] is the support parameter's assigned value; empty string if not set
[2] is a text string same as key in cfg.id_handlers
[3] is cfg.error_conditions key used to create error message
[4] is original ID support parameter name used to create error message
returns nothing; on error emits an appropriate error message
]]
local function options_check (ID_list_coins_t, ID_support_t)
for _, v in ipairs (ID_support_t) do
if is_set (v[1]) and not ID_list_coins_t[v[2]] then -- when support parameter has a value but matching identifier parameter is missing or empty
set_message (v[3], (v[4])); -- emit the appropriate error message
end
end
end
--[[--------------------------< I D E N T I F I E R _ L I S T S _ G E T >--------------------------------------
Creates two identifier lists: a k/v table of identifiers and their values to be used locally and for use in the
COinS metadata, and a sequence table of the rendered identifier strings that will be included in the rendered
citation.
]]
local function identifier_lists_get (args_t, options_t, ID_support_t)
local ID_list_coins_t = extract_ids (args_t); -- get a table of identifiers and their values for use locally and for use in COinS
options_check (ID_list_coins_t, ID_support_t); -- ID support parameters must have matching identifier parameters
local ID_access_levels_t = extract_id_access_levels (args_t, ID_list_coins_t); -- get a table of identifier access levels
local ID_list_t = build_id_list (ID_list_coins_t, options_t, ID_access_levels_t); -- get a sequence table of rendered identifier strings
return ID_list_t, ID_list_coins_t; -- return the tables
end
--[[--------------------------< S E T _ S E L E C T E D _ M O D U L E S >--------------------------------------
Sets local cfg table and imported functions table to same (live or sandbox) as that used by the other modules.
]]
local function set_selected_modules (cfg_table_ptr, utilities_page_ptr)
cfg = cfg_table_ptr;
has_accept_as_written = utilities_page_ptr.has_accept_as_written; -- import functions from select Module:Citation/CS1/Utilities module
is_set = utilities_page_ptr.is_set;
in_array = utilities_page_ptr.in_array;
set_message = utilities_page_ptr.set_message;
select_one = utilities_page_ptr.select_one;
substitute = utilities_page_ptr.substitute;
make_wikilink = utilities_page_ptr.make_wikilink;
z = utilities_page_ptr.z; -- table of tables in Module:Citation/CS1/Utilities
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {
auto_link_urls = auto_link_urls, -- table of identifier URLs to be used when auto-linking |title=
identifier_lists_get = identifier_lists_get, -- experiment to replace individual calls to build_id_list(), extract_ids, extract_id_access_levels
is_embargoed = is_embargoed;
set_selected_modules = set_selected_modules;
}
3abc2deceb5ede29ebd4cded31822d8bda63ab7d
Module:Citation/CS1/COinS
828
23
40
39
2023-12-24T02:01:05Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Citation/CS1/COinS]]
Scribunto
text/plain
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
]]
local has_accept_as_written, is_set, in_array, remove_wiki_link, strip_apostrophe_markup; -- functions in Module:Citation/CS1/Utilities
local cfg; -- table of configuration tables that are defined in Module:Citation/CS1/Configuration
--[[--------------------------< M A K E _ C O I N S _ T I T L E >----------------------------------------------
Makes a title for COinS from Title and / or ScriptTitle (or any other name-script pairs)
Apostrophe markup (bold, italics) is stripped from each value so that the COinS metadata isn't corrupted with strings
of %27%27...
]]
local function make_coins_title (title, script)
title = has_accept_as_written (title);
if is_set (title) then
title = strip_apostrophe_markup (title); -- strip any apostrophe markup
else
title = ''; -- if not set, make sure title is an empty string
end
if is_set (script) then
script = script:gsub ('^%l%l%s*:%s*', ''); -- remove language prefix if present (script value may now be empty string)
script = strip_apostrophe_markup (script); -- strip any apostrophe markup
else
script = ''; -- if not set, make sure script is an empty string
end
if is_set (title) and is_set (script) then
script = ' ' .. script; -- add a space before we concatenate
end
return title .. script; -- return the concatenation
end
--[[--------------------------< E S C A P E _ L U A _ M A G I C _ C H A R S >----------------------------------
Returns a string where all of Lua's magic characters have been escaped. This is important because functions like
string.gsub() treat their pattern and replace strings as patterns, not literal strings.
]]
local function escape_lua_magic_chars (argument)
argument = argument:gsub("%%", "%%%%"); -- replace % with %%
argument = argument:gsub("([%^%$%(%)%.%[%]%*%+%-%?])", "%%%1"); -- replace all other Lua magic pattern characters
return argument;
end
--[[--------------------------< G E T _ C O I N S _ P A G E S >------------------------------------------------
Extract page numbers from external wikilinks in any of the |page=, |pages=, or |at= parameters for use in COinS.
]]
local function get_coins_pages (pages)
local pattern;
if not is_set (pages) then return pages; end -- if no page numbers then we're done
while true do
pattern = pages:match("%[(%w*:?//[^ ]+%s+)[%w%d].*%]"); -- pattern is the opening bracket, the URL and following space(s): "[url "
if nil == pattern then break; end -- no more URLs
pattern = escape_lua_magic_chars (pattern); -- pattern is not a literal string; escape Lua's magic pattern characters
pages = pages:gsub(pattern, ""); -- remove as many instances of pattern as possible
end
pages = pages:gsub("[%[%]]", ""); -- remove the brackets
pages = pages:gsub("–", "-" ); -- replace endashes with hyphens
pages = pages:gsub("&%w+;", "-" ); -- and replace HTML entities (– etc.) with hyphens; do we need to replace numerical entities like   and the like?
return pages;
end
--[=[-------------------------< C O I N S _ R E P L A C E _ M A T H _ S T R I P M A R K E R >------------------
There are three options for math markup rendering that depend on the editor's math preference settings. These
settings are at [[Special:Preferences#mw-prefsection-rendering]] and are
PNG images
TeX source
MathML with SVG or PNG fallback
All three are heavy with HTML and CSS which doesn't belong in the metadata.
Without this function, the metadata saved in the raw wikitext contained the rendering determined by the settings
of the last editor to save the page.
This function gets the rendered form of an equation according to the editor's preference before the page is saved. It
then searches the rendering for the text equivalent of the rendered equation and replaces the rendering with that so
that the page is saved without extraneous HTML/CSS markup and with a reasonably readable text form of the equation.
When a replacement is made, this function returns true and the value with replacement; otherwise false and the initial
value. To replace multipe equations it is necessary to call this function from within a loop.
]=]
local function coins_replace_math_stripmarker (value)
local stripmarker = cfg.stripmarkers['math'];
local rendering = value:match (stripmarker); -- is there a math stripmarker
if not rendering then -- when value doesn't have a math stripmarker, abandon this test
return false, value;
end
rendering = mw.text.unstripNoWiki (rendering); -- convert stripmarker into rendered value (or nil? ''? when math render error)
if rendering:match ('alt="[^"]+"') then -- if PNG math option
rendering = rendering:match ('alt="([^"]+)"'); -- extract just the math text
elseif rendering:match ('$%s+.+%s+%$') then -- if TeX math option; $ is legit character that is escapes as \$
rendering = rendering:match ('$%s+(.+)%s+%$') -- extract just the math text
elseif rendering:match ('<annotation[^>]+>.+</annotation>') then -- if MathML math option
rendering = rendering:match ('<annotation[^>]+>(.+)</annotation>') -- extract just the math text
else
return false, value; -- had math stripmarker but not one of the three defined forms
end
return true, value:gsub (stripmarker, rendering, 1);
end
--[[--------------------------< C O I N S _ C L E A N U P >----------------------------------------------------
Cleanup parameter values for the metadata by removing or replacing invisible characters and certain HTML entities.
2015-12-10: there is a bug in mw.text.unstripNoWiki (). It replaces math stripmarkers with the appropriate content
when it shouldn't. See https://phabricator.wikimedia.org/T121085 and Wikipedia_talk:Lua#stripmarkers_and_mw.text.unstripNoWiki.28.29
TODO: move the replacement patterns and replacement values into a table in /Configuration similar to the invisible
characters table?
]]
local function coins_cleanup (value)
local replaced = true; -- default state to get the do loop running
while replaced do -- loop until all math stripmarkers replaced
replaced, value = coins_replace_math_stripmarker (value); -- replace math stripmarker with text representation of the equation
end
value = value:gsub (cfg.stripmarkers['math'], "MATH RENDER ERROR"); -- one or more couldn't be replaced; insert vague error message
value = mw.text.unstripNoWiki (value); -- replace nowiki stripmarkers with their content
value = value:gsub ('<span class="nowrap" style="padding%-left:0%.1em;">'(s?)</span>', "'%1"); -- replace {{'}} or {{'s}} with simple apostrophe or apostrophe-s
value = value:gsub (' ', ' '); -- replace entity with plain space
value = value:gsub ('\226\128\138', ' '); -- replace hair space with plain space
if not mw.ustring.find (value, cfg.indic_script) then -- don't remove zero-width joiner characters from indic script
value = value:gsub ('‍', ''); -- remove ‍ entities
value = mw.ustring.gsub (value, '[\226\128\141\226\128\139\194\173]', ''); -- remove zero-width joiner, zero-width space, soft hyphen
end
value = value:gsub ('[\009\010\013 ]+', ' '); -- replace horizontal tab, line feed, carriage return with plain space
return value;
end
--[[--------------------------< C O I N S >--------------------------------------------------------------------
COinS metadata (see <http://ocoins.info/>) allows automated tools to parse the citation information.
]]
local function COinS(data, class)
if 'table' ~= type(data) or nil == next(data) then
return '';
end
for k, v in pairs (data) do -- spin through all of the metadata parameter values
if 'ID_list' ~= k and 'Authors' ~= k then -- except the ID_list and Author tables (author nowiki stripmarker done when Author table processed)
data[k] = coins_cleanup (v);
end
end
local ctx_ver = "Z39.88-2004";
-- treat table strictly as an array with only set values.
local OCinSoutput = setmetatable( {}, {
__newindex = function(self, key, value)
if is_set(value) then
rawset( self, #self+1, table.concat{ key, '=', mw.uri.encode( remove_wiki_link( value ) ) } );
end
end
});
if in_array (class, {'arxiv', 'biorxiv', 'citeseerx', 'medrxiv', 'ssrn', 'journal', 'news', 'magazine'}) or
(in_array (class, {'conference', 'interview', 'map', 'press release', 'web'}) and is_set(data.Periodical)) or
('citation' == class and is_set(data.Periodical) and not is_set (data.Encyclopedia)) then
OCinSoutput.rft_val_fmt = "info:ofi/fmt:kev:mtx:journal"; -- journal metadata identifier
if in_array (class, {'arxiv', 'biorxiv', 'citeseerx', 'medrxiv', 'ssrn'}) then -- set genre according to the type of citation template we are rendering
OCinSoutput["rft.genre"] = "preprint"; -- cite arxiv, cite biorxiv, cite citeseerx, cite medrxiv, cite ssrn
elseif 'conference' == class then
OCinSoutput["rft.genre"] = "conference"; -- cite conference (when Periodical set)
elseif 'web' == class then
OCinSoutput["rft.genre"] = "unknown"; -- cite web (when Periodical set)
else
OCinSoutput["rft.genre"] = "article"; -- journal and other 'periodical' articles
end
OCinSoutput["rft.jtitle"] = data.Periodical; -- journal only
OCinSoutput["rft.atitle"] = data.Title; -- 'periodical' article titles
-- these used only for periodicals
OCinSoutput["rft.ssn"] = data.Season; -- keywords: winter, spring, summer, fall
OCinSoutput["rft.quarter"] = data.Quarter; -- single digits 1->first quarter, etc.
OCinSoutput["rft.chron"] = data.Chron; -- free-form date components
OCinSoutput["rft.volume"] = data.Volume; -- does not apply to books
OCinSoutput["rft.issue"] = data.Issue;
OCinSoutput['rft.artnum'] = data.ArticleNumber; -- {{cite journal}} only
OCinSoutput["rft.pages"] = data.Pages; -- also used in book metadata
elseif 'thesis' ~= class then -- all others except cite thesis are treated as 'book' metadata; genre distinguishes
OCinSoutput.rft_val_fmt = "info:ofi/fmt:kev:mtx:book"; -- book metadata identifier
if 'report' == class or 'techreport' == class then -- cite report and cite techreport
OCinSoutput["rft.genre"] = "report";
elseif 'conference' == class then -- cite conference when Periodical not set
OCinSoutput["rft.genre"] = "conference";
OCinSoutput["rft.atitle"] = data.Chapter; -- conference paper as chapter in proceedings (book)
elseif in_array (class, {'book', 'citation', 'encyclopaedia', 'interview', 'map'}) then
if is_set (data.Chapter) then
OCinSoutput["rft.genre"] = "bookitem";
OCinSoutput["rft.atitle"] = data.Chapter; -- book chapter, encyclopedia article, interview in a book, or map title
else
if 'map' == class or 'interview' == class then
OCinSoutput["rft.genre"] = 'unknown'; -- standalone map or interview
else
OCinSoutput["rft.genre"] = 'book'; -- book and encyclopedia
end
end
else -- {'audio-visual', 'AV-media-notes', 'DVD-notes', 'episode', 'interview', 'mailinglist', 'map', 'newsgroup', 'podcast', 'press release', 'serial', 'sign', 'speech', 'web'}
OCinSoutput["rft.genre"] = "unknown";
end
OCinSoutput["rft.btitle"] = data.Title; -- book only
OCinSoutput["rft.place"] = data.PublicationPlace; -- book only
OCinSoutput["rft.series"] = data.Series; -- book only
OCinSoutput["rft.pages"] = data.Pages; -- book, journal
OCinSoutput["rft.edition"] = data.Edition; -- book only
OCinSoutput["rft.pub"] = data.PublisherName; -- book and dissertation
else -- cite thesis
OCinSoutput.rft_val_fmt = "info:ofi/fmt:kev:mtx:dissertation"; -- dissertation metadata identifier
OCinSoutput["rft.title"] = data.Title; -- dissertation (also patent but that is not yet supported)
OCinSoutput["rft.degree"] = data.Degree; -- dissertation only
OCinSoutput['rft.inst'] = data.PublisherName; -- book and dissertation
end
-- NB. Not currently supported are "info:ofi/fmt:kev:mtx:patent", "info:ofi/fmt:kev:mtx:dc", "info:ofi/fmt:kev:mtx:sch_svc", "info:ofi/fmt:kev:mtx:ctx"
-- and now common parameters (as much as possible)
OCinSoutput["rft.date"] = data.Date; -- book, journal, dissertation
for k, v in pairs( data.ID_list ) do -- what to do about these? For now assume that they are common to all?
if k == 'ISBN' then v = v:gsub( "[^-0-9X]", "" ); end
local id = cfg.id_handlers[k].COinS;
if string.sub( id or "", 1, 4 ) == 'info' then -- for ids that are in the info:registry
OCinSoutput["rft_id"] = table.concat{ id, "/", v };
elseif string.sub (id or "", 1, 3 ) == 'rft' then -- for isbn, issn, eissn, etc. that have defined COinS keywords
OCinSoutput[ id ] = v;
elseif 'url' == id then -- for urls that are assembled in ~/Identifiers; |asin= and |ol=
OCinSoutput["rft_id"] = table.concat ({data.ID_list[k], "#id-name=", cfg.id_handlers[k].label});
elseif id then -- when cfg.id_handlers[k].COinS is not nil so urls created here
OCinSoutput["rft_id"] = table.concat{ cfg.id_handlers[k].prefix, v, cfg.id_handlers[k].suffix or '', "#id-name=", cfg.id_handlers[k].label }; -- others; provide a URL and indicate identifier name as #fragment (human-readable, but transparent to browsers)
end
end
local last, first;
for k, v in ipairs( data.Authors ) do
last, first = coins_cleanup (v.last), coins_cleanup (v.first or ''); -- replace any nowiki stripmarkers, non-printing or invisible characters
if k == 1 then -- for the first author name only
if is_set(last) and is_set(first) then -- set these COinS values if |first= and |last= specify the first author name
OCinSoutput["rft.aulast"] = last; -- book, journal, dissertation
OCinSoutput["rft.aufirst"] = first; -- book, journal, dissertation
elseif is_set(last) then
OCinSoutput["rft.au"] = last; -- book, journal, dissertation -- otherwise use this form for the first name
end
else -- for all other authors
if is_set(last) and is_set(first) then
OCinSoutput["rft.au"] = table.concat{ last, ", ", first }; -- book, journal, dissertation
elseif is_set(last) then
OCinSoutput["rft.au"] = last; -- book, journal, dissertation
end
-- TODO: At present we do not report "et al.". Add anything special if this condition applies?
end
end
OCinSoutput.rft_id = data.URL;
OCinSoutput.rfr_id = table.concat{ "info:sid/", mw.site.server:match( "[^/]*$" ), ":", data.RawPage };
-- TODO: Add optional extra info:
-- rfr_dat=#REVISION<version> (referrer private data)
-- ctx_id=<data.RawPage>#<ref> (identifier for the context object)
-- ctx_tim=<ts> (timestamp in format yyyy-mm-ddThh:mm:ssTZD or yyyy-mm-dd)
-- ctx_enc=info:ofi/enc:UTF-8 (character encoding)
OCinSoutput = setmetatable( OCinSoutput, nil );
-- sort with version string always first, and combine.
-- table.sort( OCinSoutput );
table.insert( OCinSoutput, 1, "ctx_ver=" .. ctx_ver ); -- such as "Z39.88-2004"
return table.concat(OCinSoutput, "&");
end
--[[--------------------------< S E T _ S E L E C T E D _ M O D U L E S >--------------------------------------
Sets local cfg table and imported functions table to same (live or sandbox) as that used by the other modules.
]]
local function set_selected_modules (cfg_table_ptr, utilities_page_ptr)
cfg = cfg_table_ptr;
has_accept_as_written = utilities_page_ptr.has_accept_as_written; -- import functions from selected Module:Citation/CS1/Utilities module
is_set = utilities_page_ptr.is_set;
in_array = utilities_page_ptr.in_array;
remove_wiki_link = utilities_page_ptr.remove_wiki_link;
strip_apostrophe_markup = utilities_page_ptr.strip_apostrophe_markup;
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {
make_coins_title = make_coins_title,
get_coins_pages = get_coins_pages,
COinS = COinS,
set_selected_modules = set_selected_modules,
}
4fe549c532af319223cc4d9da2c6d33a786131c1
Module:Citation/CS1/styles.css
828
24
42
41
2023-12-24T02:01:06Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Citation/CS1/styles.css]]
sanitized-css
text/css
/* Protection icon
the following line controls the page-protection icon in the upper right corner
it must remain within this comment
{{sandbox other||{{pp-template}}}}
*/
/* Overrides
Some wikis do not override user agent default styles for HTML <cite> and <q>,
unlike en.wp. On en.wp, keep these the same as [[MediaWiki:Common.css]].
The word-wrap and :target styles were moved here from Common.css.
On en.wp, keep these the same as [[Template:Citation/styles.css]].
*/
cite.citation {
font-style: inherit; /* Remove italics for <cite> */
/* Break long urls, etc., rather than overflowing box */
word-wrap: break-word;
}
.citation q {
quotes: '"' '"' "'" "'"; /* Straight quote marks for <q> */
}
/* Highlight linked elements (such as clicked references) in blue */
.citation:target {
/* ignore the linter - all browsers of interest implement this */
background-color: rgba(0, 127, 255, 0.133);
}
/* ID and URL access
Both core and Common.css have selector .mw-parser-output a[href$=".pdf"].external
for PDF pages. All TemplateStyles pages are hoisted to .mw-parser-output. We need
to have specificity equal to a[href$=".pdf"].external for locks to override PDF icon.
That's essentially 2 classes and 1 element.
the .id-lock-... selectors are for use by non-citation templates like
{{Catalog lookup link}} which do not have to handle PDF links
*/
.id-lock-free a,
.citation .cs1-lock-free a {
background: url(//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg)
right 0.1em center/9px no-repeat;
}
.id-lock-limited a,
.id-lock-registration a,
.citation .cs1-lock-limited a,
.citation .cs1-lock-registration a {
background: url(//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg)
right 0.1em center/9px no-repeat;
}
.id-lock-subscription a,
.citation .cs1-lock-subscription a {
background: url(//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg)
right 0.1em center/9px no-repeat;
}
/* Wikisource
Wikisource icon when |chapter= or |title= is wikilinked to Wikisource
as in cite wikisource
*/
.cs1-ws-icon a {
background: url(//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg)
right 0.1em center/12px no-repeat;
}
/* Errors and maintenance */
.cs1-code {
/* <code>...</code> style override: mediawiki's css definition is specified here:
https://git.wikimedia.org/blob/mediawiki%2Fcore.git/
69cd73811f7aadd093050dbf20ed70ef0b42a713/skins%2Fcommon%2FcommonElements.css#L199
*/
color: inherit;
background: inherit;
border: none;
padding: inherit;
}
.cs1-hidden-error {
display: none;
color: #d33;
}
.cs1-visible-error {
color: #d33;
}
.cs1-maint {
display: none;
color: #3a3;
margin-left: 0.3em;
}
/* Small text size
Set small text size in one place. 0.95 (here) * 0.9 (from references list) is
~0.85, which is the lower bound for size for accessibility. Old styling for this
was just 0.85. We could write the rule so that when this template is inside
references/reflist, only then does it multiply by 0.95; else multiply by 0.85 */
.cs1-format {
font-size: 95%;
}
/* kerning */
.cs1-kern-left {
padding-left: 0.2em;
}
.cs1-kern-right {
padding-right: 0.2em;
}
/* selflinks – avoid bold font style when cs1|2 template links to the current page */
.citation .mw-selflink {
font-weight: inherit;
}
7c96feb084b1883e7b6522660da6a14bdcc94752
Template:Pagetype
10
25
44
43
2023-12-24T02:01:07Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Pagetype]]
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:pagetype|main}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
b8e6aa66678cd57877ea2c607372a45070f030a7
Module:Pagetype
828
26
46
45
2023-12-24T02:01:07Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Pagetype]]
Scribunto
text/plain
--------------------------------------------------------------------------------
-- --
-- PAGETYPE --
-- --
-- This is a meta-module intended to replace {{pagetype}} and similar --
-- templates. It automatically detects namespaces, and allows for a --
-- great deal of customisation. It can easily be ported to other --
-- wikis by changing the values in the [[Module:Pagetype/config]]. --
-- --
--------------------------------------------------------------------------------
-- Load config.
local cfg = mw.loadData('Module:Pagetype/config')
-- Load required modules.
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local mDisambiguation = require('Module:Disambiguation')
local p = {}
-- Look up a namespace argument in the args table.
local function lookUpNamespaceArg(args, key)
local arg = args[key]
-- Convert "yes", "1" etc. to true, "no", "0" etc. to false, and leave
-- other values the same.
return yesno(arg, arg)
end
-- Append multiple values to an array
local function appendMultiple(target, source)
for _, value in ipairs(source) do
table.insert(target, value)
end
end
-- Get argument keys for a title's namespace
local function getNamespaceArgKeys(title, cfg)
local nsInfo = mw.site.namespaces[title.namespace]
local customAliases = cfg.customNamespaceAliases[title.namespace] or {}
local keys = {}
if nsInfo.name ~= '' then
table.insert(keys, nsInfo.name)
end
if nsInfo.canonicalName ~= nsInfo.name and nsInfo.canonicalName ~= '' then
table.insert(keys, nsInfo.canonicalName)
end
appendMultiple(keys, nsInfo.aliases)
appendMultiple(keys, customAliases)
return keys
end
-- Get the argument for a title's namespace, if it was specified in the args
-- table.
local function getNamespaceArg(title, args, cfg)
if title.isTalkPage then
return lookUpNamespaceArg(args, cfg.talk)
end
for _, key in ipairs(getNamespaceArgKeys(title, cfg)) do
local arg = lookUpNamespaceArg(args, mw.ustring.lower(key))
if arg ~= nil then
return arg
end
end
return nil
end
-- Look up a page type specific to the title's namespace
local function getExplicitPageType(title, cfg)
if title.isTalkPage then
return cfg.talkDefault
else
return cfg.pagetypes[title.namespace]
end
end
-- Get a default page type that is not specific to the title's namespace
local function getDefaultPageType(args, cfg)
local other = lookUpNamespaceArg(args, cfg.other)
if type(other) == 'string' then
return other
else
return cfg.otherDefault
end
end
local function detectRedirects(title, args)
local redirect = lookUpNamespaceArg(args, cfg.redirect)
if redirect == false then
-- Don't detect redirects if they have been specifically disallowed.
return nil
end
-- Allow custom values for redirects.
if not title.isRedirect then
return nil
elseif type(redirect) == 'string' then
return redirect
else
return cfg.redirectDefault
end
end
local function detectDisambiguationPages(title, args, cfg)
if title.namespace ~= 0 then
-- Only detect disambiguation pages in mainspace
return nil
end
local dab = lookUpNamespaceArg(args, cfg.dab)
if dab == false then
-- Don't detect disambiguation pages if explicitly disallowed
return nil
end
if not mDisambiguation.isDisambiguation(title:getContent()) then
return nil
elseif type(dab) == 'string' then
return dab
else
return cfg.dabDefault
end
end
-- Gets the pagetype from a class specified from the first positional
-- parameter.
local function getPageTypeFromClass(args, class, key, aliasTable, default)
local arg = lookUpNamespaceArg(args, key)
if arg == false then
-- Don't check for this class if it is specifically disallowed.
return nil
end
if aliasTable[class] then
if type(arg) == 'string' then
return arg
else
return default
end
end
return nil
end
-- Get page types for mainspaces pages with an explicit class specified
local function getMainNamespaceClassPageType(title, args, cfg)
if title.namespace ~= 0 then
return nil
end
local class = args[1]
if type(class) == 'string' then
-- Put in lower case so e.g. "na" and "NA" will both match.
class = mw.ustring.lower(class)
end
return getPageTypeFromClass(
args,
class,
cfg.na,
cfg.naAliases,
cfg.naDefault
)
end
-- Get page type specified by an explicit namespace argument.
local function getNamespaceArgPageType(title, args, cfg)
local namespaceArg = getNamespaceArg(title, args, cfg)
if namespaceArg == true then
-- Namespace has been explicitly enabled, so return the default for
-- this namespace
return getExplicitPageType(title, cfg)
elseif namespaceArg == false then
-- Namespace has been explicitly disabled
return getDefaultPageType(args, cfg)
elseif namespaceArg then
-- This namespaces uses custom text
return namespaceArg
else
return nil
end
end
-- Whether the title is in the set of default active namespaces which are
-- looked up in cfg.pagetypes.
local function isInDefaultActiveNamespace(title, args, cfg)
local defaultNamespacesKey = args[cfg.defaultns]
if defaultNamespacesKey == cfg.defaultnsAll then
return true
end
local defaultNamespaces
if defaultNamespacesKey == cfg.defaultnsExtended then
defaultNamespaces = cfg.extendedNamespaces
elseif defaultNamespacesKey == cfg.defaultnsNone then
defaultNamespaces = {}
else
defaultNamespaces = cfg.defaultNamespaces
end
return defaultNamespaces[title.namespace] or false
end
-- Get page type not specified or detected by other means
local function getOtherPageType(title, args, cfg)
if isInDefaultActiveNamespace(title, args, cfg) then
return getExplicitPageType(title, cfg)
else
return getDefaultPageType(args, cfg)
end
end
local function getPageType(title, args, cfg)
return (
detectRedirects(title, args, cfg)
or detectDisambiguationPages(title, args, cfg)
or getMainNamespaceClassPageType(title, args, cfg)
or getNamespaceArgPageType(title, args, cfg)
or getOtherPageType(title, args, cfg)
)
end
local function shouldUseSubjectTitle(args, cfg)
return not yesno(args.talk, true) and args[cfg.defaultns] ~= cfg.defaultnsAll
end
-- Get the Scribunto title object to fetch the page type of
local function getTitle(args, cfg)
local title
if args.page then
title = mw.title.new(args.page)
if not title then
return nil
end
else
title = mw.title.getCurrentTitle()
end
if shouldUseSubjectTitle(args, cfg) then
return title.subjectPageTitle
else
return title
end
end
local function pluralize(pageType, cfg)
if cfg.irregularPlurals[pageType] then
return cfg.irregularPlurals[pageType]
else
return pageType .. cfg.plural -- often 's'
end
end
local function capitalize(pageType)
local first = mw.ustring.sub(pageType, 1, 1)
local rest = mw.ustring.sub(pageType, 2)
return mw.ustring.upper(first) .. rest
end
function p._main(args)
local title = getTitle(args, cfg)
local pageType = getPageType(title, args, cfg)
if yesno(args.plural, false) then
pageType = pluralize(pageType, cfg)
end
if yesno(args.caps, false) then
pageType = capitalize(pageType)
end
return pageType
end
function p.main(frame)
local args = getArgs(frame)
return p._main(args)
end
return p
ab72b17cbd3e423817484aedfd33b480e9ba3611
Module:Pagetype/config
828
27
48
47
2023-12-24T02:01:07Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Pagetype/config]]
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Module:Pagetype configuration data --
-- This page holds localisation and configuration data for Module:Pagetype. --
--------------------------------------------------------------------------------
local cfg = {} -- Don't edit this line.
--------------------------------------------------------------------------------
-- Start configuration data --
--------------------------------------------------------------------------------
-- This table holds the default page types for each namespace. Keys to this
-- table should be integers that can be used as keys to mw.site.namespaces.
cfg.pagetypes = {
[0] = 'article', -- Main namespace
[2] = 'user page',
[4] = 'project page',
[6] = 'file',
[8] = 'interface page', -- MediaWiki namespace
[10] = 'template',
[12] = 'help page',
[14] = 'category',
[100] = 'portal',
[118] = 'draft',
[710] = 'Timed Text page',
[828] = 'module',
[2300] = 'gadget',
[2302] = 'gadget definition',
[-1] = 'special page',
[-2] = 'file', -- Media namespace
}
-- This table holds the namespaces to be looked up from cfg.pagetypes by
-- default.
cfg.defaultNamespaces = {
[0] = true, -- main
[6] = true, -- file
[10] = true, -- template
[14] = true, -- category
[828] = true, -- module
}
-- This table holds the namespaces to be looked up from cfg.pagetypes if
-- cfg.defaultnsExtended is set.
cfg.extendedNamespaces = {
[0] = true, -- main
[2] = true, -- user
[4] = true, -- project
[6] = true, -- file
[8] = true, -- mediawiki
[10] = true, -- template
[12] = true, -- help
[14] = true, -- category
[100] = true, -- portal
[118] = true, -- draft
[828] = true, -- module
}
-- This table holds custom aliases for each namespace.
cfg.customNamespaceAliases = {
[0] = {'main'},
}
-- The parameter name to set which default namespace values to be looked up from
-- cfg.pagetypes.
cfg.defaultns = 'defaultns'
-- The value of cfg.defaultns to set all namespaces, including talk.
cfg.defaultnsAll = 'all'
-- The value of cfg.defaultns to set the namespaces listed in
-- cfg.extendedNamespaces
cfg.defaultnsExtended = 'extended'
-- The value of cfg.defaultns to set no default namespaces.
cfg.defaultnsNone = 'none'
-- The parameter name to use for talk pages.
cfg.talk = 'talk'
-- The default value for talk pages.
cfg.talkDefault = 'talk page'
-- The parameter name to use for disambiguation pages page.
cfg.dab = 'dab'
-- This table holds the different possible aliases for disambiguation-class
-- pages. These should be lower-case.
cfg.dabAliases = {
['disambiguation'] = true,
['disambig'] = true,
['disamb'] = true,
['dab'] = true,
}
-- The default value for disambiguation pages.
cfg.dabDefault = 'page'
-- The parameter name to use for N/A-class page.
cfg.na = 'na'
-- This table holds the different possible aliases for N/A-class pages. These
-- should be lower-case.
cfg.naAliases = {
['na'] = true,
['n/a'] = true,
}
-- The default value for N/A-class pages.
cfg.naDefault = 'page'
-- The parameter name to use for redirects.
cfg.redirect = 'redirect'
-- The default value to use for redirects.
cfg.redirectDefault = 'redirect'
-- The parameter name for undefined namespaces.
cfg.other = 'other'
-- The value used if the module detects an undefined namespace.
cfg.otherDefault = 'page'
-- The usual suffix denoting a plural.
cfg.plural = 's'
-- This table holds plurals not formed by a simple suffix.
cfg.irregularPlurals = {
["category"] = "categories"
}
--------------------------------------------------------------------------------
-- End configuration data --
--------------------------------------------------------------------------------
return cfg -- Don't edit this line
5360b93ef5fd7551e38026f1b8df00bed8b34b2d
Module:Namespace detect/data
828
28
50
49
2023-12-24T02:01:08Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Namespace_detect/data]]
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Namespace detect data --
-- This module holds data for [[Module:Namespace detect]] to be loaded per --
-- page, rather than per #invoke, for performance reasons. --
--------------------------------------------------------------------------------
local cfg = require('Module:Namespace detect/config')
local function addKey(t, key, defaultKey)
if key ~= defaultKey then
t[#t + 1] = key
end
end
-- Get a table of parameters to query for each default parameter name.
-- This allows wikis to customise parameter names in the cfg table while
-- ensuring that default parameter names will always work. The cfg table
-- values can be added as a string, or as an array of strings.
local defaultKeys = {
'main',
'talk',
'other',
'subjectns',
'demospace',
'demopage'
}
local argKeys = {}
for i, defaultKey in ipairs(defaultKeys) do
argKeys[defaultKey] = {defaultKey}
end
for defaultKey, t in pairs(argKeys) do
local cfgValue = cfg[defaultKey]
local cfgValueType = type(cfgValue)
if cfgValueType == 'string' then
addKey(t, cfgValue, defaultKey)
elseif cfgValueType == 'table' then
for i, key in ipairs(cfgValue) do
addKey(t, key, defaultKey)
end
end
cfg[defaultKey] = nil -- Free the cfg value as we don't need it any more.
end
local function getParamMappings()
--[[
-- Returns a table of how parameter names map to namespace names. The keys
-- are the actual namespace names, in lower case, and the values are the
-- possible parameter names for that namespace, also in lower case. The
-- table entries are structured like this:
-- {
-- [''] = {'main'},
-- ['wikipedia'] = {'wikipedia', 'project', 'wp'},
-- ...
-- }
--]]
local mappings = {}
local mainNsName = mw.site.subjectNamespaces[0].name
mainNsName = mw.ustring.lower(mainNsName)
mappings[mainNsName] = mw.clone(argKeys.main)
mappings['talk'] = mw.clone(argKeys.talk)
for nsid, ns in pairs(mw.site.subjectNamespaces) do
if nsid ~= 0 then -- Exclude main namespace.
local nsname = mw.ustring.lower(ns.name)
local canonicalName = mw.ustring.lower(ns.canonicalName)
mappings[nsname] = {nsname}
if canonicalName ~= nsname then
table.insert(mappings[nsname], canonicalName)
end
for _, alias in ipairs(ns.aliases) do
table.insert(mappings[nsname], mw.ustring.lower(alias))
end
end
end
return mappings
end
return {
argKeys = argKeys,
cfg = cfg,
mappings = getParamMappings()
}
d224f42a258bc308ef3ad8cc8686cd7a4f47d005
Module:Namespace detect/config
828
29
52
51
2023-12-24T02:01:09Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Namespace_detect/config]]
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Namespace detect configuration data --
-- --
-- This module stores configuration data for Module:Namespace detect. Here --
-- you can localise the module to your wiki's language. --
-- --
-- To activate a configuration item, you need to uncomment it. This means --
-- that you need to remove the text "-- " at the start of the line. --
--------------------------------------------------------------------------------
local cfg = {} -- Don't edit this line.
--------------------------------------------------------------------------------
-- Parameter names --
-- These configuration items specify custom parameter names. Values added --
-- here will work in addition to the default English parameter names. --
-- To add one extra name, you can use this format: --
-- --
-- cfg.foo = 'parameter name' --
-- --
-- To add multiple names, you can use this format: --
-- --
-- cfg.foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'} --
--------------------------------------------------------------------------------
---- This parameter displays content for the main namespace:
-- cfg.main = 'main'
---- This parameter displays in talk namespaces:
-- cfg.talk = 'talk'
---- This parameter displays content for "other" namespaces (namespaces for which
---- parameters have not been specified):
-- cfg.other = 'other'
---- This parameter makes talk pages behave as though they are the corresponding
---- subject namespace. Note that this parameter is used with [[Module:Yesno]].
---- Edit that module to change the default values of "yes", "no", etc.
-- cfg.subjectns = 'subjectns'
---- This parameter sets a demonstration namespace:
-- cfg.demospace = 'demospace'
---- This parameter sets a specific page to compare:
cfg.demopage = 'page'
--------------------------------------------------------------------------------
-- Table configuration --
-- These configuration items allow customisation of the "table" function, --
-- used to generate a table of possible parameters in the module --
-- documentation. --
--------------------------------------------------------------------------------
---- The header for the namespace column in the wikitable containing the list of
---- possible subject-space parameters.
-- cfg.wikitableNamespaceHeader = 'Namespace'
---- The header for the wikitable containing the list of possible subject-space
---- parameters.
-- cfg.wikitableAliasesHeader = 'Aliases'
--------------------------------------------------------------------------------
-- End of configuration data --
--------------------------------------------------------------------------------
return cfg -- Don't edit this line.
0e4ff08d13c4b664d66b32c232deb129b77c1a56
Template:Short description
10
30
54
53
2023-12-24T02:01:09Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Short_description]]
wikitext
text/x-wiki
{{#ifeq:{{lc:{{{1|}}}}}|none|<nowiki /><!--Prevents whitespace issues when used with adjacent newlines-->|<div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">{{{1|}}}{{SHORTDESC:{{{1|}}}|{{{2|}}}}}</div>}}<includeonly>{{#ifeq:{{{pagetype}}}|Disambiguation pages||{{#ifeq:{{pagetype |defaultns = all |user=exclude}}|exclude||{{#ifeq:{{#switch: {{NAMESPACENUMBER}} | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 100 | 101 | 118 | 119 | 828 | 829 | = exclude|#default=}}|exclude||[[Category:{{{pagetype|{{pagetype |defaultns = extended |plural=y}}}}} with short description]]}}}}}}</includeonly><!-- Start tracking
-->{{#invoke:Check for unknown parameters|check|unknown={{Main other|[[Category:Pages using short description with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Short description]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | 2 | pagetype | bot |plural }}<!--
-->{{#ifexpr: {{#invoke:String|len|{{{1|}}}}}>100 | [[Category:{{{pagetype|{{pagetype |defaultns = extended |plural=y}}}}} with long short description]]}}<!--
--><includeonly>{{#if:{{{1|}}}||[[Category:Pages with empty short description]]}}</includeonly><!--
-->{{Short description/lowercasecheck|{{{1|}}}}}<!--
-->{{Main other |{{SDcat |sd={{{1|}}} }} }}<noinclude>
{{Documentation}}
</noinclude>
f175a6d61b40a87adb43e2dd4f73c7979759b34c
Template:Main other
10
31
56
55
2023-12-24T02:01:09Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Main_other]]
wikitext
text/x-wiki
{{#switch:
<!--If no or empty "demospace" parameter then detect namespace-->
{{#if:{{{demospace|}}}
| {{lc: {{{demospace}}} }} <!--Use lower case "demospace"-->
| {{#ifeq:{{NAMESPACE}}|{{ns:0}}
| main
| other
}}
}}
| main = {{{1|}}}
| other
| #default = {{{2|}}}
}}<noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage; interwikis go to Wikidata, thank you! -->
</noinclude>
86ad907ffeea3cc545159e00cd1f2d6433946450
Template:Short description/lowercasecheck
10
32
58
57
2023-12-24T02:01:10Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Short_description/lowercasecheck]]
wikitext
text/x-wiki
{{#ifeq:<!--test first character for lower-case letter-->{{#invoke:string|find|1={{{1|}}}|2=^%l|plain=false}}|1
|<!-- first character is a lower case letter; test against whitelist
-->{{#switch: {{First word|{{{1|}}}}}<!--begin whitelist-->
|c. <!--for circa-->
|gTLD
|iMac
|iOS
|iOS,
|iPad
|iPhone
|iTunes
|macOS
|none
|pH
|pH-dependent=<!-- end whitelist; short description starts with an allowed lower-case string; whitelist matched; do nothing -->
|#default=<!-- apply category to track lower-case short descriptions -->{{main other|[[Category:Pages with lower-case short description|{{trim|{{{1|}}}}}]]}}{{Testcases other|{{red|CATEGORY APPLIED}}}}<!-- end whitelist test -->}}
|<!-- short description does not start with lower-case letter; do nothing; end lower-case test -->
}}<noinclude>
{{documentation}}
</noinclude>
9a6d4db14b74614625fd234b4f8ee3c8e1a235c0
Template:SDcat
10
33
60
59
2023-12-24T02:01:10Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:SDcat]]
wikitext
text/x-wiki
<includeonly>{{#invoke:SDcat |setCat}}</includeonly><noinclude>
{{documentation}}
</noinclude>
8c6e8783ddb0dc699d6fb60370db97b73725b9a6
Module:Check for unknown parameters
828
34
62
61
2023-12-24T02:01:11Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Check_for_unknown_parameters]]
Scribunto
text/plain
-- This module may be used to compare the arguments passed to the parent
-- with a list of arguments, returning a specified result if an argument is
-- not on the list
local p = {}
local function trim(s)
return s:match('^%s*(.-)%s*$')
end
local function isnotempty(s)
return s and s:match('%S')
end
local function clean(text)
-- Return text cleaned for display and truncated if too long.
-- Strip markers are replaced with dummy text representing the original wikitext.
local pos, truncated
local function truncate(text)
if truncated then
return ''
end
if mw.ustring.len(text) > 25 then
truncated = true
text = mw.ustring.sub(text, 1, 25) .. '...'
end
return mw.text.nowiki(text)
end
local parts = {}
for before, tag, remainder in text:gmatch('([^\127]*)\127[^\127]*%-(%l+)%-[^\127]*\127()') do
pos = remainder
table.insert(parts, truncate(before) .. '<' .. tag .. '>...</' .. tag .. '>')
end
table.insert(parts, truncate(text:sub(pos or 1)))
return table.concat(parts)
end
function p._check(args, pargs)
if type(args) ~= "table" or type(pargs) ~= "table" then
-- TODO: error handling
return
end
-- create the list of known args, regular expressions, and the return string
local knownargs = {}
local regexps = {}
for k, v in pairs(args) do
if type(k) == 'number' then
v = trim(v)
knownargs[v] = 1
elseif k:find('^regexp[1-9][0-9]*$') then
table.insert(regexps, '^' .. v .. '$')
end
end
-- loop over the parent args, and make sure they are on the list
local ignoreblank = isnotempty(args['ignoreblank'])
local showblankpos = isnotempty(args['showblankpositional'])
local values = {}
for k, v in pairs(pargs) do
if type(k) == 'string' and knownargs[k] == nil then
local knownflag = false
for _, regexp in ipairs(regexps) do
if mw.ustring.match(k, regexp) then
knownflag = true
break
end
end
if not knownflag and ( not ignoreblank or isnotempty(v) ) then
table.insert(values, clean(k))
end
elseif type(k) == 'number' and knownargs[tostring(k)] == nil then
local knownflag = false
for _, regexp in ipairs(regexps) do
if mw.ustring.match(tostring(k), regexp) then
knownflag = true
break
end
end
if not knownflag and ( showblankpos or isnotempty(v) ) then
table.insert(values, k .. ' = ' .. clean(v))
end
end
end
-- add results to the output tables
local res = {}
if #values > 0 then
local unknown_text = args['unknown'] or 'Found _VALUE_, '
if mw.getCurrentFrame():preprocess( "{{REVISIONID}}" ) == "" then
local preview_text = args['preview']
if isnotempty(preview_text) then
preview_text = require('Module:If preview')._warning({preview_text})
elseif preview == nil then
preview_text = unknown_text
end
unknown_text = preview_text
end
for _, v in pairs(values) do
-- Fix odd bug for | = which gets stripped to the empty string and
-- breaks category links
if v == '' then v = ' ' end
-- avoid error with v = 'example%2' ("invalid capture index")
local r = unknown_text:gsub('_VALUE_', {_VALUE_ = v})
table.insert(res, r)
end
end
return table.concat(res)
end
function p.check(frame)
local args = frame.args
local pargs = frame:getParent().args
return p._check(args, pargs)
end
return p
93db6d115d4328d2a5148bb42959105e367b663e
Module:String
828
35
64
63
2023-12-24T02:01:11Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:String]]
Scribunto
text/plain
--[[
This module is intended to provide access to basic string functions.
Most of the functions provided here can be invoked with named parameters,
unnamed parameters, or a mixture. If named parameters are used, Mediawiki will
automatically remove any leading or trailing whitespace from the parameter.
Depending on the intended use, it may be advantageous to either preserve or
remove such whitespace.
Global options
ignore_errors: If set to 'true' or 1, any error condition will result in
an empty string being returned rather than an error message.
error_category: If an error occurs, specifies the name of a category to
include with the error message. The default category is
[Category:Errors reported by Module String].
no_category: If set to 'true' or 1, no category will be added if an error
is generated.
Unit tests for this module are available at Module:String/tests.
]]
local str = {}
--[[
len
This function returns the length of the target string.
Usage:
{{#invoke:String|len|target_string|}}
OR
{{#invoke:String|len|s=target_string}}
Parameters
s: The string whose length to report
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the target string.
]]
function str.len( frame )
local new_args = str._getParameters( frame.args, {'s'} )
local s = new_args['s'] or ''
return mw.ustring.len( s )
end
--[[
sub
This function returns a substring of the target string at specified indices.
Usage:
{{#invoke:String|sub|target_string|start_index|end_index}}
OR
{{#invoke:String|sub|s=target_string|i=start_index|j=end_index}}
Parameters
s: The string to return a subset of
i: The first index of the substring to return, defaults to 1.
j: The last index of the string to return, defaults to the last character.
The first character of the string is assigned an index of 1. If either i or j
is a negative value, it is interpreted the same as selecting a character by
counting from the end of the string. Hence, a value of -1 is the same as
selecting the last character of the string.
If the requested indices are out of range for the given string, an error is
reported.
]]
function str.sub( frame )
local new_args = str._getParameters( frame.args, { 's', 'i', 'j' } )
local s = new_args['s'] or ''
local i = tonumber( new_args['i'] ) or 1
local j = tonumber( new_args['j'] ) or -1
local len = mw.ustring.len( s )
-- Convert negatives for range checking
if i < 0 then
i = len + i + 1
end
if j < 0 then
j = len + j + 1
end
if i > len or j > len or i < 1 or j < 1 then
return str._error( 'String subset index out of range' )
end
if j < i then
return str._error( 'String subset indices out of order' )
end
return mw.ustring.sub( s, i, j )
end
--[[
This function implements that features of {{str sub old}} and is kept in order
to maintain these older templates.
]]
function str.sublength( frame )
local i = tonumber( frame.args.i ) or 0
local len = tonumber( frame.args.len )
return mw.ustring.sub( frame.args.s, i + 1, len and ( i + len ) )
end
--[[
_match
This function returns a substring from the source string that matches a
specified pattern. It is exported for use in other modules
Usage:
strmatch = require("Module:String")._match
sresult = strmatch( s, pattern, start, match, plain, nomatch )
Parameters
s: The string to search
pattern: The pattern or string to find within the string
start: The index within the source string to start the search. The first
character of the string has index 1. Defaults to 1.
match: In some cases it may be possible to make multiple matches on a single
string. This specifies which match to return, where the first match is
match= 1. If a negative number is specified then a match is returned
counting from the last match. Hence match = -1 is the same as requesting
the last match. Defaults to 1.
plain: A flag indicating that the pattern should be understood as plain
text. Defaults to false.
nomatch: If no match is found, output the "nomatch" value rather than an error.
For information on constructing Lua patterns, a form of [regular expression], see:
* http://www.lua.org/manual/5.1/manual.html#5.4.1
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns
]]
-- This sub-routine is exported for use in other modules
function str._match( s, pattern, start, match_index, plain_flag, nomatch )
if s == '' then
return str._error( 'Target string is empty' )
end
if pattern == '' then
return str._error( 'Pattern string is empty' )
end
start = tonumber(start) or 1
if math.abs(start) < 1 or math.abs(start) > mw.ustring.len( s ) then
return str._error( 'Requested start is out of range' )
end
if match_index == 0 then
return str._error( 'Match index is out of range' )
end
if plain_flag then
pattern = str._escapePattern( pattern )
end
local result
if match_index == 1 then
-- Find first match is simple case
result = mw.ustring.match( s, pattern, start )
else
if start > 1 then
s = mw.ustring.sub( s, start )
end
local iterator = mw.ustring.gmatch(s, pattern)
if match_index > 0 then
-- Forward search
for w in iterator do
match_index = match_index - 1
if match_index == 0 then
result = w
break
end
end
else
-- Reverse search
local result_table = {}
local count = 1
for w in iterator do
result_table[count] = w
count = count + 1
end
result = result_table[ count + match_index ]
end
end
if result == nil then
if nomatch == nil then
return str._error( 'Match not found' )
else
return nomatch
end
else
return result
end
end
--[[
match
This function returns a substring from the source string that matches a
specified pattern.
Usage:
{{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}}
OR
{{#invoke:String|match|s=source_string|pattern=pattern_string|start=start_index
|match=match_number|plain=plain_flag|nomatch=nomatch_output}}
Parameters
s: The string to search
pattern: The pattern or string to find within the string
start: The index within the source string to start the search. The first
character of the string has index 1. Defaults to 1.
match: In some cases it may be possible to make multiple matches on a single
string. This specifies which match to return, where the first match is
match= 1. If a negative number is specified then a match is returned
counting from the last match. Hence match = -1 is the same as requesting
the last match. Defaults to 1.
plain: A flag indicating that the pattern should be understood as plain
text. Defaults to false.
nomatch: If no match is found, output the "nomatch" value rather than an error.
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from each string. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
If the match_number or start_index are out of range for the string being queried, then
this function generates an error. An error is also generated if no match is found.
If one adds the parameter ignore_errors=true, then the error will be suppressed and
an empty string will be returned on any failure.
For information on constructing Lua patterns, a form of [regular expression], see:
* http://www.lua.org/manual/5.1/manual.html#5.4.1
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns
]]
-- This is the entry point for #invoke:String|match
function str.match( frame )
local new_args = str._getParameters( frame.args, {'s', 'pattern', 'start', 'match', 'plain', 'nomatch'} )
local s = new_args['s'] or ''
local start = tonumber( new_args['start'] ) or 1
local plain_flag = str._getBoolean( new_args['plain'] or false )
local pattern = new_args['pattern'] or ''
local match_index = math.floor( tonumber(new_args['match']) or 1 )
local nomatch = new_args['nomatch']
return str._match( s, pattern, start, match_index, plain_flag, nomatch )
end
--[[
pos
This function returns a single character from the target string at position pos.
Usage:
{{#invoke:String|pos|target_string|index_value}}
OR
{{#invoke:String|pos|target=target_string|pos=index_value}}
Parameters
target: The string to search
pos: The index for the character to return
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the target string. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
The first character has an index value of 1.
If one requests a negative value, this function will select a character by counting backwards
from the end of the string. In other words pos = -1 is the same as asking for the last character.
A requested value of zero, or a value greater than the length of the string returns an error.
]]
function str.pos( frame )
local new_args = str._getParameters( frame.args, {'target', 'pos'} )
local target_str = new_args['target'] or ''
local pos = tonumber( new_args['pos'] ) or 0
if pos == 0 or math.abs(pos) > mw.ustring.len( target_str ) then
return str._error( 'String index out of range' )
end
return mw.ustring.sub( target_str, pos, pos )
end
--[[
str_find
This function duplicates the behavior of {{str_find}}, including all of its quirks.
This is provided in order to support existing templates, but is NOT RECOMMENDED for
new code and templates. New code is recommended to use the "find" function instead.
Returns the first index in "source" that is a match to "target". Indexing is 1-based,
and the function returns -1 if the "target" string is not present in "source".
Important Note: If the "target" string is empty / missing, this function returns a
value of "1", which is generally unexpected behavior, and must be accounted for
separatetly.
]]
function str.str_find( frame )
local new_args = str._getParameters( frame.args, {'source', 'target'} )
local source_str = new_args['source'] or ''
local target_str = new_args['target'] or ''
if target_str == '' then
return 1
end
local start = mw.ustring.find( source_str, target_str, 1, true )
if start == nil then
start = -1
end
return start
end
--[[
find
This function allows one to search for a target string or pattern within another
string.
Usage:
{{#invoke:String|find|source_str|target_string|start_index|plain_flag}}
OR
{{#invoke:String|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}}
Parameters
source: The string to search
target: The string or pattern to find within source
start: The index within the source string to start the search, defaults to 1
plain: Boolean flag indicating that target should be understood as plain
text and not as a Lua style regular expression, defaults to true
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the parameter. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
This function returns the first index >= "start" where "target" can be found
within "source". Indices are 1-based. If "target" is not found, then this
function returns 0. If either "source" or "target" are missing / empty, this
function also returns 0.
This function should be safe for UTF-8 strings.
]]
function str.find( frame )
local new_args = str._getParameters( frame.args, {'source', 'target', 'start', 'plain' } )
local source_str = new_args['source'] or ''
local pattern = new_args['target'] or ''
local start_pos = tonumber(new_args['start']) or 1
local plain = new_args['plain'] or true
if source_str == '' or pattern == '' then
return 0
end
plain = str._getBoolean( plain )
local start = mw.ustring.find( source_str, pattern, start_pos, plain )
if start == nil then
start = 0
end
return start
end
--[[
replace
This function allows one to replace a target string or pattern within another
string.
Usage:
{{#invoke:String|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}}
OR
{{#invoke:String|replace|source=source_string|pattern=pattern_string|replace=replace_string|
count=replacement_count|plain=plain_flag}}
Parameters
source: The string to search
pattern: The string or pattern to find within source
replace: The replacement text
count: The number of occurences to replace, defaults to all.
plain: Boolean flag indicating that pattern should be understood as plain
text and not as a Lua style regular expression, defaults to true
]]
function str.replace( frame )
local new_args = str._getParameters( frame.args, {'source', 'pattern', 'replace', 'count', 'plain' } )
local source_str = new_args['source'] or ''
local pattern = new_args['pattern'] or ''
local replace = new_args['replace'] or ''
local count = tonumber( new_args['count'] )
local plain = new_args['plain'] or true
if source_str == '' or pattern == '' then
return source_str
end
plain = str._getBoolean( plain )
if plain then
pattern = str._escapePattern( pattern )
replace = mw.ustring.gsub( replace, "%%", "%%%%" ) --Only need to escape replacement sequences.
end
local result
if count ~= nil then
result = mw.ustring.gsub( source_str, pattern, replace, count )
else
result = mw.ustring.gsub( source_str, pattern, replace )
end
return result
end
--[[
simple function to pipe string.rep to templates.
]]
function str.rep( frame )
local repetitions = tonumber( frame.args[2] )
if not repetitions then
return str._error( 'function rep expects a number as second parameter, received "' .. ( frame.args[2] or '' ) .. '"' )
end
return string.rep( frame.args[1] or '', repetitions )
end
--[[
escapePattern
This function escapes special characters from a Lua string pattern. See [1]
for details on how patterns work.
[1] https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
Usage:
{{#invoke:String|escapePattern|pattern_string}}
Parameters
pattern_string: The pattern string to escape.
]]
function str.escapePattern( frame )
local pattern_str = frame.args[1]
if not pattern_str then
return str._error( 'No pattern string specified' )
end
local result = str._escapePattern( pattern_str )
return result
end
--[[
count
This function counts the number of occurrences of one string in another.
]]
function str.count(frame)
local args = str._getParameters(frame.args, {'source', 'pattern', 'plain'})
local source = args.source or ''
local pattern = args.pattern or ''
local plain = str._getBoolean(args.plain or true)
if plain then
pattern = str._escapePattern(pattern)
end
local _, count = mw.ustring.gsub(source, pattern, '')
return count
end
--[[
endswith
This function determines whether a string ends with another string.
]]
function str.endswith(frame)
local args = str._getParameters(frame.args, {'source', 'pattern'})
local source = args.source or ''
local pattern = args.pattern or ''
if pattern == '' then
-- All strings end with the empty string.
return "yes"
end
if mw.ustring.sub(source, -mw.ustring.len(pattern), -1) == pattern then
return "yes"
else
return ""
end
end
--[[
join
Join all non empty arguments together; the first argument is the separator.
Usage:
{{#invoke:String|join|sep|one|two|three}}
]]
function str.join(frame)
local args = {}
local sep
for _, v in ipairs( frame.args ) do
if sep then
if v ~= '' then
table.insert(args, v)
end
else
sep = v
end
end
return table.concat( args, sep or '' )
end
--[[
Helper function that populates the argument list given that user may need to use a mix of
named and unnamed parameters. This is relevant because named parameters are not
identical to unnamed parameters due to string trimming, and when dealing with strings
we sometimes want to either preserve or remove that whitespace depending on the application.
]]
function str._getParameters( frame_args, arg_list )
local new_args = {}
local index = 1
local value
for _, arg in ipairs( arg_list ) do
value = frame_args[arg]
if value == nil then
value = frame_args[index]
index = index + 1
end
new_args[arg] = value
end
return new_args
end
--[[
Helper function to handle error messages.
]]
function str._error( error_str )
local frame = mw.getCurrentFrame()
local error_category = frame.args.error_category or 'Errors reported by Module String'
local ignore_errors = frame.args.ignore_errors or false
local no_category = frame.args.no_category or false
if str._getBoolean(ignore_errors) then
return ''
end
local error_str = '<strong class="error">String Module Error: ' .. error_str .. '</strong>'
if error_category ~= '' and not str._getBoolean( no_category ) then
error_str = '[[Category:' .. error_category .. ']]' .. error_str
end
return error_str
end
--[[
Helper Function to interpret boolean strings
]]
function str._getBoolean( boolean_str )
local boolean_value
if type( boolean_str ) == 'string' then
boolean_str = boolean_str:lower()
if boolean_str == 'false' or boolean_str == 'no' or boolean_str == '0'
or boolean_str == '' then
boolean_value = false
else
boolean_value = true
end
elseif type( boolean_str ) == 'boolean' then
boolean_value = boolean_str
else
error( 'No boolean value found' )
end
return boolean_value
end
--[[
Helper function that escapes all pattern characters so that they will be treated
as plain text.
]]
function str._escapePattern( pattern_str )
return mw.ustring.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" )
end
return str
2ad0905c56ef4955950b75a8f00974fe82aed5e4
Module:SDcat
828
36
66
65
2023-12-24T02:01:12Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:SDcat]]
Scribunto
text/plain
--[[
SDcat
Module to check whether local short description matches that on Wikidata
--]]
local p = {}
-------------------------------------------------------------------------------
--[[
setCat has the qid of a Wikidata entity passed as |qid=
(it defaults to the associated qid of the current article if omitted)
and the local short description passed as |sd=
It returns a category if there is an associated Wikidata entity.
It returns one of the following tracking categories, as appropriate:
* Category:Short description matches Wikidata (case-insensitive)
* Category:Short description is different from Wikidata
* Category:Short description with empty Wikidata description
For testing purposes, a link prefix |lp= may be set to ":" to make the categories visible.
--]]
-- function exported for use in other modules
-- (local short description, Wikidata entity-ID, link prefix)
p._setCat = function(sdesc, itemID, lp)
if not mw.wikibase then return nil end
if itemID == "" then itemID = nil end
-- Wikidata description field
local wdesc = (mw.wikibase.getDescription(itemID) or ""):lower()
if wdesc == "" then
return "[[" .. lp .. "Category:Short description with empty Wikidata description]]"
elseif wdesc == sdesc then
return "[[" .. lp .. "Category:Short description matches Wikidata]]"
else
return "[[" .. lp .. "Category:Short description is different from Wikidata]]"
end
end
-- function exported for call from #invoke
p.setCat = function(frame)
local args
if frame.args.sd then
args = frame.args
else
args = frame:getParent().args
end
-- local short description
local sdesc = mw.text.trim(args.sd or ""):lower()
-- Wikidata entity-ID
local itemID = mw.text.trim(args.qid or "")
-- link prefix, strip quotes
local lp = mw.text.trim(args.lp or ""):gsub('"', '')
return p._setCat(sdesc, itemID, lp)
end
return p
6c19ac0f72c79a618eb105808f74701376bb2b38
Template:Category handler
10
37
68
67
2023-12-24T02:01:13Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Category_handler]]
wikitext
text/x-wiki
{{#invoke:Category handler|main}}<noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage, and interwikis to Wikidata. -->
</noinclude>
d14e9f545cf1833acbe174ae70b615c39b18cf63
Module:Category handler
828
38
70
69
2023-12-24T02:01:13Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Category_handler]]
Scribunto
text/plain
--------------------------------------------------------------------------------
-- --
-- CATEGORY HANDLER --
-- --
-- This module implements the {{category handler}} template in Lua, --
-- with a few improvements: all namespaces and all namespace aliases --
-- are supported, and namespace names are detected automatically for --
-- the local wiki. This module requires [[Module:Namespace detect]] --
-- and [[Module:Yesno]] to be available on the local wiki. It can be --
-- configured for different wikis by altering the values in --
-- [[Module:Category handler/config]], and pages can be blacklisted --
-- from categorisation by using [[Module:Category handler/blacklist]]. --
-- --
--------------------------------------------------------------------------------
-- Load required modules
local yesno = require('Module:Yesno')
-- Lazily load things we don't always need
local mShared, mappings
local p = {}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function trimWhitespace(s, removeBlanks)
if type(s) ~= 'string' then
return s
end
s = s:match('^%s*(.-)%s*$')
if removeBlanks then
if s ~= '' then
return s
else
return nil
end
else
return s
end
end
--------------------------------------------------------------------------------
-- CategoryHandler class
--------------------------------------------------------------------------------
local CategoryHandler = {}
CategoryHandler.__index = CategoryHandler
function CategoryHandler.new(data, args)
local obj = setmetatable({ _data = data, _args = args }, CategoryHandler)
-- Set the title object
do
local pagename = obj:parameter('demopage')
local success, titleObj
if pagename then
success, titleObj = pcall(mw.title.new, pagename)
end
if success and titleObj then
obj.title = titleObj
if titleObj == mw.title.getCurrentTitle() then
obj._usesCurrentTitle = true
end
else
obj.title = mw.title.getCurrentTitle()
obj._usesCurrentTitle = true
end
end
-- Set suppression parameter values
for _, key in ipairs{'nocat', 'categories'} do
local value = obj:parameter(key)
value = trimWhitespace(value, true)
obj['_' .. key] = yesno(value)
end
do
local subpage = obj:parameter('subpage')
local category2 = obj:parameter('category2')
if type(subpage) == 'string' then
subpage = mw.ustring.lower(subpage)
end
if type(category2) == 'string' then
subpage = mw.ustring.lower(category2)
end
obj._subpage = trimWhitespace(subpage, true)
obj._category2 = trimWhitespace(category2) -- don't remove blank values
end
return obj
end
function CategoryHandler:parameter(key)
local parameterNames = self._data.parameters[key]
local pntype = type(parameterNames)
if pntype == 'string' or pntype == 'number' then
return self._args[parameterNames]
elseif pntype == 'table' then
for _, name in ipairs(parameterNames) do
local value = self._args[name]
if value ~= nil then
return value
end
end
return nil
else
error(string.format(
'invalid config key "%s"',
tostring(key)
), 2)
end
end
function CategoryHandler:isSuppressedByArguments()
return
-- See if a category suppression argument has been set.
self._nocat == true
or self._categories == false
or (
self._category2
and self._category2 ~= self._data.category2Yes
and self._category2 ~= self._data.category2Negative
)
-- Check whether we are on a subpage, and see if categories are
-- suppressed based on our subpage status.
or self._subpage == self._data.subpageNo and self.title.isSubpage
or self._subpage == self._data.subpageOnly and not self.title.isSubpage
end
function CategoryHandler:shouldSkipBlacklistCheck()
-- Check whether the category suppression arguments indicate we
-- should skip the blacklist check.
return self._nocat == false
or self._categories == true
or self._category2 == self._data.category2Yes
end
function CategoryHandler:matchesBlacklist()
if self._usesCurrentTitle then
return self._data.currentTitleMatchesBlacklist
else
mShared = mShared or require('Module:Category handler/shared')
return mShared.matchesBlacklist(
self.title.prefixedText,
mw.loadData('Module:Category handler/blacklist')
)
end
end
function CategoryHandler:isSuppressed()
-- Find if categories are suppressed by either the arguments or by
-- matching the blacklist.
return self:isSuppressedByArguments()
or not self:shouldSkipBlacklistCheck() and self:matchesBlacklist()
end
function CategoryHandler:getNamespaceParameters()
if self._usesCurrentTitle then
return self._data.currentTitleNamespaceParameters
else
if not mappings then
mShared = mShared or require('Module:Category handler/shared')
mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData
end
return mShared.getNamespaceParameters(
self.title,
mappings
)
end
end
function CategoryHandler:namespaceParametersExist()
-- Find whether any namespace parameters have been specified.
-- We use the order "all" --> namespace params --> "other" as this is what
-- the old template did.
if self:parameter('all') then
return true
end
if not mappings then
mShared = mShared or require('Module:Category handler/shared')
mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData
end
for ns, params in pairs(mappings) do
for i, param in ipairs(params) do
if self._args[param] then
return true
end
end
end
if self:parameter('other') then
return true
end
return false
end
function CategoryHandler:getCategories()
local params = self:getNamespaceParameters()
local nsCategory
for i, param in ipairs(params) do
local value = self._args[param]
if value ~= nil then
nsCategory = value
break
end
end
if nsCategory ~= nil or self:namespaceParametersExist() then
-- Namespace parameters exist - advanced usage.
if nsCategory == nil then
nsCategory = self:parameter('other')
end
local ret = {self:parameter('all')}
local numParam = tonumber(nsCategory)
if numParam and numParam >= 1 and math.floor(numParam) == numParam then
-- nsCategory is an integer
ret[#ret + 1] = self._args[numParam]
else
ret[#ret + 1] = nsCategory
end
if #ret < 1 then
return nil
else
return table.concat(ret)
end
elseif self._data.defaultNamespaces[self.title.namespace] then
-- Namespace parameters don't exist, simple usage.
return self._args[1]
end
return nil
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p = {}
function p._exportClasses()
-- Used for testing purposes.
return {
CategoryHandler = CategoryHandler
}
end
function p._main(args, data)
data = data or mw.loadData('Module:Category handler/data')
local handler = CategoryHandler.new(data, args)
if handler:isSuppressed() then
return nil
end
return handler:getCategories()
end
function p.main(frame, data)
data = data or mw.loadData('Module:Category handler/data')
local args = require('Module:Arguments').getArgs(frame, {
wrappers = data.wrappers,
valueFunc = function (k, v)
v = trimWhitespace(v)
if type(k) == 'number' then
if v ~= '' then
return v
else
return nil
end
else
return v
end
end
})
return p._main(args, data)
end
return p
b74dd63857b24904ac452429b11213f18647471f
Module:Category handler/data
828
39
72
71
2023-12-24T02:01:14Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Category_handler/data]]
Scribunto
text/plain
-- This module assembles data to be passed to [[Module:Category handler]] using
-- mw.loadData. This includes the configuration data and whether the current
-- page matches the title blacklist.
local data = require('Module:Category handler/config')
local mShared = require('Module:Category handler/shared')
local blacklist = require('Module:Category handler/blacklist')
local title = mw.title.getCurrentTitle()
data.currentTitleMatchesBlacklist = mShared.matchesBlacklist(
title.prefixedText,
blacklist
)
data.currentTitleNamespaceParameters = mShared.getNamespaceParameters(
title,
mShared.getParamMappings()
)
return data
abbc68048ff698e88dda06b64ecf384bbf583120
Module:Category handler/config
828
40
74
73
2023-12-24T02:01:14Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Category_handler/config]]
Scribunto
text/plain
--------------------------------------------------------------------------------
-- [[Module:Category handler]] configuration data --
-- Language-specific parameter names and values can be set here. --
-- For blacklist config, see [[Module:Category handler/blacklist]]. --
--------------------------------------------------------------------------------
local cfg = {} -- Don't edit this line.
--------------------------------------------------------------------------------
-- Start configuration data --
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Parameter names --
-- These configuration items specify custom parameter names. --
-- To add one extra name, you can use this format: --
-- --
-- foo = 'parameter name', --
-- --
-- To add multiple names, you can use this format: --
-- --
-- foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'}, --
--------------------------------------------------------------------------------
cfg.parameters = {
-- The nocat and categories parameter suppress
-- categorisation. They are used with Module:Yesno, and work as follows:
--
-- cfg.nocat:
-- Result of yesno() Effect
-- true Categorisation is suppressed
-- false Categorisation is allowed, and
-- the blacklist check is skipped
-- nil Categorisation is allowed
--
-- cfg.categories:
-- Result of yesno() Effect
-- true Categorisation is allowed, and
-- the blacklist check is skipped
-- false Categorisation is suppressed
-- nil Categorisation is allowed
nocat = 'nocat',
categories = 'categories',
-- The parameter name for the legacy "category2" parameter. This skips the
-- blacklist if set to the cfg.category2Yes value, and suppresses
-- categorisation if present but equal to anything other than
-- cfg.category2Yes or cfg.category2Negative.
category2 = 'category2',
-- cfg.subpage is the parameter name to specify how to behave on subpages.
subpage = 'subpage',
-- The parameter for data to return in all namespaces.
all = 'all',
-- The parameter name for data to return if no data is specified for the
-- namespace that is detected.
other = 'other',
-- The parameter name used to specify a page other than the current page;
-- used for testing and demonstration.
demopage = 'page',
}
--------------------------------------------------------------------------------
-- Parameter values --
-- These are set values that can be used with certain parameters. Only one --
-- value can be specified, like this: --
-- --
-- cfg.foo = 'value name' -- --
--------------------------------------------------------------------------------
-- The following settings are used with the cfg.category2 parameter. Setting
-- cfg.category2 to cfg.category2Yes skips the blacklist, and if cfg.category2
-- is present but equal to anything other than cfg.category2Yes or
-- cfg.category2Negative then it supresses cateogrisation.
cfg.category2Yes = 'yes'
cfg.category2Negative = '¬'
-- The following settings are used with the cfg.subpage parameter.
-- cfg.subpageNo is the value to specify to not categorise on subpages;
-- cfg.subpageOnly is the value to specify to only categorise on subpages.
cfg.subpageNo = 'no'
cfg.subpageOnly = 'only'
--------------------------------------------------------------------------------
-- Default namespaces --
-- This is a table of namespaces to categorise by default. The keys are the --
-- namespace numbers. --
--------------------------------------------------------------------------------
cfg.defaultNamespaces = {
[ 0] = true, -- main
[ 6] = true, -- file
[ 12] = true, -- help
[ 14] = true, -- category
[100] = true, -- portal
[108] = true, -- book
}
--------------------------------------------------------------------------------
-- Wrappers --
-- This is a wrapper template or a list of wrapper templates to be passed to --
-- [[Module:Arguments]]. --
--------------------------------------------------------------------------------
cfg.wrappers = 'Template:Category handler'
--------------------------------------------------------------------------------
-- End configuration data --
--------------------------------------------------------------------------------
return cfg -- Don't edit this line.
373cd107b13a5b00e6a1b7e66a749f12502c849d
Module:Category handler/shared
828
41
76
75
2023-12-24T02:01:15Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Category_handler/shared]]
Scribunto
text/plain
-- This module contains shared functions used by [[Module:Category handler]]
-- and its submodules.
local p = {}
function p.matchesBlacklist(page, blacklist)
for i, pattern in ipairs(blacklist) do
local match = mw.ustring.match(page, pattern)
if match then
return true
end
end
return false
end
function p.getParamMappings(useLoadData)
local dataPage = 'Module:Namespace detect/data'
if useLoadData then
return mw.loadData(dataPage).mappings
else
return require(dataPage).mappings
end
end
function p.getNamespaceParameters(titleObj, mappings)
-- We don't use title.nsText for the namespace name because it adds
-- underscores.
local mappingsKey
if titleObj.isTalkPage then
mappingsKey = 'talk'
else
mappingsKey = mw.site.namespaces[titleObj.namespace].name
end
mappingsKey = mw.ustring.lower(mappingsKey)
return mappings[mappingsKey] or {}
end
return p
d2d5de1a031e6ce97c242cbfa8afe7a92cb9eca5
Module:Category handler/blacklist
828
42
78
77
2023-12-24T02:01:15Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Category_handler/blacklist]]
Scribunto
text/plain
-- This module contains the blacklist used by [[Module:Category handler]].
-- Pages that match Lua patterns in this list will not be categorised unless
-- categorisation is explicitly requested.
return {
'^Main Page$', -- don't categorise the main page.
-- Don't categorise the following pages or their subpages.
-- "%f[/\0]" matches if the next character is "/" or the end of the string.
'^Wikipedia:Cascade%-protected items%f[/\0]',
'^User:UBX%f[/\0]', -- The userbox "template" space.
'^User talk:UBX%f[/\0]',
-- Don't categorise subpages of these pages, but allow
-- categorisation of the base page.
'^Wikipedia:Template index/.*$',
-- Don't categorise archives.
'/[aA]rchive',
"^Wikipedia:Administrators' noticeboard/IncidentArchive%d+$",
}
87469d7a9ef2a3c41b2bf04ae18f7c59a18fb855
Template:Fix
10
43
80
79
2023-12-24T02:01:16Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Fix]]
wikitext
text/x-wiki
{{#switch:{{{subst|¬}}}
|¬={{category handler
|template=[[Category:Templates needing substitution checking]]
|nocat={{{nocat|<noinclude>true</noinclude>}}}
}}
|SUBST=[[Category:Pages with incorrectly substituted templates]]
}}{{Category handler
|main={{Fix/category
|cat-date={{{cat-date|}}}
|cat={{{cat|}}}
|cat-date2={{{cat-date2|}}}
|cat2={{{cat2|}}}
|cat-date3={{{cat-date3|}}}
|cat3={{{cat3|}}}
|date={{{date|}}}
}}
|template={{#if:{{{name|}}}|{{#ifeq:{{{name}}}|{{ROOTPAGENAME}}||{{#if:{{{date|}}}||[[Category:Templates including undated clean-up tags]]}}}}}}
|subpage=no
}}{{#if:{{{text|}}}
|<sup class="noprint Inline-Template {{{class|}}}" style="white-space:nowrap;">[<i>{{#if:{{{pre-text|}}}
|{{{pre-text}}} 
}}[[{{{link|Wikipedia:Cleanup}}}|<span title="{{#invoke:string|replace|source={{delink|1={{{title|{{{link|Wikipedia:Cleanup}}}}}}{{#if:{{{date|}}}| ({{{date}}})}}}}|pattern=" |replace=" |plain=true}}">{{{text|}}}</span>]]{{#if:{{{post-text|}}}
| {{{post-text}}}
}}</i>]</sup>|{{{special|}}}
}}<noinclude>
{{Documentation}}
<!-- Add cats and interwikis to the /doc subpage, not here! -->
</noinclude>
64d5219edf0f07567b3006bfc9681f9408b164b0
Template:Delink
10
44
82
81
2023-12-24T02:01:16Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Delink]]
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:delink|delink}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
ccf86b4255142fffb206ab8240f36ed22e029d6a
Module:Delink
828
45
84
83
2023-12-24T02:01:17Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Delink]]
Scribunto
text/plain
-- This module de-links most wikitext.
require("strict")
local p = {}
local getArgs
local function delinkReversePipeTrick(s)
if s:match("^%[%[|.*[|\n]") then -- Check for newlines or multiple pipes.
return s
end
return s:match("%[%[|(.*)%]%]")
end
local function delinkPipeTrick(s)
-- We need to deal with colons, brackets, and commas, per [[Help:Pipe trick]].
-- First, remove the text before the first colon, if any.
if s:match(":") then
s = s:match("%[%[.-:(.*)|%]%]")
-- If there are no colons, grab all of the text apart from the square brackets and the pipe.
else
s = s:match("%[%[(.*)|%]%]")
end
-- Next up, brackets and commas.
if s:match("%(.-%)$") then -- Brackets trump commas.
s = s:match("(.-) ?%(.-%)$")
elseif s:match(",") then -- If there are no brackets, display only the text before the first comma.
s = s:match("(.-),.*$")
end
return s
end
-- Return wikilink target |wikilinks=target
local function getDelinkedTarget(s)
local result = s
-- Deal with the reverse pipe trick.
if result:match("%[%[|") then
return delinkReversePipeTrick(result)
end
result = mw.uri.decode(result, "PATH") -- decode percent-encoded entities. Leave underscores and plus signs.
result = mw.text.decode(result, true) -- decode HTML entities.
-- Check for bad titles. To do this we need to find the
-- title area of the link, i.e. the part before any pipes.
local target_area
if result:match("|") then -- Find if we're dealing with a piped link.
target_area = result:match("^%[%[(.-)|.*%]%]")
else
target_area = result:match("^%[%[(.-)%]%]")
end
-- Check for bad characters.
if mw.ustring.match(target_area, "[%[%]<>{}%%%c\n]") and mw.ustring.match(target_area, "[%[%]<>{}%%%c\n]") ~= "?" then
return s
end
return target_area
end
local function getDelinkedLabel(s)
local result = s
-- Deal with the reverse pipe trick.
if result:match("%[%[|") then
return delinkReversePipeTrick(result)
end
result = mw.uri.decode(result, "PATH") -- decode percent-encoded entities. Leave underscores and plus signs.
result = mw.text.decode(result, true) -- decode HTML entities.
-- Check for bad titles. To do this we need to find the
-- title area of the link, i.e. the part before any pipes.
local target_area
if result:match("|") then -- Find if we're dealing with a piped link.
target_area = result:match("^%[%[(.-)|.*%]%]")
else
target_area = result:match("^%[%[(.-)%]%]")
end
-- Check for bad characters.
if mw.ustring.match(target_area, "[%[%]<>{}%%%c\n]") and mw.ustring.match(target_area, "[%[%]<>{}%%%c\n]") ~= "?" then
return s
end
-- Check for categories, interwikis, and files.
local colon_prefix = result:match("%[%[(.-):.*%]%]") or "" -- Get the text before the first colon.
local ns = mw.site.namespaces[colon_prefix] -- see if this is a known namespace
if mw.language.isKnownLanguageTag(colon_prefix) or (ns and (ns.canonicalName == "File" or ns.canonicalName == "Category")) then
return ""
end
-- Remove the colon if the link is using the [[Help:Colon trick]].
if result:match("%[%[:") then
result = "[[" .. result:match("%[%[:(.*%]%])")
end
-- Deal with links using the [[Help:Pipe trick]].
if mw.ustring.match(result, "^%[%[[^|]*|%]%]") then
return delinkPipeTrick(result)
end
-- Find the display area of the wikilink
if result:match("|") then -- Find if we're dealing with a piped link.
result = result:match("^%[%[.-|(.+)%]%]")
-- Remove new lines from the display of multiline piped links,
-- where the pipe is before the first new line.
result = result:gsub("\n", "")
else
result = result:match("^%[%[(.-)%]%]")
end
return result
end
local function delinkURL(s)
-- Assume we have already delinked internal wikilinks, and that
-- we have been passed some text between two square brackets [foo].
-- If the text contains a line break it is not formatted as a URL, regardless of other content.
if s:match("\n") then
return s
end
-- Check if the text has a valid URL prefix and at least one valid URL character.
local valid_url_prefixes = {"//", "http://", "https://", "ftp://", "gopher://", "mailto:", "news:", "irc://"}
local url_prefix
for _ ,v in ipairs(valid_url_prefixes) do
if mw.ustring.match(s, '^%[' .. v ..'[^"%s].*%]' ) then
url_prefix = v
break
end
end
-- Get display text
if not url_prefix then
return s
end
s = s:match("^%[" .. url_prefix .. "(.*)%]") -- Grab all of the text after the URL prefix and before the final square bracket.
s = s:match('^.-(["<> ].*)') or "" -- Grab all of the text after the first URL separator character ("<> ).
s = mw.ustring.match(s, "^%s*(%S.*)$") or "" -- If the separating character was a space, trim it off.
local s_decoded = mw.text.decode(s, true)
if mw.ustring.match(s_decoded, "%c") then
return s
end
return s_decoded
end
local function delinkLinkClass(text, pattern, delinkFunction)
if type(text) ~= "string" then
error("Attempt to de-link non-string input.", 2)
end
if type(pattern) ~= "string" or mw.ustring.sub(pattern, 1, 1) ~= "^" then
error('Invalid pattern detected. Patterns must begin with "^".', 2)
end
-- Iterate over the text string, and replace any matched text. using the
-- delink function. We need to iterate character by character rather
-- than just use gsub, otherwise nested links aren't detected properly.
local result = ""
while text ~= "" do
-- Replace text using one iteration of gsub.
text = mw.ustring.gsub(text, pattern, delinkFunction, 1)
-- Append the left-most character to the result string.
result = result .. mw.ustring.sub(text, 1, 1)
text = mw.ustring.sub(text, 2, -1)
end
return result
end
function p._delink(args)
local text = args[1] or ""
if args.refs == "yes" then
-- Remove any [[Help:Strip markers]] representing ref tags. In most situations
-- this is not a good idea - only use it if you know what you are doing!
text = mw.ustring.gsub(text, "UNIQ%w*%-ref%-%d*%-QINU", "")
end
if args.comments ~= "no" then
text = text:gsub("<!%-%-.-%-%->", "") -- Remove html comments.
end
if args.wikilinks ~= "no" and args.wikilinks ~= "target" then
-- De-link wikilinks and return the label portion of the wikilink.
text = delinkLinkClass(text, "^%[%[.-%]%]", getDelinkedLabel)
elseif args.wikilinks == "target" then
-- De-link wikilinks and return the target portions of the wikilink.
text = delinkLinkClass(text, "^%[%[.-%]%]", getDelinkedTarget)
end
if args.urls ~= "no" then
text = delinkLinkClass(text, "^%[.-%]", delinkURL) -- De-link URLs.
end
if args.whitespace ~= "no" then
-- Replace single new lines with a single space, but leave double new lines
-- and new lines only containing spaces or tabs before a second new line.
text = mw.ustring.gsub(text, "([^\n \t][ \t]*)\n([ \t]*[^\n \t])", "%1 %2")
text = text:gsub("[ \t]+", " ") -- Remove extra tabs and spaces.
end
return text
end
function p.delink(frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
return p._delink(getArgs(frame, {wrappers = 'Template:Delink'}))
end
return p
5b8e75ac750b5d3ed76cc4158aefcd1568a6a6fd
Template:Cite web
10
46
86
85
2023-12-24T02:01:17Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Cite_web]]
wikitext
text/x-wiki
<includeonly>{{#invoke:citation/CS1|citation
|CitationClass=web
}}</includeonly><noinclude>
{{documentation}}
</noinclude>
ea1b0f38afd9728a1cf9f2e3f540887a402fab8e
Template:Reflist
10
47
88
87
2023-12-24T02:01:17Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Reflist]]
wikitext
text/x-wiki
<templatestyles src="Reflist/styles.css" /><div class="reflist <!--
-->{{#if:{{{1|}}}{{{colwidth|}}}|reflist-columns references-column-width}} <!--
-->{{#switch:{{{liststyle|{{{group|}}}}}}|upper-alpha|upper-roman|lower-alpha|lower-greek|lower-roman=reflist-{{{liststyle|{{{group}}}}}}}} <!--
-->{{#if:{{{1|}}}|{{#iferror:{{#ifexpr: {{{1|1}}} > 1 }}||{{#switch:{{{1|}}}|1=|2=reflist-columns-2|#default=reflist-columns-3}} }}}}" <!-- end class
-->{{#if: {{{1|}}}<!-- start style -->
| {{#iferror: {{#ifexpr: {{{1|1}}} > 1 }} |style="column-width: {{{1}}};"}}
| {{#if: {{{colwidth|}}}|style="column-width: {{{colwidth}}};"}}
}}>
{{#tag:references|{{{refs|}}}|group={{{group|}}}|responsive={{#if:{{{1|}}}{{{colwidth|}}}|0|1}}}}</div>{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using reflist with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Reflist]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | colwidth | group | liststyle | refs }}<noinclude>
{{Documentation}}
</noinclude>
8c65cc88272db6c0f5cf2b49f84d3e460e60ee5f
Template:Reflist/styles.css
10
48
90
89
2023-12-24T02:01:18Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Reflist/styles.css]]
sanitized-css
text/css
/* {{pp|small=yes}} */
/* can we remove the font size declarations? .references gets a font-size in
* common.css that is always 90, and there is nothing else in reflist out in
* the wild. May affect column sizes.
*/
.reflist {
font-size: 90%; /* Default font-size */
margin-bottom: 0.5em;
list-style-type: decimal;
}
.reflist .references {
font-size: 100%; /* Reset font-size when nested in div.reflist */
margin-bottom: 0; /* Avoid double margin when nested in div.reflist */
list-style-type: inherit; /* Enable custom list style types */
}
/* columns-2 and columns-3 are legacy for "2 or more" column view from when the
* template was implemented with column-count.
*/
.reflist-columns-2 {
column-width: 30em;
}
.reflist-columns-3 {
column-width: 25em;
}
/* Reset top margin for lists embedded in columns */
.reflist-columns {
margin-top: 0.3em;
}
.reflist-columns ol {
margin-top: 0;
}
/* Avoid elements breaking between columns */
.reflist-columns li {
page-break-inside: avoid; /* Removed from CSS in favor of break-inside c. 2020 */
break-inside: avoid-column;
}
.reflist-upper-alpha {
list-style-type: upper-alpha;
}
.reflist-upper-roman {
list-style-type: upper-roman;
}
.reflist-lower-alpha {
list-style-type: lower-alpha;
}
.reflist-lower-greek {
list-style-type: lower-greek;
}
.reflist-lower-roman {
list-style-type: lower-roman;
}
531a26d48f0e7826c61f764cfb7d5fb200032c34
Template:Fix/category
10
49
92
91
2023-12-24T02:01:18Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Fix/category]]
wikitext
text/x-wiki
<noinclude>{{pp-template|small=yes}}</noinclude>{{{cat|[[Category:All pages needing cleanup]]}}}{{#if:{{{cat-date|}}}
|[[{{{cat-date}}} {{#if:{{{date|}}}
|from {{{date}}}
}}]]{{#if:{{{date|}}}
|{{#ifexist:{{{cat-date}}} from {{{date}}}|
|[[Category:Articles with invalid date parameter in template]]
}}
}}
}}{{#if:{{{cat2|}}}|{{{cat2}}}}}{{#if:{{{cat-date2|}}}
|[[{{{cat-date2}}} {{#if:{{{date|}}}
|from {{{date}}}
}}]]{{#if:{{{date|}}}
|{{#ifexist:{{{cat-date2}}} from {{{date}}}|
|[[Category:Articles with invalid date parameter in template]]
}}
}}
}}{{#if:{{{cat3|}}}|{{{cat3}}}}}{{#if:{{{cat-date3|}}}
|[[{{{cat-date3}}} {{#if:{{{date|}}}
|from {{{date}}}
}}]]{{#if:{{{date|}}}
|{{#ifexist:{{{cat-date3}}} from {{{date}}}|
|[[Category:Articles with invalid date parameter in template]]
}}
}}
}}
8f0a79cdee91c3d967a6d70cf7bfab4093b3d6ae
Template:Cite book
10
50
94
93
2023-12-24T02:01:19Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Cite_book]]
wikitext
text/x-wiki
<includeonly>{{#invoke:citation/CS1|citation
|CitationClass=book
}}</includeonly><noinclude>
{{documentation}}
{{collapse top|TemplateData}}
{{Cite book/TemplateData}}
{{collapse bottom}}
</noinclude>
c474cbe5d051e08f516083d594207d449245c717
Template:Refbegin
10
51
96
95
2023-12-24T02:01:20Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Refbegin]]
wikitext
text/x-wiki
<includeonly><templatestyles src="Refbegin/styles.css" /><!--
--><div class="refbegin <!--
-->{{#if: {{{indent|}}} | refbegin-hanging-indents }} <!--
-->{{#if: {{{1|{{{colwidth|}}}}}} |
{{#ifeq: {{{1}}} | 1
| <!--default to no columns-->
| refbegin-columns references-column-width
}}
}}
" style="<!--
-->{{#if: {{{1|}}}
|{{#ifeq: {{{1}}} | 1
|<!--default to no columns-->
| {{#iferror: {{#ifexpr: {{{1|1}}} > 1 }}
| column-width: {{#if:1|{{{1|30em}}}}}
| column-width: 30em
}}
}}
| {{#if: {{{colwidth|}}}
| column-width: {{{colwidth|30em}}}
}}
}}"></includeonly><noinclude>
{{Documentation}}
</noinclude>
ef78d644991e74866d1adf16edde6ea255263230
Template:Refbegin/styles.css
10
52
98
97
2023-12-24T02:01:20Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Refbegin/styles.css]]
sanitized-css
text/css
/* {{pp-template}} */
.refbegin {
font-size: 90%;
margin-bottom: 0.5em;
}
.refbegin-hanging-indents > ul {
margin-left: 0;
}
.refbegin-hanging-indents > ul > li {
margin-left: 0;
padding-left: 3.2em;
text-indent: -3.2em;
}
.refbegin-hanging-indents ul,
.refbegin-hanging-indents ul li {
list-style: none;
}
@media (max-width: 720px) {
.refbegin-hanging-indents > ul > li {
padding-left: 1.6em;
text-indent: -1.6em;
}
}
.refbegin-columns {
margin-top: 0.3em;
}
/* Reset top margin for lists embedded in columns */
.refbegin-columns ul {
margin-top: 0;
}
/* Avoid elements breaking between columns */
.refbegin-columns li {
page-break-inside: avoid; /* Removed from CSS in favor of break-inside c. 2020 */
break-inside: avoid-column;
}
287ba19370a7bfc842825711a05d34dae68d5f64
Template:Refend
10
53
100
99
2023-12-24T02:01:20Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Refend]]
wikitext
text/x-wiki
<includeonly></div></includeonly><noinclude>
{{template doc|Template:refbegin/doc}}
{{TemplateDataHeader}}
<templatedata>
{
"description": "Ends a reference lists started by {{refbegin}}.",
"params": {
}
}
</templatedata>
</noinclude>
ae41356c6aab3e8901a484fcb46ff4aa314f1bb9
Template:See also
10
54
102
101
2023-12-24T02:01:21Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:See_also]]
wikitext
text/x-wiki
<includeonly>{{#invoke:Labelled list hatnote|labelledList|See also}}</includeonly><noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
74d2ab6a0df5605fbe2085c405925ec659be52b7
Template:Sfn
10
55
104
103
2023-12-24T02:01:21Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Sfn]]
wikitext
text/x-wiki
<includeonly>{{#invoke:Footnotes|sfn|template=sfn}}</includeonly>{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using sfn with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Sfn]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | 2 | 3 | 4 | 5 | ignore-err | loc | p | page | pages | postscript | pp | ps | ref | Ref }}<noinclude>
{{documentation}}
</noinclude>
eab6519b2a87e18dc40f39343c71f5848977cc93
Template:SfnRef
10
56
106
105
2023-12-24T02:01:22Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:SfnRef]]
wikitext
text/x-wiki
{{safesubst<noinclude />:#invoke:Footnotes|sfnref}}<noinclude>
{{documentation}}
</noinclude>
56e03dd26fcd9edbe71a96b5c5c84198863b964b
Module:Footnotes
828
57
108
107
2023-12-24T02:01:22Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Footnotes]]
Scribunto
text/plain
require('strict');
local getArgs = require ('Module:Arguments').getArgs;
--[[--------------------------< A R G S _ D E F A U L T >------------------------------------------------------
a table to specify initial values.
]]
local args_default = {
bracket_left = '',
bracket_right = '',
bracket_year_left = '',
bracket_year_right = '',
postscript = '',
page = '',
pages = '',
location = '',
page_sep = ", p. ",
pages_sep = ", pp. ",
ref = '',
template = 'harv', -- if template name not provided in {{#invoke:}} use this
};
--[[--------------------------< T A R G E T _ C H E C K >------------------------------------------------------
look for anchor_id (CITEREF name-list and year or text from |ref=) in anchor_id_list
the 'no target' error may be suppressed with |ignore-err=yes when target cannot be found because target is inside
a template that wraps another template; 'multiple targets' error may not be suppressed
]]
local function target_check (anchor_id, args)
local namespace = mw.title.getCurrentTitle().namespace;
local anchor_id_list_module = mw.loadData ('Module:Footnotes/anchor_id_list');
local anchor_id_list = anchor_id_list_module.anchor_id_list;
local article_whitelist = anchor_id_list_module.article_whitelist;
local template_list = anchor_id_list_module.template_list;
local whitelist_module = mw.loadData ('Module:Footnotes/whitelist');
local whitelist = whitelist_module.whitelist;
local special_patterns = whitelist_module.special_patterns;
local DNB_special_patterns = whitelist_module.DNB_special_patterns;
local DNB_template_names = whitelist_module.DNB_template_names;
if 10 == namespace then
return ''; -- automatic form of |no-tracking=yes; TODO: is this too broad?
end
local tally = anchor_id_list[anchor_id]; -- nil when anchor_id not in list; else a tally
local msg;
local category;
if not tally then
if args.ignore then
return ''; -- if ignore is true then no message, no category
end
if article_whitelist and article_whitelist[anchor_id] then -- if an article-local whitelist and anchor ID is in it
return ''; -- done
end
local wl_anchor_id = anchor_id; -- copy to be modified to index into the whitelist
if args.year then -- for anchor IDs created by this template (not in |ref=) that have a date
if args.year:match ('%d%l$') or -- use the date value to determine if we should remove the disambiguator
args.year:match ('n%.d%.%l$') or
args.year:match ('nd%l$') then
wl_anchor_id = wl_anchor_id:gsub ('%l$', ''); -- remove the disambiguator
end
end
local t_tbl = whitelist[wl_anchor_id]; -- get list of templates associated with this anchor ID
if t_tbl then -- when anchor ID not whitelisted t_tbl is nil
for _, t in ipairs (t_tbl) do -- spin through the list of templates associated with this anchor ID
if template_list[t] then -- if associated template is found in the list of templates in the article
return ''; -- anchor ID is whitlisted and article has matching template so no error
end
end
end
for _, pattern in ipairs (special_patterns) do -- spin through the spcial patterns and try to match
if anchor_id:match (pattern) then
return '';
end
end
for _, dnb_t in ipairs (DNB_template_names or {}) do -- getting desparate now, are there any DNB templates? DNB_template_names may be nil; empty table prevents script error
if template_list[dnb_t] then -- if the article has this DNB template
for _, pattern in ipairs (DNB_special_patterns) do -- spin through the DNB-specifiec wildcard patterns
if anchor_id:match (pattern) then -- and attempt a match
return ''; -- found a match
end
end
end
end
msg = 'no target: ' .. anchor_id; -- anchor_id not found
category = '[[Category:Harv and Sfn no-target errors]]';
elseif 1 < tally then
msg = 'multiple targets (' .. tally .. '×): ' .. anchor_id; -- more than one anchor_id in this article
category = 0 == namespace and '[[Category:Harv and Sfn multiple-target errors]]' or ''; -- only categorize in article space
return '<span class="error harv-error" style="display: inline; font-size:100%"> ' .. args.template .. ' error: ' .. msg .. ' ([[:Category:Harv and Sfn template errors|help]])</span>' .. category;
end
-- category = 0 == namespace and '[[Category:Harv and Sfn template errors]]' or ''; -- only categorize in article space
category = 0 == namespace and category or ''; -- only categorize in article space
--use this version to show error messages
-- return msg and '<span class="error harv-error" style="display: inline; font-size:100%"> ' .. args.template .. ' error: ' .. msg .. ' ([[:Category:Harv and Sfn template errors|help]])</span>' .. category or '';
--use this version to hide error messages
return msg and '<span class="error harv-error" style="display: none; font-size:100%"> ' .. args.template .. ' error: ' .. msg .. ' ([[:Category:Harv and Sfn template errors|help]])</span>' .. category or '';
end
--[[--------------------------< I S _ Y E A R >----------------------------------------------------------------
evaluates param to see if it is one of these forms with or without lowercase letter disambiguator:
YYYY
n.d.
nd
c. YYYY
YYYY–YYYY (separator is endash)
YYYY–YY (separator is endash)
return true when param has a recognized form; false else
]]
local patterns_date= {
'^%d%d%d%d?%l?$',
'^n%.d%.%l?$',
'^nd%l?$',
'^c%. %d%d%d%d?%l?$',
'^%d%d%d%d–%d%d%d%d%l?$',
'^%d%d%d%d–%d%d%l?$',
}
local function is_year (param, args)
args.year = ''; -- used for harv error;
for _, pattern in ipairs (patterns_date) do
if mw.ustring.match (param, pattern) then
args.year = param; -- used for harv error;
return true;
end
end
end
--[[--------------------------< C O R E >----------------------------------------------------------------------
returns an anchor link (CITEREF) formed from one to four author names, year, and insource location (|p=, |pp=, loc=)
]]
local function core( args )
local result;
local err_msg = ''
if args.P5 ~= '' then
if is_year (args.P5, args) then
result = table.concat ({args.P1, ' et al. ', args.bracket_year_left, args.P5, args.bracket_year_right});
else
args.P5 = ''; -- when P5 not a year don't include in anchor
result = table.concat ({args.P1, ' et al.'}); -- and don't render it
end
elseif args.P4 ~= '' then
if is_year (args.P4, args) then
result = table.concat ({args.P1, ', ', args.P2, ' & ', args.P3, ' ', args.bracket_year_left, args.P4, args.bracket_year_right}); -- three names and a year
else
result = table.concat ({args.P1, ' et al.'}); -- four names
end
elseif args.P3 ~= '' then
if is_year (args.P3, args) then
result = table.concat ({args.P1, ' & ', args.P2, ' ', args.bracket_year_left, args.P3, args.bracket_year_right}); -- two names and a year
else
result = table.concat ({args.P1, ', ', args.P2, ' ', ' & ', args.P3}); -- three names
end
elseif args.P2 ~= '' then
if is_year (args.P2, args) then
result = table.concat ({args.P1, ' ', args.bracket_year_left, args.P2, args.bracket_year_right}); -- one name and year
else
result = table.concat ({args.P1, ' & ', args.P2}); -- two names
end
else
result = args.P1; -- one name
end
-- when author-date result ends with a dot (typically when the last positional parameter holds 'n.d.')
-- and when no in-source location (no |p=, |pp=, or |loc=)
-- and when the first or only character in args.postscript is a dot
-- remove the author-date result trailing dot
-- the author-date result trailing dot will be replaced later with the content of args.postscript (usually a dot)
if ('.' == result:sub(-1)) and ('.' == args.postscript:sub(1)) and ('' == args.page) and ('' == args.pages) and ('' == args.location) then
result = result:gsub ('%.$', '');
end
if args.ref ~= 'none' then
local anchor_id;
if args.ref ~= '' then
anchor_id = mw.uri.anchorEncode (args.ref);
err_msg = target_check (anchor_id, args);
result = table.concat ({'[[#', anchor_id, '|', result, ']]'});
else
anchor_id = mw.uri.anchorEncode (table.concat ({'CITEREF', args.P1, args.P2, args.P3, args.P4, args.P5}));
err_msg = target_check (anchor_id, args);
result = table.concat ({'[[#', anchor_id, '|', result, ']]'});
end
end
if args.page ~= '' then
result = table.concat ({result, args.page_sep, args.page});
elseif args.pages ~= ''then
result = table.concat ({result, args.pages_sep, args.pages});
end
if args.location ~= '' then
result = table.concat ({result, ', ', args.location});
end
result = table.concat ({args.bracket_left, result, args.bracket_right, args.postscript}):gsub ('%s+', ' '); -- strip redundant spaces
return result .. err_msg;
end
--[[--------------------------< H Y P H E N _ T O _ D A S H >--------------------------------------------------
Converts a hyphen to a dash under certain conditions. The hyphen must separate
like items; unlike items are returned unmodified. These forms are modified:
letter - letter (A - B)
digit - digit (4-5)
digit separator digit - digit separator digit (4.1-4.5 or 4-1-4-5)
letterdigit - letterdigit (A1-A5) (an optional separator between letter and
digit is supported – a.1-a.5 or a-1-a-5)
digitletter - digitletter (5a - 5d) (an optional separator between letter and
digit is supported – 5.a-5.d or 5-a-5-d)
any other forms are returned unmodified.
str may be a comma- or semicolon-separated list
This code copied from Module:Citation/CS1. The only modification is to require Module:Citation/CS1/Utilities
so that it has access to the functions is_set() and has_accept_as_written()
]]
local function hyphen_to_dash( str )
local utilities = require ('Module:Citation/CS1/Utilities'); -- only modification so that this function has access to is_set() and has_accept_as_written()
if not utilities.is_set (str) then
return str;
end
local accept; -- Boolean
str = str:gsub ('&[nm]dash;', {['–'] = '–', ['—'] = '—'}); -- replace — and – entities with their characters; semicolon mucks up the text.split
str = str:gsub ('-', '-'); -- replace HTML numeric entity with hyphen character
str = str:gsub (' ', ' '); -- replace entity with generic keyboard space character
local out = {};
local list = mw.text.split (str, '%s*[,;]%s*'); -- split str at comma or semicolon separators if there are any
for _, item in ipairs (list) do -- for each item in the list
item, accept = utilities.has_accept_as_written (item); -- remove accept-this-as-written markup when it wraps all of item
if not accept and mw.ustring.match (item, '^%w*[%.%-]?%w+%s*[%-–—]%s*%w*[%.%-]?%w+$') then -- if a hyphenated range or has endash or emdash separators
if item:match ('^%a+[%.%-]?%d+%s*%-%s*%a+[%.%-]?%d+$') or -- letterdigit hyphen letterdigit (optional separator between letter and digit)
item:match ('^%d+[%.%-]?%a+%s*%-%s*%d+[%.%-]?%a+$') or -- digitletter hyphen digitletter (optional separator between digit and letter)
item:match ('^%d+[%.%-]%d+%s*%-%s*%d+[%.%-]%d+$') or -- digit separator digit hyphen digit separator digit
item:match ('^%d+%s*%-%s*%d+$') or -- digit hyphen digit
item:match ('^%a+%s*%-%s*%a+$') then -- letter hyphen letter
item = item:gsub ('(%w*[%.%-]?%w+)%s*%-%s*(%w*[%.%-]?%w+)', '%1–%2'); -- replace hyphen, remove extraneous space characters
else
item = mw.ustring.gsub (item, '%s*[–—]%s*', '–'); -- for endash or emdash separated ranges, replace em with en, remove extraneous whitespace
end
end
table.insert (out, item); -- add the (possibly modified) item to the output table
end
local temp_str = ''; -- concatenate the output table into a comma separated string
temp_str, accept = utilities.has_accept_as_written (table.concat (out, ', ')); -- remove accept-this-as-written markup when it wraps all of concatenated out
if accept then
temp_str = utilities.has_accept_as_written (str); -- when global markup removed, return original str; do it this way to suppress boolean second return value
return temp_str;
else
return temp_str; -- else, return assembled temp_str
end
end
--[[--------------------------< A R G S _ F E T C H >---------------------------------------------------------
Because all of the templates share a common set of parameters, a single common function to fetch those parameters
from frame and parent frame.
]]
local function args_fetch (frame, ps)
local args = args_default; -- create a copy of the default table
local pframe = frame:getParent(); -- point to the template's parameter table
for k, v in pairs (frame.args) do -- override defaults with values provided in the #invoke: if any
args[k] = v;
end
args.postscript = pframe.args.postscript or pframe.args.ps or ps;
if 'none' == args.postscript then
args.postscript = '';
end
args.page = pframe.args.p or pframe.args.page or '';
args.pages = pframe.args.pp or pframe.args.pages or '';
args.pages = ('' ~= args.pages) and hyphen_to_dash (args.pages) or '';
args.location = pframe.args.loc or '';
args.ref = pframe.args.ref or pframe.args.Ref or '';
args.ignore = ('yes' == pframe.args['ignore-false-positive']) or ('yes' == pframe.args['ignore-err']);
for i, v in ipairs ({'P1', 'P2', 'P3', 'P4', 'P5'}) do -- loop through the five positional parameters and trim if set else empty string
args[v] = (pframe.args[i] and mw.text.trim (pframe.args[i])) or '';
end
if args.P5 and not is_year (args.P5, args) then
local i = 6; -- initialize the indexer to the sixth positional parameter
while pframe.args[i] do -- in case there are too many authors loop through the authors looking for a year
local v = mw.text.trim (pframe.args[i]); -- trim
if is_year (v, args) then -- if a year
args.P5 = v; -- overwrite whatever was in args.P5 with year
break; -- and abandon the search
end
i = i + 1; -- bump the indexer
end
end
return args;
end
--[[--------------------------< H A R V A R D _ C I T A T I O N >----------------------------------------------
common entry point for:
{{harvard citation}} aka {{harv}}
{{Harvard citation no brackets}} aka {{harvnb}}
{{harvcol}}
{{harvcolnb}}
{{harvcoltxt}}
{{Harvard citation text}} aka {{harvtxt}}
{{Harvp}}
Distinguishing features (brackets and page separators) are specified in this module's {{#invoke}} in the respective templates.
]]
local function harvard_citation (frame)
local args = args_fetch (frame, ''); -- get the template and invoke parameters; default postscript is empty string
return core (args);
end
--[[--------------------------< S T R I P _ U R L >------------------------------------------------------------
used by sfn() and sfnm(). This function fixes an issue with reference tooltip gadget where the tooltip is not displayed
when an insource locator (|p=, |pp=, |loc=) has an external wikilink that contains a # character
strip uri-reserved characters from urls in |p=, |pp-, and |loc= parameters The researved characters are:
!#$&'()*+,/:;=?@[]
]]
local function strip_url (pages)
local escaped_uri;
if not pages or ('' == pages) then
return pages;
end
for uri in pages:gmatch ('%[(%a[%w%+%.%-]*://%S+)') do -- for each external link get the uri
escaped_uri = uri:gsub ("([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" ); -- save a copy with lua pattern characters escaped
uri = uri:gsub ("[!#%$&'%(%)%*%+,/:;=%?@%[%]%.%%]", ''); -- remove reserved characters and '%' because '%20' (space character) is a lua 'invalid capture index'
pages = pages:gsub (escaped_uri, uri, 1); -- replace original uri with the stripped version
end
return pages;
end
--[[--------------------------< S F N >------------------------------------------------------------------------
entry point for {{sfn}} and {{sfnp}}
]]
local function sfn (frame)
local args = args_fetch (frame, '.'); -- get the template and invoke parameters; default postscript is a dot
local result = core (args); -- go make a CITEREF anchor
-- put it all together and then strip redundant spaces
local name = table.concat ({'FOOTNOTE', args.P1, args.P2, args.P3, args.P4, args.P5, strip_url (args.page), strip_url (args.pages), strip_url (args.location)}):gsub ('%s+', ' ');
return frame:extensionTag ({name='ref', args={name=name}, content=result});
end
--[[--------------------------< S F N M >----------------------------------------------------------------------
common entry point for {{sfnm}} and {{sfnmp}}
Distinguishing features (brackets) are specified in this module's {{#invoke}} in the respective templates.
]]
local function sfnm (frame)
local args = args_default; -- create a copy of the default table
local pframe = frame:getParent(); -- point to the template's parameter table
local n = 1; -- index of source; this is the 'n' in na1, ny, etc
local first_pnum = 1; -- first of a pair of positional parameters
local second_pnum = 2; -- second of a pair of positional parameters
local last_ps = 0; -- index of the last source with |nps= set
local last_index = 0; -- index of the last source; these used to determine which of |ps= or |nps= will terminate the whole rendering
local out = {}; -- table to hold rendered sources
local footnote = {'FOOTNOTE'}; -- all author, date, insource location stuff becomes part of the reference's footnote id; added as we go
for k, v in pairs (frame.args) do -- override defaults with values provided in the #invoke: if any
args[k] = v;
end
while true do
if not pframe.args[table.concat ({n, 'a1'})] and not pframe.args[first_pnum] then
break; -- no na1 or matching positional parameter so done
end
if pframe.args[table.concat ({n, 'a1'})] then -- does this source use named parameters?
for _, v in ipairs ({'P1', 'P2', 'P3', 'P4', 'P5'}) do -- initialize for this source
args[v] = '';
end
for i, v in ipairs ({'P1', 'P2', 'P3', 'P4', 'P5'}) do -- extract author and year parameters for this source
args[v] = pframe.args[table.concat ({n, 'a', i})] or ''; -- attempt to assign author name
if '' == args[v] then -- when there wasn't an author name
args[v] = pframe.args[table.concat ({n, 'y'})] or ''; -- attempt to assign year
break; -- done with author/date for this source
end
end
else -- this source uses positional parameters
args.P1 = mw.text.trim (pframe.args[first_pnum]); -- yes, only one author supported
args.P2 = (pframe.args[second_pnum] and mw.text.trim (pframe.args[second_pnum])) or ''; -- when positional author, year must also be positional
for _, v in ipairs ({'P3', 'P4', 'P5'}) do -- blank the rest of these for this source
args[v] = '';
end
first_pnum = first_pnum + 2; -- source must use positional author and positional year
second_pnum = first_pnum + 1; -- bump these for possible next positional source
end
args.postscript = pframe.args[table.concat ({n, 'ps'})] or '';
if 'none' == args.postscript then -- this for compatibility with other footnote templates; does nothing
args.postscript = '';
end
args.ref = pframe.args[table.concat ({n, 'ref'})] or ''; -- alternate reference for this source
args.page = pframe.args[table.concat ({n, 'p'})] or ''; -- insource locations for this source
args.pages = pframe.args[table.concat ({n, 'pp'})] or '';
args.pages = ('' ~= args.pages) and hyphen_to_dash (args.pages) or '';
args.location = pframe.args[table.concat ({n, 'loc'})] or '';
args.ignore = ('yes' == pframe.args[table.concat ({n, 'ignore-false-positive'})]) or ('yes' == pframe.args[table.concat ({n, 'ignore-err'})]);
table.insert (out, core (args)); -- save the rendering of this source
for k, v in ipairs ({'P1', 'P2', 'P3', 'P4', 'P5'}) do -- create the FOOTNOTE id
if '' ~= args[v] then
table.insert (footnote, args[v]);
end
end
for k, v in ipairs ({'page', 'pages', 'location'}) do -- these done separately so that we can strip uri-reserved characters from extlinked page numbers
if '' ~= args[v] then
table.insert (footnote, strip_url (args[v]))
end
end
last_index = n; -- flags used to select terminal postscript from nps or from end_ps
if '' ~= args.postscript then
last_ps = n;
end
n = n+1; -- bump for the next one
end
local name = table.concat (footnote):gsub ('%s+', ' '); -- put the footnote together and strip redundant space
args.end_ps = pframe.args.postscript or pframe.args.ps or '.'; -- this is the postscript for the whole not for the individual sources
if 'none' == args.end_ps then -- not an original sfnm parameter value; added for compatibility with other footnote templates
args.end_ps = '';
end
local result = table.concat ({table.concat (out, '; '), (last_index == last_ps) and '' or args.end_ps});
return frame:extensionTag ({name='ref', args={name=name}, content=result});
end
--[[--------------------------< S F N R E F >------------------------------------------------------------------
implements {{sfnref}}
]]
local function sfnref (frame)
local args = getArgs (frame);
local out = {};
for i=1, 5 do -- get the first five args if there are five args
if args[i] then
out[i] = args[i];
else
break; -- less than 5 args break out
end
end
if 5 == #out then -- when we have seen five args there may bemore
local i = 6; -- initialize the indexer to the sixth positional parameter
while args[i] do -- in case there are too many authors loop through the authors looking for a year
if is_year (args[i], args) then -- if a year
out[5] = args[i]; -- overwrite whatever was in args[5] with year
break; -- and abandon the search
end
i = i + 1; -- bump the indexer
end
end
return mw.uri.anchorEncode ('CITEREF' .. table.concat (out));
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {
harvard_citation = harvard_citation,
sfn = sfn,
sfnm = sfnm,
sfnref = sfnref,
};
6e6f14a1fb0053e5aed88c564fc13d570e2d5a03
Module:Footnotes/anchor id list
828
58
110
109
2023-12-24T02:01:23Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Footnotes/anchor_id_list]]
Scribunto
text/plain
require('strict');
local data = mw.loadData ('Module:Footnotes/anchor id list/data');
local whitelist = mw.loadData ('Module:Footnotes/whitelist');
local Lang_obj = mw.language.getContentLanguage(); -- used by template_list_add() to uppercase first letter of template name TODO: better way to do that?
local redirects_date = {
['date'] = true,
['datetomos'] = true,
['formatdate'] = true,
['isotodmymdy'] = true,
['isotomos'] = true,
}
local redirects_patent = { -- special case cs1-like templates because uses different parameters for name and date in anchor ID
['Cite patent'] = true,
['Citeref patent'] = true,
['Ref patent'] = true,
}
local redirects_sfnref = {
['sfnref'] = true,
['harvid'] = true,
}
local aliases_author = { -- these use pseudo-patterns in the same way as cs1|2; '#' represents 1 or more enumerator digits
'last#',
'author#',
'surname#',
'author-last#',
'author#-last',
'subject#',
'host#',
}
local aliases_contributor = {
'contributor#',
'contributor-last#',
'contributor#-last',
'contributor-surname#',
'contributor#-surname',
}
local aliases_editor = {
'editor#',
'editor-last#',
'editor#-last',
'editor-surname#',
'editor#-surname',
}
local aliases_harvc_author = {
'last#',
'author#',
}
local aliases_inventor = { -- cite patent
'inventor#',
'inventor-last#',
'inventor#-last',
'inventor-surname#',
'inventor#-surname',
'invent#',
'invent-#',
}
local alias_patterns_date = { -- normal lua patterns for most cs1|2-like templates
'|%s*year%s*=%s*',
'|%s*date%s*=%s*',
'|%s*publication%-?date%s*=%s*',
'|%s*air%-?date%s*=%s*',
}
local alias_patterns_harvc_date = { -- normal lua patterns for harvc template
'|%s*anchor%-year%s*=%s*',
'|%s*year%s*=%s*',
}
local alias_patterns_patent_date = { -- normal lua patterns for cite patent templates
'|%s*issue%-date%s*=%s*',
'|%s*gdate%s*=%s*',
'|%s*publication%-date%s*=%s*',
'|%s*pubdate%s*=%s*',
}
local patterns_date = { -- normal lua patterns
-- '(%d%d%d%d–%d%d%d%d%l?)$', -- YYYY–YYYY four-digit year range at end (Season YYYY–YYYY); with or without dab
'(%d%d%d%d)%D+(%d%d%d%d%l?)$', -- any range with four-digit years; with or without dab; not two captures
'^(%d%d%d%d–%d%d%l?)$', -- YYYY–YY two-digit year range; with or without dab
'^(c%. %d%d%d%d?%l?)$', -- three- or four-digit circa year; with or without dab
'(%d%d%d%d?%l?)$', -- three- or four-digit year at end of date (dmy or mdy); with or without dab
'^(%d%d%d%d?%l?)', -- three- or four-digit year at beginning of date (ymd or YYYY); with or without dab
'^(n%.d%.%l?)$', -- 'no date' with dots; with or without dab
'^(nd%l?)$', -- 'no date' without dots; with or without dab
}
local patterns_tags = {
'<nowiki>.-</nowiki>',
'<!%-%-.-%-%->',
'<pre>.-</pre>',
'<syntaxhighlight.->.-</syntaxhighlight>',
'<source.->.-</source>', -- deprecated alias of syntaxhighlight tag
}
local template_skip = { -- templates to be skipped for whatever reason; mostly because they resemble cs1-like templates
['Citation-attribution'] = true,
}
local Article_content;
local anchor_id_list = {}; -- exported tables
local template_list = {};
local article_whitelist = {};
--[[--------------------------< A R T I C L E _ C O N T E N T _ G E T >----------------------------------------
get article content, remove certain html-like tags and their content so that this code doesn't include any citation
templates inside the tags as valid tagets; they are not.
]]
local function article_content_get ()
if not Article_content then
Article_content = mw.title.getCurrentTitle():getContent() or ''; -- get the content of the article or ''; new pages edited w/ve do not have 'content' until saved; ve does not preview; phab:T221625
for _, tag in ipairs (patterns_tags) do
Article_content = Article_content:gsub (tag, ''); -- remove certain html-like tags and their content
end
end
end
--[[--------------------------< S F N R E F _ G E T >----------------------------------------------------------
make an anchor id from the contents of {{sfnref}} or {{harvid}}. this function assumes that {{sfnref}} and {{harvid}}
are correctly formed.
]]
local function sfnref_get (template)
template = template:gsub ('{{%s*(.-)%s*}}', '%1'); -- strip bounding template markup and trim
local parts = mw.text.split (template, '%s*|%s*'); -- split at the pipe and remove extraneous space characters
local anchor_id = {};
if redirects_sfnref[parts[1]:lower()] then
anchor_id[1] = 'CITEREF';
else
return nil; -- not an sfnref or harvid template
end
local i = 2; -- indexer into parts{} table
local j = 2; -- indexer into anchor_id{} table which already has 'CITEREF' at [1]
while parts[i] and 7 > j do -- loop through what should be just positional parameters for names and year (2-6 four names and a date)
if not parts[i]:find ('=') then -- look for equal sign (named paraneter in a template that doesn't support named parameters)
anchor_id[j] = parts[i]; -- positional parameters are saved
j = j+1; -- bump the anchor_id{} indexer
end
i = i+ 1; -- bump the parts{} indexer
end
return table.concat (anchor_id, '');
end
--[[--------------------------< D A T E _ G E T >--------------------------------------------------------------
extract year from one of |year=, |date=, |publicationdate=, or |publication-date in that order. Does not error
check (that is left to the cs1|2 templates to do)
also gets date from |<date alias>={{date|...}}
]]
local function date_get (template, aliases)
local rvalue;
for _, pattern in ipairs (aliases) do -- spin through the date alias patterns
rvalue = tostring(template):match (pattern); -- is this |<date alias>= used (tostring() because something makes match() think template is a table)
if rvalue then
rvalue = tostring(template):match (pattern .. '(%b{})'); -- is rvalue a template?
if rvalue then
rvalue = rvalue:gsub ('{{%s*(.-)%s*}}', '%1'); -- strip bounding template markup and trim
local parts = mw.text.split (rvalue, '%s*|%s*'); -- split at the pipe and remove extraneous space characters
if redirects_date[parts[1]:lower()] then -- if parts[1] names {{date}} or redirect
rvalue = parts[2]; -- assume that date template is properly formed, first positional parameter is the date
else
return ''; -- |date= holds some other template than {{date}} or redirect
end
else
rvalue = template:match (pattern .. '([^|}]+)');
if rvalue then -- if rvalue is something
rvalue = mw.text.trim (rvalue); -- trim it
end
if not rvalue or '' == rvalue then -- if rvale was nothing or trimed to nothing
rvalue = nil; -- ensure that it is unset so we can try the next parameter in the list
end
end
if rvalue then
for _, pattern in ipairs (patterns_date) do -- spin through the recognized date formats
-- date = rvalue:match (pattern); -- attempt to extract year portion according to the pattern
local date, date2 = rvalue:match (pattern); -- attempt to extract year portion according to the pattern; <date2> gets second year in any range
if date then
if date2 then -- when a second year
date = table.concat ({date, '–', date2}); -- build a date range
end
return date; -- matched so return;
end
end
break; -- found a date but it was malformed so abandon
end
end
end
return ''; -- no date param or date param doesn't hold a recognized date; empty string for concatenation
end
--[[--------------------------< V N A M E S _ G E T >----------------------------------------------------------
extract names from |vauthors= or |veditors=; there is no |vcontributors= parameter.
splits the v parameter value at the comma; correctly handles accept-as-witten markup when used to wrap a comma-
separated names (corporate)
]]
local function vnames_get (params, vparam)
local vnames = {}; -- first four author or editor names go here
local split = {}; -- temp table to assist in decoding accept-as-witten-markup
if params[vparam] then -- test for |vauthors= or |veditor=
split = mw.text.split (params[vparam], '%s*,%s*'); -- this will separate portions of ((Black, Brown, White, an Co.))
local i = 1; -- an indexer
while split[i] do
if split[i]:match ('^%(%(.*[^%)][^%)]$') then -- first segment of comma-separated accept-as-witten; this segment has the opening doubled parens
local name = split[i];
i=i+1; -- bump indexer to next segment
while split[i] do
name = name .. ', ' .. split[i]; -- concatenate with previous segments
if split[i]:match ('^.*%)%)$') then -- if this table member has the closing doubled parens
break; -- and done reassembling so
end
i=i+1; -- bump indexer
end
table.insert (vnames, name); -- and add accept-as-witten name to the vnames table
else
table.insert (vnames, split[i]); -- and add name to the vnames table
end
i=i+1; -- bump indexer
if 5 == i then break; end -- limit to four names
end
for i, vname in ipairs (vnames) do
if not vname:match ('%(%(.-%)%)') then -- without accept-this-value-as-written markup
vnames[i] = vname:gsub ('(.-)%s+%u+$', '%1'); -- extract and save surname(s)
end
end
for i, vname in ipairs (vnames) do -- repeat, this time for accept-this-value-as-written markup
vnames[i] = vname:gsub ('%(%((.-)%)%)', '%1'); -- remove markup if present and save the whole name
end
end
return 0 ~= #vnames and table.concat (vnames) or nil -- return a concatenation of the vnames; nil else
end
--[[--------------------------< N A M E S _ G E T >------------------------------------------------------------
cs1|2 makes anchor id from contributor, author, or editor name-lists in that order
get the names from the cs1|2 template; if there are no contributor names, try author names, then try editor names.
returns concatenated names in enumeration order when successful; nil else
empty name (nameholding parameter n is present without value) and missing name (nameholding parameter n is not
present) are included as empty string with all other names
]]
local function names_get (params, aliases_list)
local names = {}; -- first four author or editor names go here
local enum_alias; -- alias with '#' replaced with a digit
for enum=1, 4 do -- four names only
for i, alias in ipairs (aliases_list) do
if not names[enum] then -- hanven't found a previous alias with this [enum]? see if we can find this alias with this enum
enum_alias = alias:gsub ('#', enum); -- replace '#' to make 'lastn'
if 1 == enum then -- because |last= and last1= are exact aliases
if params[enum_alias] then -- test |last1= first
names[enum] = params[enum_alias]; -- found so save the value assigned to |last1=
break; -- next enum
else
enum_alias = alias:gsub ('#', ''); -- replace '#' to make 'last'
if params[enum_alias] then
names[enum] = params[enum_alias]; -- found so save the value assigned to |last=
break; -- next enum
end
end
else -- here for enum 2, 3, 4
if params[enum_alias] then
names[enum] = params[enum_alias]; -- found so save the value assigned to |lastn=
break; -- next enum
end
end
end
end
end
for enum=1, 4 do -- spin through the names table and
local name = names[enum];
if not name then -- when nameholding parameter n is not present (nil)
name = ''; -- convert to empty string for concatenation
end
name = name:gsub('%(%((.-)%)%)', '%1'); -- remove accept-as-written markup if present
names[enum] = name; -- save the modified name
end
local name_str = table.concat (names); -- concatenate the names
return '' ~= name_str and name_str or nil; -- return the concatenation if not empty string; nil else
end
--[[--------------------------< T E M P L A T E _ S T R I P >--------------------------------------------------
removes the citation or havrc template's {{ and }} markup then removes, in whole, any templates found inside the
citation or harvc template.
Templates are not allowed in parameters that are made part of COinS metadata; yet, they will appear. cs1|2 does
not see the template markup but instead sees the result of the template as html. cs1|2 strips the html which
leaves the displayed value for the anchor id. We can't do that here so, because templates aren't allowed in
parameters, we simply discard any templates found in the cs1|2 template.
this may leave a |lastn= parameter empty which will be treated as if it were really empty as cs1|2 do (three authors,
|last2= empty -> CITEREFLast1Last3YYYY (the harv and sfn render: 'Last1, & Last3 YYYY' with CITEREFLast1Last3YYYY).
]]
local function template_strip (template)
template = template:gsub ('^{{%s*', ''):gsub ('%s*}}$', '', 1); -- remove outer {{ and }} (cs1|2 template delimiters with trailing/leading whitespace)
template = template:gsub ('%b{}', ''); -- remove any templates from the cs1|2 template
return template;
end
--[[--------------------------< E S C A P E _ L U A _ M A G I C _ C H A R S >----------------------------------
Returns a string where all of lua's magic characters have been escaped. This is important because functions like
string.gsub() treat their pattern and replace strings as patterns, not literal strings.
]]
local function escape_lua_magic_chars (argument)
argument = argument:gsub("%%", "%%%%"); -- replace % with %%
argument = argument:gsub("([%^%$%(%)%.%[%]%*%+%-%?])", "%%%1"); -- replace all other lua magic pattern characters
return argument;
end
--[=[-------------------------< W I K I L I N K _ S T R I P >--------------------------------------------------
Wikilink markup does not belong in an anchor id and can / does confuse the code that parses apart citation and
harvc templates so here we remove any wiki markup:
[[link|label]] -> label
[[link]] -> link
]=]
local function wikilink_strip (template)
for wikilink in template:gmatch ('%[%b[]%]') do -- get a wikilink
template = template:gsub ('%[%b[]%]', '__57r1P__', 1); -- install a marker
if wikilink:match ('%[%[.-|(.-)%]%]') then
wikilink = wikilink:match ('%[%[.-|(.-)%]%]'); -- extract label from complex [[link|label]] wikilink
else
wikilink = wikilink:match ('%[%[(.-)%]%]'); -- extract link from simple [[link]] wikilinks
end
wikilink = escape_lua_magic_chars (wikilink); -- in case there are lua magic characters in wikilink
template = template:gsub ('__57r1P__', wikilink, 1); -- replace the marker with the appropriate text
end
return template;
end
--[[--------------------------< T E M P L A T E _ N A M E _ G E T >--------------------------------------------
return the citation or harvc template's name; convert to lower case and trim leading and trailing whitespace;
when the template is a sandbox the subpage portion of the template name is omitted from the returned template name
{{Cite book/new |...}} returns cite book
]]
local function template_name_get (template)
local template_name = template:match ('^{{%s*([^/|}]+)'); -- get template name; ignore subpages ~/new, ~/sandbox; parser functions
if not template_name or template_name:match ('^#') then -- parser functions, magic words don't count as templates
return nil; -- could not get template name from (possibly corrupt) template; extraneous opening { mid template can cause this;
end;
template_name = template_name:gsub ('%s*$', ''); -- trim trailing whitespace; leading whitespace already removed
return Lang_obj:ucfirst (template_name); -- first character in template name must be uppercase (same as canonical template name) TODO: better way to do this?
end
--[[--------------------------< T E M P L A T E _ P A R A M S _ G E T >----------------------------------------
parse apart a template's parameters and store in the params table where key is the parameter's name and value is
the parameter's value; empty parameters are not saved
]]
local function template_params_get (template, params_t)
template = wikilink_strip (template); -- because piped wikilinks confuse code that builds params_t{} and because wikilinks not allowed in an anchor id
-- strip templates after getting |ref= value because |ref={{sfnref}} and |ref={{harvid}} are allowed
template = template_strip (template); -- because template markup can confuse code that builds params_t{} and because templates in name parameters are not allowed
local temp_t = mw.text.split (template, '%s*|%s*'); --split on the pipe
for _, param in ipairs (temp_t) do
if param:find ('=', 1, true) then -- a named parameter?
local k, v = param:match ('%s*([^=]-)%s*=%s*([^|}]+)');
if v then -- there must be a value
if '' ~= v and not v:match ('^%s$') then -- skip when value is empty string or only whitespace
params_t[k] = mw.text.trim (v); -- add trimmed value else
end
end
end
end
end
--[[--------------------------< C I T E R E F _ M A K E _ H A R V C >------------------------------------------
makes anchor_id from {{harvc}} or redirects
]]
local function anchor_id_make_harvc (template)
local date = date_get (template, alias_patterns_harvc_date); -- get date; done here because might be in {{date}}; return date if valid; empty string else
local anchor_id;
local params = {}; -- table of harvc parameters
local id; -- custom anchor id for this {{harvc}} template
id = template:match ('|%s*id%s*=%s*(%b{})'); -- in case |id={{sfnref}}; done here because templates will be stripped
template_params_get (template, params); -- build a table of template parameters and their values; this strips wikilinks and templates
if id then -- when set is {{sfnref}} or {{harvid}} template
return sfnref_get (id); -- returns content of {{sfnref}} or {{harvid}}; nil else
end
if params.id then -- custom anchor for this {{harvc}} template (text)
return params.id; -- |id= value as written
end
anchor_id = names_get (params, aliases_harvc_author); -- get the harvc contributor names
if anchor_id then -- if names were gotten
return 'CITEREF' .. anchor_id .. date;
end
return nil; -- no names; no anchor_id
end
--[[--------------------------< A N C H O R _ I D _ M A K E _ W R A P P E R >----------------------------------
for wrapper templates
inspect externally visible |ref= to decide what to do:
|ref= - empty or missing: get names and date from whitelist defaults; override defaults from externally visible template parameters
|ref=harv - same as empty or missing
|ref={{SfnRef|name|name|name|name|year}} - assemble an anchor id from {{sfnref}} positional parameters
|ref={{Harvid|name|name|name|name|year}} - assemble an anchor id from {{harvid}} positional parameters
|ref=none - skip; do nothing because an anchor id intentionally suppressed; TODO: keep with a type code of '0'?
|ref=<text> - save param value because may match an anchor id override value in {{harv}} template |ref= parameter or {{harvc}} |id= parameter
]]
local function anchor_id_make_wrapper (template)
local ref; -- content of |ref=
local template_name; -- name of the template
local anchor_id; -- the assembled anchor id from this template
local date;
local name_default;
local date_default;
local vol;
local params = {}; -- table of template parameters
template_name = template_name_get (template); -- get first char uppercase trimmed template name; ignore subpages ~/new, ~/sandbox
if not template_name or template_skip[template_name] then
return nil; -- could not extract template name from (possibly corrupted) template (extraneous opening { in the template will cause this)
end
date = date_get (template, alias_patterns_date); -- get date; done here because might be in {{date}}
-- if '' == date then
-- date = whitelist.wrapper_templates[template_name][2] or ''; -- no externally visible date so get default date
-- end
ref = template:match ('|%s*ref%s*=%s*(%b{})'); -- first look for |ref={{sfnref}} or |ref={{harvid}} because we will strip templates from the wrapper template
if not ref then
if template:match ('|%s*ref%s*=([^|}]+)') then -- |ref={{template}} not found; if there is a |ref= param with an assigned value
ref = template:match ('|%s*ref%s*=([^|}]+)'); -- get the value; whitespace is a 'value'
if ref then -- nil when |ref=|... or when |ref=}} (no spaces between assignment operator and pipe or closing brace)
ref = mw.text.trim (ref); -- something, could be just whitespace, so trim leading / trailing whitespace
if '' == ref then -- trimming a string of whitespace makes an empty string
ref = nil; -- make empty ref same as missing ref
end
end
end
end
template_params_get (template, params); -- build a table of template parameters and their values
if whitelist.wrapper_templates[template_name][1] then -- is this wrapper a simple-default wrapper?
name_default = whitelist.wrapper_templates[template_name][1]; -- get the default names
date_default = whitelist.wrapper_templates[template_name][2]; -- get the default date
else
vol = params['volume'] or 'default';
if not whitelist.wrapper_templates[template_name][vol] then -- make sure this volume exists
vol = 'default'; -- doesn't exist, use default volume
end
name_default = whitelist.wrapper_templates[template_name][vol][1]; -- get the default names
date_default = whitelist.wrapper_templates[template_name][vol][2]; -- get the default date
end
if 'harv' == ref or not ref then -- |ref=harv specified or |ref= missing or empty
anchor_id = names_get (params, aliases_contributor) or -- get contributor, author, or editor names
names_get (params, aliases_author) or
vnames_get (params, 'vauthors') or -- |vauthors=
names_get (params, aliases_editor) or
vnames_get (params, 'veditors') or -- |veditors=
name_default; -- default names from whitelist
-- whitelist.wrapper_templates[template_name][1]; -- default names from whitelist
if '' == date then -- if date not provided in the template
date = date_default; -- use the default date from whitelist
end
if anchor_id then -- if names were gotten
anchor_id = 'CITEREF' .. anchor_id .. date;
end
elseif ref:match ('%b{}') then -- ref holds a template
anchor_id = sfnref_get (ref); -- returns content of {{sfnref}} or {{harvid}}; nil else
elseif 'none' == ref then -- |ref=none
return nil; -- anchor id expicitly suppressed
else
anchor_id = ref; -- |ref=<text> may match an anchor id override value in {{harv}} template |ref= parameter
end
return anchor_id; -- anchor_id text; nil else
end
--[[--------------------------< A N C H O R _ I D _ M A K E _ C S 1 2 >----------------------------------------
for cs1|2 template and cs1-like templates
inspect |ref= to decide what to do:
|ref= - empty or missing: get names and date from template parameters; all cs1|2 create CITEREF anchor IDs
|ref=harv - get names and date from template parameters
|ref={{SfnRef|name|name|name|name|year}} - assemble an anchor id from {{sfnref}} positional parameters
|ref={{Harvid|name|name|name|name|year}} - assemble an anchor id from {{harvid}} positional parameters
|ref=none - skip; do nothing because an anchor id intentionally suppressed; TODO: keep with a type code of '0'?
|ref=<text> - save param value because may match an anchor id override value in {{harv}} template |ref= parameter or {{harvc}} |id= parameter
]]
local function anchor_id_make_cs12 (template)
local ref; -- content of |ref=
local template_name; -- name of the template
local anchor_id; -- the assembled anchor id from this template
local date;
local params = {}; -- table of template parameters
template_name = template_name_get (template); -- get first char uppercase trimmed template name; ignore subpages ~/new, ~/sandbox
if not template_name or template_skip[template_name] then
return nil; -- could not extract template name from (possibly corrupted) template (extraneous opening { in the template will cause this)
end
if redirects_patent[template_name] then
date = date_get (template, alias_patterns_patent_date); -- get date; done here because might be in {{date}}
else
date = date_get (template, alias_patterns_date);
end
ref = template:match ('|%s*ref%s*=%s*(%b{})'); -- first look for |ref={{sfnref}} or |ref={{harvid}} because we will strip templates from the cs1|2 template
if not ref then
if template:match ('|%s*ref%s*=([^|}]+)') then -- |ref={{template}} not found; if there is a |ref= param with an assigned value
ref = template:match ('|%s*ref%s*=([^|}]+)'); -- get the value; whitespace is a 'value'
if ref then -- nil when |ref=|... or when |ref=}} (no spaces between assignment operator and pipe or closing brace)
ref = mw.text.trim (ref); -- something, could be just whitespace, so trim leading / trailing whitespace
if '' == ref then -- trimming a string of whitespace makes an empty string
ref = nil; -- make empty ref same as missing ref
end
end
end
end
template_params_get (template, params); -- build a table of template parameters and their values
if not ref then -- |ref= not set, might be cite LSA which doesn't support |ref=
if 'cite lsa' == template_name then
return 'CITEREF' .. (params.last or '') .. (params.year or ''); -- cite LSA always creates an anchor id using only |last= and |year= (no aliases)
end
end
if 'harv' == ref or not ref then -- |ref=harv specified or |ref= missing or empty
if redirects_patent[template_name] then -- if this is a cite patent template
anchor_id = names_get (params, aliases_inventor); -- inventor names only
else -- cs1|2 template
anchor_id = names_get (params, aliases_contributor) or -- get contributor, author, or editor names
names_get (params, aliases_author) or
vnames_get (params, 'vauthors') or -- |vauthors=
names_get (params, aliases_editor) or
vnames_get (params, 'veditors'); -- |veditors=
end
if anchor_id then -- if names were gotten
anchor_id = 'CITEREF' .. anchor_id .. date;
end
elseif ref:match ('%b{}') then -- ref holds a template
anchor_id = sfnref_get (ref); -- returns content of {{sfnref}} or {{harvid}}; nil else
elseif 'none' == ref and not redirects_patent[template_name] then -- |ref=none; not supported by cite patent
return nil; -- anchor id expicitly suppressed
else
anchor_id = ref; -- |ref=<text> may match an anchor id override value in {{harv}} template |ref= parameter
end
return anchor_id; -- anchor_id text; nil else
end
--[[--------------------------< L I S T _ A D D >--------------------------------------------------------------
adds an <item> to <list> table; for anchor IDs, the boolean <encode> argument must be set true; no return value
]]
local function list_add (item, list, encode)
if item then -- if there was an item
if encode then -- for anchor IDs ...
item = mw.uri.anchorEncode (item); -- encode to remove wikimarkup, convert spaces to underscores etc
end
if not list[item] then -- if not already saved
list[item] = 1; -- save it
else -- here when this item already saved
list[item] = list[item] + 1; -- to indicate that there are multiple items
end
end
end
--[[--------------------------< A N C H O R _ I D _ M A K E _ A N C H O R >------------------------------------
make anchor IDs from {{anchor}}; there may be more than one because {{anchor}} is not limited to the number of
anchors it may hold.
]]
local function anchor_id_make_anchor (template, anchor_id_list)
template = template:gsub ('^{{[^|]+|', ''):gsub ('}}$', '', 1); -- remove outer {{ and }} and template name
template = wikilink_strip (template); -- strip any wikilink markup (there shouldn't be any but just in case)
local params = {};
local anchor_id;
for param in template:gmatch ('%b{}') do -- loop through the template; remove and save templates (presumed to be sfnref or harvid)
table.insert (params, param); -- save it
template = template:gsub ('%b{}', '', 1); -- remove it from source template
end
for _, t in ipairs (params) do -- spin through the templates in params
anchor_id = sfnref_get (t); -- attempt to decode {{sfnref}} and {{harvid}}
if anchor_id then -- nil when not {{sfnref}} or {{harvid}}
list_add (anchor_id, anchor_id_list, true); -- add anchor ID to the list
end
end
template = template:gsub ('|%s*|', '|'); -- when pipe follows pipe with or without white space, remove extraneous pipe
template = template:gsub ('^|', ''):gsub('|$', ''); -- remove extraneous leading and trailing pipes
params = mw.text.split (template, '%s*|%s*'); -- split at the pipe and remove extraneous space characters
for _, t in ipairs (params) do -- spin through the anchor IDs
anchor_id = mw.text.trim (t); -- trim white space
if '' ~= anchor_id then -- should always have something
list_add (anchor_id, anchor_id_list, true); -- add anchor ID to the list
end
end
end
--[[--------------------------< T E M P L A T E _ L I S T _ A D D >--------------------------------------------
makes a list of templates use in the article.
]]
local function template_list_add (template)
local template = template:match ('{{%s*(.-)[|}]'); -- keep the case of the template - this is different from template_name_get()
if template and not template:match ('^#') then -- found a template or magic word; ignore magic words
template=mw.text.trim (template); -- trim whitespace
template = Lang_obj:ucfirst (template); -- first character in template name must be uppercase (same as canonical template name) TODO: better way to do this?
list_add (template, template_list); -- add to list with (unused) tally
end
end
--[[--------------------------< A N C H O R _ I D _ L I S T _ M A K E >----------------------------------------
makes a list of anchor ids from cs1|2, cs1|2-like, vcite xxx, harvc, anchor, wikicite templates
Because cs1|2 wrapper templates can, and often do, hide the author and date parameters inside the wrapper,
these parameters are not available in the article's wikisource so {{harv}}, {{sfn}}, and {{harvc}} templates that
link correctly to those wrapper templates will incorrectly show error messages. Use |ignore-err=yes in the {{harv}},
{{sfn}}, and {{harvc}} templates to supress the error message.
creates a list of templates used in the article for use with the whitelist
creates a list of article-local whitelisted anchor IDs from {{sfn whitelist}}
]]
local function anchor_id_list_make ()
article_content_get (); -- attempt to get this article's content
if '' == Article_content then -- when there is no article content
return ''; -- no point in continuing
end
local template; -- place to hold the template that we found
local template_name;
local anchor_id; -- place to hold an anchor id as it is extracted / decoded
local find_pattern = '%f[{]{{[^{]';
local tstart, tend = Article_content:find (find_pattern); -- find the first template; do not find template variables: {{{template var|}}}
while tstart do
template = Article_content:match ('%b{}', tstart); -- get the whole template
if not template then
break; -- template is nil for some reason (last template missing closing }} for example) so declare ourselves done
end
template_name = template_name_get (template); -- get first char uppercase trimmed template name; ignore subpages ~/new, ~/sandbox
template_list_add (template); -- add this template's name to the list
if data.known_templates_cs12 [template_name] then
anchor_id = anchor_id_make_cs12 (template); -- extract an anchor id from this template
list_add (anchor_id, anchor_id_list, true)
elseif data.known_templates_vcite [template_name] then
local ref = template:match ('|%s*ref%s*=%s*(%b{})'); -- first look for |ref={{sfnref}} or |ref={{harvid}} because we will strip templates from the vcite template
if ref then -- |ref={{template}}
anchor_id = sfnref_get (ref); -- returns content of {{sfnref}} or {{harvid}}; nil else
list_add (anchor_id, anchor_id_list, true);
else
local params = {};
template_params_get (template, params); -- build a table of template parameters and their values
anchor_id = params['ref']; -- when both set, vcite uses value from |ref=
if not anchor_id and params['harvid'] then
anchor_id = 'CITEREF' .. params['harvid']; -- in vcite, |harvid= auto-adds 'CITEREF' prefix to the value in |harvid=
end
list_add (anchor_id, anchor_id_list, true);
end
elseif data.known_templates_harvc [template_name] then
anchor_id = anchor_id_make_harvc (template); -- extract an anchor id from this template
list_add (anchor_id, anchor_id_list, true);
elseif data.known_templates_wikicite [template_name] then
local ref = template:match ('|%s*ref%s*=%s*(%b{})'); -- first look for |ref={{sfnref}} or |ref={{harvid}}
if ref then
anchor_id = sfnref_get (ref);
elseif template:match ('|%s*ref%s*=([^|}]+)') then
anchor_id = template:match ('|%s*ref%s*=([^|}]+)'); -- plain-text
elseif template:match ('|%s*id%s*=%s*(%b{})') then
ref = template:match ('|%s*id%s*=%s*(%b{})');
anchor_id = 'Reference-' .. sfnref_get (ref);
elseif template:match ('|%s*id%s*=([^|}]+)') then
anchor_id = 'Reference-' .. template:match ('|%s*id%s*=([^|}]+)'); -- plain-text
else
anchor_id = nil; -- no matches, ensure that anchor_id has no value
end
if anchor_id then
list_add (anchor_id, anchor_id_list, true);
end
elseif data.known_templates_anchor [template_name] then
anchor_id_make_anchor (template, anchor_id_list); -- extract anchor ids from this template if any
elseif data.known_templates_sfn_whitelist [template_name] then
template = template:gsub ('^{{[^|]+|', ''):gsub ('}}$', '', 1); -- remove outer {{ and }} and template name
template = mw.text.trim (template, '%s|'); -- trim leading trailing white space and pipes
template = mw.text.split (template, '%s*|%s*'); -- make a table of the template's parameters
for _, anchor_id in ipairs (template) do -- spin through this template's parameter
if '' ~= anchor_id and not article_whitelist[anchor_id] then
anchor_id = mw.uri.anchorEncode (anchor_id)
article_whitelist[anchor_id] = 1; -- add to the whitelist
end
end
elseif template_name and whitelist.wrapper_templates[template_name] then
anchor_id = anchor_id_make_wrapper (template); -- extract an anchor id from this template if possible
list_add (anchor_id, anchor_id_list, true);
elseif template_name and template_name:match ('^Cit[ea]') then -- not known, not known wrapper; last gasp, try as cs1-like
anchor_id = anchor_id_make_cs12 (template); -- extract an anchor id from this template if possible
list_add (anchor_id, anchor_id_list, true);
end
tstart, tend = Article_content:find (find_pattern, tend); -- search for another template; begin at end of last search
end
mw.logObject (anchor_id_list, 'anchor_id_list');
mw.logObject (template_list, 'template_list');
mw.logObject (article_whitelist, 'article_whitelist');
return anchor_id_list;
end
--[[--------------------------< E X P O R T E D _ T A B L E S >------------------------------------------------
]]
return {
anchor_id_list = anchor_id_list_make(), -- table of anchor ids available in this article
article_whitelist = article_whitelist, -- table of anchor ids with false-positive error message to be suppressed
template_list = template_list, -- table of templates used in this article
}
a827820b3af4a53f9ce6c4a2293bd7f418785903
Module:Footnotes/anchor id list/data
828
59
112
111
2023-12-24T02:01:23Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Footnotes/anchor_id_list/data]]
Scribunto
text/plain
-- copied from Module:Ref info/data - maybe overkill here?
-- for this application make lists from the redirect lists and force all template names first character uppercase
require('strict');
--[[--------------------------< C S 1 _ T E M P L A T E _ P A T T E R N S >------------------------------------
These are patterns for cs1 templates and their redirects. These patterns exclude redirects that are vcite-like
which redirects should be deleted because vcite is not cs1.
]]
local cs1_template_patterns = { -- lua patterns of the cannonical names and redirects
'[Cc]ite ar[Xx]iv', -- arXiv is the canonical name
'[Cc]ite ArXiv',
'[Cc]ite AV media', -- canonical
'[Cc]ite audio', '[Cc]ite AV', '[Cc]ite AV ?Media', '[Cc]ite av media',
'[Cc]ite cd', '[Cc]ite DVD', '[Cc]ite dvd', '[Cc]ite film',
'[Cc]ite image', '[Cc]ite media', '[Cc]ite movie',
'[Cc]ite music video', '[Cc]ite radio', '[Cc]ite song',
'[Cc]ite ?video', '[Cc]ite visual', '[Cc]ite You[Tt]ube',
'[Cc]ita vídeo', -- non-English redirect; TODO: tally separately?
'[Cc]ite AV media notes', -- canonical
'[Cc]ite album[ %-]notes', '[Cc]ite av media notes',
'[Cc]ite DVD[ %-]notes', '[Cc]ite dvd%-notes', '[Cc]ite liner notes',
'[Cc]ite music release notes', '[Ll]iner notes',
'[Cc]ite bio[Rr]xiv', -- bioRxiv is the canonical form
'[Cc]ite [Bb]ook', -- book is the canonical form
'[Bb]ook cite', '[Bb]ook reference', '[Bb]ook reference url',
'[Cc] book', '[Cc]it book', '[Cc]ite books', '[Cc]ite chapter',
'[Cc]ite ebook', '[Cc]ite manual', '[Cc]ite page',
'[Cc]ite publication', '[Cc]ite score',
'[Cc]ite work', '[Cc]ite%-?book',
'[Bb]okref', '[Cc]itace monografie', '[Cc]itar livro', -- non-English redirects; TODO: tally separately?
'[Cc]iteer boek', '[Oo]uvrage', '[Rr]ef%-llibre', '서적 인용',
'[Cc]ite citeseerx', -- canonical
'[Cc]ite conference', -- canonical
'[Cc]ita conferenza', '[Cc]ite proceedings', '[Cc]onference reference', -- cita conferenza is non-English; TODO: tally separately?
'[Cc]ite ?encyclopedia', -- cite encyclopedia is the canonical name
'[Cc]ite contribution', '[Cc]ite dic', '[Cc]ite dictionary',
'[Cc]ite encyclopaedia', '[Cc]ite encyclopædia', '[Ee]ncyclopedia',
'[Cc]ite [Ee]pisode', -- episode is the canonical form
'[Cc]ite show',
'[Cc]ite interview', -- canonical
'[Cc]ite ?journal', -- cite journal is the canonical form
'[Cc] journal', '[Cc]itation journal', '[Cc]ite abstract',
'[Cc]ite document', '[Cc]ite Journal', '[Cc]ite journal zh',
'[Cc]ite ?paper', '[Vv]cite2 journal',
'[Cc]ita pubblicazione', '[Cc]itace periodika', '[Cc]itar jornal', -- non-English redirects; TODO: tally separately?
'[Cc]itar publicació', '[Cc]ytuj pismo', '[Tt]idskriftsref',
'Навод из стручног часописа', '저널 인용',
'[Cc]ite [Mm]agazine', -- magazine is the canonical form
'[Cc]ite mag', '[Cc]ite magazine article', '[Cc]ite newsletter',
'[Cc]ite periodical',
'[Cc]ite mailing ?list', -- mailing list is the canonical form
'[Cc]ite list',
'[Cc]ite maps?', -- map is the canonical form
'[Cc]ite[ %-]?news', -- cite news is the canonical form
'[Cc] news', '[Cc]it news', '[Cc]itation news', '[Cc]ite article',
'[Cc]ite n', '[Cc]ite new', '[Cc]ite newspaper', '[Cc]ite News',
'[Cc]ite news%-q', '[Cc]ite news2', '[Cc]itenewsauthor', '[Cc]ute news',
'[Cc]itar notícia', '[Hh]aber kaynağı', '[Tt]idningsref', 'استشهاد بخبر', -- non-English redirects; TODO: tally separately?
'뉴스 인용',
'[Cc]ite newsgroup', -- canonical
'[Cc]ite usenet',
'[Cc]ite podcast', -- canonical
'[Cc]ite [Pp]ress release', -- press release is the canonical form
'[Cc]ite media release', '[Cc]ite news release', '[Cc]ite pr',
'[Cc]ite press', '[Cc]ite press release\.', '[Cc]ite press[%-]?release',
'[Cc]ite report', -- canonical
'[Cc]ite serial', -- canonical
'[Cc]ite sign', -- canonical
'[Cc]ite plaque',
'[Cc]ite speech', -- canonical
'[Cc]ite ssrn', -- canonical
'[Cc]ite SSRN',
'[Cc]ite tech ?report', -- techreport is the canonical form
'[Cc]ite standard', '[Cc]ite technical report', '[Tt]echrep reference',
'[Cc]ite thesis', -- canonical
'[Cc]ite dissertation',
'[Cc]itar tese', -- non-English redirect; TODO: tally separately?
'[Cc]ite [Ww]eb', -- web is the canonical form
'[Cc] web', '[Cc]it web', '[Cc]ite blog', '[Cc]ite URL', '[Cc]ite url',
'[Cc]ite w', '[Cc]ite wb', '[Cc]ite we', '[Cc]ite web\.',
'[Cc]ite webpage', '[Cc]ite website', '[Cc]ite website article',
'[Cc]ite%-?web', '[Cc]itweb', '[Cc]w', '[Rr]ef web', '[Ww]eb citation',
'[Ww]eb cite', '[Ww]eb link', '[Ww]eb[ %-]reference', '[Ww]eblink',
'[Cc]hú thích web', '[Cc]ita web', '[Cc]itace elektronické monografie', -- non-English redirects; TODO: tally separately?
'[Cc]itat web', 'مرجع ويب', 'یادکرد وب', '웹 인용',
}
--[[--------------------------< C S 2 _ T E M P L A T E _ P A T T E R N S >------------------------------------
These are patterns for cs2 templates redirects.
]]
local cs2_template_patterns = { -- lua patterns of the cannonical names and redirects
'[Cc]itation',
'[Cc]ite', '[Cc]ite citation', '[Cc]ite study',
'[Cc]ite [Tt]echnical standard',
}
--[[--------------------------< V C I T E _ T E M P L A T E _ P A T T E R N S >--------------------------------
These are patterns for Vcite-family templates and their redirects.
]]
local vcite_template_patterns = {
'[Vv]cite book', -- canonical
'[Vv]ancite book', '[Vv]ancite report', '[Vv]cite encyclopedia',
'[Vv]cite report',
'[Vv]cite journal', -- canonical
'[Cc]it journal', '[Cc]it paper', '[Vv]ancite journal', '[Vv]cite paper',
'[Vv]cite news', -- canonical
'[Vv]ancite news',
'[Vv]cite web', -- canonical
'[Vv]ancite web',
}
--[[--------------------------< H A R V C _ T E M P L A T E _ P A T T E R N S >--------------------------------
These are patterns for the harvc template and its redirects.
]]
local harvc_template_patterns = {
'[Hh]arvc', -- canonical
'[Cc]itec',
}
--[[--------------------------< C S 1 _ L I K E _ T E M P L A T E _ P A T T E R N S >--------------------------
These are patterns for miscellaneous templates and their redirects that 'look like' cs1 templates (begin with cite ...)
Because they 'look like' cs1 templates they are handled as if they were cs1 templates. These templates are NOT
wrapper templates; names and dates are always to be extracted from the article instantiation of the template.
]]
local cs1_like_template_patterns = {
'[Cc]ite LSA', -- canonical
}
--[[--------------------------< W I K I C I T E _ T E M P L A T E _ P A T T E R N S >--------------------------
These are patterns for the wikicite template and its redirects.
]]
local wikicite_template_patterns = {
'[Ww]ikicite', -- canonical
}
--[[--------------------------< A N C H O R _ T E M P L A T E _ P A T T E R N S >------------------------------
These are patterns for the anchor template and its redirects.
]]
local anchor_template_patterns = {
'[Aa]nchors?', -- anchor is canonical form
'[Aa]nchor for redirect',
'[Aa]nchro',
'[Aa]ncor',
}
--[[--------------------------< S F N _ W H I T E L I S T _ P A T T E R N S >----------------------------------
These are patterns for the anchor template and its redirects.
]]
local sfn_whitelist_patterns = {
'[Ss]fn whitelist', -- canonical
'[Hh]arv whitelist',
}
--[[--------------------------< K N O W N _ T E M P L A T E S >------------------------------------------------
These tables are created from the *_template_patterns tables. To make these tables, entries in the source tables
are evaluated to replace lua patterns with the appropriate characters to create names for the output tables.
First charqacter is always uppercase
For example:
[Cc]ite ar[Xx]iv
becomes
Cite arXiv
Cite arxiv
]]
local known_templates_cs12 = {}; -- the exported tables
local known_templates_vcite = {};
local known_templates_harvc = {};
local known_templates_wikicite = {};
local known_templates_anchor = {};
local known_templates_sfn_whitelist = {};
local function add_stripped (list, name)
if not list[name] then
list[name] = true;
end
end
local function pattern_convert (pattern, list)
local lead, tail, c, l, name;
local first_char_patterns = {
'^%[(%a)%a%]', -- leading character (usually uppercase)
'^%[%a(%a)%]', -- leading character (usually lowercase)
}
c = tostring (pattern:match ('%u')); -- tostring() required because I don't know why; lua chokes complaining that c is not a string
name = pattern:gsub ('^%[%a%a%]', c); -- replace bracketed first character [Xx] with selected character from the match
if name:match ('(.-)%[(%a)(%a)%](.*)') then -- mixed case optional letters
lead, c, l, tail = name:match ('(.-)%[(%a)(%a)%](.*)');
add_stripped (list, lead .. c .. tail); -- uppercase
add_stripped (list, lead .. l .. tail); -- lowercase
elseif name:match ('^([^%[]+)(%[ %%%-%]%?)(.+)$') then -- [ %-]?
lead, c, tail = name:match ('^([^%[]+)(%[ %%%-%]%?)(.+)$');
add_stripped (list, lead .. tail); -- neither char
add_stripped (list, lead .. ' ' .. tail); -- space
add_stripped (list, lead .. '-' .. tail); -- hyphen
elseif name:match ('^([^%[]+)(%[%%%-%]%?)(.+)$') then -- [%-]?
lead, c, tail = name:match ('^([^%[]+)(%[%%%-%]%?)(.+)$');
add_stripped (list, lead .. tail); -- no hyphen
add_stripped (list, lead .. '-' .. tail); -- hyphen
elseif name:match ('^([^%[]+)(%[ %%%-%])(.+)$') then -- [ %-]
lead, c, tail = name:match ('^([^%[]+)(%[ %%%-%])(.+)$');
add_stripped (list, lead .. ' ' .. tail); -- space
add_stripped (list, lead .. '-' .. tail); -- hyphen
elseif name:match ('^([^%?]+)(%%%-%?)(.+)$') then -- %-?
lead, c, tail = name:match ('^([^%?]+)(%%%-%?)(.+)$');
add_stripped (list, lead .. tail); -- no hyphen
add_stripped (list, lead .. '-' .. tail); -- hyphen
elseif name:match ('^(.-)(%%%-)(.+)$') then -- %-
lead, c, tail = name:match ('^(.-)(%%%-)(.+)$');
add_stripped (list, lead .. '-' .. tail); -- hyphen
elseif name:match ('^(.-)(.)%?(.*)$') then -- .?
lead, c, tail = name:match ('^(.-)(.)%?(.*)$');
add_stripped (list, lead .. tail); -- no character
add_stripped (list, lead .. c .. tail); -- character
else
add_stripped (list, name); -- no patterns so save as is
end
end
for _, t in ipairs ({
{cs1_template_patterns, known_templates_cs12},
{cs2_template_patterns, known_templates_cs12},
{cs1_like_template_patterns, known_templates_cs12},
{vcite_template_patterns, known_templates_vcite},
{harvc_template_patterns, known_templates_harvc},
{wikicite_template_patterns, known_templates_wikicite},
{anchor_template_patterns, known_templates_anchor},
{sfn_whitelist_patterns, known_templates_sfn_whitelist},
}) do
for _, pattern in ipairs (t[1]) do -- for each patern in *_template_patterns
pattern_convert (pattern, t[2]) -- convert and store in known_templates_*
end
end
--[[--------------------------< E X P O R T S >----------------------------------------------------------------
]]
return
{
known_templates_anchor = known_templates_anchor,
known_templates_cs12 = known_templates_cs12,
known_templates_harvc = known_templates_harvc,
known_templates_vcite = known_templates_vcite,
known_templates_wikicite = known_templates_wikicite,
known_templates_sfn_whitelist = known_templates_sfn_whitelist,
}
29b949b2a7e0e2aedfb7399749d699512125a378
Module:Footnotes/whitelist
828
60
114
113
2023-12-24T02:01:24Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Footnotes/whitelist]]
Scribunto
text/plain
--[[--------------------------< W R A P P E R _ T E M P L A T E _ D E F A U L T S >----------------------------
A list of wrapper templates by their canonical names – spelling and capitalization is important. Each wrapper
template has a table of two values: [1] is the wrapper's default name-list as it is used in an anchor ID; [2] is
the default year. This table is indexed indirectly through the wrapper_templates table.
This table is not available externally.
]]
local wrapper_template_defaults = { -- keys are canonical template names
['Americana'] = {'Rines', '1920'}, -- tables with default name and default year
['Cite EB1911'] = {'Chisholm', '1911'}, -- tables with default name and default year
['EB1911'] = {'Chisholm', '1911'},
['EI3'] = {'FleetKrämerMatringeNawas', ''},
['ODNB'] = {'', ''}, -- there is no default anchor ID; this forces evaluation of {{cite ODNB}} redirects
}
--[[--------------------------< W R A P P E R _ T E M P L A T E _ D E F A U L T S _ V O L >--------------------
For wrapper templates that use |volume= to specify default name (often editor names) and year. Wrapper templates
are indexed by their canonical names – spelling and capitalization is important. Each wrapper template has a table
of values for every volume. Volumes may be indexed by Arabic or Roman numerals. Each volume index has a table of
twp values" [1] is the wrapper's default name-list as it is used in an anchor ID; [2] is the default year. Each
wrapper template in this table must have a ['default'] key for those occasions when |volume= is omitted or empty.
This table is indexed indirectly through the wrapper_templates table.
This table is not available externally.
]]
local wrapper_template_defaults_vol = { -- primary keys are canonical template names; TODO: do these keys have to be canonical template names?
['Cite Catholic Encyclopedia'] = { -- secondary keys are volume
['1'] = {'Herbermann', '1907'},
['2'] = {'Herbermann', '1907'},
['3'] = {'Herbermann', '1908'},
['4'] = {'Herbermann', '1908'},
['5'] = {'Herbermann', '1909'},
['6'] = {'Herbermann', '1909'},
['7'] = {'Herbermann', '1910'},
['8'] = {'Herbermann', '1910'},
['9'] = {'Herbermann', '1910'},
['10'] = {'Herbermann', '1911'},
['11'] = {'Herbermann', '1911'},
['12'] = {'Herbermann', '1911'},
['13'] = {'Herbermann', '1912'},
['14'] = {'Herbermann', '1912'},
['15'] = {'Herbermann', '1912'},
['default'] = {'Herbermann', '1913'},
},
['Cite EB9'] = {
['1'] = {'Baynes', '1878'}, ['I'] = {'Baynes', '1878'},
['2'] = {'Baynes', '1878'}, ['II'] = {'Baynes', '1878'},
['3'] = {'Baynes', '1878'}, ['III'] = {'Baynes', '1878'},
['4'] = {'Baynes', '1878'}, ['IV'] = {'Baynes', '1878'},
['5'] = {'Baynes', '1878'}, ['V'] = {'Baynes', '1878'},
['6'] = {'Baynes', '1878'}, ['VI'] = {'Baynes', '1878'},
['7'] = {'Baynes', '1878'}, ['VII'] = {'Baynes', '1878'},
['8'] = {'Baynes', '1878'}, ['VIII'] = {'Baynes', '1878'},
['9'] = {'Baynes', '1879'}, ['IX'] = {'Baynes', '1879'},
['10'] = {'Baynes', '1879'}, ['X'] = {'Baynes', '1879'},
['11'] = {'BaynesSmith', '1880'}, ['XI'] = {'BaynesSmith', '1880'},
['12'] = {'BaynesSmith', '1881'}, ['XII'] = {'BaynesSmith', '1881'},
['13'] = {'BaynesSmith', '1881'}, ['XIII'] = {'BaynesSmith', '1881'},
['14'] = {'BaynesSmith', '1882'}, ['XIV'] = {'BaynesSmith', '1882'},
['15'] = {'BaynesSmith', '1883'}, ['XV'] = {'BaynesSmith', '1883'},
['16'] = {'BaynesSmith', '1883'}, ['XVI'] = {'BaynesSmith', '1883'},
['17'] = {'BaynesSmith', '1884'}, ['XVII'] = {'BaynesSmith', '1884'},
['18'] = {'BaynesSmith', '1885'}, ['XVIII'] = {'BaynesSmith', '1885'},
['19'] = {'BaynesSmith', '1885'}, ['XIX'] = {'BaynesSmith', '1885'},
['20'] = {'BaynesSmith', '1886'}, ['XX'] = {'BaynesSmith', '1886'},
['21'] = {'BaynesSmith', '1886'}, ['XXI'] = {'BaynesSmith', '1886'},
['22'] = {'BaynesSmith', '1887'}, ['XXII'] = {'BaynesSmith', '1887'},
['23'] = {'BaynesSmith', '1888'}, ['XXIII'] = {'BaynesSmith', '1888'},
['24'] = {'BaynesSmith', '1888'}, ['XXIV'] = {'BaynesSmith', '1888'},
['default'] = {'Baynes', '1875–1889'},
},
['Encyclopaedia of Islam, New Edition'] = {
['1'] = {'GibbKramersLévi-ProvençalSchacht', '1960'},
['2'] = {'LewisPellatSchacht', '1965'},
['3'] = {'LewisMénagePellatSchacht', '1971'},
['4'] = {'van_DonzelLewisPellatBosworth', '1978'},
['5'] = {'Bosworthvan_DonzelLewisPellat', '1986'},
['6'] = {'Bosworthvan_DonzelPellat', '1991'},
['7'] = {'Bosworthvan_DonzelHeinrichsPellat', '1993'},
['8'] = {'Bosworthvan_DonzelHeinrichsLecomte', '1995'},
['9'] = {'Bosworthvan_DonzelHeinrichsLecomte', '1997'},
['10'] = {'BearmanBianquisBosworthvan_Donzel', '2000'},
['11'] = {'BearmanBianquisBosworthvan_Donzel', '2002'},
['12'] = {'BearmanBianquisBosworthvan_Donzel', '2004'},
['atlas'] = {'Brice', '1981'},
['abridged'] = {'van_Donzel', '1994'},
['default'] = {'BearmanBianquisBosworthvan_Donzel', '1960–2005'},
},
['New Cambridge Medieval History'] = {
['1'] = {'Fouracre', '2005'},
['2'] = {'McKitterick', '1995'},
['3'] = {'Reuter', '2000'},
['4a'] = {'LuscombeRiley-Smith', '2004'},
['4b'] = {'LuscombeRiley-Smith', '2004'},
['5'] = {'Abulafia', '1999'},
['6'] = {'Jones', '2000'},
['7'] = {'Allmand', '1998'},
['default'] = {'', '1995–2005'},
},
['The History of al-Tabari'] = {
['1'] = {'Rosenthal', '1989'},
['2'] = {'Brinner', '1986'},
['3'] = {'Brinner', '1991'},
['4'] = {'Perlmann', '1987'},
['5'] = {'Bosworth', '1999'},
['6'] = {'WattMcDonald', '1989'},
['7'] = {'McDonald', '1987'},
['8'] = {'Fishbein', '1997'},
['9'] = {'Poonawala', '1990'},
['10'] = {'Donner', '1993'},
['11'] = {'Blankinship', '1993'},
['12'] = {'Friedmann', '1992'},
['13'] = {'Juynboll', '1989'},
['14'] = {'Smith', '1994'},
['15'] = {'Humphreys', '1990'},
['16'] = {'Brockett', '1997'},
['17'] = {'Hawting', '1996'},
['18'] = {'Morony', '1987'},
['19'] = {'Howard', '1990'},
['20'] = {'Hawting', '1989'},
['21'] = {'Fishbein', '1990'},
['22'] = {'Rowson', '1989'},
['23'] = {'Hinds', '1990'},
['24'] = {'Powers', '1989'},
['25'] = {'Blankinship', '1989'},
['26'] = {'Hillenbrand', '1989'},
['27'] = {'Williams', '1985'},
['28'] = {'McAuliffe', '1995'},
['29'] = {'Kennedy', '1990'},
['30'] = {'Bosworth', '1989'},
['31'] = {'Fishbein', '1992'},
['32'] = {'Bosworth', '1987'},
['33'] = {'Bosworth', '1991'},
['34'] = {'Kraemer', '1989'},
['35'] = {'Saliba', '1985'},
['36'] = {'Waines', '1992'},
['37'] = {'Fields', '1987'},
['38'] = {'Rosenthal', '1985'},
['39'] = {'Landau-Tasseron', '1998'},
['40'] = {'Popovkin', '2007'},
['default'] = {'Yarshater', '1985–2007'},
},
}
--[[--------------------------< W R A P P E R _ T E M P L A T E S >--------------------------------------------
A list of wrapper templates and their redirects – spelling and capitalization is important; first character is
always uppercase. Each wrapper template gets its value from a k/v pair in the wrapper_template_defaults table.
article reader queries this table to see if template_name is a wrapper template
]]
local wrapper_templates = { -- keys are names of wrapper templates and their redirects
['Americana'] = wrapper_template_defaults['Americana'], -- canonical name; this template calls Cite Americana
['Catholic Encyclopedia'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['1913Catholic'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['Catholic'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['Catholic encyclopedia'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['CatholicEncyclopedia'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['CE13'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['CE1913'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['Cite Americana'] = wrapper_template_defaults['Americana'], -- canonical name
['Cite Catholic Encyclopedia'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['CathEncy'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['Cite Catholic Encyclopædia'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['Cite CE1913'] = wrapper_template_defaults_vol['Cite Catholic Encyclopedia'],
['Cite EB1911'] = wrapper_template_defaults['Cite EB1911'], -- canonical name
['1911EB'] = wrapper_template_defaults['Cite EB1911'], -- redirects
['EB1911 cite'] = wrapper_template_defaults['Cite EB1911'],
['Wikisource1911Enc Citation'] = wrapper_template_defaults['Cite EB1911'],
['Wikisource1911Enc citation'] = wrapper_template_defaults['Cite EB1911'],
['Cite EB9'] = wrapper_template_defaults_vol['Cite EB9'], -- canonical
['Eb9'] = wrapper_template_defaults_vol['Cite EB9'],
['Cite ODNB'] = wrapper_template_defaults['ODNB'], -- canonical
['Cite odnb'] = wrapper_template_defaults['ODNB'],
['DNBweb'] = wrapper_template_defaults['ODNB'],
['OBDNweb'] = wrapper_template_defaults['ODNB'],
['ODNB'] = wrapper_template_defaults['ODNB'],
['ODNBref'] = wrapper_template_defaults['ODNB'],
['ODNBweb'] = wrapper_template_defaults['ODNB'],
['EB1911'] = wrapper_template_defaults['EB1911'], -- canonical name; this template calls Cite EB1911
['1911'] = wrapper_template_defaults['EB1911'], -- redirects
['1911s'] = wrapper_template_defaults['EB1911'],
['Britannica 1911'] = wrapper_template_defaults['EB1911'],
['Encyclopedia Britannica 1911'] = wrapper_template_defaults['EB1911'],
['Encyclopædia Britannica 1911'] = wrapper_template_defaults['EB1911'],
['EB9'] = wrapper_template_defaults_vol['Cite EB9'], -- canonical; this template calls Cite EB9
['Encyclopaedia of Islam, New Edition'] = wrapper_template_defaults_vol['Encyclopaedia of Islam, New Edition'], -- canonical
['EI2'] = wrapper_template_defaults_vol['Encyclopaedia of Islam, New Edition'],
['Encyclopaedia of Islam, THREE'] = wrapper_template_defaults['EI3'], -- canonical
['EI3'] = wrapper_template_defaults['EI3'],
['New Cambridge Medieval History'] = wrapper_template_defaults_vol['New Cambridge Medieval History'], -- canonical
['The History of al-Tabari'] = wrapper_template_defaults_vol['The History of al-Tabari'], -- canonical
['The History of Al-Tabari'] = wrapper_template_defaults_vol['The History of al-Tabari'], -- redirects
['The History of al-Ṭabarī'] = wrapper_template_defaults_vol['The History of al-Tabari'], -- redirects
}
--[[--------------------------< T E M P L A T E _ N A M E S >--------------------------------------------------
This table holds the names of templates and the names of their redirects. Template names must be written exactly
as they are named at their templatespace page. This same also applies to redirects.
The indexes in this table are not critical but should be short and concise.
]]
local template_names = {
['ADB'] = {'Allgemeine Deutsche Biographie', 'Cite ADB'},
['Butt_Stations'] = {'Butt-Stations', 'Butt-stations'},
['Cam_Hist_Iran'] = {'Cambridge History of Iran', 'The Cambridge History of Iran'},
['DNB'] = {'Cite DNB', 'DNB', 'DNB Cite', 'Cite DNBSupp', 'DNBSupp', 'Cite DNB12', 'Cite DNBIE', 'DNB12', 'DNBIE', 'DNBfirst'},
['ME-ref'] = {'ME-ref', 'Me-ref'},
['ODB'] = {'ODB', 'Oxford Dictionary of Byzantium'},
['ODLA'] = {'ODLA', 'Oxford Dictionary of Late Antiquity'},
['NDB'] = {'Cite NDB', 'NDB'},
['Iranica'] = {'Encyclopædia Iranica Online', 'Encyclopædia Iranica', 'Encyclopaedia Iranica', 'Cite Encyclopædia Iranica Online'},
}
--[[--------------------------< S P E C I A L _ P A T T E R N S >----------------------------------------------
Lua patterns. These are scanned sequentially which costs time and processing far and above the time and processing
needed to index into whitelist{}. Do not create a pattern here if a normal whitelist entry or entries can be created.
]]
local special_patterns = {
'CITEREFACAD%u%u%u?%u?%d+%u%u?', -- {{Acad}} ID appears to be 2-4 letters, then 3 numbers, then 1-2 letters
'CITEREFAHD%d+', -- {{Cite AHD}}
'CITEREFHistoric_England%d+', -- {{National Heritage List for England}} & {{PastScape}}
'CITEREFHistoric_Environment_Scotland%u%u%u?%u?%d', -- {{Historic Environment Scotland}} %u can be BTL, GLD, HMPA, LB, SM
'CITEREFQHR%d+', -- {{Cite QHR}}
'CITEREF[%d%a_%pöüäß→]+_at_Bach_Digital', -- {{BDh}}
'CITEREF[BR]GBl_[12]%d%d%d%-?I?I?%/%d+', -- {{Cite Austrian gazette}}
'CITEREFStGBl_[12]%d%d%d%/%d+', -- {{Cite Austrian gazette}}
'CITEREFGBlÖ_[12]%d%d%d%/%d+', -- {{Cite Austrian gazette}}
}
--[[--------------------------< D N B _ S P E C I A L _ P A T T E R N S >--------------------------------------
Lua patterns. Note at special_patterns applies. These for the DNB templates only; these will be tried only when
there is a DNB template in the article.
Pretty much any author name during the period 1885–1901 inclusive, and 1912.
The DNBIE was published in 1903, and Template:DNBIE says that its use is deprecated, but we do not fight that battle here.
]]
local DNB_special_patterns = {
'CITEREF%a[%a%-_\']*188[5-9]', -- 1885–1889
'CITEREF%a[%a%-_\']*189%d', -- 1890–1899
'CITEREF%a[%a%-_\']*190[0-1]', -- 1900–1901
'CITEREF%a[%a%-_\']*1903', -- 1903 IE
'CITEREF%a[%a%-_\']*1912', -- 1912 supplement
}
--[[--------------------------< W H I T E L I S T >------------------------------------------------------------
This is a list of anchor IDs known to be associated with specific wrapper templates. The anchor ID serves as an
index into the table. The assigned value is another table that lists the associated template and any redirects.
Except for year disambiguators, anchor IDs must have the same form as the anchor creator makes; must be the
anchor-encoded form. Remove the year disambiguator.
Template names must be written exactly as they are named at their templatespace page. This same also applies to
redirects. Module:Footnotes reads the template names left to right so most-commonly-used template or redirect name
should appear first. When there are more than one name and when those templates have various anchor IDs the template
namelist should be added to the template_names{} table.
Note that references to Template:EB1911 are listed under "E" in the alphabetical list below to keep them organized.
]]
local whitelist = {
----------< # >----------
['CITEREF2013_Statistical_Yearbook_of_the_Republic_of_Croatia'] = {'Croatia Yearbook 2013'},
----------< A >----------
['CITEREFAGA_1884–1897'] = {'Schubert\'s compositions (references)'},
['CITEREFATOC2009'] = {'ATOCConnectingCommunitiesReportS10'},
['CITEREFAbaevBailey1985'] = template_names['Iranica'],
['CITEREFAbbas1988'] = template_names['Iranica'],
['CITEREFAbbas1989'] = template_names['Iranica'],
['CITEREFAbramowitzStegun1983'] = {'Abramowitz Stegun ref'},
['CITEREFActa_Lipsiensium1723'] = {'Bach\'s compositions (sources)'},
['CITEREFAdamsFranzosa2009'] = {'Adams Franzosa Introduction to Topology Pure and Applied'},
['CITEREFAdaschErnstKeim1978'] = {'Adasch Topological Vector Spaces'},
['CITEREFAffleck1978'] = {'Affleck-On Track'},
['CITEREFAhlgrimm1969'] = {'Bach\'s compositions (sources)'},
['CITEREFAhmadiNegahban2013'] = {'Encyclopaedia Islamica'},
['CITEREFAhrons1927'] = {'Book-Ahrons-British Steam Railway Locomotive'},
['CITEREFAl-Kindi1912'] = {'The Governors and Judges of Egypt'},
['CITEREFAlbert_Schumann1886'] = {'Cite ADB'},
['CITEREFAlden1916'] = {'Shakespeare sonnets bibliography'},
['CITEREFAldrich1969'] = {'Aldrich-LocosGER7'},
['CITEREFAleksidze2018'] = template_names['ODLA'],
['CITEREFAlexiou2010'] = {'Cite flatiron'},
['CITEREFAlgar1983'] = template_names['Iranica'],
['CITEREFAlgar1989'] = template_names['Iranica'],
['CITEREFAlgar1990'] = template_names['Iranica'],
['CITEREFAlgar2003'] = template_names['Iranica'],
['CITEREFAliprantisBorder2006'] = {'Aliprantis Border Infinite Dimensional Analysis A Hitchhiker\'s Guide Third Edition'},
['CITEREFAlizadeh1990'] = template_names['Iranica'],
['CITEREFAllamaniPanagiotopoulou1978'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFAllcockDaviesle_FlemingMaskelyne1968'] = {'RCTS-LocosGWR-1'},
['CITEREFAllenBoddyBrownFry1970'] = {'RCTS-LocosLNER-8A', 'RCTS-LocosLNER'},
['CITEREFAllenBoddyBrownFry1971'] = {'RCTS-LocosLNER-8B', 'RCTS-LocosLNER'},
['CITEREFAllenBoddyBrownFry1983'] = {'RCTS-LocosLNER-8A', 'RCTS-LocosLNER'},
['CITEREFAmanat1985'] = template_names['Iranica'],
['CITEREFAmanat1998'] = template_names['Iranica'],
['CITEREFAmanat1999'] = template_names['Iranica'],
['CITEREFAmbartsumian2014'] = template_names['Iranica'],
['CITEREFAmerican_Railway_Association1922'] = {'1922 Locomotive Cyclopedia'},
['CITEREFAnderson1952'] = {'Naval Wars in the Levant 1559–1853'},
['CITEREFAndo2000'] = template_names['Iranica'],
['CITEREFAngelov2018'] = template_names['ODLA'],
['CITEREFAnwārEIr1985'] = template_names['Iranica'],
['CITEREFApostol1976'] = {'Apostol IANT'},
['CITEREFArkhangel'skiiPonomarev1984'] = {'Arkhangel\'skii Ponomarev Fundamentals of General Topology Problems and Exercises'},
['CITEREFArrey_von_Dommer1875'] = {'Cite ADB'},
['CITEREFAshraf2006'] = template_names['Iranica'],
['CITEREFAslanianBerberian2009'] = template_names['Iranica'],
['CITEREFAsmus1966'] = template_names['NDB'],
['CITEREFAsmussen1985'] = template_names['Iranica'],
['CITEREFAspreas1929'] = {'Great Military and Naval Encyclopaedia'},
['CITEREFAtkins2007'] = {'Shakespeare sonnets bibliography'},
['CITEREFAube2011'] = template_names['Iranica'],
['CITEREFAudiKondevWangHuang2017'] = {'NUBASE2016'},
['CITEREFAvdoyan2018'] = template_names['ODLA'],
['CITEREFAwdry1990'] = {'Awdry-RailCo', 'Carnarvonshire Railway'},
['CITEREFAzarnoosh2021'] = template_names['Iranica'],
['CITEREFRamelli2018'] = {'Oxford Dictionary of Late Antiquity'},['CITEREFA_History_of_the_Crusades'] = {'Setton-A History of the Crusades'},
----------< B >----------
['CITEREFBabinger1962'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFBabinger1978'] = {'Mehmed the Conqueror and His Time'},
['CITEREFBabinger1992'] = {'Mehmed the Conqueror and His Time'},
['CITEREFBachAgricola1754'] = {'Bach\'s compositions (sources)'},
['CITEREFBadura-SkodaBranscombe2008'] = {'Schubert\'s compositions (references)'},
['CITEREFBagley1999'] = {'Cite Cambridge History of China'},
['CITEREFBahramianHirtensteinGholami2013'] = {'Encyclopaedia Islamica'},
['CITEREFBalcer1990'] = template_names['Iranica'],
['CITEREFBaldwin1969'] = {'Setton-A History of the Crusades'},
['CITEREFBaldwin1985'] = {'Setton-A History of the Crusades'},
['CITEREFBaldwin1991'] = template_names['ODB'],
['CITEREFBaldwinKazhdan1991'] = template_names['ODB'],
['CITEREFBaldwinTalbot1991'] = template_names['ODB'],
['CITEREFBaltzer1916'] = {'Baltzer-Kolonialbahnen'},
['CITEREFBanach1932'] = {'Banach Théorie des Opérations Linéaires'},
['CITEREFBandy2021'] = template_names['Iranica'],
['CITEREFBartusis1991'] = template_names['ODB'],
['CITEREFBaxter1971'] = {'Baxter-BritishLocoCat1'},
['CITEREFBaxter1977'] = {'Baxter-BritishLocoCat1'},
['CITEREFBaxter1978'] = {'Baxter-BritishLocoCat2A'},
['CITEREFBaxter1979'] = {'Baxter-BritishLocoCat2B'},
['CITEREFBaxter1982'] = {'Baxter-BritishLocoCat3A', 'Baxter-BritishLocoCat3B'},
['CITEREFBaxter1984'] = {'Baxter-BritishLocoCat4'},
['CITEREFBaxter1986'] = {'Baxter-BritishLocoCat5A'},
['CITEREFBaxter1988'] = {'Baxter-BritishLocoCat5B'},
['CITEREFBaxter2012'] = {'Baxter-BritishLocoCat6'},
['CITEREFBeattie1986'] = template_names['Iranica'],
['CITEREFBeißwenger1991'] = {'Bach\'s compositions (sources)'},
['CITEREFBek2001'] = {'Cite Grove'},
['CITEREFBelke1996'] = {'Tabula Imperii Byzantini'},
['CITEREFBelkeMersisch1990'] = {'Tabula Imperii Byzantini'},
['CITEREFBelkeRestle1984'] = {'Tabula Imperii Byzantini'},
['CITEREFBellini2008'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFBernardini2003'] = template_names['Iranica'],
['CITEREFBernhard_von_Poten1889'] = template_names['ADB'],
['CITEREFBernhard_von_Poten1898'] = template_names['ADB'],
['CITEREFBernjian2008'] = {'Encyclopaedia Islamica'},
['CITEREFBezilla1980'] = {'Bezilla-PRR-Electric-Traction'},
['CITEREFBianquis1998'] = {'The Cambridge History of Egypt', 'Cambridge History of Egypt'},
['CITEREFBickerman1983'] = template_names['Cam_Hist_Iran'],
['CITEREFBierstedt1988'] = {'Bierstedt An Introduction to Locally Convex Inductive Limits'},
['CITEREFBiran2009'] = template_names['Iranica'],
['CITEREFBirken1976'] = {'Die Provinzen des Osmanischen Reiches'},
['CITEREFBivar1983'] = template_names['Cam_Hist_Iran'],
['CITEREFBivar2003'] = template_names['Iranica'],
['CITEREFBlair2002'] = template_names['Iranica'],
['CITEREFBlair2021'] = template_names['Iranica'],
['CITEREFBlake1966'] = {'DisraeliRef'},
['CITEREFBlanken2019'] = {'Bach\'s compositions (sources)'},
['CITEREFBlankinship1994'] = {'The End of the Jihâd State', 'The End of the Jihad State'},
['CITEREFBlautSchulze2008'] = {'Bach\'s compositions (sources)'},
['CITEREFBloom2007'] = {'Cite Routledge Broadway', 'Cite Broadway Routledge', 'Cite Routledge Guide to Broadway', 'Routledge Guide to Broadway'},
['CITEREFBock1978'] = {'Audie-bock-directors'},
['CITEREFBodde1986'] = {'Cite Cambridge History of China'},
['CITEREFBoddyBrownFryHennigan1968'] = {'RCTS-LocosLNER-4', 'RCTS-LocosLNER'},
['CITEREFBoddyBrownFryHennigan1975'] = {'RCTS-LocosLNER-2B', 'RCTS-LocosLNER'},
['CITEREFBoddyBrownFryHennigan1977'] = {'RCTS-LocosLNER-9A', 'RCTS-LocosLNER-9B', 'RCTS-LocosLNER'},
['CITEREFBoddyBrownFryHennigan1979'] = {'RCTS-LocosLNER-3A', 'RCTS-LocosLNER'},
['CITEREFBoddyBrownHenniganHoole1984'] = {'RCTS-LocosLNER-6C', 'RCTS-LocosLNER'},
['CITEREFBoddyBrownHenniganNeve1981'] = {'RCTS-LocosLNER-3B', 'RCTS-LocosLNER'},
['CITEREFBoddyBrownNeveYeadon1983'] = {'RCTS-LocosLNER-6B', 'RCTS-LocosLNER'},
['CITEREFBoddyFryHenniganHoole1990'] = {'RCTS-LocosLNER-10B', 'RCTS-LocosLNER'},
['CITEREFBoddyFryHenniganProud1963'] = {'RCTS-LocosLNER-1', 'RCTS-LocosLNER'},
['CITEREFBoddyNeveTeeYeadon1982'] = {'RCTS-LocosLNER-6A', 'RCTS-LocosLNER'},
['CITEREFBoddyNeveYeadon1973'] = {'RCTS-LocosLNER-2A', 'RCTS-LocosLNER'},
['CITEREFBody1989'] = {'Body-Railways-Vol2'},
['CITEREFBon1969'] = {'La Morée franque'},
['CITEREFBonebakker1997'] = template_names['Iranica'],
['CITEREFBonner2010'] = {'New Cambridge History of Islam'},
['CITEREFBonnett2005'] = {'Bonnett Practical Rail Engineering'},
['CITEREFBonporti1712'] = {'Bach\'s compositions (sources)'},
['CITEREFBooth2000'] = {'Shakespeare sonnets bibliography'},
['CITEREFBorsari1964'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFBossert1914'] = {'Schaff-Herzog'},
['CITEREFBosworth1968'] = template_names['Cam_Hist_Iran'],
['CITEREFBosworth1975'] = template_names['Cam_Hist_Iran'],
['CITEREFBosworth1983'] = template_names['Iranica'],
['CITEREFBosworth1984'] = template_names['Iranica'],
['CITEREFBosworth1987'] = template_names['Iranica'],
['CITEREFBosworth1988'] = template_names['Iranica'],
['CITEREFBosworth1989'] = template_names['Iranica'],
['CITEREFBosworth1994'] = template_names['Iranica'],
['CITEREFBosworth1995'] = template_names['Iranica'],
['CITEREFBosworth1997'] = template_names['Iranica'],
['CITEREFBosworth1998'] = template_names['Iranica'],
['CITEREFBosworth1999'] = template_names['Iranica'],
['CITEREFBosworth2000'] = template_names['Iranica'],
['CITEREFBosworth2001'] = template_names['Iranica'],
['CITEREFBosworth2002'] = template_names['Iranica'],
['CITEREFBosworth2003'] = template_names['Iranica'],
['CITEREFBosworth2008'] = template_names['Iranica'],
['CITEREFBosworth2009'] = template_names['Iranica'],
['CITEREFBosworth2010'] = template_names['Iranica'],
['CITEREFBosworth2011'] = template_names['Iranica'],
['CITEREFBosworthCrane1984'] = template_names['Iranica'],
['CITEREFBottoMitchell2002'] = {'Cite ATT Broadway', 'Cite At This Theatre Broadway', 'Cite Broadway At This Theatre', 'Cite Broadway ATT'},
['CITEREFBourbaki1987'] = {'Bourbaki Topological Vector Spaces', 'Bourbaki Topological Vector Spaces Part 1 Chapters 1–5'},
['CITEREFBourbaki1989'] = {'Bourbaki General Topology Part I Chapters 1-4', 'Bourbaki General Topology Part II Chapters 5-10', 'Bourbaki Algebra I Chapters 1-3 Springer'},
['CITEREFBourbaki1994'] = {'Bourbaki EHM'},
['CITEREFBournoutian2018'] = {'Cite Armenia and Imperial Decline'},
['CITEREFBowen1928'] = {'The Life and Times of Ali ibn Isa'},
['CITEREFBowmanCameronGarnsey2005'] = {'Cambridge Ancient History'},
['CITEREFBoyce1983'] = template_names['Iranica'],
['CITEREFBoyce1986'] = template_names['Iranica'],
['CITEREFBoyce1989'] = template_names['Iranica'],
['CITEREFBoyce2000'] = template_names['Iranica'],
['CITEREFBoyce2009'] = template_names['Iranica'],
['CITEREFBoyd1970'] = {'Boyd-MidWales'},
['CITEREFBoyd1975'] = {'Boyd-FR1'},
['CITEREFBoyd1985'] = {'Boyd-NCaerns2Penrhyn'},
['CITEREFBoyd1986'] = {'Boyd-NCaerns3Dinorwic'},
['CITEREFBoyd1988'] = {'Boyd-SCaerns1'},
['CITEREFBoyd1989'] = {'Boyd-SCaerns2'},
['CITEREFBoyd1990'] = {'Boyd-NCaerns1'},
['CITEREFBradshaw1968'] = {'Bradshaw-1910April'},
['CITEREFBradshaw1985'] = {'Bradshaw-1922July'},
['CITEREFBradshaw2011'] = {'Bradshaw-1895December'},
['CITEREFBradshaw2012'] = {'Bradshaw-1850March'},
['CITEREFBrand1968'] = {'Byzantium Confronts the West'},
['CITEREFBrand1991'] = {'DBI', 'ODB', 'Oxford Dictionary of Byzantium'},
['CITEREFBray2010'] = {'Bray-SDJR'},
['CITEREFBrett2010'] = {'New Cambridge History of Islam'},
['CITEREFBriant1985'] = template_names['Iranica'],
['CITEREFBrosius2000'] = template_names['Iranica'],
['CITEREFBrown2000'] = template_names['Iranica'],
['CITEREFBrown2008'] = {'The Cambridge History of the Byzantine Empire'},
['CITEREFBrown2021'] = {'Cite Gaia EDR3'},
['CITEREFBrunner1975'] = template_names['Cam_Hist_Iran'],
['CITEREFBrunner1983'] = template_names['Cam_Hist_Iran'],
['CITEREFBrunner1984'] = template_names['Iranica'],
['CITEREFBrunner1986'] = template_names['Iranica'],
['CITEREFBryan1886'] = {'Bryan (3rd edition)'},
['CITEREFBryan1889'] = {'Bryan (3rd edition)'},
['CITEREFBuhle1909'] = {'Bach\'s compositions (sources)'},
['CITEREFBulliet1984'] = template_names['Iranica'],
['CITEREFBulookbashiNegahban2008'] = {'Encyclopaedia Islamica'},
['CITEREFBunbury1857'] = {'DGRG'},
['CITEREFBurant1987'] = {'Cite DCB'},
['CITEREFBurch1911'] = {'Burch Electric Traction'},
['CITEREFBurke1866'] = {'O\'Donnell family tree'},
['CITEREFBurn1985'] = template_names['Cam_Hist_Iran'],
['CITEREFBurrowsWallace1999'] = {'Cite gotham'},
['CITEREFBury1911'] = {'The Imperial Administrative System of the Ninth Century'},
['CITEREFBusse1975'] = template_names['Cam_Hist_Iran'],
['CITEREFBusse1982'] = template_names['Iranica'],
['CITEREFButcherNicholson2018'] = template_names['ODLA'],
['CITEREFButt1995'] = template_names['Butt_Stations'],
['CITEREFBöwering1995'] = template_names['Iranica'],
['CITEREFBürgelMottahedeh1988'] = template_names['Iranica'],
----------< C >----------
['CITEREFCIC1983'] = {'CIC1983bib'},
['CITEREFCalifornia1988'] = {'CA-Rail Passenger Development Plan-1988'},
['CITEREFCallwell1999'] = {'Muni Chronology'},
['CITEREFCalmard1988'] = template_names['Iranica'],
['CITEREFCalmard1999'] = template_names['Iranica'],
['CITEREFCaltrans1984'] = {'Countrystudy'},
['CITEREFCameronWard-PerkinsWhitby2000'] = {'Cambridge Ancient History'},
['CITEREFCanepa2018'] = template_names['ODLA'],
['CITEREFCanny2008'] = {'O\'Donnell family tree'},
['CITEREFCappelCutlerKazhdan1991'] = template_names['ODB'],
['CITEREFCarl_von_Prantl1879'] = {'Cite ADB'},
['CITEREFCarlson2010'] = {'Dlmf'},
['CITEREFCaro1974'] = {'Cite Power Broker'},
['CITEREFCarpenter1977'] = template_names['ME-ref'],
['CITEREFCarpenter1981'] = template_names['ME-ref'],
['CITEREFCarra_de_VauxHodgson1965'] = {'EI2'},
['CITEREFCarter2006'] = {'Carter-RailwaysMotivePowerArgentina'},
['CITEREFCasserley1968'] = {'Casserley-joint'},
['CITEREFCasserleyJohnston1966'] = {'Casserley-LocoGrouping3'},
['CITEREFCasserleyJohnston1974'] = {'Casserley-LocoGrouping3', 'Casserley-LocoGrouping2', '0-7110-0554-0'},
['CITEREFCasway1984'] = {'O\'Donnell family tree'},
['CITEREFCavanna_Ciappina2001'] = {'DBI'},
['CITEREFCawley2001'] = {'Medieval Lands by Charles Cawley', 'MLCC'},
['CITEREFCawley2001'] = {'Medieval Lands by Charles Cawley'},
['CITEREFCawley2010'] = {'MLCC'},
['CITEREFCawley2011'] = {'MLCC'},
['CITEREFCawley2012'] = {'Medieval Lands by Charles Cawley'},
['CITEREFChaléardChanson-JabeurBéranger2006'] = {'Chaléard-Le cdf en Afrique'},
['CITEREFChambers1728'] = {'Cyclopaedia 1728'},
['CITEREFChasiotis1975'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFChaumont1985'] = template_names['Iranica'],
['CITEREFChaumont1986'] = template_names['Iranica'],
['CITEREFChaumont1987'] = template_names['Iranica'],
['CITEREFChaumont1990'] = template_names['Iranica'],
['CITEREFChaumontSchippmann1988'] = template_names['Iranica'],
['CITEREFCheyneBlack1899'] = {'Biblica', 'Cite Biblica'},
['CITEREFCheyneBlack1899–1903'] = {'Cite Biblica'},
['CITEREFCheyneBlack1901'] = {'Cite Biblica'},
['CITEREFCheyneBlack1902'] = {'Cite Biblica'},
['CITEREFCheyneBlack1903'] = {'Cite Biblica'},
['CITEREFChisholm1922'] = {'EB1922', 'Cite EB1922'},
['CITEREFChittick1997'] = template_names['Iranica'],
['CITEREFChkeidze2001'] = template_names['Iranica'],
['CITEREFChoniates1984'] = {'O City of Byzantium'},
['CITEREFChrista_Jost1999'] = template_names['NDB'],
['CITEREFChung1994'] = {'Country study'},
['CITEREFChurchmanHurst2001'] = {'Churchman & Hurst Railways of New Zealand'},
['CITEREFChurchman_&_Hurst2001'] = {'Churchman & Hurst Railways of New Zealand'},
['CITEREFChurella2013'] = {'Churella-PRR-1'},
['CITEREFClementsMcMahon2008'] = {'ClementsMcMahon-GSR Locomotives'},
['CITEREFClinker1978'] = {'Clinker-Stations'},
['CITEREFClinker1988'] = {'Clinker-Stations'},
['CITEREFCoates1990'] = {'Coates-Reading'},
['CITEREFColbyWilliams1916'] = {'New International Encyclopedia', 'NIE'},
['CITEREFColledgeWarlow2006'] = {'Colledge', 'Cite Colledge2006'},
['CITEREFColledgeWarlow2010'] = {'Cite Colledge2010'},
['CITEREFCollins2016'] = {'Cite Collins 2016'},
['CITEREFColvin1947'] = {'Colvin1947'},
['CITEREFConolly1998'] = {'IanAllan-PreGroup-Atlas1998'},
['CITEREFConway1990'] = {'Conway A Course in Functional Analysis'},
['CITEREFCosentino2008'] = {'DBI'},
['CITEREFCoulthard-Clark2002'] = {'Australian Dictionary of Biography'},
['CITEREFCousin1910'] = {'A Short Biographical Dictionary of English Literature', 'Cite SBDEL'},
['CITEREFCoverdale_&_Colpitts1946'] = {'Coverdale & Colpitts 1', 'Coverdale & Colpitts 2', 'Coverdale & Colpitts 3'},
['CITEREFCox1967'] = {'Cox-Upper Darby'},
['CITEREFCox2011'] = {'Cox-Dixie'},
['CITEREFCrevier1993'] = {'Crevier 1993'},
['CITEREFCrockett2007'] = {'Australian Dictionary of Biography'},
['CITEREFCroke2018'] = template_names['ODLA'],
['CITEREFCrone1980'] = {'Slaves on Horses'},
['CITEREFCrone2003'] = {'Slaves on Horses'},
['CITEREFCronin2011'] = template_names['Iranica'],
['CITEREFCroughtonKidnerYoung1982'] = {'Croughton-PrivateStations'},
['CITEREFCruickshanks1970'] = {'HistoryofParliament'},
['CITEREFCsászár1978'] = {'Császár General Topology'},
['CITEREFCudahy2002'] = {'Cudahy-Hudson'},
['CITEREFCudahy2003'] = {'Cudahy-Subways'},
['CITEREFCurta2006'] = {'Southeastern Europe in the Middle Ages, 500–1250'},
----------< D >----------
['CITEREFDBI'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFDZS2015'] = {'Croatia Yearbook 2015'},
['CITEREFDadelsen1957'] = {'Bach\'s compositions (sources)'},
['CITEREFDaftary1990'] = {'Daftary-The Ismailis'},
['CITEREFDaftary2003'] = template_names['Iranica'],
['CITEREFDaftary2007'] = {'Daftary-The Ismailis'},
['CITEREFDaftary2015'] = template_names['Iranica'],
['CITEREFDaiber1988'] = template_names['Iranica'],
['CITEREFDandamayevShahbaziLecoq1986'] = template_names['Iranica'],
['CITEREFDaniel2000'] = template_names['Iranica'],
['CITEREFDaniel2010'] = {'New Cambridge History of Islam'},
['CITEREFDanielsDench1963'] = {'Daniels-NoMore'},
['CITEREFDanielsDench1973'] = {'Daniels-NoMore'},
['CITEREFDanner1975'] = template_names['Cam_Hist_Iran'],
['CITEREFDarleyCanepa2018'] = {'Oxford Dictionary of Late Antiquity'},
['CITEREFDaryaee2009'] = template_names['Iranica'],
['CITEREFDaryaee2018'] = template_names['ODLA'],
['CITEREFDaryaeeCanepa2018'] = template_names['ODLA'],
['CITEREFDavid1961'] = {'Bach\'s compositions (sources)'},
['CITEREFDavidson2010'] = {'HistoryofParliament'},
['CITEREFDavidsonThrush2010'] = {'HistoryofParliament'},
['CITEREFDavies1996'] = {'Davies-PLMLocoList'},
['CITEREFDavies1997'] = {'Davies-NordLocoList'},
['CITEREFDavies2001'] = {'Davies-EstLocoList3', 'Davies-ÉtatLocoList'},
['CITEREFDavies2003'] = {'Davies-SNCFLocoList'},
['CITEREFDaviesFirthLuckingThomas1966'] = {'RCTS-LocosGWR-10'},
['CITEREFDavud2018'] = {'Encyclopaedia Islamica'},
['CITEREFDavudNazerian2008'] = {'Encyclopaedia Islamica'},
['CITEREFDe_Negri1997'] = {'DBI'},
['CITEREFDemircan2010'] = {'TDV Encyclopedia of Islam'},
['CITEREFDer_Matossian2020'] = {'Cite The First Republic of Armenia'},
['CITEREFDeutsch1951'] = {'Schubert\'s compositions (references)'},
['CITEREFDeutsch1978'] = {'Schubert\'s compositions (references)'},
['CITEREFDeutsche_Autos,_Band_2,2001'] = {'Deutsche Autos-2'},
['CITEREFDeutsche_Autos,_Band_3,2001'] = {'Deutsche Autos-3'},
['CITEREFDeutsche_Autos,_Band_4,2001'] = {'Deutsche Autos-4'},
['CITEREFDeutsche_Autos,_Band_5,2001'] = {'Deutsche Autos-5'},
['CITEREFDeutsche_Autos,_Band_6,2001'] = {'Deutsche Autos-6'},
['CITEREFDewick2005'] = {'Dewick-Atlas'},
['CITEREFDiamonstein-Spielvogel2011'] = {'Cite landmarks'},
['CITEREFDickens2018'] = template_names['ODLA'],
['CITEREFDirksen1998'] = {'Bach\'s compositions (sources)'},
['CITEREFDirksen2010'] = {'Bach\'s compositions (sources)'},
['CITEREFDirksen2016'] = {'Bach\'s compositions (sources)'},
['CITEREFDixmier1984'] = {'Dixmier General Topology'},
['CITEREFDoerfer1989'] = template_names['Iranica'],
['CITEREFDoganis1930'] = {'Great Military and Naval Encyclopaedia'},
['CITEREFDoleckiMynard2016'] = {'Dolecki Mynard Convergence Foundations Of Topology'},
['CITEREFDolkart1998'] = {'Cite morningside'},
['CITEREFDonaghy1972'] = {'Donaghy-LMR'},
['CITEREFDonner1995'] = template_names['Iranica'],
['CITEREFDonohue2003'] = {'The Buwayhid Dynasty in Iraq'},
['CITEREFDorin1972'] = {'Dorin-North Western'},
['CITEREFDow1962'] = {'Dow-GC2'},
['CITEREFDow1965'] = {'Dow-GC3'},
['CITEREFDow1985'] = {'Dow-GC1'},
['CITEREFDowney2007'] = {'Downey-Chicago'},
['CITEREFDrechsler2005'] = template_names['Iranica'],
['CITEREFDrummond1964'] = {'HistoryofParliament'},
['CITEREFDrury1985'] = {'Drury Historical Guide 1985'},
['CITEREFDrury1993'] = {'Drury-North American Steam'},
['CITEREFDuchesne-Guillemin1994'] = template_names['Iranica'],
['CITEREFDugundji1966'] = {'Dugundji Topology'},
['CITEREFDuke1995'] = {'Duke-Santa Fe-1'},
['CITEREFDukeKeilty1990'] = {'Duke-RDC'},
['CITEREFDumbarton_Oaks_Hagiography_Database'] = {'Dumbarton Oaks Hagiography Database'},
['CITEREFDunbar1969'] = {'Dunbar-Railroads'},
['CITEREFDuncan-Jones2010'] = {'Shakespeare sonnets bibliography'},
['CITEREFDunlop1895'] = {'O\'Donnell family tree'},
['CITEREFDunlop1985'] = template_names['Iranica'],
['CITEREFDunn2013'] = {'Dunn-Comeng-5'},
['CITEREFDurand-Guédy2008'] = template_names['Iranica'],
['CITEREFDurand-Guédy2010'] = template_names['Iranica'],
['CITEREFDurand-Guédy2013'] = {'Encyclopaedia Islamica'},
['CITEREFDurham1998'] = {'California\'s Geographic Names'},
['CITEREFDurrant1972'] = {'Durrant-Steam Locos Eastern Europe'},
['CITEREFDurrant1981'] = {'Durrant-Garratt-Rev'},
['CITEREFDurrantLewisJorgensen1981'] = {'Durrant-SteamAfrica'},
['CITEREFDömlingKohlhase1971'] = {'Bach\'s compositions (sources)'},
['CITEREFDürr1952'] = {'Bach\'s compositions (sources)'},
['CITEREFDürr1954'] = {'Bach\'s compositions (sources)'},
['CITEREFDürr1987'] = {'Bach\'s compositions (sources)'},
['CITEREFDürrJones2006'] = {'Bach\'s compositions (sources)'},
['CITEREFDürrKobayashi1998'] = {'Bach\'s compositions (sources)'},
['CITEREFde_Blois2000'] = template_names['Iranica'],
['CITEREFde_Planhol1987'] = template_names['Iranica'],
['CITEREFde_Planhol1988'] = template_names['Iranica'],
----------< E >----------
['CITEREFEIr.1994'] = template_names['Iranica'],
['CITEREFEarle2018'] = {'Gymnosperm Database'},
['CITEREFEaston1897'] = {'Eastons', 'EBD'},
['CITEREFEbata2019'] = {'BDh'},
['CITEREFEbata2020'] = {'BDh'},
['CITEREFEbrahimKhodaverdian2018'] = {'Encyclopaedia Islamica'},
['CITEREFEdwards1995'] = {'Edwards Functional Analysis Theory and Applications'},
['CITEREFEichberg1976'] = {'Bach\'s compositions (sources)'},
['CITEREFEilers1983'] = template_names ['Cam_Hist_Iran'],
['CITEREFEkbal1991'] = template_names['Iranica'],
['CITEREFEl-Hibri2010'] = {'New Cambridge History of Islam'},
['CITEREFEl-Hibri2021'] = {'The Abbasid Caliphate: A History'},
['CITEREFEldredgeHorenstein2014'] = {'Cite concrete'},
['CITEREFElsholz1982'] = {'Schubert\'s compositions (references)'},
['CITEREFElwell-Sutton1984'] = template_names['Iranica'],
['CITEREFEppstein1966'] = {'Bach\'s compositions (sources)'},
['CITEREFEppstein1982'] = {'Bach\'s compositions (sources)'},
['CITEREFEquasis'] = {'Csr', 'Cite ship register'},
['CITEREFEuDaly2009'] = {'Complete Book of North American Railroading'},
['CITEREFEuDalySchaferJessupBoyd2009'] = {'Complete Book of North American Railroading'},
----------< F >----------
['CITEREFFacella2021'] = template_names['Iranica'],
['CITEREFFang1943'] = {'Cite ECCP'},
['CITEREFFarinella2001'] = {'DBI'},
['CITEREFFatehi-NezhadAzarnooshNegahban2008'] = {'Encyclopaedia Islamica'},
['CITEREFFatehi-nezhadRahimi2008'] = {'Encyclopaedia Islamica'},
['CITEREFFeder1958'] = {'Bach\'s compositions (sources)'},
['CITEREFFederal_Writers'_Project1939'] = {'Cite fednyc'},
['CITEREFFelixMadelung1995'] = template_names['Iranica'],
['CITEREFFernandez1983'] = {'Fernandez1983'},
['CITEREFFerneyhough1980'] = {'Ferneyhough-LMR'},
['CITEREFFesharaki2015'] = {'Encyclopaedia Islamica'},
['CITEREFFiaccadori1991'] = template_names['ODB'],
['CITEREFFikratUmar2008'] = template_names['Iranica'],
['CITEREFFine1991'] = {'The Early Medieval Balkans'},
['CITEREFFine1994'] = {'The Late Medieval Balkans'},
['CITEREFFletcher,_Great_Tank_Scandal'] = {'Book-Fletcher-Great Tank Scandal'},
['CITEREFFletcher,_Universal_Tank'] = {'Book-Fletcher-Universal Tank'},
['CITEREFFloor1992'] = template_names['Iranica'],
['CITEREFFloor2005'] = template_names['Iranica'],
['CITEREFFlora_of_North_America'] = {'EFloras'},
['CITEREFFlora_of_North_America2009'] = {'EFloras'},
['CITEREFFluckMarshallWilson1996'] = {'FluMarWil-LocRailCR'},
['CITEREFFonstad1991'] = template_names['ME-ref'],
['CITEREFFordCrowther1922'] = {'Ford1922'},
['CITEREFForkelTerry1920'] = {'Bach\'s compositions (sources)'},
['CITEREFFornaçon,_Siegfried1957'] = template_names['NDB'],
['CITEREFForrestal1999'] = {'Forrestal-Wineries'},
['CITEREFForster1990'] = {'Cite DCB'},
['CITEREFFoss1991'] = template_names['ODB'],
['CITEREFFoster1971'] = template_names['ME-ref'],
['CITEREFFoster1996'] = {'Foster-Field Guide'},
['CITEREFFrailey2010'] = {'Frailey-Twilight'},
['CITEREFFranke1994'] = {'Cite Cambridge History of China', 'The Cambridge History of China'},
['CITEREFFranke1994'] = {'Cite Cambridge History of China'},
['CITEREFFranz_Schnorr_von_Carolsfeld1883'] = {'Cite ADB'},
['CITEREFFriedrich_Wilhelm_Bautz1975'] = {'BBKL'},
['CITEREFFriedrich_Wilhelm_Bautz1990'] = {'BBKL'},
['CITEREFFry1964'] = {'RCTS-LocosLNER-7', 'RCTS-LocosLNER'},
['CITEREFFry1966'] = {'RCTS-LocosLNER-5', 'RCTS-LocosLNER'},
['CITEREFFrye1975'] = template_names['Cam_Hist_Iran'],
['CITEREFFrye1983'] = template_names['Cam_Hist_Iran'],
['CITEREFFrye2004'] = template_names['Iranica'],
['CITEREFFubini2012'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFFudenbergTirole1991'] = {'Cite Fudenberg Tirole 1991'},
['CITEREFFultonHarris1991'] = {'Fulton-Harris'},
----------< G >----------
['CITEREFGaines2008'] = {'Cite Gaines 2008'},
['CITEREFGarakaniBrown2013'] = {'Encyclopaedia Islamica'},
['CITEREFGardner2005'] = {'MSW3 Microbiotheria'},
['CITEREFGardoni2015'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFGareyJohnson1979'] = {'Garey-Johnson'},
['CITEREFGarsoian2000'] = template_names['Iranica'],
['CITEREFGarsoian2004'] = template_names['Iranica'],
['CITEREFGarsoian2005'] = template_names['Iranica'],
['CITEREFGarth2003'] = template_names['ME-ref'],
['CITEREFGazette27462'] = {'London Gazette'},
['CITEREFGazette34205'] = {'London Gazette'},
['CITEREFGazette34339'] = {'London Gazette'},
['CITEREFGazette34390'] = {'London Gazette'},
['CITEREFGazette34427'] = {'London Gazette'},
['CITEREFGazette34558'] = {'London Gazette'},
['CITEREFGazette34870'] = {'London Gazette'},
['CITEREFGazette34978'] = {'London Gazette'},
['CITEREFGazette34989'] = {'London Gazette'},
['CITEREFGazette35037'] = {'London Gazette'},
['CITEREFGazette35107'] = {'London Gazette'},
['CITEREFGazette35134'] = {'London Gazette'},
['CITEREFGazette35284'] = {'London Gazette'},
['CITEREFGazette37560'] = {'London Gazette'},
['CITEREFGazette37590'] = {'London Gazette'},
['CITEREFGazette37598'] = {'London Gazette'},
['CITEREFGazette37610'] = {'London Gazette'},
['CITEREFGazette38020'] = {'London Gazette'},
['CITEREFGazette38611'] = {'London Gazette'},
['CITEREFGeanakoplos1959'] = {'Emperor Michael Palaeologus and the West'},
['CITEREFGeorg_von_Dadelsen1953'] = template_names['NDB'],
['CITEREFGhanoonparvar1989'] = template_names['Iranica'],
['CITEREFGhereghlou2009'] = template_names['Iranica'],
['CITEREFGhereghlou2016'] = template_names['Iranica'],
['CITEREFGhulamiyan2015'] = template_names['Iranica'],
['CITEREFGhulamiyan2015'] = {'Encyclopaedia Islamica'},
['CITEREFGiannasi1975'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFGibb1923'] = {'The Arab Conquests in Central Asia'},
['CITEREFGignoux1983'] = template_names['Iranica'],
['CITEREFGignoux1994'] = template_names['Iranica'],
['CITEREFGil1997'] = {'A History of Palestine, 634-1099', 'A History of Palestine, 634–1099'},
['CITEREFGillham2001'] = {'Gillham-Waterloo-City'},
['CITEREFGilliland1969'] = {'Gilliland'},
['CITEREFGilliland1994'] = {'Pop Chronicles 40s'},
['CITEREFGilliverMarshallWeiner2006'] = template_names['ME-ref'],
['CITEREFGilmanPeckColby1905'] = {'Cite NIE', 'New International Encyclopedia', 'NIE'},
['CITEREFGilmanPeckColby1916'] = {'New International Encyclopedia', 'NIE'},
['CITEREFGiunashvili2016'] = template_names['Iranica'],
['CITEREFGleaves1921'] = {'Gleaves'},
['CITEREFGlischinski1997'] = {'Glischinski-Santa Fe'},
['CITEREFGlöckner1983'] = {'Bach\'s compositions (sources)'},
['CITEREFGoldberg1981'] = {'Goldberg-Amtrak'},
['CITEREFGordon2001'] = {'Gordon-The Breaking of a Thousand Swords'},
['CITEREFGraham1974'] = {'Cite DCB'},
['CITEREFGrant1994'] = {'Grant-Death'},
['CITEREFGrant2010'] = {'Grant-Twilight'},
['CITEREFGrant2017'] = {'Grant-RailCo'},
['CITEREFGrassi2018'] = template_names['Iranica'],
['CITEREFGray1986'] = template_names['Cam_Hist_Iran'],
['CITEREFGreenlaw2007'] = {'Greenlaw-Via Rail'},
['CITEREFGreenwoodEarnshaw1997'] = {'Greenwood&Earnshaw2nd'},
['CITEREFGregory1991'] = template_names['ODB'],
['CITEREFGregoryKazhdan1991'] = template_names['ODB'],
['CITEREFGregoryŠevčenko1991'] = template_names['ODB'],
['CITEREFGrete_Schemann1957'] = template_names['NDB'],
['CITEREFGrey2002'] = {'Australian Dictionary of Biography'},
['CITEREFGrierson1903'] = {'Cite LSI', 'LSI', 'Linguistic Survey of India'},
['CITEREFGrierson1908'] = {'Cite LSI', 'LSI', 'Linguistic Survey of India'},
['CITEREFGrierson1919'] = {'Cite LSI', 'LSI', 'Linguistic Survey of India'},
['CITEREFGrierson1967'] = {'Cite LSI', 'LSI', 'Linguistic Survey of India'},
['CITEREFGriffith1991'] = template_names['ODB'],
['CITEREFGriffithsSmith1999'] = {'Griffiths-Sheds1'},
['CITEREFGriffithsSmith2000'] = {'Griffiths-Sheds2'},
['CITEREFGrothendieck1955'] = {'Grothendieck Produits Tensoriels Topologiques et Espaces Nucléaires'},
['CITEREFGrothendieck1973'] = {'Grothendieck Topological Vector Spaces'},
['CITEREFGrothendieckDieudonné1960'] = {'EGA'},
['CITEREFGrothendieckDieudonné1961'] = {'EGA'},
['CITEREFGrothendieckDieudonné1963'] = {'EGA'},
['CITEREFGrothendieckDieudonné1964'] = {'EGA'},
['CITEREFGrothendieckDieudonné1965'] = {'EGA'},
['CITEREFGrothendieckDieudonné1966'] = {'EGA'},
['CITEREFGrothendieckDieudonné1967'] = {'EGA'},
['CITEREFGrothendieckDieudonné1971'] = {'EGA'},
['CITEREFGroves2005'] = {'MSW3 Primates', 'MSW3 Groves'},
['CITEREFGrubb2005'] = {'MSW3 Artiodactyla'},
['CITEREFGuilland1967'] = {'Recherches sur les institutions byzantines'},
['CITEREFGulino2005'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFGunzburg1984'] = {'Gunzburg-History WAGR Steam'},
['CITEREFGurneyNabavi1993'] = template_names['Iranica'],
['CITEREFGutas1987'] = template_names['Iranica'],
['CITEREFGvakharia2001'] = template_names['Iranica'],
['CITEREFGüner1997'] = {'TDV Encyclopedia of Islam'},
----------< H >----------
['CITEREFHaarer2018'] = template_names['ODLA'],
['CITEREFHabibi2021'] = template_names['Iranica'],
['CITEREFHadidi2000'] = template_names['Iranica'],
['CITEREFHaji2008'] = template_names['Iranica'],
['CITEREFHaldon1999'] = {'Warfare, State and Society in the Byzantine World, 565–1204'},
['CITEREFHalliday1985'] = {'Halliday-AustWineCompend'},
['CITEREFHalliday2008'] = {'Halliday-JHWAtlasAust2008'},
['CITEREFHalliday2009'] = {'Halliday-AustWineEncyc'},
['CITEREFHalm1991'] = {'Das Reich des Mahdi'},
['CITEREFHalm1998'] = template_names['Iranica'],
['CITEREFHalm2003'] = {'Die Kalifen von Kairo'},
['CITEREFHalm2014'] = {'Kalifen und Assassinen'},
['CITEREFHalmos1982'] = {'Halmos A Hilbert Space Problem Book 1982'},
['CITEREFHalpenny1990'] = {'Canadabio'},
['CITEREFHambly1990'] = template_names['Cam_Hist_Iran'],
['CITEREFHambly1991'] = template_names['Cam_Hist_Iran'],
['CITEREFHammondAnderson1993'] = template_names['ME-ref'],
['CITEREFHammondScull1995'] = template_names['ME-ref'],
['CITEREFHammondScull2005'] = template_names['ME-ref'],
['CITEREFHammondScull2006'] = template_names['ME-ref'],
['CITEREFHanaway1988'] = template_names['Iranica'],
['CITEREFHanaway1989'] = template_names['Iranica'],
['CITEREFHanawayLewisohn2004'] = template_names['Iranica'],
['CITEREFHans_Heinrich_Borcherdt1955'] = template_names['NDB'],
['CITEREFHans_Knudsen1972'] = template_names['NDB'],
['CITEREFHansen1988'] = {'Book-Hansen-US Nuclear Weapons'},
['CITEREFHansman1991'] = template_names['Iranica'],
['CITEREFHartshorne1977'] = {'Hartshorne AG'},
['CITEREFHassanpour1989'] = template_names['Iranica'],
['CITEREFHassanpour1995'] = template_names['Iranica'],
['CITEREFHasumi2003'] = {'Hasumi-shiguehiko-ozu-2003'},
['CITEREFHaswell-Smith2004'] = {'Haswell-Smith'},
['CITEREFHaugic1908'] = {'Schaff-Herzog'},
['CITEREFHawting1987'] = {'The First Dynasty of Islam'},
['CITEREFHawting2000'] = {'The First Dynasty of Islam'},
['CITEREFHaynes2011'] = {'RubberBible92nd'},
['CITEREFHeinichen1728'] = {'Bach\'s compositions (sources)'},
['CITEREFHeinrich_Welti1890'] = {'Cite ADB'},
['CITEREFHelgen2005'] = {'MSW3 Scandentia'},
['CITEREFHellmann1965'] = {'Bach\'s compositions (sources)'},
['CITEREFHenrici1725'] = {'Bach\'s compositions (sources)'},
['CITEREFHenryOrsmond1928'] = {'Raiatea family tree'},
['CITEREFHermann_Palm1876'] = {'Cite ADB'},
['CITEREFHerr2000'] = {'Herr-LN'},
['CITEREFHeschel2007'] = {'Encyclopaedia Judaica', 'Cite EJ', 'Cite Encyclopaedia Judaica'},
['CITEREFHewsen1988'] = template_names['Iranica'],
['CITEREFHidyHidyScottHofsummer2004'] = {'Hidy-Great Northern'},
['CITEREFHildHellenkemper1990'] = {'Tabula Imperii Byzantini'},
['CITEREFHildHellenkemper1994'] = {'Tabula Imperii Byzantini'},
['CITEREFHildRestle1981'] = {'Tabula Imperii Byzantini'},
['CITEREFHillenbrand1986'] = template_names['Iranica'],
['CITEREFHills,_Power_from_Steam'] = {'Book-Hills-Power from Steam'},
['CITEREFHills1989'] = {'Book-Hills-Power from Steam'},
['CITEREFHilmarJestremski2004'] = {'Schubert\'s compositions (references)'},
['CITEREFHilton1980'] = {'Hilton-Amtrak'},
['CITEREFHilton1990'] = {'Hilton Narrow Gauge'},
['CITEREFHiltonDue1960'] = {'Hilton-Interurban'},
['CITEREFHinton1986'] = {'HistoryofParliament'},
['CITEREFHirsch1906'] = {'Cite JE1906'},
['CITEREFHistoric_England'] = {'NHLE', 'National Heritage List for England'},
['CITEREFHistoric_England_Benty_Grange'] = {'NHLE'},
['CITEREFHistoric_Environment_Scotland'] = {'Canmore'},
['CITEREFHistoric_Environment_Scotland1972'] = {'Historic Environment Scotland'},
['CITEREFHistoric_Environment_Scotland1976'] = {'Historic Environment Scotland'},
['CITEREFHistoric_Environment_Scotland2020'] = {'Historic Environment Scotland'},
['CITEREFHistoric_Environment_Scotland:_Rusco_Tower2020'] = {'Historic Environment Scotland'},
['CITEREFHistoric_Environment_ScotlandLB33744'] = {'Historic Environment Scotland'},
['CITEREFHistoric_Environment_ScotlandLB50114'] = {'Historic Environment Scotland'},
['CITEREFHitchins2001'] = template_names['Iranica'],
['CITEREFHob.'] = {'Schubert\'s compositions (references)'},
['CITEREFHoffmanSmith2005'] = {'MSW3 Lagomorpha'},
['CITEREFHoffmann1738'] = {'Bach\'s compositions (sources)'},
['CITEREFHofmann1983'] = {'Bach\'s compositions (sources)'},
['CITEREFHofmann1987'] = {'Bach\'s compositions (sources)'},
['CITEREFHofmann1999'] = {'Bach\'s compositions (sources)'},
['CITEREFHolland1972'] = {'Holland-Vol 2'},
['CITEREFHolland1988'] = {'Cite DCB'},
['CITEREFHolland1989'] = {'Holland1989'},
['CITEREFHolland2001'] = {'Holland-Classic'},
['CITEREFHollingsworth1980'] = {'Hollingsworth-Atlas-Rigby'},
['CITEREFHollingsworth1991'] = template_names['ODB'],
['CITEREFHollingsworthCutler1991'] = template_names['ODB'],
['CITEREFHolmgren2003'] = {'EFloras'},
['CITEREFHoltBiddle1986'] = {'Holt-NorthWest'},
['CITEREFHolton1989'] = {'Holton-Reading-1'},
['CITEREFHonigmann1935'] = {'Byzance et les Arabes'},
['CITEREFHopley1983'] = {'Australian Dictionary of Biography'},
['CITEREFHort1911'] = {'DCBL'},
['CITEREFHorváth1966'] = {'Horváth Topological Vector Spaces and Distributions Volume 1 1966'},
['CITEREFHosseini2017'] = template_names['Iranica'],
['CITEREFHounshell1984'] = {'Hounshell1984'},
['CITEREFHovannisian1967'] = {'Cite Armenia on the Road to Independence'},
['CITEREFHovannisian1971'] = {'Cite The Republic of Armenia Volume 1'},
['CITEREFHovannisian1982'] = {'Cite The Republic of Armenia Volume 2'},
['CITEREFHovannisian1996'] = {'Cite The Republic of Armenia Volume 3', 'Cite The Republic of Armenia Volume 4'},
['CITEREFHowes1995'] = {'Howes Modern Analysis and Topology 1995'},
['CITEREFHudson1997'] = {'Country study'},
['CITEREFHughes1990'] = {'Hughes-IndianLocos1'},
['CITEREFHughes1992'] = {'Hughes-IndianLocos2'},
['CITEREFHughes1994'] = {'Hughes-IndianLocos3'},
['CITEREFHughes1996'] = {'Hughes-IndianLocos4'},
['CITEREFHummel1943'] = {'Cite ECCP'},
['CITEREFHumphreys2018'] = template_names['ODLA'],
['CITEREFHunter-Crawley2018'] = template_names['ODLA'],
['CITEREFHunter2008'] = {'Country study'},
['CITEREFHunter2012'] = {'Cite HGOC', 'Cite Hunter'},
['CITEREFHutter2009'] = template_names['Iranica'],
['CITEREFHutterer2005'] = {'MSW3 Soricomorpha'},
['CITEREFHütter2012'] = {'Hütter-50bis53'},
['CITEREFHütter2015'] = {'Hütter-54bis59'},
['CITEREFHütter2021'] = {'Hütter-60bis91'},
----------< I >----------
['CITEREFIacocca1984'] = {'Iacocca1984'},
['CITEREFIbn_Khallikan1843'] = {'Ibn Khallikan\'s Biographical Dictionary'},
['CITEREFImber2002'] = {'Imber-The Ottoman Empire, 1300–1650'},
['CITEREFInalcik1989'] = {'Setton-A History of the Crusades'},
['CITEREFIranica:_Bahrām'] = template_names['Iranica'],
['CITEREFIrvine2006'] = template_names['Iranica'],
['CITEREFIshino1998'] = {'Teishajo'},
['CITEREFIshkevariNejad2008'] = {'Encyclopaedia Islamica'},
['CITEREFIvey1919'] = {'Ivey-Marquette'},
----------< J >----------
['CITEREFJackson1908'] = {'Schaff-Herzog'},
['CITEREFJackson1988'] = template_names['Iranica'],
['CITEREFJackson1989'] = template_names['Iranica'],
['CITEREFJackson1995'] = {'Cite enc-nyc'},
['CITEREFJackson2010'] = {'Cite enc-nyc2'},
['CITEREFJacksonMelville2001'] = template_names['Iranica'],
['CITEREFJacobs1904'] = {'Cite Jewish Encyclopedia'},
['CITEREFJarchow1981'] = {'Jarchow Locally Convex Spaces'},
['CITEREFJavadiBurrill1988'] = template_names['Iranica'],
['CITEREFJohn_O'Donovan1856'] = {'Cite AFM'},
['CITEREFJohnson1906'] = {'BDA1906', 'Cite BDA1906'},
['CITEREFJohnstonWelshSchafer2001'] = {'Johnston-Streamliner'},
['CITEREFJones2011'] = {'Cite EPD'},
['CITEREFJordan2002'] = {'Jordan-WineWABest'},
['CITEREFJoshi1983'] = {'Joshi Introduction to General Topology'},
['CITEREFJoslen2003'] = {'Joslen-OOB'},
['CITEREFJowett1867'] = {'DGRBM', 'Cite DGRBM'},
['CITEREFJowett1989'] = {'Jowett-Atlas', 'Carnarvonshire Railway'},
['CITEREFJowett2000'] = {'Jowett-Nationalised'},
['CITEREFJullien2018'] = template_names['ODLA'],
['CITEREFJupp1986'] = {'HistoryofParliament'},
----------< K >----------
['CITEREFK.'] = {'Schubert\'s compositions (references)'},
['CITEREFKadinsky2016'] = {'Cite Hidden Waters NYC'},
['CITEREFKaegi1991'] = template_names['ODB'],
['CITEREFKamaly2006'] = template_names['Iranica'],
['CITEREFKamp1981'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFKang2008'] = {'Country study'},
['CITEREFKaramatiMelvin-Koushki2021'] = template_names['Iranica'],
['CITEREFKaramatiMelvin-Koushki2021'] = {'Encyclopaedia Islamica'},
['CITEREFKarimi-Hakkak1997'] = template_names['Iranica'],
['CITEREFKarimiMaghsoodi2013'] = {'Encyclopaedia Islamica'},
['CITEREFKarl_Frohnmeyer1953'] = template_names['NDB'],
['CITEREFKarnow1989'] = {'Cite-Karnow'},
['CITEREFKasheff2001'] = template_names['Iranica'],
['CITEREFKayvaniGholami2008'] = {'Encyclopaedia Islamica'},
['CITEREFKazemzadeh1951'] = {'Cite The Struggle for Transcaucasia'},
['CITEREFKazemzadeh1951'] = {'The Struggle for Transcaucasia'},
['CITEREFKazhdan1991'] = template_names['ODB'],
['CITEREFKazhdanCutler1991'] = template_names['ODB'],
['CITEREFKazhdanJeffreys1991'] = template_names['ODB'],
['CITEREFKazhdanŠevčenko1991'] = template_names['ODB'],
['CITEREFKeall1987'] = template_names['Iranica'],
['CITEREFKeefe2006'] = {'Schubert\'s compositions (references)'},
['CITEREFKeightley1999'] = {'Cite Cambridge History of China'},
['CITEREFKeller1937'] = {'Bach\'s compositions (sources)'},
['CITEREFKelley1975'] = {'Kelley General Topology'},
['CITEREFKelly1988'] = {'Cite GEIL'},
['CITEREFKellyBurrage1920'] = {'Cite AMB1920'},
['CITEREFKennedy1998'] = {'The Cambridge History of Egypt', 'Cite Kennedy 1998', 'Cambridge History of Egypt'},
['CITEREFKennedy2001'] = {'Kennedy-The Armies of the Caliphs'},
['CITEREFKennedy2004'] = {'The Prophet and the Age of the Caliphates'},
['CITEREFKennedy2007'] = {'Kennedy-The Great Arab Conquests'},
['CITEREFKennedy2016'] = {'The Prophet and the Age of the Caliphates'},
['CITEREFKenyon2011'] = {'Bach\'s compositions (sources)'},
['CITEREFKerrigan1995'] = {'Shakespeare sonnets bibliography'},
['CITEREFKettenhofen1995'] = template_names['Iranica'],
['CITEREFKettenhofen2001'] = template_names['Iranica'],
['CITEREFKettenhofenBournoutianHewsen1998'] = template_names['Iranica'],
['CITEREFKhaleelulla1982'] = {'Khaleelulla Counterexamples in Topological Vector Spaces'},
['CITEREFKhaleghi-Motlagh1999'] = template_names['Iranica'],
['CITEREFKhaleghi-Motlagh2001'] = template_names['Iranica'],
['CITEREFKhan2012'] = {'Cite Banglapedia'},
['CITEREFKhatibiNegahban2013'] = {'Encyclopaedia Islamica'},
['CITEREFKim1994'] = {'Country study'},
['CITEREFKirnberger1774'] = {'Bach\'s compositions (sources)'},
['CITEREFKirnberger1780'] = {'Bach\'s compositions (sources)'},
['CITEREFKlein2006'] = {'Klein-UP-2'},
['CITEREFKlíma1988'] = template_names['Iranica'],
['CITEREFKobayashi1978'] = {'Bach\'s compositions (sources)'},
['CITEREFKoderHild1976'] = {'Tabula Imperii Byzantini'},
['CITEREFKoderSoustalKoder1998'] = {'Tabula Imperii Byzantini'},
['CITEREFKoeppel2015'] = {'Cite citygrid'},
['CITEREFKofos1977'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFKohler1902'] = {'Cite Jewish Encyclopedia'},
['CITEREFKolde1914'] = {'Schaff-Herzog'},
['CITEREFKoliopoulos1978'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFKolmogorovFomin1957'] = {'Kolmogorov Fomin Elements of the Theory of Functions and Functional Analysis'},
['CITEREFKonrad_Ameln1985'] = template_names['NDB'],
['CITEREFKorkotyan1932'] = {'Cite The Population of Soviet Armenia'},
['CITEREFKoska2011'] = {'Bach\'s compositions (sources)'},
['CITEREFKratville1962'] = {'Kratville-SSL'},
['CITEREFKretzschmar1910'] = {'Bach\'s compositions (sources)'},
['CITEREFKube2009'] = {'Schubert\'s compositions (references)'},
['CITEREFKubrusly2011'] = {'Kubrusly The Elements of Operator Theory 2nd Edition 2011'},
['CITEREFKurz1983'] = template_names['Cam_Hist_Iran'],
['CITEREFKuznik2008'] = {'Bach\'s compositions (sources)'},
['CITEREFKöthe1969'] = {'Köthe Topological Vector Spaces I'},
['CITEREFKöthe1979'] = {'Köthe Topological Vector Spaces II'},
['CITEREFKöthe1983'] = {'Köthe Topological Vector Spaces I'},
['CITEREFKülzer2008'] = {'Tabula Imperii Byzantini'},
['CITEREFKüçükaşcı2001'] = {'TDV Encyclopedia of Islam'},
----------< L >----------
['CITEREFLa_Porta2018'] = template_names['ODLA'],
['CITEREFLacourcière1974'] = {'Cite DCB'},
['CITEREFLadefogedMaddieson1996'] = {'SOWL'},
['CITEREFLandau-Tasseron2010'] = {'New Cambridge History of Islam'},
['CITEREFLandauCondit1996'] = {'Cite nysky'},
['CITEREFLandmann1907'] = {'Bach\'s compositions (sources)'},
['CITEREFLang1983'] = template_names['Cam_Hist_Iran'],
['CITEREFLang2002'] = {'Lang Algebra'},
['CITEREFLangaroodiCooper2008'] = {'Encyclopaedia Islamica'},
['CITEREFLangaroodiCooper2015'] = template_names['Iranica'],
['CITEREFLangaroodiCooper2015'] = {'Encyclopaedia Islamica'},
['CITEREFLangaroodiNegahban2008'] = {'Encyclopaedia Islamica'},
['CITEREFLangaroodiNegahban2015'] = template_names['Iranica'],
['CITEREFLangaroodiNegahban2015'] = {'Encyclopaedia Islamica'},
['CITEREFLangaroudi2001'] = template_names['Iranica'],
['CITEREFLatham1982–2021'] = template_names['Iranica'],
['CITEREFLazard1975'] = template_names['Cam_Hist_Iran'],
['CITEREFLaërtius1925'] = {'Cite Lives of the Eminent Philosophers', 'Cite LotEP'},
['CITEREFLeCoq1986'] = template_names['Iranica'],
['CITEREFLe_Quien1740'] = {'Oriens Christianus'},
['CITEREFLe_Strange1900'] = {'Baghdad During the Abbasid Caliphate'},
['CITEREFLe_Strange1905'] = {'Lands of the Eastern Caliphate'},
['CITEREFLe_Strange1922'] = {'Baghdad During the Abbasid Caliphate'},
['CITEREFLeblanc1979'] = {'Cite DCB'},
['CITEREFLee1903'] = {'Cite DNBIE'},
['CITEREFLee2018'] = template_names['ODLA'],
['CITEREFLegifrance'] = {'Cite Legifrance', 'Cite Légifrance'},
['CITEREFLeisingerWollny1993'] = {'Bach\'s compositions (sources)'},
['CITEREFLerner1988'] = template_names['Iranica'],
['CITEREFLev1999'] = {'Saladin in Egypt'},
['CITEREFLevitan2001'] = {'Springer'},
['CITEREFLewin1925'] = {'Lewin-EarlyRail'},
['CITEREFLewis1969'] = {'Setton-A History of the Crusades'},
['CITEREFLewis1986'] = {'Lewis-Shortline-1986'},
['CITEREFLewis1991'] = {'Lewis-Shortline-1991'},
['CITEREFLewis1996'] = {'Lewis-Shortline-1996'},
['CITEREFLewis2001'] = template_names['Iranica'],
['CITEREFLi2002'] = {'Cite Cambridge History of China'},
['CITEREFLiederNet_Archive'] = {'Schubert\'s compositions (references)'},
['CITEREFLieu1997'] = template_names['Iranica'],
['CITEREFLighthouses_of_Australia_Inc'] = {'Cite loa'},
['CITEREFLilieLudwigPratschZielke1998–2013'] = {'Prosopographie der mittelbyzantinischen Zeit'},
['CITEREFLilieLudwigPratschZielke1999'] = {'Prosopographie der mittelbyzantinischen Zeit', 'PMBZ'},
['CITEREFLilieLudwigPratschZielke2000'] = {'Prosopographie der mittelbyzantinischen Zeit'},
['CITEREFLilieLudwigPratschZielke2001'] = {'Prosopographie der mittelbyzantinischen Zeit'},
['CITEREFLilieLudwigPratschZielke2002'] = {'Prosopographie der mittelbyzantinischen Zeit'},
['CITEREFLilieLudwigPratschZielke2009'] = {'Prosopographie der mittelbyzantinischen Zeit'},
['CITEREFLilieLudwigPratschZielke2013'] = {'Prosopographie der mittelbyzantinischen Zeit'},
['CITEREFLind1986'] = {'Lind-Limiteds'},
['CITEREFLittle1974'] = {'Cite DCB'},
['CITEREFLongnon1969'] = {'Setton-A History of the Crusades'},
['CITEREFLosensky2003'] = template_names['Iranica'],
['CITEREFLoverance2018'] = template_names['ODLA'],
['CITEREFLukonin1983'] = {'Cambridge History of Iran'},
['CITEREFLurie'] = {'Lurie-HA'},
['CITEREFLurje2010'] = template_names['Iranica'],
['CITEREFLuttrell1975'] = {'Setton-A History of the Crusades'},
['CITEREFLuttrell1987'] = {'DBI'},
['CITEREFLynch2004'] = {'Lynch-Penn Central'},
['CITEREFLynch2005'] = {'Lynch-New Haven passenger'},
['CITEREFLynch2018'] = template_names['ODLA'],
['CITEREFLéger1990'] = {'Cite DCB'},
['CITEREFle_Fleming1953'] = {'RCTS-LocosGWR-8'},
['CITEREFle_Fleming1960'] = {'RCTS-LocosGWR-8'},
----------< M >----------
['CITEREFMacDermot1927'] = {'Infobox GWR'},
['CITEREFMacDermot1931'] = {'Infobox GWR'},
['CITEREFMacEoin1988'] = template_names['Iranica'],
['CITEREFMacKenzie1992'] = template_names['Iranica'],
['CITEREFMachinery's_Handbook1996'] = {'MachinerysHandbook25e'},
['CITEREFMadelung1975'] = template_names['Cam_Hist_Iran'],
['CITEREFMadelung1978'] = {'EI2'},
['CITEREFMadelung1983'] = template_names['Iranica'],
['CITEREFMadelung1984'] = template_names['Iranica'],
['CITEREFMadelung1988'] = template_names['Iranica'],
['CITEREFMadelung1993'] = template_names['Iranica'],
['CITEREFMadelung2003'] = template_names['Iranica'],
['CITEREFMadelungFelix1995'] = template_names['Iranica'],
['CITEREFMaeda2009'] = template_names['Iranica'],
['CITEREFMagdalino2002'] = {'The Empire of Manuel I Komnenos'},
['CITEREFMaiken1989'] = {'Maiken-Night Trains'},
['CITEREFMailer2004'] = {'Mailer-Omaha Road'},
['CITEREFMajidiNegahban'] = {'Encyclopaedia Islamica'},
['CITEREFMalandra2009'] = template_names['Iranica'],
['CITEREFManfred_Knedlik2007'] = {'BBKL'},
['CITEREFMarshak1994'] = template_names['Iranica'],
['CITEREFMarshak2002'] = template_names['Iranica'],
['CITEREFMarshall1823'] = {'Cite RNB1823'},
['CITEREFMarshall1824'] = {'Cite RNB1823'},
['CITEREFMarshall1825'] = {'Cite RNB1823'},
['CITEREFMarshall1827'] = {'Cite RNB1823'},
['CITEREFMarshall1828'] = {'Cite RNB1823'},
['CITEREFMarshall1829'] = {'Cite RNB1823'},
['CITEREFMarshall1830'] = {'Cite RNB1823'},
['CITEREFMarshall1831'] = {'Cite RNB1823'},
['CITEREFMarshall1832'] = {'Cite RNB1823'},
['CITEREFMarshall1833'] = {'Cite RNB1823'},
['CITEREFMarshall1835'] = {'Cite RNB1823'},
['CITEREFMarshall1972'] = {'Lancashire & Yorkshire Railway 3'},
['CITEREFMarshall2001'] = {'Marshall-INGSR'},
['CITEREFMartin_Persch1992'] = {'BBKL'},
['CITEREFMartin_Persch1993'] = {'BBKL'},
['CITEREFMartin_Persch1996'] = {'BBKL'},
['CITEREFMartindale1980'] = {'Prosopography of the Later Roman Empire', 'PLRE'},
['CITEREFMartindale1992'] = {'Prosopography of the Later Roman Empire', 'PLRE'},
['CITEREFMartindaleJonesMorris1971'] = {'Prosopography of the Later Roman Empire', 'PLRE'},
['CITEREFMasoud_Jalali-Moqaddam2015'] = {'Encyclopaedia Islamica'},
['CITEREFMatini1987'] = template_names['Iranica'],
['CITEREFMatthee2008'] = template_names['Iranica'],
['CITEREFMatthee2012'] = template_names['Iranica'],
['CITEREFMatthee2015'] = template_names['Iranica'],
['CITEREFMaul2005'] = {'Bach\'s compositions (sources)'},
['CITEREFMayGray2006'] = {'MayGray-WAGRPassCar'},
['CITEREFMazzaoui2002'] = template_names['Iranica'],
['CITEREFMcArthurMcArthur2003'] = {'Cite ogn', 'Cite Oregon Geographic Names'},
['CITEREFMcCaffrey1990'] = template_names['Iranica'],
['CITEREFMcCorduck2004'] = {'McCorduck 2004'},
['CITEREFMcCurdyRogers1902'] = {'Cite Jewish Encyclopedia'},
['CITEREFMcDonnell2015'] = {'McDonnell-Locomotives-2nd'},
['CITEREFMcGeerNesbittOikonomides2001'] = {'Catalogue of Byzantine Seals at Dumbarton Oaks and in the Fogg Museum of Art'},
['CITEREFMcGeerNesbittOikonomides2005'] = {'Catalogue of Byzantine Seals at Dumbarton Oaks and in the Fogg Museum of Art'},
['CITEREFMcGhee2008'] = {'Cite McGhee 2008'},
['CITEREFMeiningen1704'] = {'Bach\'s compositions (sources)'},
['CITEREFMeints1992'] = {'Meints-Companies'},
['CITEREFMeints2005'] = {'Meints-Lines'},
['CITEREFMelamed1988'] = {'Bach\'s compositions (sources)'},
['CITEREFMelamed1995'] = {'Bach\'s compositions (sources)'},
['CITEREFMelville1997'] = template_names['Iranica'],
['CITEREFMelville2003'] = template_names['Iranica'],
['CITEREFMennell1892'] = {'Dictionary of Australasian Biography'},
['CITEREFMetcalfe2009'] = {'The Muslims of Medieval Italy'},
['CITEREFMiddleton1961'] = {'Middleton-Interurban'},
['CITEREFMiddleton2001'] = {'Middleton-Electrified-2nd'},
['CITEREFMiddleton2002'] = {'Middleton-PRR-Under-Wire'},
['CITEREFMiddletonSmerkDiehl2007'] = {'Encyclopedia of North American Railroads'},
['CITEREFMiles1975'] = template_names['Cam_Hist_Iran'],
['CITEREFMillar2011'] = {'NZR Steam Locomotive'},
['CITEREFMiller'] = {'Encyclopaedia Islamica'},
['CITEREFMiller1908'] = {'The Latins in the Levant', 'Latins in the Levant'},
['CITEREFMiller1921'] = {'Essays on the Latin Orient'},
['CITEREFMinnich2008'] = {'Country study'},
['CITEREFMiramar_Ship_Index'] = {'Csr', 'Cite ship register'},
['CITEREFMitchell1965'] = {'Mitchell TOC'},
['CITEREFMittermeierKonstantHawkinsLouis2006'] = {'LoM2'},
['CITEREFMittermeierLouisRichardsonSchwitzer2010'] = {'LoM3'},
['CITEREFMittermeierTattersallKonstantMeyers1994'] = {'LoM1'},
['CITEREFMoore1875'] = {'Cite CEM'},
['CITEREFMorana1993'] = {'Bach\'s compositions (sources)'},
['CITEREFMorony2009'] = template_names['Iranica'],
['CITEREFMoschonas1975'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFMottahedeh1975'] = template_names['Cam_Hist_Iran'],
['CITEREFMozartHaydnHaydn2008'] = {'Schubert\'s compositions (references)'},
['CITEREFMullié1852'] = {'Cite Mullié', 'Mullié'},
['CITEREFMunkres1974'] = {'Munkres Topology'},
['CITEREFMunkres2000'] = {'Munkres Topology'},
['CITEREFMurray2006'] = {'Murray-Illinois Central'},
['CITEREFMusserCarleton2005'] = {'MSW3 Muroidea'},
['CITEREFMyersWang2002'] = {'Cite Cambridge History of China'},
['CITEREFMüller,_Hans-Christian1966'] = template_names['NDB'],
----------< N >----------
['CITEREFNSA_II,_15'] = {'Schubert\'s compositions (references)'},
['CITEREFNSA_scores'] = {'Schubert\'s compositions (references)'},
['CITEREFNSA_website'] = {'Schubert\'s compositions (references)'},
['CITEREFNagel1990'] = template_names['Iranica'],
['CITEREFNariciBeckenstein2011'] = {'Narici Beckenstein Topological Vector Spaces'},
['CITEREFNavāʾī1988'] = template_names['Iranica'],
['CITEREFNegahban2008'] = {'Encyclopaedia Islamica'},
['CITEREFNemiroffBonnell1998'] = {'Cite APOD'},
['CITEREFNemiroffBonnell2004'] = {'Cite APOD'},
['CITEREFNemiroffBonnell2005'] = {'Cite APOD'},
['CITEREFNemiroffBonnell2006'] = {'Cite APOD'},
['CITEREFNemiroffBonnell2007'] = {'Cite APOD'},
['CITEREFNersessian2018'] = template_names['ODLA'],
['CITEREFNesbittMorrisson2009'] = {'Catalogue of Byzantine Seals at Dumbarton Oaks and in the Fogg Museum of Art'},
['CITEREFNesbittOikonomides1991'] = {'Catalogue of Byzantine Seals at Dumbarton Oaks and in the Fogg Museum of Art'},
['CITEREFNesbittOikonomides1994'] = {'Catalogue of Byzantine Seals at Dumbarton Oaks and in the Fogg Museum of Art'},
['CITEREFNesbittOikonomides1996'] = {'Catalogue of Byzantine Seals at Dumbarton Oaks and in the Fogg Museum of Art'},
['CITEREFNestruev2020'] = {'Nestruev Smooth Manifolds and Observables 2020'},
['CITEREFNetzer1998'] = template_names['Iranica'],
['CITEREFNetzer2007'] = template_names['Iranica'],
['CITEREFNeukirch1999'] = {'Neukirch ANT'},
['CITEREFNeukirchSchmidtWingberg2000'] = {'Neukirch et al. CNF'},
['CITEREFNew_York_City_Landmarks_Preservation_CommissionDolkartPostal2009'] = {'Cite nycland'},
['CITEREFNewbould1999'] = {'Schubert\'s compositions (references)'},
['CITEREFNewman1994'] = template_names['Iranica'],
['CITEREFNicholson2018'] = template_names['ODLA'],
['CITEREFNicholsonCanepaDaryaee2018'] = template_names['ODLA'],
['CITEREFNicol1968'] = {'The Byzantine Family of Kantakouzenos'},
['CITEREFNicol1984'] = {'The Despotate of Epiros, 1267–1479'},
['CITEREFNicol1988'] = {'Byzantium and Venice: A Study in Diplomatic and Cultural Relations'},
['CITEREFNicol1992'] = {'The Immortal Emperor: The Life and Legend of Constantine Palaiologos, Last Emperor of the Romans'},
['CITEREFNicol1993'] = {'The Last Centuries of Byzantium, 1261–1453', 'The Last Centuries of Byzantium'},
['CITEREFNicol1994'] = {'The Byzantine Lady: Ten Portraits, 1250–1500'},
['CITEREFNock1974'] = {'Nock-EustonGlasgow'},
----------< O >----------
['CITEREFO'Byrne1849'] = {'Cite NBD1849'},
['CITEREFO'ConnorRobertson'] = {'MacTutor Biography', 'MacTutor'},
['CITEREFO'ConnorRobertson1996'] = {'MacTutor Biography', 'MacTutor'},
['CITEREFO'ConnorRobertson2000'] = {'MacTutor Biography', 'MacTutor'},
['CITEREFO'ConnorRobertson2004'] = {'MacTutor Biography', 'MacTutor'},
['CITEREFO'Donoghue1897'] = {'Cite DNB'},
['CITEREFODB'] = template_names['ODB'],
['CITEREFODLA'] = template_names['ODLA'],
['CITEREFOberling1984'] = template_names['Iranica'],
['CITEREFOberling2008'] = template_names['Iranica'],
['CITEREFOberling2010'] = template_names['Iranica'],
['CITEREFOdisheli2018'] = template_names['ODLA'],
['CITEREFOfficial_Guide_of_the_Railways1950'] = {'Official Guide of the Railways'},
['CITEREFOgorek2012'] = {'Ogorek-South Shore'},
['CITEREFOikonomides1991'] = template_names['ODB'],
['CITEREFOikonomou1977'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFOlbrycht2021'] = template_names['Iranica'],
['CITEREFOrmsby1982'] = {'Cite DCB'},
----------< P >----------
['CITEREFPLP'] = {'Prosopographisches Lexikon der Palaiologenzeit', 'PLP'},
['CITEREFPalmer1875'] = {'Cite ADB'},
['CITEREFPalmerStewart1965'] = {'Palmer & Stewart'},
['CITEREFPanainoAbdollahyBalland1990'] = template_names['Iranica'],
['CITEREFPandariHirtensteinNegahban2013'] = {'Encyclopaedia Islamica'},
['CITEREFParvin2003'] = template_names['Iranica'],
['CITEREFParvin2009'] = template_names['Iranica'],
['CITEREFPatience1996'] = {'Patience-SteamTwilight'},
['CITEREFPatton2005'] = {'MSW3 Geomyidae'},
['CITEREFPaul2000'] = template_names['Iranica'],
['CITEREFPawson1979'] = {'Pawson-Delaware Valley'},
['CITEREFPaxtonBourne1985'] = {'Paxton-Bourne'},
['CITEREFPeacock2011'] = template_names['Iranica'],
['CITEREFPeck1898'] = {'HDCA'},
['CITEREFPerlis2001'] = {'Springer'},
['CITEREFPerreault2004'] = {'Bach\'s compositions (sources)'},
['CITEREFPerry1983'] = template_names['Cam_Hist_Iran'],
['CITEREFPerry1990'] = template_names['Cam_Hist_Iran'],
['CITEREFPerry1991'] = template_names['Cam_Hist_Iran'],
['CITEREFPetropoulosKoumarianou1977'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFPetrucci1982'] = {'DBI'},
['CITEREFPezeshk2017'] = {'Encyclopaedia Islamica'},
['CITEREFPezeshkKhaleeli2017'] = template_names['Iranica'],
['CITEREFPezeshkKhaleeli2017'] = {'Encyclopaedia Islamica'},
['CITEREFPfau2008'] = {'Bach\'s compositions (sources)'},
['CITEREFPikros1977'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFPinkepank1973'] = {'Pinkepank diesel spotters guide 2'},
['CITEREFPlantlist2016'] = {'Plantlist'},
['CITEREFPlaten1976'] = {'Bach\'s compositions (sources)'},
['CITEREFPloumidisAlexiou1974'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFPmbZ'] = {'Prosopographie der mittelbyzantinischen Zeit', 'PMBZ'},
['CITEREFPolemis1968'] = {'Polemis-The Doukai'},
['CITEREFPope2007'] = {'Encyclopaedia Judaica', 'Cite EJ', 'Cite Encyclopaedia Judaica'},
['CITEREFPopplewell'] = {'Popplewell-Gazetteer'},
['CITEREFPotts2018'] = template_names['ODLA'],
['CITEREFPottsCanepa2018'] = template_names['ODLA'],
['CITEREFPourshariati2017'] = {'Encyclopædia Iranica Online'},
['CITEREFPozza1992'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFPrawer1985'] = {'Setton-A History of the Crusades'},
['CITEREFPritsak1991'] = template_names['ODB'],
['CITEREFProsopographie_der_mittelbyz._Zeit'] = {'Prosopographie der mittelbyzantinischen Zeit'},
----------< Q >----------
['CITEREFQuick2009'] = {'Quick-Stations'},
['CITEREFQuick2019'] = {'Quick-stations-5'},
['CITEREFQuick2020'] = {'Quick-stations-5'},
['CITEREFQuick2022'] = {'Quick-stations-5'},
['CITEREFQuinn2003'] = template_names['Iranica'],
----------< R >----------
['CITEREFRaditsa1983'] = template_names['Cam_Hist_Iran'],
['CITEREFRahman1983'] = template_names['Iranica'],
['CITEREFRaja'i1987'] = template_names['Iranica'],
['CITEREFRamaer1974'] = {'Ramaer-SteamLocosEAR'},
['CITEREFRansome-Wallis1971'] = {'Ransome-Wallis 1'},
['CITEREFRateliff2007'] = template_names['ME-ref'],
['CITEREFRavegnano2000'] = {'DBI'},
['CITEREFReed1953'] = {'RCTS-LocosGWR-2'},
['CITEREFReed1975'] = {'Reed-Streamline era'},
['CITEREFReed1997'] = {'Schubert\'s compositions (references)'},
['CITEREFReinhard_Tenberg1990'] = {'BBKL'},
['CITEREFRettinghaus2020'] = {'BDh'},
['CITEREFReynolds1921'] = {'Cite Collier\'s', 'Collier\'s'},
['CITEREFReynoldsOroszi2000'] = {'Reynolds-BO'},
['CITEREFRezaHirtensteinGholami2021'] = {'Encyclopaedia Islamica'},
['CITEREFRezakhani2018'] = template_names['ODLA'],
['CITEREFRezvani2014'] = template_names['Iranica'],
['CITEREFRichter-Bernburg2003'] = template_names['Iranica'],
['CITEREFRichter2018'] = {'BDh'},
['CITEREFRigo2005'] = template_names['ODB'],
['CITEREFRipleyDana1863'] = {'New American Cyclopedia'},
['CITEREFRipleyDana1864'] = {'New American Cyclopedia'},
['CITEREFRipleyDana1879'] = {'Cite AmCyc'},
['CITEREFRistaino1988'] = {'Country study'},
['CITEREFRobert_Eitner1891'] = {'Cite ADB'},
['CITEREFRobertson1983'] = {'Robertson-OriginScot'},
['CITEREFRockafellarWets2009'] = {'Rockafellar Wets Variational Analysis 2009 Springer'},
['CITEREFRoe1916'] = {'Roe1916'},
['CITEREFRoe1937'] = {'Roe1937'},
['CITEREFRoemer1986'] = template_names['Cam_Hist_Iran'],
['CITEREFRoemer1989'] = template_names['Iranica'],
['CITEREFRoemer2004'] = template_names['Iranica'],
['CITEREFRolt1965'] = {'Rolt1965'},
['CITEREFRoltKichenside1982'] = {'Rolt-Red'},
['CITEREFRose1857'] = {'Cite Newgenbio'},
['CITEREFRosenfeld1974'] = template_names['NDB'],
['CITEREFRosenzweigBlackmar1992'] = {'Cite Central Park History', 'Cite Central Park history'},
['CITEREFRowe2002'] = {'Cite Cambridge History of China'},
['CITEREFRowledge1975'] = {'Rowledge-Engines of the LMS'},
['CITEREFRowledge1993'] = {'Rowledge-Irish Steam Register'},
['CITEREFRowlett'] = {'Cite rowlett', 'Cite Rowlett'},
['CITEREFRowlett2007'] = {'Cite rowlett', 'Cite Rowlett'},
['CITEREFRowlett2012'] = {'Cite rowlett', 'Cite Rowlett'},
['CITEREFRowlett2013'] = {'Cite rowlett', 'Cite Rowlett'},
['CITEREFRowlett2016'] = {'Cite rowlett', 'Cite Rowlett'},
['CITEREFRowlett2017'] = {'Cite rowlett', 'Cite Rowlett'},
['CITEREFRowson1998'] = template_names['Iranica'],
['CITEREFRudin1973'] = {'Rudin Walter Functional Analysis'},
['CITEREFRudin1991'] = {'Rudin Walter Functional Analysis'},
['CITEREFRunciman1951'] = {'Runciman-A History of the Crusades'},
['CITEREFRunciman1951–1954'] = {'Runciman-A History of the Crusades'},
['CITEREFRunciman1952'] = {'Runciman-A History of the Crusades'},
['CITEREFRunciman1954'] = {'Runciman-A History of the Crusades'},
['CITEREFRunciman1989'] = {'Runciman-A History of the Crusades'},
['CITEREFRussell1985'] = {'Setton-A History of the Crusades', 'Encyclopædia Iranica Online', 'Encyclopædia Iranica', 'Encyclopaedia Iranica', 'Cite Encyclopædia Iranica Online'},
['CITEREFRussell1986'] = template_names['Iranica'],
['CITEREFRussell1987'] = template_names['Iranica'],
['CITEREFRussellNorvig2003'] = {'Russell Norvig 2003'},
['CITEREFRybczynski2000'] = {'Rybczynski2000'},
['CITEREFRypka1968'] = template_names['Cam_Hist_Iran'],
----------< S >----------
['CITEREFSR_staff2013'] = {'Houston family tree'},
['CITEREFSadeghiTehrani2008'] = {'Encyclopaedia Islamica'},
['CITEREFSadıkoğlu1996'] = {'TDV Encyclopedia of Islam'},
['CITEREFSafa1987'] = template_names['Iranica'],
['CITEREFSafa1988'] = template_names['Iranica'],
['CITEREFSafa1989'] = template_names['Iranica'],
['CITEREFSafa1994'] = template_names['Iranica'],
['CITEREFSafa2003'] = template_names['Iranica'],
['CITEREFSajjadiAsatryanMelvin-Koushki'] = {'Encyclopaedia Islamica Online'},
['CITEREFSajjadiAsatryanMelvin-Koushki'] = {'Encyclopaedia Islamica'},
['CITEREFSajjadiAsatryanMelvin-Koushki2021'] = template_names['Iranica'],
['CITEREFSalbiev2021'] = template_names['Iranica'],
['CITEREFSalo2004'] = template_names['ME-ref'],
['CITEREFSamiʿiMelvin-Koushki2013'] = {'Encyclopaedia Islamica'},
['CITEREFSanders1998'] = {'The Cambridge History of Egypt', 'Cambridge History of Egypt'},
['CITEREFSanders2003'] = {'Sanders-Indiana'},
['CITEREFSanders2006'] = {'Sanders-Heartland'},
['CITEREFSanders2007'] = {'Sanders-Akron'},
['CITEREFSarikakis1974'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFSaunders2001'] = {'Saunders-Merging Lines'},
['CITEREFSaunders2013'] = {'Saunders-Giants of the Seas'},
['CITEREFSavadaShaw1992'] = {'Country study'},
['CITEREFSavoryKaramustafa1998'] = template_names['Iranica'],
['CITEREFScarce1986'] = template_names['Iranica'],
['CITEREFSchaeferWolff1999'] = {'Schaefer Wolff Topological Vector Spaces'},
['CITEREFSchafer1996'] = {'Schafer-Classic-Railroads-1'},
['CITEREFSchafer1998'] = {'Schafer-Vintage Diesel'},
['CITEREFSchafer2000'] = {'Schafer-More-Classic'},
['CITEREFSchafer2003'] = {'Schafer-Classic-Railroads-3'},
['CITEREFSchaferSolomon1997'] = {'Schafer-Pennsylvania'},
['CITEREFSchaferWelsh1997'] = {'Schafer-Classic'},
['CITEREFSchaferWelsh2002'] = {'Schafer-Streamliners'},
['CITEREFSchaferWelshHolland2001'] = {'Schafer-American passenger train'},
['CITEREFSchaff-Herzog'] = {'Schaff-Herzog'},
['CITEREFSchechter1996'] = {'Schechter Handbook of Analysis and Its Foundations'},
['CITEREFScheide1960'] = {'Bach\'s compositions (sources)'},
['CITEREFSchicht1805'] = {'Bach\'s compositions (sources)'},
['CITEREFSchilling1997'] = {'Schilling-pop-culture'},
['CITEREFSchindel2013'] = template_names['Iranica'],
['CITEREFSchippmann1986'] = template_names['Iranica'],
['CITEREFSchippmann1987'] = template_names['Iranica'],
['CITEREFSchlitter2005'] = {'MSW3 Tubulidentata'},
['CITEREFSchlumberger1983'] = template_names['Cam_Hist_Iran'],
['CITEREFSchmieder1950'] = {'Bach\'s compositions (sources)'},
['CITEREFSchmieder1990'] = {'Bach\'s compositions (sources)'},
['CITEREFSchmitt1986'] = template_names['Iranica'],
['CITEREFSchmitt1989'] = template_names['Iranica'],
['CITEREFSchmitt1993'] = template_names['Iranica'],
['CITEREFSchmitt1994'] = template_names['Iranica'],
['CITEREFSchmitt1995'] = template_names['Iranica'],
['CITEREFSchmitt2002'] = template_names['Iranica'],
['CITEREFSchmitt2004'] = template_names['Iranica'],
['CITEREFSchmitt2005'] = template_names['Iranica'],
['CITEREFSchmitt2018'] = template_names['Iranica'],
['CITEREFSchmittBailey1986'] = template_names['Iranica'],
['CITEREFSchmitz1870'] = {'Cite DGRBM'},
['CITEREFSchneider1907'] = {'Bach\'s compositions (sources)'},
['CITEREFSchneider1912'] = {'Bach\'s compositions (sources)'},
['CITEREFScholze1736'] = {'Bach\'s compositions (sources)'},
['CITEREFSchroeter1961'] = {'Schroeter-Eisenbahnen'},
['CITEREFSchroeterRamaer1993'] = {'Schroeter-Ramaer-Eisenbahnen'},
['CITEREFSchubert-online'] = {'Schubert\'s compositions (references)'},
['CITEREFSchubert1968'] = {'Schubert Topology'},
['CITEREFSchulenberg2010'] = {'Bach\'s compositions (sources)'},
['CITEREFSchulenberg2013'] = {'Bach\'s compositions (sources)'},
['CITEREFSchulze1980'] = {'Bach\'s compositions (sources)'},
['CITEREFSchulze1983'] = {'Bach\'s compositions (sources)'},
['CITEREFSchulze1984'] = {'Bach\'s compositions (sources)'},
['CITEREFSchwieterman2001'] = {'Schwieterman-Leaves-Eastern'},
['CITEREFScottNegus2011'] = {'Scott-Negus-Cellar Door'},
['CITEREFScribbins1970'] = {'Scribbins-Hiawatha'},
['CITEREFScribbins2008'] = {'Scribbins-400-2008', 'Scribbins-Remembered'},
['CITEREFSearle'] = {'Cite sslidx'},
['CITEREFSearle1980'] = {'Searle 1980'},
['CITEREFSegal1982'] = template_names['Iranica'],
['CITEREFSellwood1983'] = template_names['Cam_Hist_Iran'],
['CITEREFSemmensGoldfinch2003'] = {'Book-Semmens-Goldfinch-How Steam Locomotives Really Work'},
['CITEREFSemsarZand2008'] = {'Encyclopaedia Islamica'},
['CITEREFSetton1975'] = {'Setton-A History of the Crusades'},
['CITEREFSetton1976'] = {'The Papacy and the Levant'},
['CITEREFSetton1978'] = {'The Papacy and the Levant'},
['CITEREFSetton1984'] = {'The Papacy and the Levant'},
['CITEREFSettonHazard1975'] = {'Setton-A History of the Crusades'},
['CITEREFSfyroeras1975'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFShahbazi1986'] = template_names['Iranica'],
['CITEREFShahbazi1987'] = template_names['Iranica'],
['CITEREFShahbazi1988'] = template_names['Iranica'],
['CITEREFShahbazi1989'] = template_names['Iranica'],
['CITEREFShahbazi1991'] = template_names['Iranica'],
['CITEREFShahbazi1994'] = template_names['Iranica'],
['CITEREFShahbazi2002'] = template_names['Iranica'],
['CITEREFShahbazi2003'] = template_names['Iranica'],
['CITEREFShahbazi2004'] = template_names['Iranica'],
['CITEREFShahbazi2005'] = template_names['Iranica'],
['CITEREFShahbaziBosworth1990'] = template_names['Iranica'],
['CITEREFShahbaziRichter-Bernburg2002'] = template_names['Iranica'],
['CITEREFShaki1991'] = template_names['Iranica'],
['CITEREFShaughnessy1997'] = {'Shaughnessy-DH'},
['CITEREFShaw1978'] = {'Shaw-RailroadAccidents'},
['CITEREFShayegan2004'] = template_names['Iranica'],
['CITEREFShayesteh2013'] = template_names['Iranica'],
['CITEREFSheikhsofla2018'] = {'Encyclopaedia Islamica'},
['CITEREFShindo2004'] = {'Kaneto-shindo-shinario-jinsei'},
['CITEREFShippey2005'] = template_names['ME-ref'],
['CITEREFShoarian-SattariRezaeeNegahban2008'] = {'Encyclopaedia Islamica'},
['CITEREFShoshani2005'] = {'MSW3 Shoshani'},
['CITEREFShtern2001'] = {'Springer', 'SpringerEOM'},
['CITEREFSiegele1957'] = {'Bach\'s compositions (sources)'},
['CITEREFSilanos2014'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFSilke2006'] = {'O\'Donnell family tree'},
['CITEREFSimmons2005'] = {'MSW3 Chiroptera'},
['CITEREFSimon1966'] = {'Simon-Wines Australia'},
['CITEREFSimonWarner2011'] = {'Amtrak By the Numbers'},
['CITEREFSinclair1911'] = {'DCBL'},
['CITEREFSinger1905'] = {'Jewish Encyclopedia'},
['CITEREFSix1934'] = {'Cite Six', 'Cite six'},
['CITEREFSkjærvø2018'] = template_names['ODLA'],
['CITEREFSkoulatos1980'] = {'Les personnages byzantins de l\'Alexiade'},
['CITEREFSloan1964'] = {'Sloan1964'},
['CITEREFSmid2008'] = {'Smid2008'},
['CITEREFSmid2010'] = {'Smid2010'},
['CITEREFSmith1854'] = {'Cite DGRG', 'DGRG'},
['CITEREFSmith1870'] = {'DGRBM', 'Cite DGRBM'},
['CITEREFSmith1873'] = {'DGRBM', 'Cite DGRBM'},
['CITEREFSmith1876'] = {'DGRBM', 'Cite DGRBM'},
['CITEREFSmith1880'] = {'DGRBM', 'Cite DGRBM'},
['CITEREFSmith2010'] = {'Smith-Cruise Ships-2010'},
['CITEREFSolomentsev2001'] = {'Springer', 'SpringerEOM'},
['CITEREFSolomon2000'] = {'Solomon-American Diesel', 'Solomon-UP'},
['CITEREFSolomon2003'] = {'Solomon-Masterpieces'},
['CITEREFSolomon2004'] = {'Solomon-Amtrak'},
['CITEREFSolomon2005'] = {'Solomon-SP-Passenger'},
['CITEREFSolomon2006'] = {'Solomon-EMD Locomotives'},
['CITEREFSolomon2011'] = {'Solomon-Modern Diesel'},
['CITEREFSolomon2014'] = {'Solomon-GE and EMD'},
['CITEREFSolomonSchafer2007'] = {'Solomon-New York Central'},
['CITEREFSolopova2009'] = template_names['ME-ref'],
['CITEREFSorensen1956'] = {'Sorensen1956'},
['CITEREFSoucek1982'] = template_names['Iranica'],
['CITEREFSoucek1983'] = template_names['Iranica'],
['CITEREFSoustal1991'] = {'Tabula Imperii Byzantini'},
['CITEREFSoustalKoder1981'] = {'Tabula Imperii Byzantini'},
['CITEREFSpielhoff1991'] = {'Spielhoff-EL'},
['CITEREFSpitta1894'] = {'Bach\'s compositions (sources)'},
['CITEREFSpitta1899'] = {'Bach\'s compositions (sources)'},
['CITEREFSpringirth2016'] = {'Springirth-Philadelphia'},
['CITEREFSpuhler1986'] = template_names['Cam_Hist_Iran'],
['CITEREFSpuler1983'] = template_names['Iranica'],
['CITEREFSpuler1987'] = template_names['Iranica'],
['CITEREFSpyropoulos1928'] = {'Great Military and Naval Encyclopaedia'},
['CITEREFStagner1993'] = {'Stagner-Transition'},
['CITEREFStansfield1999'] = {'Stansfield-AyrRenfrew'},
['CITEREFStatistical_Yearbook_of_the_Republic_of_Croatia_2015'] = {'Croatia Yearbook 2015'},
['CITEREFStaufer1993'] = {'Staufer-Pennsy_III'},
['CITEREFStauferPennypacker1962'] = {'Staufer-Pennsy'},
['CITEREFStauferPennypacker1968'] = {'Staufer-Pennsy Power II'},
['CITEREFStaunton1988'] = {'Australian Dictionary of Biography'},
['CITEREFSternFishmanTilove2006'] = {'Cite New York 2000', 'Cite NY2000', 'Cite ny2000', 'Cite NY 2000', 'Cite ny 2000'},
['CITEREFSternGilmartinMassengale1983'] = {'Cite New York 1900', 'Cite NY1900'},
['CITEREFSternGilmartinMellins1987'] = {'Cite New York 1930', 'Cite NY 1930', 'Cite NY1930', 'Cite ny1930', 'Cite ny 1930'},
['CITEREFSternMellinsFishman1995'] = {'Cite New York 1960', 'Cite NY1960', 'Cite NY 1960', 'Cite ny1960', 'Cite ny 1960'},
['CITEREFSternMellinsFishman1999'] = {'Cite New York 1880', 'Cite NY1880', 'Cite NY 1880', 'Cite ny1880', 'Cite ny 1880'},
['CITEREFStewart1974'] = {'When Steam Was King'},
['CITEREFStrachey1981'] = template_names['ME-ref'],
['CITEREFStrickland1983'] = {'Strickland Locomotive Directory'},
['CITEREFStähelin1909'] = {'Schaff-Herzog'},
['CITEREFSuetin2001'] = {'Springer', 'SpringerEOM'},
['CITEREFSundermann1988'] = template_names['Iranica'],
['CITEREFSusanne_Schurr1992'] = {'BBKL'},
['CITEREFSusanne_Siebert1992'] = {'BBKL'},
['CITEREFSvolopoulos1977'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFSwartz1992'] = {'Swartz An Introduction to Functional Analysis'},
----------< T >----------
['CITEREFLondon_Gazette'] = {'London Gazette'},
['CITEREFTaber1977'] = {'Taber-DLW-19th'},
['CITEREFTaberTaber1980'] = {'Taber-DLW-20th-1'},
['CITEREFTaberTaber1981'] = {'Taber-DLW-20th-2'},
['CITEREFTafazzoli1999'] = template_names['Iranica'],
['CITEREFTafazzoli1999'] = {'Encyclopaedia Islamica'},
['CITEREFTafazzoli2000'] = template_names['Iranica'],
['CITEREFTalbot1991'] = template_names['ODB'],
['CITEREFTalbotKazhdan1991'] = template_names['ODB'],
['CITEREFTanındı2008'] = template_names['Iranica'],
['CITEREFTao2009'] = {'Cite Cambridge History of China', 'The Cambridge History of China'},
['CITEREFTao2009'] = {'Cite Cambridge History of China'},
['CITEREFTer-Ghewondyan1976'] = {'The Arab Emirates in Bagratid Armenia'},
['CITEREFThe_London_Gazette1950'] = {'London Gazette'},
['CITEREFThe_London_Gazette_26_September_1919'] = {'London Gazette'},
['CITEREFThielemann2012'] = {'Bach\'s compositions (sources)'},
['CITEREFThomas1970'] = {'HistoryofParliament'},
['CITEREFThomas1971'] = {'Thomas-History-VI'},
['CITEREFThrush2010'] = {'HistoryofParliament'},
['CITEREFTikhomirov2001'] = {'Springer'},
['CITEREFTittel1966'] = {'Bach\'s compositions (sources)'},
['CITEREFTodt1996'] = {'BBKL'},
['CITEREFTodtVest2014'] = {'Tabula Imperii Byzantini'},
['CITEREFTolkien1937'] = template_names['ME-ref'],
['CITEREFTolkien1954'] = template_names['ME-ref'],
['CITEREFTolkien1955'] = template_names['ME-ref'],
['CITEREFTolkien1964'] = template_names['ME-ref'],
['CITEREFTolkien1966'] = template_names['ME-ref'],
['CITEREFTolkien1977'] = template_names['ME-ref'],
['CITEREFTolkien1979'] = {'ME-ref'},
['CITEREFTolkien1980'] = template_names['ME-ref'],
['CITEREFTolkien1982'] = template_names['ME-ref'],
['CITEREFTolkien1983'] = template_names['ME-ref'],
['CITEREFTolkien1984'] = template_names['ME-ref'],
['CITEREFTolkien1985'] = template_names['ME-ref'],
['CITEREFTolkien1986'] = template_names['ME-ref'],
['CITEREFTolkien1987'] = template_names['ME-ref'],
['CITEREFTolkien1988'] = template_names['ME-ref'],
['CITEREFTolkien1989'] = template_names['ME-ref'],
['CITEREFTolkien1990'] = template_names['ME-ref'],
['CITEREFTolkien1992'] = template_names['ME-ref'],
['CITEREFTolkien1993'] = template_names['ME-ref'],
['CITEREFTolkien1994'] = template_names['ME-ref'],
['CITEREFTolkien1996'] = template_names['ME-ref'],
['CITEREFTolkien1998'] = template_names['ME-ref'],
['CITEREFTolkien1999'] = template_names['ME-ref'],
['CITEREFTolkien2007'] = template_names['ME-ref'],
['CITEREFTolkienSwann1978'] = template_names['ME-ref'],
['CITEREFTolkienSwann2002'] = {'ME-ref'},
['CITEREFTolkienTolkien1992'] = template_names['ME-ref'],
['CITEREFTonks1988'] = {'Tonks ironstone'},
['CITEREFTonks1989'] = {'Tonks ironstone'},
['CITEREFTonks1992'] = {'Tonks ironstone'},
['CITEREFTopping1975'] = {'Setton-A History of the Crusades', 'Wisconsin History of the Crusades'},
['CITEREFTorri2013'] = {'Bach\'s compositions (sources)'},
['CITEREFTougher2018'] = template_names['ODLA'],
['CITEREFToumanoff1986'] = template_names['Iranica'],
['CITEREFToumanoff2010'] = template_names['Iranica'],
['CITEREFToumanoffChaumont1987'] = template_names['Iranica'],
['CITEREFTourret1995'] = {'Tourret-Allied Military Locomotives'},
['CITEREFTrapp1991'] = template_names['ODB'],
['CITEREFTrappBeyerSturm-Schnabl1983'] = {'Prosopographisches Lexikon der Palaiologenzeit'},
['CITEREFTrappWaltherBeyer1976'] = {'Prosopographisches Lexikon der Palaiologenzeit'},
['CITEREFTrappWaltherBeyerSturm-Schnabl1978'] = {'Prosopographisches Lexikon der Palaiologenzeit'},
['CITEREFTreadgold1988'] = {'The Byzantine Revival, 780–842'},
['CITEREFTreadgold1997'] = {'A History of the Byzantine State and Society'},
['CITEREFTrèves2006'] = {'Trèves François Topological vector spaces, distributions and kernels'},
['CITEREFTsutsiev2014'] = {'Cite Atlas of the Ethno-Political History of the Caucasus'},
['CITEREFTucker2009'] = {'Encyclopaedia Islamica'},
['CITEREFTurim1998'] = {'Turim-oshima'},
['CITEREFTuring1950'] = {'Turing 1950'},
----------< U >----------
['CITEREFUS-NHub_Music_Deposit_31_(Klavierbüchlein_für_W._F._Bach)_at_Bach_Digital'] = {'Bach\'s compositions (sources)'},
['CITEREFUtas2002'] = template_names['Iranica'],
['CITEREFUwe_Eckardt2001'] = {'BBKL'},
['CITEREFunknown_author1881'] = {'Cite ADB'},
['CITEREFunknown_author1882'] = {'Cite ADB'},
----------< V >----------
['CITEREFVakalopoulos1975'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFVan_Cleve1969'] = {'Setton-A History of the Crusades'},
['CITEREFVan_Hoorickx1971'] = {'Schubert\'s compositions (references)'},
['CITEREFVan_Hoorickx_1974–1976'] = {'Schubert\'s compositions (references)'},
['CITEREFVan_Lint2018'] = template_names['ODLA'],
['CITEREFVan_Riemsdijk,_Compound_Locomotives'] = {'Book-Van Riemsdijk-Compound Locomotives'},
['CITEREFVan_Riemsdijk1994'] = {'Book-Van Riemsdijk-Compound Locomotives'},
['CITEREFVan_Tricht2011'] = {'The Latin Renovatio of Byzantium'},
['CITEREFVandenberghen1989'] = {'Vandenberghen-SNCB12.2'},
['CITEREFVarzos1984'] = {'Η Γενεαλογία των Κομνηνών', 'Varzos-Genealogy of the Komnenoi'},
['CITEREFVasiliev1935'] = {'Byzance et les Arabes'},
['CITEREFVasiliev1968'] = {'Byzance et les Arabes'},
['CITEREFVenables1911'] = {'DCBL'},
['CITEREFVendler1997'] = {'Shakespeare sonnets bibliography'},
['CITEREFVenetis2012'] = template_names['Iranica'],
['CITEREFVenn1954'] = {'VennAC'},
['CITEREFVentura1963'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFVesel1999'] = template_names['Iranica'],
['CITEREFVetter1713'] = {'Bach\'s compositions (sources)'},
['CITEREFVevainaCanepa2018'] = template_names['ODLA'],
['CITEREFVeysey1958'] = {'Veysey-PE-1958'},
['CITEREFVischer1912'] = {'Schaff-Herzog'},
['CITEREFVogelsang2003'] = template_names['Iranica'],
['CITEREFVolkmer1991'] = {'Volkmer-Pennsy-Electric'},
['CITEREFvan_Leyden1956'] = {'Bach\'s compositions (sources)'},
['CITEREFvan_Lint2018'] = template_names['ODLA'],
['CITEREFvon_Prantl1879'] = {'Cite ADB'},
----------< W >----------
['CITEREFWagnerBäzoldZschechLüderitz1990'] = {'Wagner-EFA2.3.2'},
['CITEREFWalter1967'] = {'DBI', 'Dizionario Biografico degli Italiani'},
['CITEREFWalter_Asmus1966'] = template_names['NDB'],
['CITEREFWayner1972'] = {'Wayner - Car names, numbers, consists'},
['CITEREFWayner1973'] = {'Wayner-Spotter-2nd'},
['CITEREFWebb2018'] = template_names['ODLA'],
['CITEREFWeber2016'] = template_names['Iranica'],
['CITEREFWechsler1979'] = {'Cite Cambridge History of China', 'The Cambridge History of China'},
['CITEREFWechsler1979'] = {'Cite Cambridge History of China'},
['CITEREFWegman2008'] = {'Wegman-Illustrated'},
['CITEREFWeibel1994'] = {'Weibel IHA'},
['CITEREFWeinrebHibbertKeayKeay2008'] = {'London encyclopedia'},
['CITEREFWeisbrod1991'] = {'Weisbrod-EFA1.5'},
['CITEREFWeisbrodMüllerPetznik1978'] = {'Weisbrod-EFA1.2'},
['CITEREFWeiskopf1987'] = template_names['Iranica'],
['CITEREFWeiskopf1989'] = template_names['Iranica'],
['CITEREFWeiskopf1990'] = template_names['Iranica'],
['CITEREFWeiskopf1993'] = template_names['Iranica'],
['CITEREFWellhausen1927'] = {'The Arab Kingdom and its Fall'},
['CITEREFWells1982'] = {'Accents of English'},
['CITEREFWells1990'] = {'Cite LPD'},
['CITEREFWells2000'] = {'Cite LPD'},
['CITEREFWells2008'] = {'Cite LPD'},
['CITEREFWelsh2006'] = {'Welsh-Broadway'},
['CITEREFWelsh2008'] = {'Welsh-UP'},
['CITEREFWerner_Raupp2001'] = {'BBKL'},
['CITEREFWestcott1911'] = {'DCBL'},
['CITEREFWestermayer,_Georg1882'] = {'Cite ADB'},
['CITEREFWham1997'] = {'Wham-Ayrshire'},
['CITEREFWharton1991'] = template_names['ODB'],
['CITEREFWhishaw1842'] = {'Whishaw-RailofGB-2ndEd'},
['CITEREFWhishaw1969'] = {'Whishaw-RailofGB'},
['CITEREFWhite1985'] = {'White-Passenger-1985'},
['CITEREFWhite1993'] = {'White - American railroad freight car'},
['CITEREFWhiteWillenskyLeadon2010'] = {'Cite aia5'},
['CITEREFWhitehurst1973'] = {'Whitehurst GW Engines from 1940'},
['CITEREFWhittow1996'] = {'The Making of Byzantium, 600–1025'},
['CITEREFWickman1982'] = {'Country study'},
['CITEREFWiesehöfer1986'] = template_names['Iranica'],
['CITEREFWiesehöfer2018'] = template_names['ODLA'],
['CITEREFWilansky2008'] = {'Wilansky Topology for Analysis 2008'},
['CITEREFWilansky2013'] = {'Wilansky Modern Methods in Topological Vector Spaces'},
['CITEREFWillard2004'] = {'Willard General Topology'},
['CITEREFWilliams1998'] = {'Williams-Philadelphia'},
['CITEREFWilliams2003'] = {'Bach\'s compositions (sources)'},
['CITEREFWilliams2014'] = template_names['Iranica'],
['CITEREFWillis1750'] = {'Cite Notitia Parliamentaria'},
['CITEREFWilson2017'] = {'Wilson-Guide'},
['CITEREFWilsonFiske1889'] = {'Appletons\'', 'Cite Appletons\'', 'Appletons'},
['CITEREFWilsonFiske1891'] = {'Appletons\'', 'Cite Appletons\'', 'Appletons'},
['CITEREFWilsonFiske1892'] = {'Appletons\'', 'Cite Appletons\'', 'Appletons'},
['CITEREFWilsonFiske1900'] = {'Appletons\'', 'Cite Appletons\'', 'Appletons'},
['CITEREFWiltshire2000'] = {'Lloyd-Margaret River'},
['CITEREFWinfieldLyon2004'] = {'Winfield'},
['CITEREFWinkler1883'] = template_names['ADB'],
['CITEREFWitakowski2018'] = template_names['ODLA'],
['CITEREFWolff1969'] = {'Setton-A History of the Crusades'},
['CITEREFWollny2015'] = {'Bach\'s compositions (sources)'},
['CITEREFWood1907'] = {'Cite Nuttall', 'Nuttall'},
['CITEREFWoodsKilpatrick2005'] = {'MSW3 Hystricognathi'},
['CITEREFWorden2008'] = {'Country study'},
['CITEREFWortley2010'] = {'John Skylitzes: A Synopsis of Byzantine History, 811–1057'},
['CITEREFWozencraft2005'] = {'MSW3 Carnivora'},
['CITEREFWright1979'] = {'Cite Cambridge History of China', 'The Cambridge History of China'},
['CITEREFWright1979'] = {'Cite Cambridge History of China'},
['CITEREFWright2000'] = {'Bach\'s compositions (sources)'},
['CITEREFWägliJacobi2010'] = {'Schienennetz Schweiz'},
['CITEREFWürsch2013'] = template_names['Iranica'],
----------< X >----------
----------< Y >----------
['CITEREFYakubova2016'] = template_names['Iranica'],
['CITEREFYarshater1983'] = template_names['Iranica'],
['CITEREFYarshater1986'] = template_names['Cam_Hist_Iran'],
['CITEREFYarshater1988'] = template_names['Iranica'],
['CITEREFYarshater2018'] = template_names['Iranica'],
['CITEREFYarshater2021'] = template_names['Iranica'],
['CITEREFYazici2002'] = template_names['Iranica'],
['CITEREFYenne2005'] = {'Yenne-Chiefs'},
['CITEREFYildiz2004'] = template_names['Iranica'],
['CITEREFYonge1990'] = {'Quail-4'},
['CITEREFYonge1994'] = {'Quail-5'},
['CITEREFYonge2002'] = {'Quail-5'},
['CITEREFYonge2008'] = {'Quail-5'},
['CITEREFYonge2016'] = {'Quail-2-2016'},
['CITEREFYongePadgettSzwenk2013'] = {'Quail-4-Paper-3rdEd'},
['CITEREFYu1986'] = {'Cite Cambridge History of China'},
['CITEREFYusofi1990'] = template_names['Iranica'],
----------< Z >----------
['CITEREFZahn1889–1893'] = {'Bach\'s compositions (sources)'},
['CITEREFZakeri2021'] = template_names['Iranica'],
['CITEREFZarrinkoubNegahban2008'] = {'Encyclopaedia Islamica'},
['CITEREFZarrinkub1975'] = template_names['Cam_Hist_Iran'],
['CITEREFZeiniWiesehöfer2018'] = template_names['ODLA'],
['CITEREFZekulich2000'] = {'Zekulich-WineWA'},
['CITEREFZimmermann2004'] = {'Zimmermann-Burlington'},
['CITEREFZimmermann2007'] = {'Zimmermann-GrandLuxe'},
['CITEREFZuccaric._1747'] = {'Bach\'s compositions (sources)'},
['CITEREFZălinescu2002'] = {'Zălinescu Convex Analysis in General Vector Spaces 2002'},
----------< OTHER >----------
----------< UNSORTED >----------
['CITEREFDaniel2001'] = template_names['Iranica'],
['CITEREFΙστορία_του_Ελληνικού_Έθνους'] = {'Ιστορία του Ελληνικού Έθνους'},
['CITEREFÖz1993'] = {'TDV Encyclopedia of Islam'},
['CITEREFÖzgüdenli2008'] = template_names['Iranica'],
['CITEREFÖzaydın2002'] = {'TDV Encyclopedia of Islam'},
['CITEREFÖzaydın2006'] = {'TDV Encyclopedia of Islam'},
['CITEREFÖzkuyumcu2006'] = {'TDV Encyclopedia of Islam'},
['CITEREFÖztürk2013'] = {'TDV Encyclopedia of Islam'},
['CITEREFΜεγάλη_Στρατιωτικὴ_καὶ_Ναυτικὴ_Ἐγκυκλοπαιδεία'] = {'Great Military and Naval Encyclopaedia'},
['CITEREFŞeşen1988'] = {'TDV Encyclopedia of Islam'},
['CITEREFCotsonis2020'] = {'Catalogue of Byzantine Seals at Dumbarton Oaks and in the Fogg Museum of Art'},
['CITEREFКавказский_календарь_на_1913_год'] = {'Cite Kavkazskiy Kalendar 1913'},
['CITEREFКавказский_календарь_на_1917_год'] = {'Cite Kavkazskiy Kalendar 1917'},
['CITEREFКавказский_календарь_на_1910_год'] = {'Cite Kavkazskiy Kalendar 1910'},
['CITEREFКавказский_календарь_на_1915_год'] = {'Cite Kavkazskiy Kalendar 1915'},
}
--[[--------------------------< E X P O R T E D T A B L E S >------------------------------------------------
]]
return {
DNB_special_patterns = DNB_special_patterns,
DNB_template_names = template_names['DNB'],
special_patterns = special_patterns,
whitelist = whitelist,
wrapper_templates = wrapper_templates,
}
196d9221006f9bf6ed5402ba071fb7c5fe320258
Module:Format link
828
61
116
115
2023-12-24T02:01:24Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Format_link]]
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Format link
--
-- Makes a wikilink from the given link and display values. Links are escaped
-- with colons if necessary, and links to sections are detected and displayed
-- with " § " as a separator rather than the standard MediaWiki "#". Used in
-- the {{format link}} template.
--------------------------------------------------------------------------------
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg
local mArguments -- lazily initialise [[Module:Arguments]]
local mError -- lazily initialise [[Module:Error]]
local yesno -- lazily initialise [[Module:Yesno]]
local p = {}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function getArgs(frame)
-- Fetches the arguments from the parent frame. Whitespace is trimmed and
-- blanks are removed.
mArguments = require('Module:Arguments')
return mArguments.getArgs(frame, {parentOnly = true})
end
local function removeInitialColon(s)
-- Removes the initial colon from a string, if present.
return s:match('^:?(.*)')
end
local function maybeItalicize(s, shouldItalicize)
-- Italicize s if s is a string and the shouldItalicize parameter is true.
if s and shouldItalicize then
return '<i>' .. s .. '</i>'
else
return s
end
end
local function parseLink(link)
-- Parse a link and return a table with the link's components.
-- These components are:
-- - link: the link, stripped of any initial colon (always present)
-- - page: the page name (always present)
-- - section: the page name (may be nil)
-- - display: the display text, if manually entered after a pipe (may be nil)
link = removeInitialColon(link)
-- Find whether a faux display value has been added with the {{!}} magic
-- word.
local prePipe, display = link:match('^(.-)|(.*)$')
link = prePipe or link
-- Find the page, if it exists.
-- For links like [[#Bar]], the page will be nil.
local preHash, postHash = link:match('^(.-)#(.*)$')
local page
if not preHash then
-- We have a link like [[Foo]].
page = link
elseif preHash ~= '' then
-- We have a link like [[Foo#Bar]].
page = preHash
end
-- Find the section, if it exists.
local section
if postHash and postHash ~= '' then
section = postHash
end
return {
link = link,
page = page,
section = section,
display = display,
}
end
local function formatDisplay(parsed, options)
-- Formats a display string based on a parsed link table (matching the
-- output of parseLink) and an options table (matching the input options for
-- _formatLink).
local page = maybeItalicize(parsed.page, options.italicizePage)
local section = maybeItalicize(parsed.section, options.italicizeSection)
if (not section) then
return page
elseif (not page) then
return mw.ustring.format('§ %s', section)
else
return mw.ustring.format('%s § %s', page, section)
end
end
local function missingArgError(target)
mError = require('Module:Error')
return mError.error{message =
'Error: no link or target specified! ([[' .. target .. '#Errors|help]])'
}
end
--------------------------------------------------------------------------------
-- Main functions
--------------------------------------------------------------------------------
function p.formatLink(frame)
-- The formatLink export function, for use in templates.
yesno = require('Module:Yesno')
local args = getArgs(frame)
local link = args[1] or args.link
local target = args[3] or args.target
if not (link or target) then
return missingArgError('Template:Format link')
end
return p._formatLink{
link = link,
display = args[2] or args.display,
target = target,
italicizePage = yesno(args.italicizepage),
italicizeSection = yesno(args.italicizesection),
categorizeMissing = args.categorizemissing
}
end
function p._formatLink(options)
-- The formatLink export function, for use in modules.
checkType('_formatLink', 1, options, 'table')
local function check(key, expectedType) --for brevity
checkTypeForNamedArg(
'_formatLink', key, options[key], expectedType or 'string', true
)
end
check('link')
check('display')
check('target')
check('italicizePage', 'boolean')
check('italicizeSection', 'boolean')
check('categorizeMissing')
-- Normalize link and target and check that at least one is present
if options.link == '' then options.link = nil end
if options.target == '' then options.target = nil end
if not (options.link or options.target) then
return missingArgError('Module:Format link')
end
local parsed = parseLink(options.link)
local display = options.display or parsed.display
local catMissing = options.categorizeMissing
local category = ''
-- Find the display text
if not display then display = formatDisplay(parsed, options) end
-- Handle the target option if present
if options.target then
local parsedTarget = parseLink(options.target)
parsed.link = parsedTarget.link
parsed.page = parsedTarget.page
end
-- Test if page exists if a diagnostic category is specified
if catMissing and (mw.ustring.len(catMissing) > 0) then
local title = nil
if parsed.page then title = mw.title.new(parsed.page) end
if title and (not title.isExternal) then
local success, exists = pcall(function() return title.exists end)
if success and not exists then
category = mw.ustring.format('[[Category:%s]]', catMissing)
end
end
end
-- Format the result as a link
if parsed.link == display then
return mw.ustring.format('[[:%s]]%s', parsed.link, category)
else
return mw.ustring.format('[[:%s|%s]]%s', parsed.link, display, category)
end
end
--------------------------------------------------------------------------------
-- Derived convenience functions
--------------------------------------------------------------------------------
function p.formatPages(options, pages)
-- Formats an array of pages using formatLink and the given options table,
-- and returns it as an array. Nil values are not allowed.
local ret = {}
for i, page in ipairs(pages) do
ret[i] = p._formatLink{
link = page,
categorizeMissing = options.categorizeMissing,
italicizePage = options.italicizePage,
italicizeSection = options.italicizeSection
}
end
return ret
end
return p
1253bdd2683ee4badc33856bfd5499b09a7dca1f
Module:Hatnote
828
62
118
117
2023-12-24T02:01:25Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Hatnote]]
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Module:Hatnote --
-- --
-- This module produces hatnote links and links to related articles. It --
-- implements the {{hatnote}} and {{format link}} meta-templates and includes --
-- helper functions for other Lua hatnote modules. --
--------------------------------------------------------------------------------
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg
local mArguments -- lazily initialise [[Module:Arguments]]
local yesno -- lazily initialise [[Module:Yesno]]
local formatLink -- lazily initialise [[Module:Format link]] ._formatLink
local p = {}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function getArgs(frame)
-- Fetches the arguments from the parent frame. Whitespace is trimmed and
-- blanks are removed.
mArguments = require('Module:Arguments')
return mArguments.getArgs(frame, {parentOnly = true})
end
local function removeInitialColon(s)
-- Removes the initial colon from a string, if present.
return s:match('^:?(.*)')
end
function p.defaultClasses(inline)
-- Provides the default hatnote classes as a space-separated string; useful
-- for hatnote-manipulation modules like [[Module:Hatnote group]].
return
(inline == 1 and 'hatnote-inline' or 'hatnote') .. ' ' ..
'navigation-not-searchable'
end
function p.disambiguate(page, disambiguator)
-- Formats a page title with a disambiguation parenthetical,
-- i.e. "Example" → "Example (disambiguation)".
checkType('disambiguate', 1, page, 'string')
checkType('disambiguate', 2, disambiguator, 'string', true)
disambiguator = disambiguator or 'disambiguation'
return mw.ustring.format('%s (%s)', page, disambiguator)
end
function p.findNamespaceId(link, removeColon)
-- Finds the namespace id (namespace number) of a link or a pagename. This
-- function will not work if the link is enclosed in double brackets. Colons
-- are trimmed from the start of the link by default. To skip colon
-- trimming, set the removeColon parameter to false.
checkType('findNamespaceId', 1, link, 'string')
checkType('findNamespaceId', 2, removeColon, 'boolean', true)
if removeColon ~= false then
link = removeInitialColon(link)
end
local namespace = link:match('^(.-):')
if namespace then
local nsTable = mw.site.namespaces[namespace]
if nsTable then
return nsTable.id
end
end
return 0
end
function p.makeWikitextError(msg, helpLink, addTrackingCategory, title)
-- Formats an error message to be returned to wikitext. If
-- addTrackingCategory is not false after being returned from
-- [[Module:Yesno]], and if we are not on a talk page, a tracking category
-- is added.
checkType('makeWikitextError', 1, msg, 'string')
checkType('makeWikitextError', 2, helpLink, 'string', true)
yesno = require('Module:Yesno')
title = title or mw.title.getCurrentTitle()
-- Make the help link text.
local helpText
if helpLink then
helpText = ' ([[' .. helpLink .. '|help]])'
else
helpText = ''
end
-- Make the category text.
local category
if not title.isTalkPage -- Don't categorise talk pages
and title.namespace ~= 2 -- Don't categorise userspace
and yesno(addTrackingCategory) ~= false -- Allow opting out
then
category = 'Hatnote templates with errors'
category = mw.ustring.format(
'[[%s:%s]]',
mw.site.namespaces[14].name,
category
)
else
category = ''
end
return mw.ustring.format(
'<strong class="error">Error: %s%s.</strong>%s',
msg,
helpText,
category
)
end
local curNs = mw.title.getCurrentTitle().namespace
p.missingTargetCat =
--Default missing target category, exported for use in related modules
((curNs == 0) or (curNs == 14)) and
'Articles with hatnote templates targeting a nonexistent page' or nil
function p.quote(title)
--Wraps titles in quotation marks. If the title starts/ends with a quotation
--mark, kerns that side as with {{-'}}
local quotationMarks = {
["'"]=true, ['"']=true, ['“']=true, ["‘"]=true, ['”']=true, ["’"]=true
}
local quoteLeft, quoteRight = -- Test if start/end are quotation marks
quotationMarks[string.sub(title, 1, 1)],
quotationMarks[string.sub(title, -1, -1)]
if quoteLeft or quoteRight then
title = mw.html.create("span"):wikitext(title)
end
if quoteLeft then title:css("padding-left", "0.15em") end
if quoteRight then title:css("padding-right", "0.15em") end
return '"' .. tostring(title) .. '"'
end
--------------------------------------------------------------------------------
-- Hatnote
--
-- Produces standard hatnote text. Implements the {{hatnote}} template.
--------------------------------------------------------------------------------
function p.hatnote(frame)
local args = getArgs(frame)
local s = args[1]
if not s then
return p.makeWikitextError(
'no text specified',
'Template:Hatnote#Errors',
args.category
)
end
return p._hatnote(s, {
extraclasses = args.extraclasses,
selfref = args.selfref
})
end
function p._hatnote(s, options)
checkType('_hatnote', 1, s, 'string')
checkType('_hatnote', 2, options, 'table', true)
options = options or {}
local inline = options.inline
local hatnote = mw.html.create(inline == 1 and 'span' or 'div')
local extraclasses
if type(options.extraclasses) == 'string' then
extraclasses = options.extraclasses
end
hatnote
:attr('role', 'note')
:addClass(p.defaultClasses(inline))
:addClass(extraclasses)
:addClass(options.selfref and 'selfref' or nil)
:wikitext(s)
return mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Module:Hatnote/styles.css' }
} .. tostring(hatnote)
end
return p
3ae1ed7094c5005ca0896395ec9a587287a0bef1
Module:Hatnote/styles.css
828
63
120
119
2023-12-24T02:01:25Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Hatnote/styles.css]]
sanitized-css
text/css
/* {{pp|small=y}} */
.hatnote {
font-style: italic;
}
/* Limit structure CSS to divs because of [[Module:Hatnote inline]] */
div.hatnote {
/* @noflip */
padding-left: 1.6em;
margin-bottom: 0.5em;
}
.hatnote i {
font-style: normal;
}
/* The templatestyles element inserts a link element before hatnotes.
* TODO: Remove link if/when WMF resolves T200206 */
.hatnote + link + .hatnote {
margin-top: -0.5em;
}
44680ffd6e888866df2cdfa0341af9c7b97da94c
Module:Hatnote list
828
64
122
121
2023-12-24T02:01:26Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Hatnote_list]]
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Module:Hatnote list --
-- --
-- This module produces and formats lists for use in hatnotes. In particular, --
-- it implements the for-see list, i.e. lists of "For X, see Y" statements, --
-- as used in {{about}}, {{redirect}}, and their variants. Also introduced --
-- are andList & orList helpers for formatting lists with those conjunctions. --
--------------------------------------------------------------------------------
local mArguments --initialize lazily
local mFormatLink = require('Module:Format link')
local mHatnote = require('Module:Hatnote')
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local p = {}
--------------------------------------------------------------------------------
-- List stringification helper functions
--
-- These functions are used for stringifying lists, usually page lists inside
-- the "Y" portion of "For X, see Y" for-see items.
--------------------------------------------------------------------------------
--default options table used across the list stringification functions
local stringifyListDefaultOptions = {
conjunction = "and",
separator = ",",
altSeparator = ";",
space = " ",
formatted = false
}
--Searches display text only
local function searchDisp(haystack, needle)
return string.find(
string.sub(haystack, (string.find(haystack, '|') or 0) + 1), needle
)
end
-- Stringifies a list generically; probably shouldn't be used directly
local function stringifyList(list, options)
-- Type-checks, defaults, and a shortcut
checkType("stringifyList", 1, list, "table")
if #list == 0 then return nil end
checkType("stringifyList", 2, options, "table", true)
options = options or {}
for k, v in pairs(stringifyListDefaultOptions) do
if options[k] == nil then options[k] = v end
end
local s = options.space
-- Format the list if requested
if options.formatted then
list = mFormatLink.formatPages(
{categorizeMissing = mHatnote.missingTargetCat}, list
)
end
-- Set the separator; if any item contains it, use the alternate separator
local separator = options.separator
for k, v in pairs(list) do
if searchDisp(v, separator) then
separator = options.altSeparator
break
end
end
-- Set the conjunction, apply Oxford comma, and force a comma if #1 has "§"
local conjunction = s .. options.conjunction .. s
if #list == 2 and searchDisp(list[1], "§") or #list > 2 then
conjunction = separator .. conjunction
end
-- Return the formatted string
return mw.text.listToText(list, separator .. s, conjunction)
end
--DRY function
function p.conjList (conj, list, fmt)
return stringifyList(list, {conjunction = conj, formatted = fmt})
end
-- Stringifies lists with "and" or "or"
function p.andList (...) return p.conjList("and", ...) end
function p.orList (...) return p.conjList("or", ...) end
--------------------------------------------------------------------------------
-- For see
--
-- Makes a "For X, see [[Y]]." list from raw parameters. Intended for the
-- {{about}} and {{redirect}} templates and their variants.
--------------------------------------------------------------------------------
--default options table used across the forSee family of functions
local forSeeDefaultOptions = {
andKeyword = 'and',
title = mw.title.getCurrentTitle().text,
otherText = 'other uses',
forSeeForm = 'For %s, see %s.',
}
--Collapses duplicate punctuation at end of string, ignoring italics and links
local function punctuationCollapse (text)
return text:match("[.?!]('?)%1(%]?)%2%.$") and text:sub(1, -2) or text
end
-- Structures arguments into a table for stringification, & options
function p.forSeeArgsToTable (args, from, options)
-- Type-checks and defaults
checkType("forSeeArgsToTable", 1, args, 'table')
checkType("forSeeArgsToTable", 2, from, 'number', true)
from = from or 1
checkType("forSeeArgsToTable", 3, options, 'table', true)
options = options or {}
for k, v in pairs(forSeeDefaultOptions) do
if options[k] == nil then options[k] = v end
end
-- maxArg's gotten manually because getArgs() and table.maxn aren't friends
local maxArg = 0
for k, v in pairs(args) do
if type(k) == 'number' and k > maxArg then maxArg = k end
end
-- Structure the data out from the parameter list:
-- * forTable is the wrapper table, with forRow rows
-- * Rows are tables of a "use" string & a "pages" table of pagename strings
-- * Blanks are left empty for defaulting elsewhere, but can terminate list
local forTable = {}
local i = from
local terminated = false
-- If there is extra text, and no arguments are given, give nil value
-- to not produce default of "For other uses, see foo (disambiguation)"
if options.extratext and i > maxArg then return nil end
-- Loop to generate rows
repeat
-- New empty row
local forRow = {}
-- On blank use, assume list's ended & break at end of this loop
forRow.use = args[i]
if not args[i] then terminated = true end
-- New empty list of pages
forRow.pages = {}
-- Insert first pages item if present
table.insert(forRow.pages, args[i + 1])
-- If the param after next is "and", do inner loop to collect params
-- until the "and"'s stop. Blanks are ignored: "1|and||and|3" → {1, 3}
while args[i + 2] == options.andKeyword do
if args[i + 3] then
table.insert(forRow.pages, args[i + 3])
end
-- Increment to next "and"
i = i + 2
end
-- Increment to next use
i = i + 2
-- Append the row
table.insert(forTable, forRow)
until terminated or i > maxArg
return forTable
end
-- Stringifies a table as formatted by forSeeArgsToTable
function p.forSeeTableToString (forSeeTable, options)
-- Type-checks and defaults
checkType("forSeeTableToString", 1, forSeeTable, "table", true)
checkType("forSeeTableToString", 2, options, "table", true)
options = options or {}
for k, v in pairs(forSeeDefaultOptions) do
if options[k] == nil then options[k] = v end
end
-- Stringify each for-see item into a list
local strList = {}
if forSeeTable then
for k, v in pairs(forSeeTable) do
local useStr = v.use or options.otherText
local pagesStr =
p.andList(v.pages, true) or
mFormatLink._formatLink{
categorizeMissing = mHatnote.missingTargetCat,
link = mHatnote.disambiguate(options.title)
}
local forSeeStr = string.format(options.forSeeForm, useStr, pagesStr)
forSeeStr = punctuationCollapse(forSeeStr)
table.insert(strList, forSeeStr)
end
end
if options.extratext then table.insert(strList, punctuationCollapse(options.extratext..'.')) end
-- Return the concatenated list
return table.concat(strList, ' ')
end
-- Produces a "For X, see [[Y]]" string from arguments. Expects index gaps
-- but not blank/whitespace values. Ignores named args and args < "from".
function p._forSee (args, from, options)
local forSeeTable = p.forSeeArgsToTable(args, from, options)
return p.forSeeTableToString(forSeeTable, options)
end
-- As _forSee, but uses the frame.
function p.forSee (frame, from, options)
mArguments = require('Module:Arguments')
return p._forSee(mArguments.getArgs(frame), from, options)
end
return p
1c8e6212115f76ecc3db8d05137011cd18207988
Module:Labelled list hatnote
828
65
124
123
2023-12-24T02:01:26Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Labelled_list_hatnote]]
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Labelled list --
-- --
-- This module does the core work of creating a hatnote composed of a list --
-- prefixed by a colon-terminated label, i.e. "LABEL: [andList of pages]", --
-- for {{see also}} and similar templates. --
--------------------------------------------------------------------------------
local mHatnote = require('Module:Hatnote')
local mHatlist = require('Module:Hatnote list')
local mArguments --initialize lazily
local yesno --initialize lazily
local p = {}
-- Defaults global to this module
local defaults = {
label = 'See also', --Final fallback for label argument
labelForm = '%s: %s',
prefixes = {'label', 'label ', 'l'},
template = 'Module:Labelled list hatnote'
}
-- Localizable message strings
local msg = {
errorSuffix = '#Errors',
noInputWarning = 'no page names specified',
noOutputWarning =
"'''[[%s]] — no output: none of the target pages exist.'''"
}
-- Helper function that pre-combines display parameters into page arguments.
-- Also compresses sparse arrays, as a desirable side-effect.
function p.preprocessDisplays (args, prefixes)
-- Prefixes specify which parameters, in order, to check for display options
-- They each have numbers auto-appended, e.g. 'label1', 'label 1', & 'l1'
prefixes = prefixes or defaults.prefixes
local indices = {}
local sparsePages = {}
for k, v in pairs(args) do
if type(k) == 'number' then
indices[#indices + 1] = k
local display
for i = 1, #prefixes do
display = args[prefixes[i] .. k]
if display then break end
end
sparsePages[k] = display and
string.format('%s|%s', string.gsub(v, '|.*$', ''), display) or v
end
end
table.sort(indices)
local pages = {}
for k, v in ipairs(indices) do pages[#pages + 1] = sparsePages[v] end
return pages
end
--Helper function to get a page target from a processed page string
--e.g. "Page|Label" → "Page" or "Target" → "Target"
local function getTarget(pagename)
local pipe = string.find(pagename, '|')
return string.sub(pagename, 0, pipe and pipe - 1 or nil)
end
-- Produces a labelled pages-list hatnote.
-- The main frame (template definition) takes 1 or 2 arguments, for a singular
-- and (optionally) plural label respectively:
-- * {{#invoke:Labelled list hatnote|labelledList|Singular label|Plural label}}
-- The resulting template takes pagename & label parameters normally.
function p.labelledList (frame)
mArguments = require('Module:Arguments')
yesno = require('Module:Yesno')
local labels = {frame.args[1] or defaults.label}
labels[2] = frame.args[2] or labels[1]
labels[3] = frame.args[3] --no defaulting
labels[4] = frame.args[4] --no defaulting
local template = frame:getParent():getTitle()
local args = mArguments.getArgs(frame, {parentOnly = true})
local pages = p.preprocessDisplays(args)
local options = {
category = yesno(args.category),
extraclasses = frame.args.extraclasses,
ifexists = yesno(frame.args.ifexists),
namespace = frame.args.namespace or args.namespace,
selfref = yesno(frame.args.selfref or args.selfref),
template = template
}
return p._labelledList(pages, labels, options)
end
function p._labelledList (pages, labels, options)
if options.ifexists then
for k = #pages, 1, -1 do --iterate backwards to allow smooth removals
local v = pages[k]
local title = mw.title.new(getTarget(v), namespace)
if (v == '') or title == nil or not title.exists then
table.remove(pages, k)
end
end
end
labels = labels or {}
label = (#pages == 1 and labels[1] or labels[2]) or defaults.label
for k, v in pairs(pages) do
if mHatnote.findNamespaceId(v) ~= 0 then
label =
(
#pages == 1 and
(labels[3] or labels[1] or defaults.label) or
(labels[4] or labels[2] or defaults.label)
) or defaults.label
end
end
if #pages == 0 then
if options.ifexists then
mw.addWarning(
string.format(
msg.noOutputWarning, options.template or defaults.template
)
)
return ''
else
return mHatnote.makeWikitextError(
msg.noInputWarning,
(options.template or defaults.template) .. msg.errorSuffix,
options.category
)
end
end
local text = string.format(
options.labelForm or defaults.labelForm,
label,
mHatlist.andList(pages, true)
)
local hnOptions = {
extraclasses = options.extraclasses,
selfref = options.selfref
}
return mHatnote._hatnote(text, hnOptions)
end
return p
b7a8ba27cf6195e6427701b94e8d2acad3c40a21
Template:Hatnote
10
66
126
125
2023-12-24T02:01:27Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Hatnote]]
wikitext
text/x-wiki
<includeonly>{{#invoke:Hatnote|hatnote}}</includeonly><noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
4a1d1028d07c9056022807a96051e1c82cf2a1c7
Module:Disambiguation
828
67
128
127
2023-12-24T02:01:27Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Disambiguation]]
Scribunto
text/plain
local p = {}
local mRedirect = require('Module:Redirect')
local disambiguationTemplates = mw.loadData('Module:Disambiguation/templates')
local function capitalize(s)
-- This function only works on ASCII strings. If your wiki has
-- disambiguation templates that use Unicode strings, use the commented-out
-- line instead. Enwiki uses ASCII string manipulation only here to improve
-- performance.
return s:sub(1, 1):upper() .. s:sub(2, -1)
-- return mw.ustring.upper(mw.ustring.sub(1, 1)) .. mw.ustring.sub(2, -1)
end
local function isDisambiguationTemplate(template)
return disambiguationTemplates[capitalize(template)] or false
end
p.isDisambiguation = function(content)
-- false if there is no content
if content == nil then
return false
end
-- redirects are not disambiguation pages
if mRedirect.getTargetFromText(content) ~= nil then
return false
end
-- check for disambiguation templates in the content
local templateNames = {}
for template in string.gmatch(content, "{{%s*([^|}]-)%s*[|}]") do
if isDisambiguationTemplate(template) then
return true
end
end
-- check for magic word
if string.find(content, "__DISAMBIG__", 1, true) ~= nil then
return true
end
return false
end
p._isDisambiguationPage = function(page)
-- Look "(disambiguation)" in the title
if string.find(page, "(disambiguation)",0,true) ~= nil then
return true;
end
-- Look for disamiguation template in page content
local title = mw.title.new(page)
if not title then return false end
local content = title:getContent()
return p.isDisambiguation(content)
end
-- Entry points for templates
p.isDisambiguationPage = function(frame)
local title = frame.args[1]
return p._isDisambiguationPage(title) and "yes" or ""
end
return p
fedda4d3046080cab39fcd65ab9a9318912a8d57
Template:Disambiguation needed
10
68
130
129
2023-12-24T02:01:28Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Disambiguation_needed]]
wikitext
text/x-wiki
{{ {{{|safesubst:}}}#invoke:Unsubst||date=__DATE__ |$B=
{{#if:{{{1|}}}
|[[{{{1}}}|<span>{{ #if:{{{2|}}} | {{{2|}}} | {{{1}}} }}</span>]]
}}{{Fix
|name=Disambiguation needed
|link=Wikipedia:WikiProject Disambiguation/Fixing links
|text=disambiguation needed
|title=Link needs disambiguation
|date={{{date|}}}
|cat-date=Category:Articles with links needing disambiguation
|cat=[[Category:All articles with links needing disambiguation]]
}}
}}<noinclude>
{{Documentation}}
</noinclude>
f14e8d2a26d12440c4bdf824986bef19595349c1
Template:Dn
10
69
132
131
2023-12-24T02:01:28Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Dn]]
wikitext
text/x-wiki
#REDIRECT [[Template:Disambiguation needed]]
{{Redirect category shell|
{{R from template shortcut}}
{{R from move}}
}}
30cdf9a806947028ecbc2413887cbd53f0cc4070
Template:Self-reference
10
70
134
133
2023-12-24T02:01:29Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Self-reference]]
wikitext
text/x-wiki
{{#switch:{{{2|NONE}}}
|NONE|hatnote|hat={{Hatnote|extraclasses=plainlinks selfreference noprint|1={{{1}}}}}
|inline=<div class="plainlinks selfreference" style="display:inline; font-style: italic;"><!--Same style as class hatnote.-->{{{1}}}</div>
|<!--Matching the empty string here for unprintworthy content is for backwards compatibility with the 2006-2008 version. Do not depend on it!-->=<div style="display:inline;" class="plainlinks selfreference noprint">{{{1}}}</div>
|#default={{error|Second parameter must be <code>hatnote</code>, <code>hat</code>, or <code>inline</code>}}
}}<noinclude>
{{Documentation}}
<!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES THE /doc SUBPAGE, AND INTERWIKIS TO WIKIDATA, THANKS -->
</noinclude>
0c4a08f880070e918c3edcaa50cc493f99841e98
Module:Disambiguation/templates
828
71
136
135
2023-12-24T02:01:29Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Disambiguation/templates]]
Scribunto
text/plain
-- This page contains a table of all disambiguation templates and their
-- redirects. Templates names are capitalized, and the Template: prefix is
-- removed. Templates are grouped with the main template first, followed by
-- its redirects.
return {
["Disambiguation"] = true,
["Begriffsklärung"] = true,
["DAB"] = true,
["Dab"] = true,
["Dab page"] = true,
["Dabpage"] = true,
["Dbig"] = true,
["Dis"] = true,
["Disam"] = true,
["Disamb"] = true,
["Disambig"] = true,
["Disambig misspelling"] = true,
["Disambig-plants"] = true,
["Disambiguation page"] = true,
["Meta disambig"] = true,
["Project disambiguation"] = true,
["Shortcut disambig"] = true,
["WP disambig"] = true,
["WP-disambig"] = true,
["Wikipedia disambiguation"] = true,
["Airport disambiguation"] = true,
["Airport disambig"] = true,
["Biology disambiguation"] = true,
["Call sign disambiguation"] = true,
["Callsigndis"] = true,
["Caselaw disambiguation"] = true,
["Case law disambiguation"] = true,
["Chinese title disambiguation"] = true,
["CJKVdab"] = true,
["Chinese title disambig"] = true,
["Disambig-Chinese-char-title"] = true,
["Disambiguation cleanup"] = true,
["Cleanup disambig"] = true,
["Cleanup disambiguation"] = true,
["CleanupDisambig"] = true,
["Dab cleanup"] = true,
["Dab-cleanup"] = true,
["Dabclean"] = true,
["Disamb-cleanup"] = true,
["Disambcleanup"] = true,
["Disambig cleanup"] = true,
["Disambig-CU"] = true,
["Disambig-cleanup"] = true,
["Disambig-cu"] = true,
["Disambigcleanup"] = true,
["Disambiguate-cleanup"] = true,
["Disambiguation-cleanup"] = true,
["Geodis-cleanup"] = true,
["Genus disambiguation"] = true,
["Genus disambig"] = true,
["Hangul title disambiguation"] = true,
["Hospital disambiguation"] = true,
["Hospitaldis"] = true,
["Human name disambiguation"] = true,
["Bio-dab"] = true,
["HNDIS"] = true,
["HnDis"] = true,
["Hndab"] = true,
["Hndis"] = true,
["Hndisambig"] = true,
["Human name dab"] = true,
["Personal name"] = true,
["Personal name disambiguation"] = true,
["Human name disambiguation cleanup"] = true,
["Hndis-cleanup"] = true,
["Personal name disambiguation cleanup"] = true,
["Hurricane season disambiguation"] = true,
["Letter–number combination disambiguation"] = true,
["LNCD"] = true,
["Letter-Number Combination Disambiguation"] = true,
["Letter-Number combination disambiguation"] = true,
["Letter-NumberCombDisambig"] = true,
["Letter-NumberCombdisambig"] = true,
["Letter-NumberCombinationDisambiguation"] = true,
["Letter-number combination disambiguation"] = true,
["Mathematical disambiguation"] = true,
["Math dab"] = true,
["Math disambiguation"] = true,
["Mathdab"] = true,
["Mathematics disambiguation"] = true,
["Maths disambiguation"] = true,
["Military unit disambiguation"] = true,
["Mil-unit-dis"] = true,
["Mil-unit-disambig"] = true,
["Music disambiguation"] = true,
["Music disambig"] = true,
["Number disambiguation"] = true,
["Numberdis"] = true,
["Numdab"] = true,
["Numdisambig"] = true,
["Opus number disambiguation"] = true,
["Phonetics disambiguation"] = true,
["Place name disambiguation"] = true,
["DisambigG"] = true,
["DisambigGeo"] = true,
["Disambiggeo"] = true,
["Geo-dis"] = true,
["Geodab"] = true,
["Geodis"] = true,
["Geodisambig"] = true,
["Geographic disambiguation"] = true,
["Portal disambiguation"] = true,
["Portal disambig"] = true,
["Road disambiguation"] = true,
["Roaddis"] = true,
["School disambiguation"] = true,
["School disambig"] = true,
["Schooldab"] = true,
["Schooldis"] = true,
["Species Latin name abbreviation disambiguation"] = true,
["Species Latin name disambiguation"] = true,
["LatinNameDisambig"] = true,
["SpeciesLatinNameDisambig"] = true,
["Station disambiguation"] = true,
["Station dab"] = true,
["Synagogue disambiguation"] = true,
["Taxonomic authority disambiguation"] = true,
["Taxonomic authorities disambiguation"] = true,
["Taxonomy disambiguation"] = true,
["Species disambiguation"] = true,
["Template disambiguation"] = true,
["Template ambiguous"] = true,
["Template dab"] = true,
["Template disambig"] = true,
["WoO number disambiguation"] = true,
}
80e83cb6d90e1e23e1810373e244a1c6f917fac0
MediaWiki:Common.css
8
73
138
137
2023-12-24T02:03:16Z
Floopymichael
2
1 revision imported from [[:wikipedia:MediaWiki:Common.css]]
css
text/css
/*
* This is the CSS common to all desktop skins on en.Wikipedia.
* Styling inside .mw-parser-output should generally use TemplateStyles.
*/
/* Reset italic styling set by user agent */
cite,
dfn {
font-style: inherit;
}
/* Straight quote marks for <q> */
q {
quotes: '"' '"' "'" "'";
}
/* Avoid collision of blockquote with floating elements by swapping margin and padding */
blockquote {
overflow: hidden;
margin: 1em 0;
padding: 0 40px;
}
/* Consistent size for <small>, <sub> and <sup> */
small {
font-size: 85%;
}
.mw-body-content sub,
.mw-body-content sup {
font-size: 80%;
}
/* Same spacing for indented and unindented paragraphs on talk pages */
.ns-talk .mw-body-content dd {
margin-top: 0.4em;
margin-bottom: 0.4em;
}
/* Reduce page jumps by hiding collapsed/dismissed content */
.client-js .collapsible:not( .mw-made-collapsible).collapsed > tbody > tr:not(:first-child),
/* Avoid FOUC/reflows on collapsed elements. */
/* This copies MediaWiki's solution for T42812 to apply to innercollapse/outercollapse (T325115). */
/* TODO: Use :is() selector at some reasonable future when support is good for Most Clients */
/* Reference: https://gerrit.wikimedia.org/g/mediawiki/core/+/ecda06cb2aef55b77c4b4d7ecda492d634419ead/resources/src/jquery/jquery.makeCollapsible.styles.less#75 */
.client-js .outercollapse .innercollapse.mw-collapsible:not( .mw-made-collapsible ) > p,
.client-js .outercollapse .innercollapse.mw-collapsible:not( .mw-made-collapsible ) > table,
.client-js .outercollapse .innercollapse.mw-collapsible:not( .mw-made-collapsible ) > thead + tbody,
.client-js .outercollapse .innercollapse.mw-collapsible:not( .mw-made-collapsible ) tr:not( :first-child ),
.client-js .outercollapse .innercollapse.mw-collapsible:not( .mw-made-collapsible ) .mw-collapsible-content,
/* Hide charinsert base for those not using the gadget */
#editpage-specialchars {
display: none;
}
/* Make the list of references smaller
* Keep in sync with Template:Refbegin/styles.css
* And Template:Reflist/styles.css
*/
ol.references {
font-size: 90%;
margin-bottom: 0.5em;
}
/* Cite customizations for Parsoid
* Once everything uses the one true parser these are just customizations
*/
span[ rel="mw:referencedBy" ] {
counter-reset: mw-ref-linkback 0;
}
span[ rel='mw:referencedBy' ] > a::before {
content: counter( mw-ref-linkback, lower-alpha );
font-size: 80%;
font-weight: bold;
font-style: italic;
}
a[ rel="mw:referencedBy" ]::before {
font-weight: bold;
content: "^";
}
span[ rel="mw:referencedBy" ]::before {
content: "^ ";
}
.mw-ref > a[data-mw-group=lower-alpha]::after {
content: '[' counter( mw-Ref, lower-alpha ) ']';
}
.mw-ref > a[data-mw-group=upper-alpha]::after {
content: '[' counter( mw-Ref, upper-alpha ) ']';
}
.mw-ref > a[data-mw-group=decimal]::after {
content: '[' counter( mw-Ref, decimal ) ']';
}
.mw-ref > a[data-mw-group=lower-roman]::after {
content: '[' counter( mw-Ref, lower-roman ) ']';
}
.mw-ref > a[data-mw-group=upper-roman]::after {
content: '[' counter( mw-Ref, upper-roman ) ']';
}
.mw-ref > a[data-mw-group=lower-greek]::after {
content: '[' counter( mw-Ref, lower-greek ) ']';
}
/* Styling for jQuery makeCollapsible, matching that of collapseButton */
.mw-parser-output .mw-collapsible-toggle:not(.mw-ui-button) {
font-weight: normal;
padding-right: 0.2em;
padding-left: 0.2em;
}
.mw-collapsible-leftside-toggle .mw-collapsible-toggle {
/* @noflip */
float: left;
}
/* Lists in wikitable data cells are always left-aligned */
.wikitable td ul,
.wikitable td ol,
.wikitable td dl {
/* @noflip */
text-align: left;
}
/* Change the external link icon to a PDF icon for all PDF files */
.mw-parser-output a[href$=".pdf"].external,
.mw-parser-output a[href*=".pdf?"].external,
.mw-parser-output a[href*=".pdf#"].external,
.mw-parser-output a[href$=".PDF"].external,
.mw-parser-output a[href*=".PDF?"].external,
.mw-parser-output a[href*=".PDF#"].external {
background: url("//upload.wikimedia.org/wikipedia/commons/4/4d/Icon_pdf_file.png") no-repeat right;
/* @noflip */
padding: 8px 18px 8px 0;
}
/* System messages styled similarly to fmbox */
/* for .mw-warning-with-logexcerpt, behavior of this line differs between
* the edit-protected notice and the special:Contribs for blocked users
* The latter has specificity of 3 classes so we have to triple up here.
*/
.mw-warning-with-logexcerpt.mw-warning-with-logexcerpt.mw-warning-with-logexcerpt,
div.mw-lag-warn-high,
div.mw-cascadeprotectedwarning,
div#mw-protect-cascadeon {
clear: both;
margin: 0.2em 0;
border: 1px solid #bb7070;
background-color: #ffdbdb;
padding: 0.25em 0.9em;
box-sizing: border-box;
}
/* default colors for partial block message */
/* gotta get over the hump introduced by the triple class above */
.mw-contributions-blocked-notice-partial .mw-warning-with-logexcerpt.mw-warning-with-logexcerpt {
border-color: #fc3;
background-color: #fef6e7;
}
/* Minimum thumb width */
figure[typeof~='mw:File/Thumb'],
figure[typeof~='mw:File/Frame'],
.thumbinner {
min-width: 100px;
}
/* Prevent floating boxes from overlapping any category listings,
file histories, edit previews, and edit [Show changes] views. */
#mw-subcategories,
#mw-pages,
#mw-category-media,
#filehistory,
#wikiPreview,
#wikiDiff {
clear: both;
}
/* Styling for tags in changes pages */
.mw-tag-markers {
font-style: italic;
font-size: 90%;
}
/* Hide stuff meant for accounts with special permissions. Made visible again in
[[MediaWiki:Group-checkuser.css]], [[MediaWiki:Group-sysop.css]], [[MediaWiki:Group-abusefilter.css]],
[[MediaWiki:Group-abusefilter-helper.css]], [[MediaWiki:Group-patroller.css]],
[[MediaWiki:Group-templateeditor.css]], [[MediaWiki:Group-extendedmover.css]],
[[MediaWiki:Group-extendedconfirmed.css]], and [[Mediawiki:Group-autoconfirmed.css]]. */
.checkuser-show,
.sysop-show,
.abusefilter-show,
.abusefilter-helper-show,
.patroller-show,
.templateeditor-show,
.extendedmover-show,
.extendedconfirmed-show,
.autoconfirmed-show,
.user-show {
display: none;
}
/* Hide the redlink generated by {{Editnotice}},
this overrides the ".sysop-show { display: none; }" above that applies
to the same link as well. See [[phab:T45013]]
Hide the images in editnotices to keep them readable in VE view.
Long term, editnotices should become a core feature so that they can be designed responsive. */
.ve-ui-mwNoticesPopupTool-item .editnotice-redlink,
.ve-ui-mwNoticesPopupTool-item .mbox-image,
.ve-ui-mwNoticesPopupTool-item .mbox-imageright {
display: none !important;
}
/* Remove bullets when there are multiple edit page warnings */
ul.permissions-errors {
margin: 0;
}
ul.permissions-errors > li {
list-style: none;
}
/* larger inline math */
span.mwe-math-mathml-inline {
font-size: 118%;
}
/* Make <math display="block"> be left aligned with one space indent for
* compatibility with style conventions
*/
.mwe-math-fallback-image-display,
.mwe-math-mathml-display {
margin-left: 1.6em !important;
margin-top: 0.6em;
margin-bottom: 0.6em;
}
.mwe-math-mathml-display math {
display: inline;
}
@media screen {
/* Put a chequered background behind images, only visible if they have transparency,
* except on main, user, and portal namespaces
*/
body:not(.ns-0):not(.ns-2):not(.ns-100) .gallerybox .thumb img {
background: #fff url(//upload.wikimedia.org/wikipedia/commons/5/5d/Checker-16x16.png) repeat;
}
/* Display "From Wikipedia, the free encyclopedia" in skins that support it,
do not apply to print mode */
#siteSub {
display: block;
}
}
/* Hide FlaggedRevs notice UI when there are no pending changes */
.flaggedrevs_draft_synced,
.flaggedrevs_stable_synced,
/* "Temporary" to remove links in sidebar T255381 */
#t-upload,
/* Hide broken download box on Special:Book pending T285400 */
.mw-special-Book #coll-downloadbox {
display: none;
}
/*
* BELOW HERE THERE BE SOONTOBE TEMPLATESTYLES THINGS;
* SEE [[MediaWiki talk:Common.css/to do]]
*/
/* Infobox template style */
.infobox {
border: 1px solid #a2a9b1;
border-spacing: 3px;
background-color: #f8f9fa;
color: black;
/* @noflip */
margin: 0.5em 0 0.5em 1em;
padding: 0.2em;
/* @noflip */
float: right;
/* @noflip */
clear: right;
font-size: 88%;
line-height: 1.5em;
width: 22em;
}
.infobox-header,
.infobox-label,
.infobox-above,
.infobox-full-data,
.infobox-data,
.infobox-below,
.infobox-subheader,
.infobox-image,
.infobox-navbar,
/* Remove element selector when every .infobox thing is using the standard module/templates */
.infobox th,
.infobox td {
vertical-align: top;
}
.infobox-label,
.infobox-data,
/* Remove element selector when every .infobox thing is using the standard module/templates */
.infobox th,
.infobox td {
/* @noflip */
text-align: left;
}
/* Remove .infobox when element selectors above are removed */
.infobox .infobox-above,
.infobox .infobox-title,
/* Remove element selector when every .infobox thing is using the standard module/templates */
.infobox caption {
font-size: 125%;
font-weight: bold;
text-align: center;
}
.infobox-title,
/* Remove element selector when every .infobox thing is using the standard module/templates */
.infobox caption {
padding: 0.2em;
}
/* Remove .infobox when element selectors above are removed */
.infobox .infobox-header,
.infobox .infobox-subheader,
.infobox .infobox-image,
.infobox .infobox-full-data,
.infobox .infobox-below {
text-align: center;
}
/* Remove .infobox when element selectors above are removed */
.infobox .infobox-navbar {
/* @noflip */
text-align: right;
}
/* Normal font styling for wikitable row headers with scope="row" tag */
.wikitable.plainrowheaders th[scope=row],
.wikitable.plainrowheaders th[scope=rowgroup] {
font-weight: normal;
/* @noflip */
text-align: left;
}
/* Remove underlines from certain links */
.nounderlines a,
.IPA a:link,
.IPA a:visited {
text-decoration: none !important;
}
/* Prevent line breaks in silly places where desired (nowrap)
and links when we don't want them to (nowraplinks a) */
.nowrap,
.nowraplinks a {
white-space: nowrap;
}
/* But allow wrapping where desired: */
.wrap,
.wraplinks a {
white-space: normal;
}
/* texhtml class for inline math (based on generic times-serif class) */
span.texhtml {
font-family: "Nimbus Roman No9 L", "Times New Roman", Times, serif;
font-size: 118%;
line-height: 1;
white-space: nowrap;
/* Force tabular and lining display for texhtml */
font-variant-numeric: lining-nums tabular-nums;
font-kerning: none;
}
span.texhtml span.texhtml {
font-size: 100%;
}
@media screen {
.nochecker .gallerybox .thumb img {
background-image: none;
}
}
/* Put anything you mean to be a sitewide addition above the TemplateStyles
* comment above.
*/
6fb8f3b49a11a996e92a6014fa1eb15459a6daa4
Module:Message box
828
74
140
139
2023-12-24T02:03:18Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Message_box]]
Scribunto
text/plain
require('strict')
local getArgs
local yesno = require('Module:Yesno')
local lang = mw.language.getContentLanguage()
local CONFIG_MODULE = 'Module:Message box/configuration'
local DEMOSPACES = {talk = 'tmbox', image = 'imbox', file = 'imbox', category = 'cmbox', article = 'ambox', main = 'ambox'}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function getTitleObject(...)
-- Get the title object, passing the function through pcall
-- in case we are over the expensive function count limit.
local success, title = pcall(mw.title.new, ...)
if success then
return title
end
end
local function union(t1, t2)
-- Returns the union of two arrays.
local vals = {}
for i, v in ipairs(t1) do
vals[v] = true
end
for i, v in ipairs(t2) do
vals[v] = true
end
local ret = {}
for k in pairs(vals) do
table.insert(ret, k)
end
table.sort(ret)
return ret
end
local function getArgNums(args, prefix)
local nums = {}
for k, v in pairs(args) do
local num = mw.ustring.match(tostring(k), '^' .. prefix .. '([1-9]%d*)$')
if num then
table.insert(nums, tonumber(num))
end
end
table.sort(nums)
return nums
end
--------------------------------------------------------------------------------
-- Box class definition
--------------------------------------------------------------------------------
local MessageBox = {}
MessageBox.__index = MessageBox
function MessageBox.new(boxType, args, cfg)
args = args or {}
local obj = {}
-- Set the title object and the namespace.
obj.title = getTitleObject(args.page) or mw.title.getCurrentTitle()
-- Set the config for our box type.
obj.cfg = cfg[boxType]
if not obj.cfg then
local ns = obj.title.namespace
-- boxType is "mbox" or invalid input
if args.demospace and args.demospace ~= '' then
-- implement demospace parameter of mbox
local demospace = string.lower(args.demospace)
if DEMOSPACES[demospace] then
-- use template from DEMOSPACES
obj.cfg = cfg[DEMOSPACES[demospace]]
elseif string.find( demospace, 'talk' ) then
-- demo as a talk page
obj.cfg = cfg.tmbox
else
-- default to ombox
obj.cfg = cfg.ombox
end
elseif ns == 0 then
obj.cfg = cfg.ambox -- main namespace
elseif ns == 6 then
obj.cfg = cfg.imbox -- file namespace
elseif ns == 14 then
obj.cfg = cfg.cmbox -- category namespace
else
local nsTable = mw.site.namespaces[ns]
if nsTable and nsTable.isTalk then
obj.cfg = cfg.tmbox -- any talk namespace
else
obj.cfg = cfg.ombox -- other namespaces or invalid input
end
end
end
-- Set the arguments, and remove all blank arguments except for the ones
-- listed in cfg.allowBlankParams.
do
local newArgs = {}
for k, v in pairs(args) do
if v ~= '' then
newArgs[k] = v
end
end
for i, param in ipairs(obj.cfg.allowBlankParams or {}) do
newArgs[param] = args[param]
end
obj.args = newArgs
end
-- Define internal data structure.
obj.categories = {}
obj.classes = {}
-- For lazy loading of [[Module:Category handler]].
obj.hasCategories = false
return setmetatable(obj, MessageBox)
end
function MessageBox:addCat(ns, cat, sort)
if not cat then
return nil
end
if sort then
cat = string.format('[[Category:%s|%s]]', cat, sort)
else
cat = string.format('[[Category:%s]]', cat)
end
self.hasCategories = true
self.categories[ns] = self.categories[ns] or {}
table.insert(self.categories[ns], cat)
end
function MessageBox:addClass(class)
if not class then
return nil
end
table.insert(self.classes, class)
end
function MessageBox:setParameters()
local args = self.args
local cfg = self.cfg
-- Get type data.
self.type = args.type
local typeData = cfg.types[self.type]
self.invalidTypeError = cfg.showInvalidTypeError
and self.type
and not typeData
typeData = typeData or cfg.types[cfg.default]
self.typeClass = typeData.class
self.typeImage = typeData.image
self.typeImageNeedsLink = typeData.imageNeedsLink
-- Find if the box has been wrongly substituted.
self.isSubstituted = cfg.substCheck and args.subst == 'SUBST'
-- Find whether we are using a small message box.
self.isSmall = cfg.allowSmall and (
cfg.smallParam and args.small == cfg.smallParam
or not cfg.smallParam and yesno(args.small)
)
-- Add attributes, classes and styles.
self.id = args.id
self.name = args.name
if self.name then
self:addClass('box-' .. string.gsub(self.name,' ','_'))
end
if yesno(args.plainlinks) ~= false then
self:addClass('plainlinks')
end
for _, class in ipairs(cfg.classes or {}) do
self:addClass(class)
end
if self.isSmall then
self:addClass(cfg.smallClass or 'mbox-small')
end
self:addClass(self.typeClass)
self:addClass(args.class)
self.style = args.style
self.attrs = args.attrs
-- Set text style.
self.textstyle = args.textstyle
-- Find if we are on the template page or not. This functionality is only
-- used if useCollapsibleTextFields is set, or if both cfg.templateCategory
-- and cfg.templateCategoryRequireName are set.
self.useCollapsibleTextFields = cfg.useCollapsibleTextFields
if self.useCollapsibleTextFields
or cfg.templateCategory
and cfg.templateCategoryRequireName
then
if self.name then
local templateName = mw.ustring.match(
self.name,
'^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$'
) or self.name
templateName = 'Template:' .. templateName
self.templateTitle = getTitleObject(templateName)
end
self.isTemplatePage = self.templateTitle
and mw.title.equals(self.title, self.templateTitle)
end
-- Process data for collapsible text fields. At the moment these are only
-- used in {{ambox}}.
if self.useCollapsibleTextFields then
-- Get the self.issue value.
if self.isSmall and args.smalltext then
self.issue = args.smalltext
else
local sect
if args.sect == '' then
sect = 'This ' .. (cfg.sectionDefault or 'page')
elseif type(args.sect) == 'string' then
sect = 'This ' .. args.sect
end
local issue = args.issue
issue = type(issue) == 'string' and issue ~= '' and issue or nil
local text = args.text
text = type(text) == 'string' and text or nil
local issues = {}
table.insert(issues, sect)
table.insert(issues, issue)
table.insert(issues, text)
self.issue = table.concat(issues, ' ')
end
-- Get the self.talk value.
local talk = args.talk
-- Show talk links on the template page or template subpages if the talk
-- parameter is blank.
if talk == ''
and self.templateTitle
and (
mw.title.equals(self.templateTitle, self.title)
or self.title:isSubpageOf(self.templateTitle)
)
then
talk = '#'
elseif talk == '' then
talk = nil
end
if talk then
-- If the talk value is a talk page, make a link to that page. Else
-- assume that it's a section heading, and make a link to the talk
-- page of the current page with that section heading.
local talkTitle = getTitleObject(talk)
local talkArgIsTalkPage = true
if not talkTitle or not talkTitle.isTalkPage then
talkArgIsTalkPage = false
talkTitle = getTitleObject(
self.title.text,
mw.site.namespaces[self.title.namespace].talk.id
)
end
if talkTitle and talkTitle.exists then
local talkText
if self.isSmall then
local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk)
talkText = string.format('([[%s|talk]])', talkLink)
else
talkText = 'Relevant discussion may be found on'
if talkArgIsTalkPage then
talkText = string.format(
'%s [[%s|%s]].',
talkText,
talk,
talkTitle.prefixedText
)
else
talkText = string.format(
'%s the [[%s#%s|talk page]].',
talkText,
talkTitle.prefixedText,
talk
)
end
end
self.talk = talkText
end
end
-- Get other values.
self.fix = args.fix ~= '' and args.fix or nil
local date
if args.date and args.date ~= '' then
date = args.date
elseif args.date == '' and self.isTemplatePage then
date = lang:formatDate('F Y')
end
if date then
self.date = string.format(" <span class='date-container'><i>(<span class='date'>%s</span>)</i></span>", date)
end
self.info = args.info
if yesno(args.removalnotice) then
self.removalNotice = cfg.removalNotice
end
end
-- Set the non-collapsible text field. At the moment this is used by all box
-- types other than ambox, and also by ambox when small=yes.
if self.isSmall then
self.text = args.smalltext or args.text
else
self.text = args.text
end
-- Set the below row.
self.below = cfg.below and args.below
-- General image settings.
self.imageCellDiv = not self.isSmall and cfg.imageCellDiv
self.imageEmptyCell = cfg.imageEmptyCell
-- Left image settings.
local imageLeft = self.isSmall and args.smallimage or args.image
if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none'
or not cfg.imageCheckBlank and imageLeft ~= 'none'
then
self.imageLeft = imageLeft
if not imageLeft then
local imageSize = self.isSmall
and (cfg.imageSmallSize or '30x30px')
or '40x40px'
self.imageLeft = string.format('[[File:%s|%s%s|alt=]]', self.typeImage
or 'Information icon4.svg', imageSize, self.typeImageNeedsLink and "" or "|link=" )
end
end
-- Right image settings.
local imageRight = self.isSmall and args.smallimageright or args.imageright
if not (cfg.imageRightNone and imageRight == 'none') then
self.imageRight = imageRight
end
-- set templatestyles
self.base_templatestyles = cfg.templatestyles
self.templatestyles = args.templatestyles
end
function MessageBox:setMainspaceCategories()
local args = self.args
local cfg = self.cfg
if not cfg.allowMainspaceCategories then
return nil
end
local nums = {}
for _, prefix in ipairs{'cat', 'category', 'all'} do
args[prefix .. '1'] = args[prefix]
nums = union(nums, getArgNums(args, prefix))
end
-- The following is roughly equivalent to the old {{Ambox/category}}.
local date = args.date
date = type(date) == 'string' and date
local preposition = 'from'
for _, num in ipairs(nums) do
local mainCat = args['cat' .. tostring(num)]
or args['category' .. tostring(num)]
local allCat = args['all' .. tostring(num)]
mainCat = type(mainCat) == 'string' and mainCat
allCat = type(allCat) == 'string' and allCat
if mainCat and date and date ~= '' then
local catTitle = string.format('%s %s %s', mainCat, preposition, date)
self:addCat(0, catTitle)
catTitle = getTitleObject('Category:' .. catTitle)
if not catTitle or not catTitle.exists then
self:addCat(0, 'Articles with invalid date parameter in template')
end
elseif mainCat and (not date or date == '') then
self:addCat(0, mainCat)
end
if allCat then
self:addCat(0, allCat)
end
end
end
function MessageBox:setTemplateCategories()
local args = self.args
local cfg = self.cfg
-- Add template categories.
if cfg.templateCategory then
if cfg.templateCategoryRequireName then
if self.isTemplatePage then
self:addCat(10, cfg.templateCategory)
end
elseif not self.title.isSubpage then
self:addCat(10, cfg.templateCategory)
end
end
-- Add template error categories.
if cfg.templateErrorCategory then
local templateErrorCategory = cfg.templateErrorCategory
local templateCat, templateSort
if not self.name and not self.title.isSubpage then
templateCat = templateErrorCategory
elseif self.isTemplatePage then
local paramsToCheck = cfg.templateErrorParamsToCheck or {}
local count = 0
for i, param in ipairs(paramsToCheck) do
if not args[param] then
count = count + 1
end
end
if count > 0 then
templateCat = templateErrorCategory
templateSort = tostring(count)
end
if self.categoryNums and #self.categoryNums > 0 then
templateCat = templateErrorCategory
templateSort = 'C'
end
end
self:addCat(10, templateCat, templateSort)
end
end
function MessageBox:setAllNamespaceCategories()
-- Set categories for all namespaces.
if self.invalidTypeError then
local allSort = (self.title.namespace == 0 and 'Main:' or '') .. self.title.prefixedText
self:addCat('all', 'Wikipedia message box parameter needs fixing', allSort)
end
if self.isSubstituted then
self:addCat('all', 'Pages with incorrectly substituted templates')
end
end
function MessageBox:setCategories()
if self.title.namespace == 0 then
self:setMainspaceCategories()
elseif self.title.namespace == 10 then
self:setTemplateCategories()
end
self:setAllNamespaceCategories()
end
function MessageBox:renderCategories()
if not self.hasCategories then
-- No categories added, no need to pass them to Category handler so,
-- if it was invoked, it would return the empty string.
-- So we shortcut and return the empty string.
return ""
end
-- Convert category tables to strings and pass them through
-- [[Module:Category handler]].
return require('Module:Category handler')._main{
main = table.concat(self.categories[0] or {}),
template = table.concat(self.categories[10] or {}),
all = table.concat(self.categories.all or {}),
nocat = self.args.nocat,
page = self.args.page
}
end
function MessageBox:export()
local root = mw.html.create()
-- Add the subst check error.
if self.isSubstituted and self.name then
root:tag('b')
:addClass('error')
:wikitext(string.format(
'Template <code>%s[[Template:%s|%s]]%s</code> has been incorrectly substituted.',
mw.text.nowiki('{{'), self.name, self.name, mw.text.nowiki('}}')
))
end
local frame = mw.getCurrentFrame()
root:wikitext(frame:extensionTag{
name = 'templatestyles',
args = { src = self.base_templatestyles },
})
-- Add support for a single custom templatestyles sheet. Undocumented as
-- need should be limited and many templates using mbox are substed; we
-- don't want to spread templatestyles sheets around to arbitrary places
if self.templatestyles then
root:wikitext(frame:extensionTag{
name = 'templatestyles',
args = { src = self.templatestyles },
})
end
-- Create the box table.
local boxTable = root:tag('table')
boxTable:attr('id', self.id or nil)
for i, class in ipairs(self.classes or {}) do
boxTable:addClass(class or nil)
end
boxTable
:cssText(self.style or nil)
:attr('role', 'presentation')
if self.attrs then
boxTable:attr(self.attrs)
end
-- Add the left-hand image.
local row = boxTable:tag('tr')
if self.imageLeft then
local imageLeftCell = row:tag('td'):addClass('mbox-image')
if self.imageCellDiv then
-- If we are using a div, redefine imageLeftCell so that the image
-- is inside it. Divs use style="width: 52px;", which limits the
-- image width to 52px. If any images in a div are wider than that,
-- they may overlap with the text or cause other display problems.
imageLeftCell = imageLeftCell:tag('div'):addClass('mbox-image-div')
end
imageLeftCell:wikitext(self.imageLeft or nil)
elseif self.imageEmptyCell then
-- Some message boxes define an empty cell if no image is specified, and
-- some don't. The old template code in templates where empty cells are
-- specified gives the following hint: "No image. Cell with some width
-- or padding necessary for text cell to have 100% width."
row:tag('td')
:addClass('mbox-empty-cell')
end
-- Add the text.
local textCell = row:tag('td'):addClass('mbox-text')
if self.useCollapsibleTextFields then
-- The message box uses advanced text parameters that allow things to be
-- collapsible. At the moment, only ambox uses this.
textCell:cssText(self.textstyle or nil)
local textCellDiv = textCell:tag('div')
textCellDiv
:addClass('mbox-text-span')
:wikitext(self.issue or nil)
if (self.talk or self.fix) then
textCellDiv:tag('span')
:addClass('hide-when-compact')
:wikitext(self.talk and (' ' .. self.talk) or nil)
:wikitext(self.fix and (' ' .. self.fix) or nil)
end
textCellDiv:wikitext(self.date and (' ' .. self.date) or nil)
if self.info and not self.isSmall then
textCellDiv
:tag('span')
:addClass('hide-when-compact')
:wikitext(self.info and (' ' .. self.info) or nil)
end
if self.removalNotice then
textCellDiv:tag('span')
:addClass('hide-when-compact')
:tag('i')
:wikitext(string.format(" (%s)", self.removalNotice))
end
else
-- Default text formatting - anything goes.
textCell
:cssText(self.textstyle or nil)
:wikitext(self.text or nil)
end
-- Add the right-hand image.
if self.imageRight then
local imageRightCell = row:tag('td'):addClass('mbox-imageright')
if self.imageCellDiv then
-- If we are using a div, redefine imageRightCell so that the image
-- is inside it.
imageRightCell = imageRightCell:tag('div'):addClass('mbox-image-div')
end
imageRightCell
:wikitext(self.imageRight or nil)
end
-- Add the below row.
if self.below then
boxTable:tag('tr')
:tag('td')
:attr('colspan', self.imageRight and '3' or '2')
:addClass('mbox-text')
:cssText(self.textstyle or nil)
:wikitext(self.below or nil)
end
-- Add error message for invalid type parameters.
if self.invalidTypeError then
root:tag('div')
:addClass('mbox-invalid-type')
:wikitext(string.format(
'This message box is using an invalid "type=%s" parameter and needs fixing.',
self.type or ''
))
end
-- Add categories.
root:wikitext(self:renderCategories() or nil)
return tostring(root)
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p, mt = {}, {}
function p._exportClasses()
-- For testing.
return {
MessageBox = MessageBox
}
end
function p.main(boxType, args, cfgTables)
local box = MessageBox.new(boxType, args, cfgTables or mw.loadData(CONFIG_MODULE))
box:setParameters()
box:setCategories()
return box:export()
end
function mt.__index(t, k)
return function (frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
return t.main(k, getArgs(frame, {trim = false, removeBlanks = false}))
end
end
return setmetatable(p, mt)
f2fb84f7b817d2d88747f57c40902a0d8be8158a
Module:Message box/configuration
828
75
142
141
2023-12-24T02:03:19Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Message_box/configuration]]
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Message box configuration --
-- --
-- This module contains configuration data for [[Module:Message box]]. --
--------------------------------------------------------------------------------
return {
ambox = {
types = {
speedy = {
class = 'ambox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'ambox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'ambox-content',
image = 'Ambox important.svg'
},
style = {
class = 'ambox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'ambox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'ambox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'ambox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst', 'hidden'},
allowSmall = true,
smallParam = 'left',
smallClass = 'mbox-small-left',
substCheck = true,
classes = {'metadata', 'ambox'},
imageEmptyCell = true,
imageCheckBlank = true,
imageSmallSize = '20x20px',
imageCellDiv = true,
useCollapsibleTextFields = true,
imageRightNone = true,
sectionDefault = 'article',
allowMainspaceCategories = true,
templateCategory = 'Article message templates',
templateCategoryRequireName = true,
templateErrorCategory = 'Article message templates with missing parameters',
templateErrorParamsToCheck = {'issue', 'fix', 'subst'},
removalNotice = '<small>[[Help:Maintenance template removal|Learn how and when to remove this template message]]</small>',
templatestyles = 'Module:Message box/ambox.css'
},
cmbox = {
types = {
speedy = {
class = 'cmbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'cmbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'cmbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'cmbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'cmbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'cmbox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'cmbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'cmbox'},
imageEmptyCell = true,
templatestyles = 'Module:Message box/cmbox.css'
},
fmbox = {
types = {
warning = {
class = 'fmbox-warning',
image = 'Ambox warning pn.svg'
},
editnotice = {
class = 'fmbox-editnotice',
image = 'Information icon4.svg'
},
system = {
class = 'fmbox-system',
image = 'Information icon4.svg'
}
},
default = 'system',
showInvalidTypeError = true,
classes = {'fmbox'},
imageEmptyCell = false,
imageRightNone = false,
templatestyles = 'Module:Message box/fmbox.css'
},
imbox = {
types = {
speedy = {
class = 'imbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'imbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'imbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'imbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'imbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'imbox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
license = {
class = 'imbox-license licensetpl',
image = 'Imbox-license.svg'
},
["license-related"] = {
class = 'imbox-license',
image = 'Imbox-license.svg'
},
featured = {
class = 'imbox-featured',
image = 'Cscr-featured.svg',
imageNeedsLink = true
},
notice = {
class = 'imbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'imbox'},
imageEmptyCell = true,
below = true,
templateCategory = 'File message boxes',
templatestyles = 'Module:Message box/imbox.css'
},
ombox = {
types = {
speedy = {
class = 'ombox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'ombox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'ombox-content',
image = 'Ambox important.svg'
},
style = {
class = 'ombox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'ombox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'ombox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'ombox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'ombox'},
allowSmall = true,
imageEmptyCell = true,
imageRightNone = true,
templatestyles = 'Module:Message box/ombox.css'
},
tmbox = {
types = {
speedy = {
class = 'tmbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'tmbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'tmbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'tmbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'tmbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'tmbox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'tmbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'tmbox'},
allowSmall = true,
imageRightNone = true,
imageEmptyCell = true,
templateCategory = 'Talk message boxes',
templatestyles = 'Module:Message box/tmbox.css'
}
}
ccb6bdf2868087b6833d203307f2f6a92b3b0a01
Template:FULLROOTPAGENAME
10
76
144
143
2023-12-24T02:03:19Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:FULLROOTPAGENAME]]
wikitext
text/x-wiki
{{ safesubst:<noinclude/>#if: {{ safesubst:<noinclude/>Ns has subpages | {{ safesubst:<noinclude/>#if:{{{1|}}}|{{ safesubst:<noinclude/>NAMESPACE:{{{1}}}}}|{{ safesubst:<noinclude/>NAMESPACE}}}} }}
| {{ safesubst:<noinclude/>#titleparts:{{ safesubst:<noinclude/>#if:{{{1|}}}|{{{1}}}|{{ safesubst:<noinclude/>FULLPAGENAME}}}}|1}}
| {{ safesubst:<noinclude/>#if:{{{1|}}}|{{{1}}}|{{ safesubst:<noinclude/>FULLPAGENAME}}}}
}}<noinclude>
{{documentation}}
</noinclude>
fd0c4e7050dded2d50e5df405e6e5e31dd0d46ac
Template:Ns has subpages
10
77
146
145
2023-12-24T02:03:20Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Ns_has_subpages]]
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:Ns has subpages|main}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
060d2d01af26cb67fd90a7c346a0d2d5e450a040
Module:Ns has subpages
828
78
148
147
2023-12-24T02:03:21Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Ns_has_subpages]]
Scribunto
text/plain
-- This module implements [[Template:Ns has subpages]].
-- While the template is fairly simple, this information is made available to
-- Lua directly, so using a module means that we don't have to update the
-- template as new namespaces are added.
local p = {}
function p._main(ns, frame)
-- Get the current namespace if we were not passed one.
if not ns then
ns = mw.title.getCurrentTitle().namespace
end
-- Look up the namespace table from mw.site.namespaces. This should work
-- for a majority of cases.
local nsTable = mw.site.namespaces[ns]
-- Try using string matching to get the namespace from page names.
-- Do a quick and dirty bad title check to try and make sure we do the same
-- thing as {{NAMESPACE}} in most cases.
if not nsTable and type(ns) == 'string' and not ns:find('[<>|%[%]{}]') then
local nsStripped = ns:gsub('^[_%s]*:', '')
nsStripped = nsStripped:gsub(':.*$', '')
nsTable = mw.site.namespaces[nsStripped]
end
-- If we still have no match then try the {{NAMESPACE}} parser function,
-- which should catch the remainder of cases. Don't use a mw.title object,
-- as this would increment the expensive function count for each new page
-- tested.
if not nsTable then
frame = frame or mw.getCurrentFrame()
local nsProcessed = frame:callParserFunction('NAMESPACE', ns)
nsTable = nsProcessed and mw.site.namespaces[nsProcessed]
end
return nsTable and nsTable.hasSubpages
end
function p.main(frame)
local ns = frame:getParent().args[1]
if ns then
ns = ns:match('^%s*(.-)%s*$') -- trim whitespace
ns = tonumber(ns) or ns
end
local hasSubpages = p._main(ns, frame)
return hasSubpages and 'yes' or ''
end
return p
e133068ba73738b16e1e3eba47735516a461eb5b
Template:Fmbox
10
79
150
149
2023-12-24T02:03:22Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Fmbox]]
wikitext
text/x-wiki
{{#invoke:Message box|fmbox}}<noinclude>
{{documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
dfb511d767bd2208627c0874ccf91faf6b8551cc
Template:Editnotice
10
80
152
151
2023-12-24T02:03:26Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Editnotice]]
wikitext
text/x-wiki
{{#ifeq:{{FULLROOTPAGENAME}}|Template:Editnotices
|{{Editnotice/notice
|expiry={{{expiry|¬}}}
|redirect={{{redirect|}}}
}}
}}{{#ifexpr:{{#ifeq:{{FULLROOTPAGENAME}}|Template:Editnotices
|1
|0
}}+{{#switch:{{{expiry|¬}}}
|indefinite = 1
|
|¬ = 1 <!-- Expiry not specified -->
|#default = {{#iferror:{{#time:U|{{{expiry}}}}}
|0 <!-- Invalid expiry time -->
|{{#ifexpr:{{#time:U|{{{expiry}}}}}-{{#time:U|{{CURRENTTIMESTAMP}}}}>0
|1 <!-- Notice current -->
|0 <!-- Notice expired -->
}}
}}
}}
|{{fmbox
|type = {{{type|editnotice}}}
|id = {{{id|}}}
|textstyle = {{{textstyle|}}}
|style = {{{style|}}}
|class = {{{class|}}}
|image = {{#if:{{{image|}}}
|{{#invoke:InfoboxImage|InfoboxImage|image={{{image}}}|size={{{imagesize|}}}|sizedefault=40x40px}}
|none
}}
|imageright= {{#if:{{{imageright|}}}
|{{#invoke:InfoboxImage|InfoboxImage|image={{{imageright}}}|size={{{imagerightsize|}}}|sizedefault=40x40px}}
}}
|text = {{#if:{{{header|}}}
|<div style="font-weight: bold; {{{headerstyle|}}}">{{{header}}}</div>
}}
{{{text|{{{1}}}}}}
}}
}}{{#ifeq:{{FULLROOTPAGENAME}}|Template:Editnotices|{{#switch:{{{expiry|¬}}}
|indefinite
|
|¬ = <!-- Expiry not specified -->
|#default = {{#iferror:{{#time:U|{{{expiry}}}}}
| <!-- Invalid expiry time -->
|{{#ifexpr:{{#time:U|{{{expiry}}}}}-{{#time:U|{{CURRENTTIMESTAMP}}}}>0
| <!-- Notice current -->
|[[Category:Expired editnotices]] <!-- Notice expired -->
}}
}}
}}
}}<noinclude>
{{documentation}}
</noinclude>
d491e59c5e20682ddd6f1997443ffdfb78730dc4
Module:Message box/fmbox.css
828
81
154
153
2023-12-24T02:03:26Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Message_box/fmbox.css]]
sanitized-css
text/css
/* {{pp|small=y}} */
.fmbox {
clear: both;
margin: 0.2em 0;
width: 100%;
border: 1px solid #a2a9b1;
background-color: #f8f9fa; /* Default "system" gray */
box-sizing: border-box;
}
.fmbox-warning {
border: 1px solid #bb7070; /* Dark pink */
background-color: #ffdbdb; /* Pink */
}
.fmbox-editnotice {
background-color: transparent;
}
.fmbox .mbox-text {
border: none;
/* @noflip */
padding: 0.25em 0.9em;
width: 100%;
}
.fmbox .mbox-image {
border: none;
/* @noflip */
padding: 2px 0 2px 0.9em;
text-align: center;
}
.fmbox .mbox-imageright {
border: none;
/* @noflip */
padding: 2px 0.9em 2px 0;
text-align: center;
}
.fmbox .mbox-invalid-type {
text-align: center;
}
fca0f5e4b400e4a2ab158b219c52822451211d66
Template:Infobox
10
82
156
155
2023-12-24T02:07:19Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Infobox]]
wikitext
text/x-wiki
{{#invoke:Infobox|infobox}}<includeonly>{{template other|{{#ifeq:{{PAGENAME}}|Infobox||{{#ifeq:{{str left|{{SUBPAGENAME}}|7}}|Infobox|[[Category:Infobox templates|{{remove first word|{{SUBPAGENAME}}}}]]}}}}|}}</includeonly><noinclude>
{{documentation}}
<!-- Categories go in the /doc subpage, and interwikis go in Wikidata. -->
</noinclude>
817a9f5b6524eced06a57bd1d5fd7179f9369bf2
Template:Tl
10
83
158
157
2023-12-24T02:07:21Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Tl]]
wikitext
text/x-wiki
#REDIRECT [[Template:Template link]]
{{Redirect category shell|
{{R from move}}
}}
d6593bb3b4a866249f55d0f34b047a71fe1f1529
Template:Template link
10
84
160
159
2023-12-24T02:07:21Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Template_link]]
wikitext
text/x-wiki
{{[[Template:{{{1}}}|{{{1}}}]]}}<noinclude>{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
eabbec62efe3044a98ebb3ce9e7d4d43c222351d
Template:Yesno
10
85
162
161
2023-12-24T02:07:23Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Yesno]]
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: {{{1|¬}}} }}
|no
|n
|f
|false
|off
|0 = {{{no|<!-- null -->}}}
| = {{{blank|{{{no|<!-- null -->}}}}}}
|¬ = {{{¬|}}}
|yes
|y
|t
|true
|on
|1 = {{{yes|yes}}}
|#default = {{{def|{{{yes|yes}}}}}}
}}<noinclude>
{{Documentation}}
</noinclude>
629c2937bc5cf7cfe13cd2a598582af832782399
Template:Nobold
10
86
164
163
2023-12-24T02:07:24Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Nobold]]
wikitext
text/x-wiki
<templatestyles src="Nobold/styles.css"/><span class="nobold">{{{1}}}</span><noinclude>
{{documentation}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS -->
</noinclude>
9c92b5951772bb26ca0fbe9256418b65e47700dd
Template:Nobold/styles.css
10
87
166
165
2023-12-24T02:07:24Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Nobold/styles.css]]
sanitized-css
text/css
/* {{pp-template}} */
/* Styling for Template:Nobold */
.nobold {
font-weight: normal;
}
83e5f0adacf8c7984251f1fd9d11ed82ebaadf03
Module:Infobox
828
88
168
167
2023-12-24T02:07:25Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Infobox]]
Scribunto
text/plain
local p = {}
local args = {}
local origArgs = {}
local root
local empty_row_categories = {}
local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]'
local has_rows = false
local lists = {
plainlist_t = {
patterns = {
'^plainlist$',
'%splainlist$',
'^plainlist%s',
'%splainlist%s'
},
found = false,
styles = 'Plainlist/styles.css'
},
hlist_t = {
patterns = {
'^hlist$',
'%shlist$',
'^hlist%s',
'%shlist%s'
},
found = false,
styles = 'Hlist/styles.css'
}
}
local function has_list_class(args_to_check)
for _, list in pairs(lists) do
if not list.found then
for _, arg in pairs(args_to_check) do
for _, pattern in ipairs(list.patterns) do
if mw.ustring.find(arg or '', pattern) then
list.found = true
break
end
end
if list.found then break end
end
end
end
end
local function fixChildBoxes(sval, tt)
local function notempty( s ) return s and s:match( '%S' ) end
if notempty(sval) then
local marker = '<span class=special_infobox_marker>'
local s = sval
-- start moving templatestyles and categories inside of table rows
local slast = ''
while slast ~= s do
slast = s
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*%]%])', '%2%1')
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)', '%2%1')
end
-- end moving templatestyles and categories inside of table rows
s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1')
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>)', '%1' .. marker)
if s:match(marker) then
s = mw.ustring.gsub(s, marker .. '%s*' .. marker, '')
s = mw.ustring.gsub(s, '([\r\n]|-[^\r\n]*[\r\n])%s*' .. marker, '%1')
s = mw.ustring.gsub(s, marker .. '%s*([\r\n]|-)', '%1')
s = mw.ustring.gsub(s, '(</[Cc][Aa][Pp][Tt][Ii][Oo][Nn]%s*>%s*)' .. marker, '%1')
s = mw.ustring.gsub(s, '(<%s*[Tt][Aa][Bb][Ll][Ee][^<>]*>%s*)' .. marker, '%1')
s = mw.ustring.gsub(s, '^(%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1')
s = mw.ustring.gsub(s, '([\r\n]%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1')
s = mw.ustring.gsub(s, marker .. '(%s*</[Tt][Aa][Bb][Ll][Ee]%s*>)', '%1')
s = mw.ustring.gsub(s, marker .. '(%s*\n|%})', '%1')
end
if s:match(marker) then
local subcells = mw.text.split(s, marker)
s = ''
for k = 1, #subcells do
if k == 1 then
s = s .. subcells[k] .. '</' .. tt .. '></tr>'
elseif k == #subcells then
local rowstyle = ' style="display:none"'
if notempty(subcells[k]) then rowstyle = '' end
s = s .. '<tr' .. rowstyle ..'><' .. tt .. ' colspan=2>\n' ..
subcells[k]
elseif notempty(subcells[k]) then
if (k % 2) == 0 then
s = s .. subcells[k]
else
s = s .. '<tr><' .. tt .. ' colspan=2>\n' ..
subcells[k] .. '</' .. tt .. '></tr>'
end
end
end
end
-- the next two lines add a newline at the end of lists for the PHP parser
-- [[Special:Diff/849054481]]
-- remove when [[:phab:T191516]] is fixed or OBE
s = mw.ustring.gsub(s, '([\r\n][%*#;:][^\r\n]*)$', '%1\n')
s = mw.ustring.gsub(s, '^([%*#;:][^\r\n]*)$', '%1\n')
s = mw.ustring.gsub(s, '^([%*#;:])', '\n%1')
s = mw.ustring.gsub(s, '^(%{%|)', '\n%1')
return s
else
return sval
end
end
-- Cleans empty tables
local function cleanInfobox()
root = tostring(root)
if has_rows == false then
root = mw.ustring.gsub(root, '<table[^<>]*>%s*</table>', '')
end
end
-- Returns the union of the values of two tables, as a sequence.
local function union(t1, t2)
local vals = {}
for k, v in pairs(t1) do
vals[v] = true
end
for k, v in pairs(t2) do
vals[v] = true
end
local ret = {}
for k, v in pairs(vals) do
table.insert(ret, k)
end
return ret
end
-- Returns a table containing the numbers of the arguments that exist
-- for the specified prefix. For example, if the prefix was 'data', and
-- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}.
local function getArgNums(prefix)
local nums = {}
for k, v in pairs(args) do
local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$')
if num then table.insert(nums, tonumber(num)) end
end
table.sort(nums)
return nums
end
-- Adds a row to the infobox, with either a header cell
-- or a label/data cell combination.
local function addRow(rowArgs)
if rowArgs.header and rowArgs.header ~= '_BLANK_' then
has_rows = true
has_list_class({ rowArgs.rowclass, rowArgs.class, args.headerclass })
root
:tag('tr')
:addClass(rowArgs.rowclass)
:cssText(rowArgs.rowstyle)
:tag('th')
:attr('colspan', '2')
:addClass('infobox-header')
:addClass(rowArgs.class)
:addClass(args.headerclass)
-- @deprecated next; target .infobox-<name> .infobox-header
:cssText(args.headerstyle)
:cssText(rowArgs.rowcellstyle)
:wikitext(fixChildBoxes(rowArgs.header, 'th'))
if rowArgs.data then
root:wikitext(
'[[Category:Pages using infobox templates with ignored data cells]]'
)
end
elseif rowArgs.data and rowArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then
has_rows = true
has_list_class({ rowArgs.rowclass, rowArgs.class })
local row = root:tag('tr')
row:addClass(rowArgs.rowclass)
row:cssText(rowArgs.rowstyle)
if rowArgs.label then
row
:tag('th')
:attr('scope', 'row')
:addClass('infobox-label')
-- @deprecated next; target .infobox-<name> .infobox-label
:cssText(args.labelstyle)
:cssText(rowArgs.rowcellstyle)
:wikitext(rowArgs.label)
:done()
end
local dataCell = row:tag('td')
dataCell
:attr('colspan', not rowArgs.label and '2' or nil)
:addClass(not rowArgs.label and 'infobox-full-data' or 'infobox-data')
:addClass(rowArgs.class)
-- @deprecated next; target .infobox-<name> .infobox(-full)-data
:cssText(rowArgs.datastyle)
:cssText(rowArgs.rowcellstyle)
:wikitext(fixChildBoxes(rowArgs.data, 'td'))
else
table.insert(empty_row_categories, rowArgs.data or '')
end
end
local function renderTitle()
if not args.title then return end
has_rows = true
has_list_class({args.titleclass})
root
:tag('caption')
:addClass('infobox-title')
:addClass(args.titleclass)
-- @deprecated next; target .infobox-<name> .infobox-title
:cssText(args.titlestyle)
:wikitext(args.title)
end
local function renderAboveRow()
if not args.above then return end
has_rows = true
has_list_class({ args.aboveclass })
root
:tag('tr')
:tag('th')
:attr('colspan', '2')
:addClass('infobox-above')
:addClass(args.aboveclass)
-- @deprecated next; target .infobox-<name> .infobox-above
:cssText(args.abovestyle)
:wikitext(fixChildBoxes(args.above,'th'))
end
local function renderBelowRow()
if not args.below then return end
has_rows = true
has_list_class({ args.belowclass })
root
:tag('tr')
:tag('td')
:attr('colspan', '2')
:addClass('infobox-below')
:addClass(args.belowclass)
-- @deprecated next; target .infobox-<name> .infobox-below
:cssText(args.belowstyle)
:wikitext(fixChildBoxes(args.below,'td'))
end
local function addSubheaderRow(subheaderArgs)
if subheaderArgs.data and
subheaderArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then
has_rows = true
has_list_class({ subheaderArgs.rowclass, subheaderArgs.class })
local row = root:tag('tr')
row:addClass(subheaderArgs.rowclass)
local dataCell = row:tag('td')
dataCell
:attr('colspan', '2')
:addClass('infobox-subheader')
:addClass(subheaderArgs.class)
:cssText(subheaderArgs.datastyle)
:cssText(subheaderArgs.rowcellstyle)
:wikitext(fixChildBoxes(subheaderArgs.data, 'td'))
else
table.insert(empty_row_categories, subheaderArgs.data or '')
end
end
local function renderSubheaders()
if args.subheader then
args.subheader1 = args.subheader
end
if args.subheaderrowclass then
args.subheaderrowclass1 = args.subheaderrowclass
end
local subheadernums = getArgNums('subheader')
for k, num in ipairs(subheadernums) do
addSubheaderRow({
data = args['subheader' .. tostring(num)],
-- @deprecated next; target .infobox-<name> .infobox-subheader
datastyle = args.subheaderstyle,
rowcellstyle = args['subheaderstyle' .. tostring(num)],
class = args.subheaderclass,
rowclass = args['subheaderrowclass' .. tostring(num)]
})
end
end
local function addImageRow(imageArgs)
if imageArgs.data and
imageArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then
has_rows = true
has_list_class({ imageArgs.rowclass, imageArgs.class })
local row = root:tag('tr')
row:addClass(imageArgs.rowclass)
local dataCell = row:tag('td')
dataCell
:attr('colspan', '2')
:addClass('infobox-image')
:addClass(imageArgs.class)
:cssText(imageArgs.datastyle)
:wikitext(fixChildBoxes(imageArgs.data, 'td'))
else
table.insert(empty_row_categories, imageArgs.data or '')
end
end
local function renderImages()
if args.image then
args.image1 = args.image
end
if args.caption then
args.caption1 = args.caption
end
local imagenums = getArgNums('image')
for k, num in ipairs(imagenums) do
local caption = args['caption' .. tostring(num)]
local data = mw.html.create():wikitext(args['image' .. tostring(num)])
if caption then
data
:tag('div')
:addClass('infobox-caption')
-- @deprecated next; target .infobox-<name> .infobox-caption
:cssText(args.captionstyle)
:wikitext(caption)
end
addImageRow({
data = tostring(data),
-- @deprecated next; target .infobox-<name> .infobox-image
datastyle = args.imagestyle,
class = args.imageclass,
rowclass = args['imagerowclass' .. tostring(num)]
})
end
end
-- When autoheaders are turned on, preprocesses the rows
local function preprocessRows()
if not args.autoheaders then return end
local rownums = union(getArgNums('header'), getArgNums('data'))
table.sort(rownums)
local lastheader
for k, num in ipairs(rownums) do
if args['header' .. tostring(num)] then
if lastheader then
args['header' .. tostring(lastheader)] = nil
end
lastheader = num
elseif args['data' .. tostring(num)] and
args['data' .. tostring(num)]:gsub(
category_in_empty_row_pattern, ''
):match('^%S') then
local data = args['data' .. tostring(num)]
if data:gsub(category_in_empty_row_pattern, ''):match('%S') then
lastheader = nil
end
end
end
if lastheader then
args['header' .. tostring(lastheader)] = nil
end
end
-- Gets the union of the header and data argument numbers,
-- and renders them all in order
local function renderRows()
local rownums = union(getArgNums('header'), getArgNums('data'))
table.sort(rownums)
for k, num in ipairs(rownums) do
addRow({
header = args['header' .. tostring(num)],
label = args['label' .. tostring(num)],
data = args['data' .. tostring(num)],
datastyle = args.datastyle,
class = args['class' .. tostring(num)],
rowclass = args['rowclass' .. tostring(num)],
-- @deprecated next; target .infobox-<name> rowclass
rowstyle = args['rowstyle' .. tostring(num)],
rowcellstyle = args['rowcellstyle' .. tostring(num)]
})
end
end
local function renderNavBar()
if not args.name then return end
has_rows = true
root
:tag('tr')
:tag('td')
:attr('colspan', '2')
:addClass('infobox-navbar')
:wikitext(require('Module:Navbar')._navbar{
args.name,
mini = 1,
})
end
local function renderItalicTitle()
local italicTitle = args['italic title'] and mw.ustring.lower(args['italic title'])
if italicTitle == '' or italicTitle == 'force' or italicTitle == 'yes' then
root:wikitext(require('Module:Italic title')._main({}))
end
end
-- Categories in otherwise empty rows are collected in empty_row_categories.
-- This function adds them to the module output. It is not affected by
-- args.decat because this module should not prevent module-external categories
-- from rendering.
local function renderEmptyRowCategories()
for _, s in ipairs(empty_row_categories) do
root:wikitext(s)
end
end
-- Render tracking categories. args.decat == turns off tracking categories.
local function renderTrackingCategories()
if args.decat == 'yes' then return end
if args.child == 'yes' then
if args.title then
root:wikitext(
'[[Category:Pages using embedded infobox templates with the title parameter]]'
)
end
elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
root:wikitext('[[Category:Articles using infobox templates with no data rows]]')
end
end
--[=[
Loads the templatestyles for the infobox.
TODO: FINISH loading base templatestyles here rather than in
MediaWiki:Common.css. There are 4-5000 pages with 'raw' infobox tables.
See [[Mediawiki_talk:Common.css/to_do#Infobox]] and/or come help :).
When we do this we should clean up the inline CSS below too.
Will have to do some bizarre conversion category like with sidebar.
]=]
local function loadTemplateStyles()
local frame = mw.getCurrentFrame()
local hlist_templatestyles = ''
if lists.hlist_t.found then
hlist_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = lists.hlist_t.styles }
}
end
local plainlist_templatestyles = ''
if lists.plainlist_t.found then
plainlist_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = lists.plainlist_t.styles }
}
end
-- See function description
local base_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = 'Module:Infobox/styles.css' }
}
local templatestyles = ''
if args['templatestyles'] then
templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['templatestyles'] }
}
end
local child_templatestyles = ''
if args['child templatestyles'] then
child_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['child templatestyles'] }
}
end
local grandchild_templatestyles = ''
if args['grandchild templatestyles'] then
grandchild_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['grandchild templatestyles'] }
}
end
return table.concat({
-- hlist -> plainlist -> base is best-effort to preserve old Common.css ordering.
-- this ordering is not a guarantee because the rows of interest invoking
-- each class may not be on a specific page
hlist_templatestyles,
plainlist_templatestyles,
base_templatestyles,
templatestyles,
child_templatestyles,
grandchild_templatestyles
})
end
-- common functions between the child and non child cases
local function structure_infobox_common()
renderSubheaders()
renderImages()
preprocessRows()
renderRows()
renderBelowRow()
renderNavBar()
renderItalicTitle()
renderEmptyRowCategories()
renderTrackingCategories()
cleanInfobox()
end
-- Specify the overall layout of the infobox, with special settings if the
-- infobox is used as a 'child' inside another infobox.
local function _infobox()
if args.child ~= 'yes' then
root = mw.html.create('table')
root
:addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox')
:addClass(args.bodyclass)
-- @deprecated next; target .infobox-<name>
:cssText(args.bodystyle)
has_list_class({ args.bodyclass })
renderTitle()
renderAboveRow()
else
root = mw.html.create()
root
:wikitext(args.title)
end
structure_infobox_common()
return loadTemplateStyles() .. root
end
-- If the argument exists and isn't blank, add it to the argument table.
-- Blank arguments are treated as nil to match the behaviour of ParserFunctions.
local function preprocessSingleArg(argName)
if origArgs[argName] and origArgs[argName] ~= '' then
args[argName] = origArgs[argName]
end
end
-- Assign the parameters with the given prefixes to the args table, in order, in
-- batches of the step size specified. This is to prevent references etc. from
-- appearing in the wrong order. The prefixTable should be an array containing
-- tables, each of which has two possible fields, a "prefix" string and a
-- "depend" table. The function always parses parameters containing the "prefix"
-- string, but only parses parameters in the "depend" table if the prefix
-- parameter is present and non-blank.
local function preprocessArgs(prefixTable, step)
if type(prefixTable) ~= 'table' then
error("Non-table value detected for the prefix table", 2)
end
if type(step) ~= 'number' then
error("Invalid step value detected", 2)
end
-- Get arguments without a number suffix, and check for bad input.
for i,v in ipairs(prefixTable) do
if type(v) ~= 'table' or type(v.prefix) ~= "string" or
(v.depend and type(v.depend) ~= 'table') then
error('Invalid input detected to preprocessArgs prefix table', 2)
end
preprocessSingleArg(v.prefix)
-- Only parse the depend parameter if the prefix parameter is present
-- and not blank.
if args[v.prefix] and v.depend then
for j, dependValue in ipairs(v.depend) do
if type(dependValue) ~= 'string' then
error('Invalid "depend" parameter value detected in preprocessArgs')
end
preprocessSingleArg(dependValue)
end
end
end
-- Get arguments with number suffixes.
local a = 1 -- Counter variable.
local moreArgumentsExist = true
while moreArgumentsExist == true do
moreArgumentsExist = false
for i = a, a + step - 1 do
for j,v in ipairs(prefixTable) do
local prefixArgName = v.prefix .. tostring(i)
if origArgs[prefixArgName] then
-- Do another loop if any arguments are found, even blank ones.
moreArgumentsExist = true
preprocessSingleArg(prefixArgName)
end
-- Process the depend table if the prefix argument is present
-- and not blank, or we are processing "prefix1" and "prefix" is
-- present and not blank, and if the depend table is present.
if v.depend and (args[prefixArgName] or (i == 1 and args[v.prefix])) then
for j,dependValue in ipairs(v.depend) do
local dependArgName = dependValue .. tostring(i)
preprocessSingleArg(dependArgName)
end
end
end
end
a = a + step
end
end
-- Parse the data parameters in the same order that the old {{infobox}} did, so
-- that references etc. will display in the expected places. Parameters that
-- depend on another parameter are only processed if that parameter is present,
-- to avoid phantom references appearing in article reference lists.
local function parseDataParameters()
preprocessSingleArg('autoheaders')
preprocessSingleArg('child')
preprocessSingleArg('bodyclass')
preprocessSingleArg('subbox')
preprocessSingleArg('bodystyle')
preprocessSingleArg('title')
preprocessSingleArg('titleclass')
preprocessSingleArg('titlestyle')
preprocessSingleArg('above')
preprocessSingleArg('aboveclass')
preprocessSingleArg('abovestyle')
preprocessArgs({
{prefix = 'subheader', depend = {'subheaderstyle', 'subheaderrowclass'}}
}, 10)
preprocessSingleArg('subheaderstyle')
preprocessSingleArg('subheaderclass')
preprocessArgs({
{prefix = 'image', depend = {'caption', 'imagerowclass'}}
}, 10)
preprocessSingleArg('captionstyle')
preprocessSingleArg('imagestyle')
preprocessSingleArg('imageclass')
preprocessArgs({
{prefix = 'header'},
{prefix = 'data', depend = {'label'}},
{prefix = 'rowclass'},
{prefix = 'rowstyle'},
{prefix = 'rowcellstyle'},
{prefix = 'class'}
}, 50)
preprocessSingleArg('headerclass')
preprocessSingleArg('headerstyle')
preprocessSingleArg('labelstyle')
preprocessSingleArg('datastyle')
preprocessSingleArg('below')
preprocessSingleArg('belowclass')
preprocessSingleArg('belowstyle')
preprocessSingleArg('name')
-- different behaviour for italics if blank or absent
args['italic title'] = origArgs['italic title']
preprocessSingleArg('decat')
preprocessSingleArg('templatestyles')
preprocessSingleArg('child templatestyles')
preprocessSingleArg('grandchild templatestyles')
end
-- If called via #invoke, use the args passed into the invoking template.
-- Otherwise, for testing purposes, assume args are being passed directly in.
function p.infobox(frame)
if frame == mw.getCurrentFrame() then
origArgs = frame:getParent().args
else
origArgs = frame
end
parseDataParameters()
return _infobox()
end
-- For calling via #invoke within a template
function p.infoboxTemplate(frame)
origArgs = {}
for k,v in pairs(frame.args) do origArgs[k] = mw.text.trim(v) end
parseDataParameters()
return _infobox()
end
return p
0ddb7e5c8426d67cd589b710efb9912ddfb67fea
Module:Infobox/styles.css
828
89
170
169
2023-12-24T02:07:26Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Infobox/styles.css]]
sanitized-css
text/css
/* {{pp|small=y}} */
/*
* This TemplateStyles sheet deliberately does NOT include the full set of
* infobox styles. We are still working to migrate all of the manual
* infoboxes. See [[MediaWiki talk:Common.css/to do#Infobox]]
* DO NOT ADD THEM HERE
*/
/*
* not strictly certain these styles are necessary since the modules now
* exclusively output infobox-subbox or infobox, not both
* just replicating the module faithfully
*/
.infobox-subbox {
padding: 0;
border: none;
margin: -3px;
width: auto;
min-width: 100%;
font-size: 100%;
clear: none;
float: none;
background-color: transparent;
}
.infobox-3cols-child {
margin: auto;
}
.infobox .navbar {
font-size: 100%;
}
/* T281642 */
body.skin-minerva .infobox-header,
body.skin-minerva .infobox-subheader,
body.skin-minerva .infobox-above,
body.skin-minerva .infobox-title,
body.skin-minerva .infobox-image,
body.skin-minerva .infobox-full-data,
body.skin-minerva .infobox-below {
text-align: center;
}
e8de6d96f4fde53afc4a6b0fed534405ab59b0a7
Module:List
828
90
172
171
2023-12-24T02:07:26Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:List]]
Scribunto
text/plain
local libUtil = require('libraryUtil')
local checkType = libUtil.checkType
local mTableTools = require('Module:TableTools')
local p = {}
local listTypes = {
['bulleted'] = true,
['unbulleted'] = true,
['horizontal'] = true,
['ordered'] = true,
['horizontal_ordered'] = true
}
function p.makeListData(listType, args)
-- Constructs a data table to be passed to p.renderList.
local data = {}
-- Classes and TemplateStyles
data.classes = {}
data.templatestyles = ''
if listType == 'horizontal' or listType == 'horizontal_ordered' then
table.insert(data.classes, 'hlist')
data.templatestyles = mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Hlist/styles.css' }
}
elseif listType == 'unbulleted' then
table.insert(data.classes, 'plainlist')
data.templatestyles = mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Plainlist/styles.css' }
}
end
table.insert(data.classes, args.class)
-- Main div style
data.style = args.style
-- Indent for horizontal lists
if listType == 'horizontal' or listType == 'horizontal_ordered' then
local indent = tonumber(args.indent)
indent = indent and indent * 1.6 or 0
if indent > 0 then
data.marginLeft = indent .. 'em'
end
end
-- List style types for ordered lists
-- This could be "1, 2, 3", "a, b, c", or a number of others. The list style
-- type is either set by the "type" attribute or the "list-style-type" CSS
-- property.
if listType == 'ordered' or listType == 'horizontal_ordered' then
data.listStyleType = args.list_style_type or args['list-style-type']
data.type = args['type']
-- Detect invalid type attributes and attempt to convert them to
-- list-style-type CSS properties.
if data.type
and not data.listStyleType
and not tostring(data.type):find('^%s*[1AaIi]%s*$')
then
data.listStyleType = data.type
data.type = nil
end
end
-- List tag type
if listType == 'ordered' or listType == 'horizontal_ordered' then
data.listTag = 'ol'
else
data.listTag = 'ul'
end
-- Start number for ordered lists
data.start = args.start
if listType == 'horizontal_ordered' then
-- Apply fix to get start numbers working with horizontal ordered lists.
local startNum = tonumber(data.start)
if startNum then
data.counterReset = 'listitem ' .. tostring(startNum - 1)
end
end
-- List style
-- ul_style and ol_style are included for backwards compatibility. No
-- distinction is made for ordered or unordered lists.
data.listStyle = args.list_style
-- List items
-- li_style is included for backwards compatibility. item_style was included
-- to be easier to understand for non-coders.
data.itemStyle = args.item_style or args.li_style
data.items = {}
for _, num in ipairs(mTableTools.numKeys(args)) do
local item = {}
item.content = args[num]
item.style = args['item' .. tostring(num) .. '_style']
or args['item_style' .. tostring(num)]
item.value = args['item' .. tostring(num) .. '_value']
or args['item_value' .. tostring(num)]
table.insert(data.items, item)
end
return data
end
function p.renderList(data)
-- Renders the list HTML.
-- Return the blank string if there are no list items.
if type(data.items) ~= 'table' or #data.items < 1 then
return ''
end
-- Render the main div tag.
local root = mw.html.create('div')
for _, class in ipairs(data.classes or {}) do
root:addClass(class)
end
root:css{['margin-left'] = data.marginLeft}
if data.style then
root:cssText(data.style)
end
-- Render the list tag.
local list = root:tag(data.listTag or 'ul')
list
:attr{start = data.start, type = data.type}
:css{
['counter-reset'] = data.counterReset,
['list-style-type'] = data.listStyleType
}
if data.listStyle then
list:cssText(data.listStyle)
end
-- Render the list items
for _, t in ipairs(data.items or {}) do
local item = list:tag('li')
if data.itemStyle then
item:cssText(data.itemStyle)
end
if t.style then
item:cssText(t.style)
end
item
:attr{value = t.value}
:wikitext(t.content)
end
return data.templatestyles .. tostring(root)
end
function p.renderTrackingCategories(args)
local isDeprecated = false -- Tracks deprecated parameters.
for k, v in pairs(args) do
k = tostring(k)
if k:find('^item_style%d+$') or k:find('^item_value%d+$') then
isDeprecated = true
break
end
end
local ret = ''
if isDeprecated then
ret = ret .. '[[Category:List templates with deprecated parameters]]'
end
return ret
end
function p.makeList(listType, args)
if not listType or not listTypes[listType] then
error(string.format(
"bad argument #1 to 'makeList' ('%s' is not a valid list type)",
tostring(listType)
), 2)
end
checkType('makeList', 2, args, 'table')
local data = p.makeListData(listType, args)
local list = p.renderList(data)
local trackingCategories = p.renderTrackingCategories(args)
return list .. trackingCategories
end
for listType in pairs(listTypes) do
p[listType] = function (frame)
local mArguments = require('Module:Arguments')
local origArgs = mArguments.getArgs(frame, {
valueFunc = function (key, value)
if not value or not mw.ustring.find(value, '%S') then return nil end
if mw.ustring.find(value, '^%s*[%*#;:]') then
return value
else
return value:match('^%s*(.-)%s*$')
end
return nil
end
})
-- Copy all the arguments to a new table, for faster indexing.
local args = {}
for k, v in pairs(origArgs) do
args[k] = v
end
return p.makeList(listType, args)
end
end
return p
7a4f36a6e9cd56370bdd8207d23694124821dc1a
Module:TableTools
828
91
174
173
2023-12-24T02:07:27Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:TableTools]]
Scribunto
text/plain
------------------------------------------------------------------------------------
-- TableTools --
-- --
-- This module includes a number of functions for dealing with Lua tables. --
-- It is a meta-module, meant to be called from other Lua modules, and should not --
-- be called directly from #invoke. --
------------------------------------------------------------------------------------
local libraryUtil = require('libraryUtil')
local p = {}
-- Define often-used variables and functions.
local floor = math.floor
local infinity = math.huge
local checkType = libraryUtil.checkType
local checkTypeMulti = libraryUtil.checkTypeMulti
------------------------------------------------------------------------------------
-- isPositiveInteger
--
-- This function returns true if the given value is a positive integer, and false
-- if not. Although it doesn't operate on tables, it is included here as it is
-- useful for determining whether a given table key is in the array part or the
-- hash part of a table.
------------------------------------------------------------------------------------
function p.isPositiveInteger(v)
return type(v) == 'number' and v >= 1 and floor(v) == v and v < infinity
end
------------------------------------------------------------------------------------
-- isNan
--
-- This function returns true if the given number is a NaN value, and false if
-- not. Although it doesn't operate on tables, it is included here as it is useful
-- for determining whether a value can be a valid table key. Lua will generate an
-- error if a NaN is used as a table key.
------------------------------------------------------------------------------------
function p.isNan(v)
return type(v) == 'number' and v ~= v
end
------------------------------------------------------------------------------------
-- shallowClone
--
-- This returns a clone of a table. The value returned is a new table, but all
-- subtables and functions are shared. Metamethods are respected, but the returned
-- table will have no metatable of its own.
------------------------------------------------------------------------------------
function p.shallowClone(t)
checkType('shallowClone', 1, t, 'table')
local ret = {}
for k, v in pairs(t) do
ret[k] = v
end
return ret
end
------------------------------------------------------------------------------------
-- removeDuplicates
--
-- This removes duplicate values from an array. Non-positive-integer keys are
-- ignored. The earliest value is kept, and all subsequent duplicate values are
-- removed, but otherwise the array order is unchanged.
------------------------------------------------------------------------------------
function p.removeDuplicates(arr)
checkType('removeDuplicates', 1, arr, 'table')
local isNan = p.isNan
local ret, exists = {}, {}
for _, v in ipairs(arr) do
if isNan(v) then
-- NaNs can't be table keys, and they are also unique, so we don't need to check existence.
ret[#ret + 1] = v
else
if not exists[v] then
ret[#ret + 1] = v
exists[v] = true
end
end
end
return ret
end
------------------------------------------------------------------------------------
-- numKeys
--
-- This takes a table and returns an array containing the numbers of any numerical
-- keys that have non-nil values, sorted in numerical order.
------------------------------------------------------------------------------------
function p.numKeys(t)
checkType('numKeys', 1, t, 'table')
local isPositiveInteger = p.isPositiveInteger
local nums = {}
for k in pairs(t) do
if isPositiveInteger(k) then
nums[#nums + 1] = k
end
end
table.sort(nums)
return nums
end
------------------------------------------------------------------------------------
-- affixNums
--
-- This takes a table and returns an array containing the numbers of keys with the
-- specified prefix and suffix. For example, for the table
-- {a1 = 'foo', a3 = 'bar', a6 = 'baz'} and the prefix "a", affixNums will return
-- {1, 3, 6}.
------------------------------------------------------------------------------------
function p.affixNums(t, prefix, suffix)
checkType('affixNums', 1, t, 'table')
checkType('affixNums', 2, prefix, 'string', true)
checkType('affixNums', 3, suffix, 'string', true)
local function cleanPattern(s)
-- Cleans a pattern so that the magic characters ()%.[]*+-?^$ are interpreted literally.
return s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1')
end
prefix = prefix or ''
suffix = suffix or ''
prefix = cleanPattern(prefix)
suffix = cleanPattern(suffix)
local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$'
local nums = {}
for k in pairs(t) do
if type(k) == 'string' then
local num = mw.ustring.match(k, pattern)
if num then
nums[#nums + 1] = tonumber(num)
end
end
end
table.sort(nums)
return nums
end
------------------------------------------------------------------------------------
-- numData
--
-- Given a table with keys like {"foo1", "bar1", "foo2", "baz2"}, returns a table
-- of subtables in the format
-- {[1] = {foo = 'text', bar = 'text'}, [2] = {foo = 'text', baz = 'text'}}.
-- Keys that don't end with an integer are stored in a subtable named "other". The
-- compress option compresses the table so that it can be iterated over with
-- ipairs.
------------------------------------------------------------------------------------
function p.numData(t, compress)
checkType('numData', 1, t, 'table')
checkType('numData', 2, compress, 'boolean', true)
local ret = {}
for k, v in pairs(t) do
local prefix, num = mw.ustring.match(tostring(k), '^([^0-9]*)([1-9][0-9]*)$')
if num then
num = tonumber(num)
local subtable = ret[num] or {}
if prefix == '' then
-- Positional parameters match the blank string; put them at the start of the subtable instead.
prefix = 1
end
subtable[prefix] = v
ret[num] = subtable
else
local subtable = ret.other or {}
subtable[k] = v
ret.other = subtable
end
end
if compress then
local other = ret.other
ret = p.compressSparseArray(ret)
ret.other = other
end
return ret
end
------------------------------------------------------------------------------------
-- compressSparseArray
--
-- This takes an array with one or more nil values, and removes the nil values
-- while preserving the order, so that the array can be safely traversed with
-- ipairs.
------------------------------------------------------------------------------------
function p.compressSparseArray(t)
checkType('compressSparseArray', 1, t, 'table')
local ret = {}
local nums = p.numKeys(t)
for _, num in ipairs(nums) do
ret[#ret + 1] = t[num]
end
return ret
end
------------------------------------------------------------------------------------
-- sparseIpairs
--
-- This is an iterator for sparse arrays. It can be used like ipairs, but can
-- handle nil values.
------------------------------------------------------------------------------------
function p.sparseIpairs(t)
checkType('sparseIpairs', 1, t, 'table')
local nums = p.numKeys(t)
local i = 0
local lim = #nums
return function ()
i = i + 1
if i <= lim then
local key = nums[i]
return key, t[key]
else
return nil, nil
end
end
end
------------------------------------------------------------------------------------
-- size
--
-- This returns the size of a key/value pair table. It will also work on arrays,
-- but for arrays it is more efficient to use the # operator.
------------------------------------------------------------------------------------
function p.size(t)
checkType('size', 1, t, 'table')
local i = 0
for _ in pairs(t) do
i = i + 1
end
return i
end
local function defaultKeySort(item1, item2)
-- "number" < "string", so numbers will be sorted before strings.
local type1, type2 = type(item1), type(item2)
if type1 ~= type2 then
return type1 < type2
elseif type1 == 'table' or type1 == 'boolean' or type1 == 'function' then
return tostring(item1) < tostring(item2)
else
return item1 < item2
end
end
------------------------------------------------------------------------------------
-- keysToList
--
-- Returns an array of the keys in a table, sorted using either a default
-- comparison function or a custom keySort function.
------------------------------------------------------------------------------------
function p.keysToList(t, keySort, checked)
if not checked then
checkType('keysToList', 1, t, 'table')
checkTypeMulti('keysToList', 2, keySort, {'function', 'boolean', 'nil'})
end
local arr = {}
local index = 1
for k in pairs(t) do
arr[index] = k
index = index + 1
end
if keySort ~= false then
keySort = type(keySort) == 'function' and keySort or defaultKeySort
table.sort(arr, keySort)
end
return arr
end
------------------------------------------------------------------------------------
-- sortedPairs
--
-- Iterates through a table, with the keys sorted using the keysToList function.
-- If there are only numerical keys, sparseIpairs is probably more efficient.
------------------------------------------------------------------------------------
function p.sortedPairs(t, keySort)
checkType('sortedPairs', 1, t, 'table')
checkType('sortedPairs', 2, keySort, 'function', true)
local arr = p.keysToList(t, keySort, true)
local i = 0
return function ()
i = i + 1
local key = arr[i]
if key ~= nil then
return key, t[key]
else
return nil, nil
end
end
end
------------------------------------------------------------------------------------
-- isArray
--
-- Returns true if the given value is a table and all keys are consecutive
-- integers starting at 1.
------------------------------------------------------------------------------------
function p.isArray(v)
if type(v) ~= 'table' then
return false
end
local i = 0
for _ in pairs(v) do
i = i + 1
if v[i] == nil then
return false
end
end
return true
end
------------------------------------------------------------------------------------
-- isArrayLike
--
-- Returns true if the given value is iterable and all keys are consecutive
-- integers starting at 1.
------------------------------------------------------------------------------------
function p.isArrayLike(v)
if not pcall(pairs, v) then
return false
end
local i = 0
for _ in pairs(v) do
i = i + 1
if v[i] == nil then
return false
end
end
return true
end
------------------------------------------------------------------------------------
-- invert
--
-- Transposes the keys and values in an array. For example, {"a", "b", "c"} ->
-- {a = 1, b = 2, c = 3}. Duplicates are not supported (result values refer to
-- the index of the last duplicate) and NaN values are ignored.
------------------------------------------------------------------------------------
function p.invert(arr)
checkType("invert", 1, arr, "table")
local isNan = p.isNan
local map = {}
for i, v in ipairs(arr) do
if not isNan(v) then
map[v] = i
end
end
return map
end
------------------------------------------------------------------------------------
-- listToSet
--
-- Creates a set from the array part of the table. Indexing the set by any of the
-- values of the array returns true. For example, {"a", "b", "c"} ->
-- {a = true, b = true, c = true}. NaN values are ignored as Lua considers them
-- never equal to any value (including other NaNs or even themselves).
------------------------------------------------------------------------------------
function p.listToSet(arr)
checkType("listToSet", 1, arr, "table")
local isNan = p.isNan
local set = {}
for _, v in ipairs(arr) do
if not isNan(v) then
set[v] = true
end
end
return set
end
------------------------------------------------------------------------------------
-- deepCopy
--
-- Recursive deep copy function. Preserves identities of subtables.
------------------------------------------------------------------------------------
local function _deepCopy(orig, includeMetatable, already_seen)
-- Stores copies of tables indexed by the original table.
already_seen = already_seen or {}
local copy = already_seen[orig]
if copy ~= nil then
return copy
end
if type(orig) == 'table' then
copy = {}
for orig_key, orig_value in pairs(orig) do
copy[_deepCopy(orig_key, includeMetatable, already_seen)] = _deepCopy(orig_value, includeMetatable, already_seen)
end
already_seen[orig] = copy
if includeMetatable then
local mt = getmetatable(orig)
if mt ~= nil then
local mt_copy = _deepCopy(mt, includeMetatable, already_seen)
setmetatable(copy, mt_copy)
already_seen[mt] = mt_copy
end
end
else -- number, string, boolean, etc
copy = orig
end
return copy
end
function p.deepCopy(orig, noMetatable, already_seen)
checkType("deepCopy", 3, already_seen, "table", true)
return _deepCopy(orig, not noMetatable, already_seen)
end
------------------------------------------------------------------------------------
-- sparseConcat
--
-- Concatenates all values in the table that are indexed by a number, in order.
-- sparseConcat{a, nil, c, d} => "acd"
-- sparseConcat{nil, b, c, d} => "bcd"
------------------------------------------------------------------------------------
function p.sparseConcat(t, sep, i, j)
local arr = {}
local arr_i = 0
for _, v in p.sparseIpairs(t) do
arr_i = arr_i + 1
arr[arr_i] = v
end
return table.concat(arr, sep, i, j)
end
------------------------------------------------------------------------------------
-- length
--
-- Finds the length of an array, or of a quasi-array with keys such as "data1",
-- "data2", etc., using an exponential search algorithm. It is similar to the
-- operator #, but may return a different value when there are gaps in the array
-- portion of the table. Intended to be used on data loaded with mw.loadData. For
-- other tables, use #.
-- Note: #frame.args in frame object always be set to 0, regardless of the number
-- of unnamed template parameters, so use this function for frame.args.
------------------------------------------------------------------------------------
function p.length(t, prefix)
-- requiring module inline so that [[Module:Exponential search]] which is
-- only needed by this one function doesn't get millions of transclusions
local expSearch = require("Module:Exponential search")
checkType('length', 1, t, 'table')
checkType('length', 2, prefix, 'string', true)
return expSearch(function (i)
local key
if prefix then
key = prefix .. tostring(i)
else
key = i
end
return t[key] ~= nil
end) or 0
end
------------------------------------------------------------------------------------
-- inArray
--
-- Returns true if valueToFind is a member of the array, and false otherwise.
------------------------------------------------------------------------------------
function p.inArray(arr, valueToFind)
checkType("inArray", 1, arr, "table")
-- if valueToFind is nil, error?
for _, v in ipairs(arr) do
if v == valueToFind then
return true
end
end
return false
end
return p
085e7094ac84eb0132ee65822cf3f69cd8ba3d81
Template:Tlx
10
92
176
175
2023-12-24T02:07:27Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Tlx]]
wikitext
text/x-wiki
#REDIRECT [[Template:Template link expanded]]
{{Redirect category shell|
{{R from move}}
}}
1fec988ceb46cb324af228aac45d7cd25fcc9008
Template:Template link expanded
10
93
178
177
2023-12-24T02:07:28Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Template_link_expanded]]
wikitext
text/x-wiki
{{#Invoke:Template link general|main|code=on}}<noinclude>
{{Documentation|1=Template:Tlg/doc
|content = {{tlg/doc|tlx}}
}}
<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
6c99696fee02f1da368ed20d2504e19bc15b1c13
Module:Template link general
828
94
180
179
2023-12-24T02:07:28Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Template_link_general]]
Scribunto
text/plain
-- This implements Template:Tlg
local getArgs = require('Module:Arguments').getArgs
local p = {}
-- Is a string non-empty?
local function _ne(s)
return s ~= nil and s ~= ""
end
local nw = mw.text.nowiki
local function addTemplate(s)
local i, _ = s:find(':', 1, true)
if i == nil then
return 'Template:' .. s
end
local ns = s:sub(1, i - 1)
if ns == '' or mw.site.namespaces[ns] then
return s
else
return 'Template:' .. s
end
end
local function trimTemplate(s)
local needle = 'template:'
if s:sub(1, needle:len()):lower() == needle then
return s:sub(needle:len() + 1)
else
return s
end
end
local function linkTitle(args)
if _ne(args.nolink) then
return args['1']
end
local titleObj
local titlePart = '[['
if args['1'] then
-- This handles :Page and other NS
titleObj = mw.title.new(args['1'], 'Template')
else
titleObj = mw.title.getCurrentTitle()
end
titlePart = titlePart .. (titleObj ~= nil and titleObj.fullText or
addTemplate(args['1']))
local textPart = args.alttext
if not _ne(textPart) then
if titleObj ~= nil then
textPart = titleObj:inNamespace("Template") and args['1'] or titleObj.fullText
else
-- redlink
textPart = args['1']
end
end
if _ne(args.subst) then
-- HACK: the ns thing above is probably broken
textPart = 'subst:' .. textPart
end
if _ne(args.brace) then
textPart = nw('{{') .. textPart .. nw('}}')
elseif _ne(args.braceinside) then
textPart = nw('{') .. textPart .. nw('}')
end
titlePart = titlePart .. '|' .. textPart .. ']]'
if _ne(args.braceinside) then
titlePart = nw('{') .. titlePart .. nw('}')
end
return titlePart
end
function p.main(frame)
local args = getArgs(frame, {
trim = true,
removeBlanks = false
})
return p._main(args)
end
function p._main(args)
local bold = _ne(args.bold) or _ne(args.boldlink) or _ne(args.boldname)
local italic = _ne(args.italic) or _ne(args.italics)
local dontBrace = _ne(args.brace) or _ne(args.braceinside)
local code = _ne(args.code) or _ne(args.tt)
local show_result = _ne(args._show_result)
local expand = _ne(args._expand)
-- Build the link part
local titlePart = linkTitle(args)
if bold then titlePart = "'''" .. titlePart .. "'''" end
if _ne(args.nowrapname) then titlePart = '<span class="nowrap">' .. titlePart .. '</span>' end
-- Build the arguments
local textPart = ""
local textPartBuffer = "|"
local codeArguments = {}
local codeArgumentsString = ""
local i = 2
local j = 1
while args[i] do
local val = args[i]
if val ~= "" then
if _ne(args.nowiki) then
-- Unstrip nowiki tags first because calling nw on something that already contains nowiki tags will
-- mangle the nowiki strip marker and result in literal UNIQ...QINU showing up
val = nw(mw.text.unstripNoWiki(val))
end
local k, v = string.match(val, "(.*)=(.*)")
if not k then
codeArguments[j] = val
j = j + 1
else
codeArguments[k] = v
end
codeArgumentsString = codeArgumentsString .. textPartBuffer .. val
if italic then
val = '<span style="font-style:italic;">' .. val .. '</span>'
end
textPart = textPart .. textPartBuffer .. val
end
i = i + 1
end
-- final wrap
local ret = titlePart .. textPart
if not dontBrace then ret = nw('{{') .. ret .. nw('}}') end
if _ne(args.a) then ret = nw('*') .. ' ' .. ret end
if _ne(args.kbd) then ret = '<kbd>' .. ret .. '</kbd>' end
if code then
ret = '<code>' .. ret .. '</code>'
elseif _ne(args.plaincode) then
ret = '<code style="border:none;background:transparent;">' .. ret .. '</code>'
end
if _ne(args.nowrap) then ret = '<span class="nowrap">' .. ret .. '</span>' end
--[[ Wrap as html??
local span = mw.html.create('span')
span:wikitext(ret)
--]]
if _ne(args.debug) then ret = ret .. '\n<pre>' .. mw.text.encode(mw.dumpObject(args)) .. '</pre>' end
if show_result then
local result = mw.getCurrentFrame():expandTemplate{title = addTemplate(args[1]), args = codeArguments}
ret = ret .. " → " .. result
end
if expand then
local query = mw.text.encode('{{' .. addTemplate(args[1]) .. string.gsub(codeArgumentsString, textPartBuffer, "|") .. '}}')
local url = mw.uri.fullUrl('special:ExpandTemplates', 'wpInput=' .. query)
mw.log()
ret = ret .. " [" .. tostring(url) .. "]"
end
return ret
end
return p
c7307fa3959d308a2dd7fd2f5009c1ce6db3d122
Template:Template other
10
95
182
181
2023-12-24T02:07:29Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Template_other]]
wikitext
text/x-wiki
{{#switch:
<!--If no or empty "demospace" parameter then detect namespace-->
{{#if:{{{demospace|}}}
| {{lc: {{{demospace}}} }} <!--Use lower case "demospace"-->
| {{#ifeq:{{NAMESPACE}}|{{ns:Template}}
| template
| other
}}
}}
| template = {{{1|}}}
| other
| #default = {{{2|}}}
}}<!--End switch--><noinclude>
{{documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
06fb13d264df967b5232141067eb7d2b67372d76
Template:Clear
10
96
184
183
2023-12-24T02:07:29Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Clear]]
wikitext
text/x-wiki
<div style="clear:{{{1|both}}};"></div><noinclude>
{{documentation}}
</noinclude>
38bab3e3d7fbd3d6800d46556e60bc6bac494d72
Template:Distinguish
10
97
186
185
2023-12-24T02:07:29Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Distinguish]]
wikitext
text/x-wiki
{{#invoke:Distinguish|distinguish}}<noinclude><!-- splitting these lines causes {{Documentation}} template to terminate green shading when Distinguish is used in /doc pages. -->
{{Documentation}}
<!-- Add categories to the /doc subpage and interwikis to Wikidata, not here! -->
</noinclude>
f949a4cbfd6eb0ab77b832e69059a40a964b1fd8
Template:Sidebar
10
98
188
187
2023-12-24T02:07:30Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Sidebar]]
wikitext
text/x-wiki
{{#invoke:Sidebar|sidebar}}<noinclude>
{{documentation}}</noinclude>
ab2498000a99daf324f656b0badd187b4a3e2b42
Module:Distinguish
828
99
190
189
2023-12-24T02:07:30Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Distinguish]]
Scribunto
text/plain
local mHatnote = require('Module:Hatnote')
local mHatlist = require('Module:Hatnote list')
local mArguments --initialize lazily
local mTableTools --initialize lazily
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local p = {}
function p.distinguish(frame)
mArguments = require('Module:Arguments')
mTableTools = require('Module:TableTools')
local args = mArguments.getArgs(frame)
local selfref = args.selfref
local text = args.text
args = mTableTools.compressSparseArray(args)
return p._distinguish(args, text, selfref)
end
function p._distinguish(args, text, selfref)
checkType("_distinguish", 1, args, 'table')
if #args == 0 and not text then return '' end
local text = string.format(
'Not to be confused with %s.',
text or mHatlist.orList(args, true)
)
hnOptions = {selfref = selfref}
return mHatnote._hatnote(text, hnOptions)
end
return p
0364d14af01fc656ad1d898c5036fbd12a7ca938
Module:Effective protection expiry
828
100
192
191
2023-12-24T02:07:30Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Effective_protection_expiry]]
Scribunto
text/plain
local p = {}
-- Returns the expiry of a restriction of an action on a given title, or unknown if it cannot be known.
-- If no title is specified, the title of the page being displayed is used.
function p._main(action, pagename)
local title
if type(pagename) == 'table' and pagename.prefixedText then
title = pagename
elseif pagename then
title = mw.title.new(pagename)
else
title = mw.title.getCurrentTitle()
end
pagename = title.prefixedText
if action == 'autoreview' then
local stabilitySettings = mw.ext.FlaggedRevs.getStabilitySettings(title)
return stabilitySettings and stabilitySettings.expiry or 'unknown'
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then
error( 'First parameter must be one of edit, move, create, upload, autoreview', 2 )
end
local rawExpiry = mw.getCurrentFrame():callParserFunction('PROTECTIONEXPIRY', action, pagename)
if rawExpiry == 'infinity' then
return 'infinity'
elseif rawExpiry == '' then
return 'unknown'
else
local year, month, day, hour, minute, second = rawExpiry:match(
'^(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)$'
)
if year then
return string.format(
'%s-%s-%sT%s:%s:%s',
year, month, day, hour, minute, second
)
else
error('internal error in Module:Effective protection expiry; malformed expiry timestamp')
end
end
end
setmetatable(p, { __index = function(t, k)
return function(frame)
return t._main(k, frame.args[1])
end
end })
return p
9a8c58dc2667232ed08a9b206a5d89ca8150312b
Module:Effective protection level
828
101
194
193
2023-12-24T02:07:31Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Effective_protection_level]]
Scribunto
text/plain
local p = {}
-- Returns the permission required to perform a given action on a given title.
-- If no title is specified, the title of the page being displayed is used.
function p._main(action, pagename)
local title
if type(pagename) == 'table' and pagename.prefixedText then
title = pagename
elseif pagename then
title = mw.title.new(pagename)
else
title = mw.title.getCurrentTitle()
end
pagename = title.prefixedText
if action == 'autoreview' then
local level = mw.ext.FlaggedRevs.getStabilitySettings(title)
level = level and level.autoreview
if level == 'review' then
return 'reviewer'
elseif level ~= '' then
return level
else
return nil -- not '*'. a page not being PC-protected is distinct from it being PC-protected with anyone able to review. also not '', as that would mean PC-protected but nobody can review
end
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' and action ~= 'undelete' then
error( 'First parameter must be one of edit, move, create, upload, undelete, autoreview', 2 )
end
if title.namespace == 8 then -- MediaWiki namespace
if title.text:sub(-3) == '.js' or title.text:sub(-4) == '.css' or title.contentModel == 'javascript' or title.contentModel == 'css' then -- site JS or CSS page
return 'interfaceadmin'
else -- any non-JS/CSS MediaWiki page
return 'sysop'
end
elseif title.namespace == 2 and title.isSubpage then
if title.contentModel == 'javascript' or title.contentModel == 'css' then -- user JS or CSS page
return 'interfaceadmin'
elseif title.contentModel == 'json' then -- user JSON page
return 'sysop'
end
end
if action == 'undelete' then
return 'sysop'
end
local level = title.protectionLevels[action] and title.protectionLevels[action][1]
if level == 'sysop' or level == 'editprotected' then
return 'sysop'
elseif title.cascadingProtection.restrictions[action] and title.cascadingProtection.restrictions[action][1] then -- used by a cascading-protected page
return 'sysop'
elseif level == 'templateeditor' then
return 'templateeditor'
elseif action == 'move' then
local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move.
if blacklistentry and not blacklistentry.params.autoconfirmed then
return 'templateeditor'
elseif title.namespace == 6 then
return 'filemover'
elseif level == 'extendedconfirmed' then
return 'extendedconfirmed'
else
return 'autoconfirmed'
end
end
local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename)
if blacklistentry then
if not blacklistentry.params.autoconfirmed then
return 'templateeditor'
elseif level == 'extendedconfirmed' then
return 'extendedconfirmed'
else
return 'autoconfirmed'
end
elseif level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason
return 'autoconfirmed'
elseif level then
return level
elseif action == 'upload' then
return 'autoconfirmed'
elseif action == 'create' and title.namespace % 2 == 0 and title.namespace ~= 118 then -- You need to be registered, but not autoconfirmed, to create non-talk pages other than drafts
return 'user'
else
return '*'
end
end
setmetatable(p, { __index = function(t, k)
return function(frame)
return t._main(k, frame.args[1])
end
end })
return p
70256a489edf6be9808031b14a7e3ef3e025da97
Module:File link
828
102
196
195
2023-12-24T02:07:31Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:File_link]]
Scribunto
text/plain
-- This module provides a library for formatting file wikilinks.
local yesno = require('Module:Yesno')
local checkType = require('libraryUtil').checkType
local p = {}
function p._main(args)
checkType('_main', 1, args, 'table')
-- This is basically libraryUtil.checkTypeForNamedArg, but we are rolling our
-- own function to get the right error level.
local function checkArg(key, val, level)
if type(val) ~= 'string' then
error(string.format(
"type error in '%s' parameter of '_main' (expected string, got %s)",
key, type(val)
), level)
end
end
local ret = {}
-- Adds a positional parameter to the buffer.
local function addPositional(key)
local val = args[key]
if not val then
return nil
end
checkArg(key, val, 4)
ret[#ret + 1] = val
end
-- Adds a named parameter to the buffer. We assume that the parameter name
-- is the same as the argument key.
local function addNamed(key)
local val = args[key]
if not val then
return nil
end
checkArg(key, val, 4)
ret[#ret + 1] = key .. '=' .. val
end
-- Filename
checkArg('file', args.file, 3)
ret[#ret + 1] = 'File:' .. args.file
-- Format
if args.format then
checkArg('format', args.format)
if args.formatfile then
checkArg('formatfile', args.formatfile)
ret[#ret + 1] = args.format .. '=' .. args.formatfile
else
ret[#ret + 1] = args.format
end
end
-- Border
if yesno(args.border) then
ret[#ret + 1] = 'border'
end
addPositional('location')
addPositional('alignment')
addPositional('size')
addNamed('upright')
addNamed('link')
addNamed('alt')
addNamed('page')
addNamed('class')
addNamed('lang')
addNamed('start')
addNamed('end')
addNamed('thumbtime')
addPositional('caption')
return string.format('[[%s]]', table.concat(ret, '|'))
end
function p.main(frame)
local origArgs = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:File link'
})
if not origArgs.file then
error("'file' parameter missing from [[Template:File link]]", 0)
end
-- Copy the arguments that were passed to a new table to avoid looking up
-- every possible parameter in the frame object.
local args = {}
for k, v in pairs(origArgs) do
-- Make _BLANK a special argument to add a blank parameter. For use in
-- conditional templates etc. it is useful for blank arguments to be
-- ignored, but we still need a way to specify them so that we can do
-- things like [[File:Example.png|link=]].
if v == '_BLANK' then
v = ''
end
args[k] = v
end
return p._main(args)
end
return p
66925f088d11530f2482f04181a3baaaa0ad3d0c
Module:Navbar
828
103
198
197
2023-12-24T02:07:37Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Navbar]]
Scribunto
text/plain
local p = {}
local cfg = mw.loadData('Module:Navbar/configuration')
local function get_title_arg(is_collapsible, template)
local title_arg = 1
if is_collapsible then title_arg = 2 end
if template then title_arg = 'template' end
return title_arg
end
local function choose_links(template, args)
-- The show table indicates the default displayed items.
-- view, talk, edit, hist, move, watch
-- TODO: Move to configuration.
local show = {true, true, true, false, false, false}
if template then
show[2] = false
show[3] = false
local index = {t = 2, d = 2, e = 3, h = 4, m = 5, w = 6,
talk = 2, edit = 3, hist = 4, move = 5, watch = 6}
-- TODO: Consider removing TableTools dependency.
for _, v in ipairs(require ('Module:TableTools').compressSparseArray(args)) do
local num = index[v]
if num then show[num] = true end
end
end
local remove_edit_link = args.noedit
if remove_edit_link then show[3] = false end
return show
end
local function add_link(link_description, ul, is_mini, font_style)
local l
if link_description.url then
l = {'[', '', ']'}
else
l = {'[[', '|', ']]'}
end
ul:tag('li')
:addClass('nv-' .. link_description.full)
:wikitext(l[1] .. link_description.link .. l[2])
:tag(is_mini and 'abbr' or 'span')
:attr('title', link_description.html_title)
:cssText(font_style)
:wikitext(is_mini and link_description.mini or link_description.full)
:done()
:wikitext(l[3])
:done()
end
local function make_list(title_text, has_brackets, displayed_links, is_mini, font_style)
local title = mw.title.new(mw.text.trim(title_text), cfg.title_namespace)
if not title then
error(cfg.invalid_title .. title_text)
end
local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or ''
-- TODO: Get link_descriptions and show into the configuration module.
-- link_descriptions should be easier...
local link_descriptions = {
{ ['mini'] = 'v', ['full'] = 'view', ['html_title'] = 'View this template',
['link'] = title.fullText, ['url'] = false },
{ ['mini'] = 't', ['full'] = 'talk', ['html_title'] = 'Discuss this template',
['link'] = talkpage, ['url'] = false },
{ ['mini'] = 'e', ['full'] = 'edit', ['html_title'] = 'Edit this template',
['link'] = 'Special:EditPage/' .. title.fullText, ['url'] = false },
{ ['mini'] = 'h', ['full'] = 'hist', ['html_title'] = 'History of this template',
['link'] = 'Special:PageHistory/' .. title.fullText, ['url'] = false },
{ ['mini'] = 'm', ['full'] = 'move', ['html_title'] = 'Move this template',
['link'] = mw.title.new('Special:Movepage'):fullUrl('target='..title.fullText), ['url'] = true },
{ ['mini'] = 'w', ['full'] = 'watch', ['html_title'] = 'Watch this template',
['link'] = title:fullUrl('action=watch'), ['url'] = true }
}
local ul = mw.html.create('ul')
if has_brackets then
ul:addClass(cfg.classes.brackets)
:cssText(font_style)
end
for i, _ in ipairs(displayed_links) do
if displayed_links[i] then add_link(link_descriptions[i], ul, is_mini, font_style) end
end
return ul:done()
end
function p._navbar(args)
-- TODO: We probably don't need both fontstyle and fontcolor...
local font_style = args.fontstyle
local font_color = args.fontcolor
local is_collapsible = args.collapsible
local is_mini = args.mini
local is_plain = args.plain
local collapsible_class = nil
if is_collapsible then
collapsible_class = cfg.classes.collapsible
if not is_plain then is_mini = 1 end
if font_color then
font_style = (font_style or '') .. '; color: ' .. font_color .. ';'
end
end
local navbar_style = args.style
local div = mw.html.create():tag('div')
div
:addClass(cfg.classes.navbar)
:addClass(cfg.classes.plainlinks)
:addClass(cfg.classes.horizontal_list)
:addClass(collapsible_class) -- we made the determination earlier
:cssText(navbar_style)
if is_mini then div:addClass(cfg.classes.mini) end
local box_text = (args.text or cfg.box_text) .. ' '
-- the concatenated space guarantees the box text is separated
if not (is_mini or is_plain) then
div
:tag('span')
:addClass(cfg.classes.box_text)
:cssText(font_style)
:wikitext(box_text)
end
local template = args.template
local displayed_links = choose_links(template, args)
local has_brackets = args.brackets
local title_arg = get_title_arg(is_collapsible, template)
local title_text = args[title_arg] or (':' .. mw.getCurrentFrame():getParent():getTitle())
local list = make_list(title_text, has_brackets, displayed_links, is_mini, font_style)
div:node(list)
if is_collapsible then
local title_text_class
if is_mini then
title_text_class = cfg.classes.collapsible_title_mini
else
title_text_class = cfg.classes.collapsible_title_full
end
div:done()
:tag('div')
:addClass(title_text_class)
:cssText(font_style)
:wikitext(args[1])
end
local frame = mw.getCurrentFrame()
-- hlist -> navbar is best-effort to preserve old Common.css ordering.
return frame:extensionTag{
name = 'templatestyles', args = { src = cfg.hlist_templatestyles }
} .. frame:extensionTag{
name = 'templatestyles', args = { src = cfg.templatestyles }
} .. tostring(div:done())
end
function p.navbar(frame)
return p._navbar(require('Module:Arguments').getArgs(frame))
end
return p
047f307758c878eb3e99ed1768cc40920a6ec5fa
Module:Navbar/configuration
828
104
200
199
2023-12-24T02:07:37Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Navbar/configuration]]
Scribunto
text/plain
return {
['templatestyles'] = 'Module:Navbar/styles.css',
['hlist_templatestyles'] = 'Hlist/styles.css',
['box_text'] = 'This box: ', -- default text box when not plain or mini
['title_namespace'] = 'Template', -- namespace to default to for title
['invalid_title'] = 'Invalid title ',
['classes'] = { -- set a line to nil if you don't want it
['navbar'] = 'navbar',
['plainlinks'] = 'plainlinks', -- plainlinks
['horizontal_list'] = 'hlist', -- horizontal list class
['mini'] = 'navbar-mini', -- class indicating small links in the navbar
['this_box'] = 'navbar-boxtext',
['brackets'] = 'navbar-brackets',
-- 'collapsible' is the key for a class to indicate the navbar is
-- setting up the collapsible element in addition to the normal
-- navbar.
['collapsible'] = 'navbar-collapse',
['collapsible_title_mini'] = 'navbar-ct-mini',
['collapsible_title_full'] = 'navbar-ct-full'
}
}
b007c336b17ec4bcd4d5a9dca9f8cba301662b55
Module:Navbar/styles.css
828
105
202
201
2023-12-24T02:07:38Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Navbar/styles.css]]
sanitized-css
text/css
/* {{pp|small=yes}} */
.navbar {
display: inline;
font-size: 88%;
font-weight: normal;
}
.navbar-collapse {
float: left;
text-align: left;
}
.navbar-boxtext {
word-spacing: 0;
}
.navbar ul {
display: inline-block;
white-space: nowrap;
line-height: inherit;
}
.navbar-brackets::before {
margin-right: -0.125em;
content: '[ ';
}
.navbar-brackets::after {
margin-left: -0.125em;
content: ' ]';
}
.navbar li {
word-spacing: -0.125em;
}
.navbar a > span,
.navbar a > abbr {
text-decoration: inherit;
}
.navbar-mini abbr {
font-variant: small-caps;
border-bottom: none;
text-decoration: none;
cursor: inherit;
}
.navbar-ct-full {
font-size: 114%;
margin: 0 7em;
}
.navbar-ct-mini {
font-size: 114%;
margin: 0 4em;
}
9d4056f949b4f0b159e3d40dfb1a5f01e72f9571
Module:Protection banner
828
106
204
203
2023-12-24T02:07:38Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Protection_banner]]
Scribunto
text/plain
-- This module implements {{pp-meta}} and its daughter templates such as
-- {{pp-dispute}}, {{pp-vandalism}} and {{pp-sock}}.
-- Initialise necessary modules.
require('strict')
local makeFileLink = require('Module:File link')._main
local effectiveProtectionLevel = require('Module:Effective protection level')._main
local effectiveProtectionExpiry = require('Module:Effective protection expiry')._main
local yesno = require('Module:Yesno')
-- Lazily initialise modules and objects we don't always need.
local getArgs, makeMessageBox, lang
-- Set constants.
local CONFIG_MODULE = 'Module:Protection banner/config'
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function makeCategoryLink(cat, sort)
if cat then
return string.format(
'[[%s:%s|%s]]',
mw.site.namespaces[14].name,
cat,
sort
)
end
end
-- Validation function for the expiry and the protection date
local function validateDate(dateString, dateType)
if not lang then
lang = mw.language.getContentLanguage()
end
local success, result = pcall(lang.formatDate, lang, 'U', dateString)
if success then
result = tonumber(result)
if result then
return result
end
end
error(string.format(
'invalid %s: %s',
dateType,
tostring(dateString)
), 4)
end
local function makeFullUrl(page, query, display)
return string.format(
'[%s %s]',
tostring(mw.uri.fullUrl(page, query)),
display
)
end
-- Given a directed graph formatted as node -> table of direct successors,
-- get a table of all nodes reachable from a given node (though always
-- including the given node).
local function getReachableNodes(graph, start)
local toWalk, retval = {[start] = true}, {}
while true do
-- Can't use pairs() since we're adding and removing things as we're iterating
local k = next(toWalk) -- This always gets the "first" key
if k == nil then
return retval
end
toWalk[k] = nil
retval[k] = true
for _,v in ipairs(graph[k]) do
if not retval[v] then
toWalk[v] = true
end
end
end
end
--------------------------------------------------------------------------------
-- Protection class
--------------------------------------------------------------------------------
local Protection = {}
Protection.__index = Protection
Protection.supportedActions = {
edit = true,
move = true,
autoreview = true,
upload = true
}
Protection.bannerConfigFields = {
'text',
'explanation',
'tooltip',
'alt',
'link',
'image'
}
function Protection.new(args, cfg, title)
local obj = {}
obj._cfg = cfg
obj.title = title or mw.title.getCurrentTitle()
-- Set action
if not args.action then
obj.action = 'edit'
elseif Protection.supportedActions[args.action] then
obj.action = args.action
else
error(string.format(
'invalid action: %s',
tostring(args.action)
), 3)
end
-- Set level
obj.level = args.demolevel or effectiveProtectionLevel(obj.action, obj.title)
if not obj.level or (obj.action == 'move' and obj.level == 'autoconfirmed') then
-- Users need to be autoconfirmed to move pages anyway, so treat
-- semi-move-protected pages as unprotected.
obj.level = '*'
end
-- Set expiry
local effectiveExpiry = effectiveProtectionExpiry(obj.action, obj.title)
if effectiveExpiry == 'infinity' then
obj.expiry = 'indef'
elseif effectiveExpiry ~= 'unknown' then
obj.expiry = validateDate(effectiveExpiry, 'expiry date')
end
-- Set reason
if args[1] then
obj.reason = mw.ustring.lower(args[1])
if obj.reason:find('|') then
error('reasons cannot contain the pipe character ("|")', 3)
end
end
-- Set protection date
if args.date then
obj.protectionDate = validateDate(args.date, 'protection date')
end
-- Set banner config
do
obj.bannerConfig = {}
local configTables = {}
if cfg.banners[obj.action] then
configTables[#configTables + 1] = cfg.banners[obj.action][obj.reason]
end
if cfg.defaultBanners[obj.action] then
configTables[#configTables + 1] = cfg.defaultBanners[obj.action][obj.level]
configTables[#configTables + 1] = cfg.defaultBanners[obj.action].default
end
configTables[#configTables + 1] = cfg.masterBanner
for i, field in ipairs(Protection.bannerConfigFields) do
for j, t in ipairs(configTables) do
if t[field] then
obj.bannerConfig[field] = t[field]
break
end
end
end
end
return setmetatable(obj, Protection)
end
function Protection:isUserScript()
-- Whether the page is a user JavaScript or CSS page.
local title = self.title
return title.namespace == 2 and (
title.contentModel == 'javascript' or title.contentModel == 'css'
)
end
function Protection:isProtected()
return self.level ~= '*'
end
function Protection:shouldShowLock()
-- Whether we should output a banner/padlock
return self:isProtected() and not self:isUserScript()
end
-- Whether this page needs a protection category.
Protection.shouldHaveProtectionCategory = Protection.shouldShowLock
function Protection:isTemporary()
return type(self.expiry) == 'number'
end
function Protection:makeProtectionCategory()
if not self:shouldHaveProtectionCategory() then
return ''
end
local cfg = self._cfg
local title = self.title
-- Get the expiry key fragment.
local expiryFragment
if self.expiry == 'indef' then
expiryFragment = self.expiry
elseif type(self.expiry) == 'number' then
expiryFragment = 'temp'
end
-- Get the namespace key fragment.
local namespaceFragment = cfg.categoryNamespaceKeys[title.namespace]
if not namespaceFragment and title.namespace % 2 == 1 then
namespaceFragment = 'talk'
end
-- Define the order that key fragments are tested in. This is done with an
-- array of tables containing the value to be tested, along with its
-- position in the cfg.protectionCategories table.
local order = {
{val = expiryFragment, keypos = 1},
{val = namespaceFragment, keypos = 2},
{val = self.reason, keypos = 3},
{val = self.level, keypos = 4},
{val = self.action, keypos = 5}
}
--[[
-- The old protection templates used an ad-hoc protection category system,
-- with some templates prioritising namespaces in their categories, and
-- others prioritising the protection reason. To emulate this in this module
-- we use the config table cfg.reasonsWithNamespacePriority to set the
-- reasons for which namespaces have priority over protection reason.
-- If we are dealing with one of those reasons, move the namespace table to
-- the end of the order table, i.e. give it highest priority. If not, the
-- reason should have highest priority, so move that to the end of the table
-- instead.
--]]
table.insert(order, table.remove(order, self.reason and cfg.reasonsWithNamespacePriority[self.reason] and 2 or 3))
--[[
-- Define the attempt order. Inactive subtables (subtables with nil "value"
-- fields) are moved to the end, where they will later be given the key
-- "all". This is to cut down on the number of table lookups in
-- cfg.protectionCategories, which grows exponentially with the number of
-- non-nil keys. We keep track of the number of active subtables with the
-- noActive parameter.
--]]
local noActive, attemptOrder
do
local active, inactive = {}, {}
for i, t in ipairs(order) do
if t.val then
active[#active + 1] = t
else
inactive[#inactive + 1] = t
end
end
noActive = #active
attemptOrder = active
for i, t in ipairs(inactive) do
attemptOrder[#attemptOrder + 1] = t
end
end
--[[
-- Check increasingly generic key combinations until we find a match. If a
-- specific category exists for the combination of key fragments we are
-- given, that match will be found first. If not, we keep trying different
-- key fragment combinations until we match using the key
-- "all-all-all-all-all".
--
-- To generate the keys, we index the key subtables using a binary matrix
-- with indexes i and j. j is only calculated up to the number of active
-- subtables. For example, if there were three active subtables, the matrix
-- would look like this, with 0 corresponding to the key fragment "all", and
-- 1 corresponding to other key fragments.
--
-- j 1 2 3
-- i
-- 1 1 1 1
-- 2 0 1 1
-- 3 1 0 1
-- 4 0 0 1
-- 5 1 1 0
-- 6 0 1 0
-- 7 1 0 0
-- 8 0 0 0
--
-- Values of j higher than the number of active subtables are set
-- to the string "all".
--
-- A key for cfg.protectionCategories is constructed for each value of i.
-- The position of the value in the key is determined by the keypos field in
-- each subtable.
--]]
local cats = cfg.protectionCategories
for i = 1, 2^noActive do
local key = {}
for j, t in ipairs(attemptOrder) do
if j > noActive then
key[t.keypos] = 'all'
else
local quotient = i / 2 ^ (j - 1)
quotient = math.ceil(quotient)
if quotient % 2 == 1 then
key[t.keypos] = t.val
else
key[t.keypos] = 'all'
end
end
end
key = table.concat(key, '|')
local attempt = cats[key]
if attempt then
return makeCategoryLink(attempt, title.text)
end
end
return ''
end
function Protection:isIncorrect()
local expiry = self.expiry
return not self:shouldHaveProtectionCategory()
or type(expiry) == 'number' and expiry < os.time()
end
function Protection:isTemplateProtectedNonTemplate()
local action, namespace = self.action, self.title.namespace
return self.level == 'templateeditor'
and (
(action ~= 'edit' and action ~= 'move')
or (namespace ~= 10 and namespace ~= 828)
)
end
function Protection:makeCategoryLinks()
local msg = self._cfg.msg
local ret = {self:makeProtectionCategory()}
if self:isIncorrect() then
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-incorrect'],
self.title.text
)
end
if self:isTemplateProtectedNonTemplate() then
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-template'],
self.title.text
)
end
return table.concat(ret)
end
--------------------------------------------------------------------------------
-- Blurb class
--------------------------------------------------------------------------------
local Blurb = {}
Blurb.__index = Blurb
Blurb.bannerTextFields = {
text = true,
explanation = true,
tooltip = true,
alt = true,
link = true
}
function Blurb.new(protectionObj, args, cfg)
return setmetatable({
_cfg = cfg,
_protectionObj = protectionObj,
_args = args
}, Blurb)
end
-- Private methods --
function Blurb:_formatDate(num)
-- Formats a Unix timestamp into dd Month, YYYY format.
lang = lang or mw.language.getContentLanguage()
local success, date = pcall(
lang.formatDate,
lang,
self._cfg.msg['expiry-date-format'] or 'j F Y',
'@' .. tostring(num)
)
if success then
return date
end
end
function Blurb:_getExpandedMessage(msgKey)
return self:_substituteParameters(self._cfg.msg[msgKey])
end
function Blurb:_substituteParameters(msg)
if not self._params then
local parameterFuncs = {}
parameterFuncs.CURRENTVERSION = self._makeCurrentVersionParameter
parameterFuncs.EDITREQUEST = self._makeEditRequestParameter
parameterFuncs.EXPIRY = self._makeExpiryParameter
parameterFuncs.EXPLANATIONBLURB = self._makeExplanationBlurbParameter
parameterFuncs.IMAGELINK = self._makeImageLinkParameter
parameterFuncs.INTROBLURB = self._makeIntroBlurbParameter
parameterFuncs.INTROFRAGMENT = self._makeIntroFragmentParameter
parameterFuncs.PAGETYPE = self._makePagetypeParameter
parameterFuncs.PROTECTIONBLURB = self._makeProtectionBlurbParameter
parameterFuncs.PROTECTIONDATE = self._makeProtectionDateParameter
parameterFuncs.PROTECTIONLEVEL = self._makeProtectionLevelParameter
parameterFuncs.PROTECTIONLOG = self._makeProtectionLogParameter
parameterFuncs.TALKPAGE = self._makeTalkPageParameter
parameterFuncs.TOOLTIPBLURB = self._makeTooltipBlurbParameter
parameterFuncs.TOOLTIPFRAGMENT = self._makeTooltipFragmentParameter
parameterFuncs.VANDAL = self._makeVandalTemplateParameter
self._params = setmetatable({}, {
__index = function (t, k)
local param
if parameterFuncs[k] then
param = parameterFuncs[k](self)
end
param = param or ''
t[k] = param
return param
end
})
end
msg = msg:gsub('${(%u+)}', self._params)
return msg
end
function Blurb:_makeCurrentVersionParameter()
-- A link to the page history or the move log, depending on the kind of
-- protection.
local pagename = self._protectionObj.title.prefixedText
if self._protectionObj.action == 'move' then
-- We need the move log link.
return makeFullUrl(
'Special:Log',
{type = 'move', page = pagename},
self:_getExpandedMessage('current-version-move-display')
)
else
-- We need the history link.
return makeFullUrl(
pagename,
{action = 'history'},
self:_getExpandedMessage('current-version-edit-display')
)
end
end
function Blurb:_makeEditRequestParameter()
local mEditRequest = require('Module:Submit an edit request')
local action = self._protectionObj.action
local level = self._protectionObj.level
-- Get the edit request type.
local requestType
if action == 'edit' then
if level == 'autoconfirmed' then
requestType = 'semi'
elseif level == 'extendedconfirmed' then
requestType = 'extended'
elseif level == 'templateeditor' then
requestType = 'template'
end
end
requestType = requestType or 'full'
-- Get the display value.
local display = self:_getExpandedMessage('edit-request-display')
return mEditRequest._link{type = requestType, display = display}
end
function Blurb:_makeExpiryParameter()
local expiry = self._protectionObj.expiry
if type(expiry) == 'number' then
return self:_formatDate(expiry)
else
return expiry
end
end
function Blurb:_makeExplanationBlurbParameter()
-- Cover special cases first.
if self._protectionObj.title.namespace == 8 then
-- MediaWiki namespace
return self:_getExpandedMessage('explanation-blurb-nounprotect')
end
-- Get explanation blurb table keys
local action = self._protectionObj.action
local level = self._protectionObj.level
local talkKey = self._protectionObj.title.isTalkPage and 'talk' or 'subject'
-- Find the message in the explanation blurb table and substitute any
-- parameters.
local explanations = self._cfg.explanationBlurbs
local msg
if explanations[action][level] and explanations[action][level][talkKey] then
msg = explanations[action][level][talkKey]
elseif explanations[action][level] and explanations[action][level].default then
msg = explanations[action][level].default
elseif explanations[action].default and explanations[action].default[talkKey] then
msg = explanations[action].default[talkKey]
elseif explanations[action].default and explanations[action].default.default then
msg = explanations[action].default.default
else
error(string.format(
'could not find explanation blurb for action "%s", level "%s" and talk key "%s"',
action,
level,
talkKey
), 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeImageLinkParameter()
local imageLinks = self._cfg.imageLinks
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if imageLinks[action][level] then
msg = imageLinks[action][level]
elseif imageLinks[action].default then
msg = imageLinks[action].default
else
msg = imageLinks.edit.default
end
return self:_substituteParameters(msg)
end
function Blurb:_makeIntroBlurbParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('intro-blurb-expiry')
else
return self:_getExpandedMessage('intro-blurb-noexpiry')
end
end
function Blurb:_makeIntroFragmentParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('intro-fragment-expiry')
else
return self:_getExpandedMessage('intro-fragment-noexpiry')
end
end
function Blurb:_makePagetypeParameter()
local pagetypes = self._cfg.pagetypes
return pagetypes[self._protectionObj.title.namespace]
or pagetypes.default
or error('no default pagetype defined', 8)
end
function Blurb:_makeProtectionBlurbParameter()
local protectionBlurbs = self._cfg.protectionBlurbs
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if protectionBlurbs[action][level] then
msg = protectionBlurbs[action][level]
elseif protectionBlurbs[action].default then
msg = protectionBlurbs[action].default
elseif protectionBlurbs.edit.default then
msg = protectionBlurbs.edit.default
else
error('no protection blurb defined for protectionBlurbs.edit.default', 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeProtectionDateParameter()
local protectionDate = self._protectionObj.protectionDate
if type(protectionDate) == 'number' then
return self:_formatDate(protectionDate)
else
return protectionDate
end
end
function Blurb:_makeProtectionLevelParameter()
local protectionLevels = self._cfg.protectionLevels
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if protectionLevels[action][level] then
msg = protectionLevels[action][level]
elseif protectionLevels[action].default then
msg = protectionLevels[action].default
elseif protectionLevels.edit.default then
msg = protectionLevels.edit.default
else
error('no protection level defined for protectionLevels.edit.default', 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeProtectionLogParameter()
local pagename = self._protectionObj.title.prefixedText
if self._protectionObj.action == 'autoreview' then
-- We need the pending changes log.
return makeFullUrl(
'Special:Log',
{type = 'stable', page = pagename},
self:_getExpandedMessage('pc-log-display')
)
else
-- We need the protection log.
return makeFullUrl(
'Special:Log',
{type = 'protect', page = pagename},
self:_getExpandedMessage('protection-log-display')
)
end
end
function Blurb:_makeTalkPageParameter()
return string.format(
'[[%s:%s#%s|%s]]',
mw.site.namespaces[self._protectionObj.title.namespace].talk.name,
self._protectionObj.title.text,
self._args.section or 'top',
self:_getExpandedMessage('talk-page-link-display')
)
end
function Blurb:_makeTooltipBlurbParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('tooltip-blurb-expiry')
else
return self:_getExpandedMessage('tooltip-blurb-noexpiry')
end
end
function Blurb:_makeTooltipFragmentParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('tooltip-fragment-expiry')
else
return self:_getExpandedMessage('tooltip-fragment-noexpiry')
end
end
function Blurb:_makeVandalTemplateParameter()
return mw.getCurrentFrame():expandTemplate{
title="vandal-m",
args={self._args.user or self._protectionObj.title.baseText}
}
end
-- Public methods --
function Blurb:makeBannerText(key)
-- Validate input.
if not key or not Blurb.bannerTextFields[key] then
error(string.format(
'"%s" is not a valid banner config field',
tostring(key)
), 2)
end
-- Generate the text.
local msg = self._protectionObj.bannerConfig[key]
if type(msg) == 'string' then
return self:_substituteParameters(msg)
elseif type(msg) == 'function' then
msg = msg(self._protectionObj, self._args)
if type(msg) ~= 'string' then
error(string.format(
'bad output from banner config function with key "%s"'
.. ' (expected string, got %s)',
tostring(key),
type(msg)
), 4)
end
return self:_substituteParameters(msg)
end
end
--------------------------------------------------------------------------------
-- BannerTemplate class
--------------------------------------------------------------------------------
local BannerTemplate = {}
BannerTemplate.__index = BannerTemplate
function BannerTemplate.new(protectionObj, cfg)
local obj = {}
obj._cfg = cfg
-- Set the image filename.
local imageFilename = protectionObj.bannerConfig.image
if imageFilename then
obj._imageFilename = imageFilename
else
-- If an image filename isn't specified explicitly in the banner config,
-- generate it from the protection status and the namespace.
local action = protectionObj.action
local level = protectionObj.level
local namespace = protectionObj.title.namespace
local reason = protectionObj.reason
-- Deal with special cases first.
if (
namespace == 10
or namespace == 828
or reason and obj._cfg.indefImageReasons[reason]
)
and action == 'edit'
and level == 'sysop'
and not protectionObj:isTemporary()
then
-- Fully protected modules and templates get the special red "indef"
-- padlock.
obj._imageFilename = obj._cfg.msg['image-filename-indef']
else
-- Deal with regular protection types.
local images = obj._cfg.images
if images[action] then
if images[action][level] then
obj._imageFilename = images[action][level]
elseif images[action].default then
obj._imageFilename = images[action].default
end
end
end
end
return setmetatable(obj, BannerTemplate)
end
function BannerTemplate:renderImage()
local filename = self._imageFilename
or self._cfg.msg['image-filename-default']
or 'Transparent.gif'
return makeFileLink{
file = filename,
size = (self.imageWidth or 20) .. 'px',
alt = self._imageAlt,
link = self._imageLink,
caption = self.imageCaption
}
end
--------------------------------------------------------------------------------
-- Banner class
--------------------------------------------------------------------------------
local Banner = setmetatable({}, BannerTemplate)
Banner.__index = Banner
function Banner.new(protectionObj, blurbObj, cfg)
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb.
obj.imageWidth = 40
obj.imageCaption = blurbObj:makeBannerText('alt') -- Large banners use the alt text for the tooltip.
obj._reasonText = blurbObj:makeBannerText('text')
obj._explanationText = blurbObj:makeBannerText('explanation')
obj._page = protectionObj.title.prefixedText -- Only makes a difference in testing.
return setmetatable(obj, Banner)
end
function Banner:__tostring()
-- Renders the banner.
makeMessageBox = makeMessageBox or require('Module:Message box').main
local reasonText = self._reasonText or error('no reason text set', 2)
local explanationText = self._explanationText
local mbargs = {
page = self._page,
type = 'protection',
image = self:renderImage(),
text = string.format(
"'''%s'''%s",
reasonText,
explanationText and '<br />' .. explanationText or ''
)
}
return makeMessageBox('mbox', mbargs)
end
--------------------------------------------------------------------------------
-- Padlock class
--------------------------------------------------------------------------------
local Padlock = setmetatable({}, BannerTemplate)
Padlock.__index = Padlock
function Padlock.new(protectionObj, blurbObj, cfg)
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb.
obj.imageWidth = 20
obj.imageCaption = blurbObj:makeBannerText('tooltip')
obj._imageAlt = blurbObj:makeBannerText('alt')
obj._imageLink = blurbObj:makeBannerText('link')
obj._indicatorName = cfg.padlockIndicatorNames[protectionObj.action]
or cfg.padlockIndicatorNames.default
or 'pp-default'
return setmetatable(obj, Padlock)
end
function Padlock:__tostring()
local frame = mw.getCurrentFrame()
-- The nowiki tag helps prevent whitespace at the top of articles.
return frame:extensionTag{name = 'nowiki'} .. frame:extensionTag{
name = 'indicator',
args = {name = self._indicatorName},
content = self:renderImage()
}
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p = {}
function p._exportClasses()
-- This is used for testing purposes.
return {
Protection = Protection,
Blurb = Blurb,
BannerTemplate = BannerTemplate,
Banner = Banner,
Padlock = Padlock,
}
end
function p._main(args, cfg, title)
args = args or {}
cfg = cfg or require(CONFIG_MODULE)
local protectionObj = Protection.new(args, cfg, title)
local ret = {}
-- If a page's edit protection is equally or more restrictive than its
-- protection from some other action, then don't bother displaying anything
-- for the other action (except categories).
if not yesno(args.catonly) and (protectionObj.action == 'edit' or
args.demolevel or
not getReachableNodes(
cfg.hierarchy,
protectionObj.level
)[effectiveProtectionLevel('edit', protectionObj.title)])
then
-- Initialise the blurb object
local blurbObj = Blurb.new(protectionObj, args, cfg)
-- Render the banner
if protectionObj:shouldShowLock() then
ret[#ret + 1] = tostring(
(yesno(args.small) and Padlock or Banner)
.new(protectionObj, blurbObj, cfg)
)
end
end
-- Render the categories
if yesno(args.category) ~= false then
ret[#ret + 1] = protectionObj:makeCategoryLinks()
end
return table.concat(ret)
end
function p.main(frame, cfg)
cfg = cfg or require(CONFIG_MODULE)
-- Find default args, if any.
local parent = frame.getParent and frame:getParent()
local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub('/sandbox$', '')]
-- Find user args, and use the parent frame if we are being called from a
-- wrapper template.
getArgs = getArgs or require('Module:Arguments').getArgs
local userArgs = getArgs(frame, {
parentOnly = defaultArgs,
frameOnly = not defaultArgs
})
-- Build the args table. User-specified args overwrite default args.
local args = {}
for k, v in pairs(defaultArgs or {}) do
args[k] = v
end
for k, v in pairs(userArgs) do
args[k] = v
end
return p._main(args, cfg)
end
return p
894f0884d4c2da1ce19d385b96f59af654b0946a
Module:Protection banner/config
828
107
206
205
2023-12-24T02:07:39Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Protection_banner/config]]
Scribunto
text/plain
-- This module provides configuration data for [[Module:Protection banner]].
return {
--------------------------------------------------------------------------------
--
-- BANNER DATA
--
--------------------------------------------------------------------------------
--[[
-- Banner data consists of six fields:
-- * text - the main protection text that appears at the top of protection
-- banners.
-- * explanation - the text that appears below the main protection text, used
-- to explain the details of the protection.
-- * tooltip - the tooltip text you see when you move the mouse over a small
-- padlock icon.
-- * link - the page that the small padlock icon links to.
-- * alt - the alt text for the small padlock icon. This is also used as tooltip
-- text for the large protection banners.
-- * image - the padlock image used in both protection banners and small padlock
-- icons.
--
-- The module checks in three separate tables to find a value for each field.
-- First it checks the banners table, which has values specific to the reason
-- for the page being protected. Then the module checks the defaultBanners
-- table, which has values specific to each protection level. Finally, the
-- module checks the masterBanner table, which holds data for protection
-- templates to use if no data has been found in the previous two tables.
--
-- The values in the banner data can take parameters. These are specified
-- using ${TEXTLIKETHIS} (a dollar sign preceding a parameter name
-- enclosed in curly braces).
--
-- Available parameters:
--
-- ${CURRENTVERSION} - a link to the page history or the move log, with the
-- display message "current-version-edit-display" or
-- "current-version-move-display".
--
-- ${EDITREQUEST} - a link to create an edit request for the current page.
--
-- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes
-- on the talk page; you may submit a request to ask an administrator to make
-- an edit if it is minor or supported by consensus."
--
-- ${IMAGELINK} - a link to set the image to, depending on the protection
-- action and protection level.
--
-- ${INTROBLURB} - the PROTECTIONBLURB parameter, plus the expiry if an expiry
-- is set. E.g. "Editing of this page by new or unregistered users is currently
-- disabled until dd Month YYYY."
--
-- ${INTROFRAGMENT} - the same as ${INTROBLURB}, but without final punctuation
-- so that it can be used in run-on sentences.
--
-- ${PAGETYPE} - the type of the page, e.g. "article" or "template".
-- Defined in the cfg.pagetypes table.
--
-- ${PROTECTIONBLURB} - a blurb explaining the protection level of the page, e.g.
-- "Editing of this page by new or unregistered users is currently disabled"
--
-- ${PROTECTIONDATE} - the protection date, if it has been supplied to the
-- template.
--
-- ${PROTECTIONLEVEL} - the protection level, e.g. "fully protected" or
-- "semi-protected".
--
-- ${PROTECTIONLOG} - a link to the protection log or the pending changes log,
-- depending on the protection action.
--
-- ${TALKPAGE} - a link to the talk page. If a section is specified, links
-- straight to that talk page section.
--
-- ${TOOLTIPBLURB} - uses the PAGETYPE, PROTECTIONTYPE and EXPIRY parameters to
-- create a blurb like "This template is semi-protected", or "This article is
-- move-protected until DD Month YYYY".
--
-- ${VANDAL} - links for the specified username (or the root page name)
-- using Module:Vandal-m.
--
-- Functions
--
-- For advanced users, it is possible to use Lua functions instead of strings
-- in the banner config tables. Using functions gives flexibility that is not
-- possible just by using parameters. Functions take two arguments, the
-- protection object and the template arguments, and they must output a string.
--
-- For example:
--
-- text = function (protectionObj, args)
-- if protectionObj.level == 'autoconfirmed' then
-- return 'foo'
-- else
-- return 'bar'
-- end
-- end
--
-- Some protection object properties and methods that may be useful:
-- protectionObj.action - the protection action
-- protectionObj.level - the protection level
-- protectionObj.reason - the protection reason
-- protectionObj.expiry - the expiry. Nil if unset, the string "indef" if set
-- to indefinite, and the protection time in unix time if temporary.
-- protectionObj.protectionDate - the protection date in unix time, or nil if
-- unspecified.
-- protectionObj.bannerConfig - the banner config found by the module. Beware
-- of editing the config field used by the function, as it could create an
-- infinite loop.
-- protectionObj:isProtected - returns a boolean showing whether the page is
-- protected.
-- protectionObj:isTemporary - returns a boolean showing whether the expiry is
-- temporary.
-- protectionObj:isIncorrect - returns a boolean showing whether the protection
-- template is incorrect.
--]]
-- The master banner data, used if no values have been found in banners or
-- defaultBanners.
masterBanner = {
text = '${INTROBLURB}',
explanation = '${EXPLANATIONBLURB}',
tooltip = '${TOOLTIPBLURB}',
link = '${IMAGELINK}',
alt = 'Page ${PROTECTIONLEVEL}'
},
-- The default banner data. This holds banner data for different protection
-- levels.
-- *required* - this table needs edit, move, autoreview and upload subtables.
defaultBanners = {
edit = {},
move = {},
autoreview = {
default = {
alt = 'Page protected with pending changes',
tooltip = 'All edits by unregistered and new users are subject to review prior to becoming visible to unregistered users',
image = 'Pending-protection-shackle.svg'
}
},
upload = {}
},
-- The banner data. This holds banner data for different protection reasons.
-- In fact, the reasons specified in this table control which reasons are
-- valid inputs to the first positional parameter.
--
-- There is also a non-standard "description" field that can be used for items
-- in this table. This is a description of the protection reason for use in the
-- module documentation.
--
-- *required* - this table needs edit, move, autoreview and upload subtables.
banners = {
edit = {
blp = {
description = 'For pages protected to promote compliance with the'
.. ' [[Wikipedia:Biographies of living persons'
.. '|biographies of living persons]] policy',
text = '${INTROFRAGMENT} to promote compliance with'
.. ' [[Wikipedia:Biographies of living persons'
.. "|Wikipedia's policy on the biographies"
.. ' of living people]].',
tooltip = '${TOOLTIPFRAGMENT} to promote compliance with the policy on'
.. ' biographies of living persons',
},
dmca = {
description = 'For pages protected by the Wikimedia Foundation'
.. ' due to [[Digital Millennium Copyright Act]] takedown requests',
explanation = function (protectionObj, args)
local ret = 'Pursuant to a rights owner notice under the Digital'
.. ' Millennium Copyright Act (DMCA) regarding some content'
.. ' in this article, the Wikimedia Foundation acted under'
.. ' applicable law and took down and restricted the content'
.. ' in question.'
if args.notice then
ret = ret .. ' A copy of the received notice can be found here: '
.. args.notice .. '.'
end
ret = ret .. ' For more information, including websites discussing'
.. ' how to file a counter-notice, please see'
.. " [[Wikipedia:Office actions]] and the article's ${TALKPAGE}."
.. "'''Do not remove this template from the article until the"
.. " restrictions are withdrawn'''."
return ret
end,
image = 'Office-protection-shackle.svg',
},
dispute = {
description = 'For pages protected due to editing disputes',
text = function (protectionObj, args)
-- Find the value of "disputes".
local display = 'disputes'
local disputes
if args.section then
disputes = string.format(
'[[%s:%s#%s|%s]]',
mw.site.namespaces[protectionObj.title.namespace].talk.name,
protectionObj.title.text,
args.section,
display
)
else
disputes = display
end
-- Make the blurb, depending on the expiry.
local msg
if type(protectionObj.expiry) == 'number' then
msg = '${INTROFRAGMENT} or until editing %s have been resolved.'
else
msg = '${INTROFRAGMENT} until editing %s have been resolved.'
end
return string.format(msg, disputes)
end,
explanation = "This protection is '''not''' an endorsement of the"
.. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}',
tooltip = '${TOOLTIPFRAGMENT} due to editing disputes',
},
ecp = {
description = 'For articles in topic areas authorized by'
.. ' [[Wikipedia:Arbitration Committee|ArbCom]] or'
.. ' meets the criteria for community use',
tooltip = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}',
alt = 'Extended-protected ${PAGETYPE}',
},
mainpage = {
description = 'For pages protected for being displayed on the [[Main Page]]',
text = 'This file is currently'
.. ' [[Wikipedia:This page is protected|protected]] from'
.. ' editing because it is currently or will soon be displayed'
.. ' on the [[Main Page]].',
explanation = 'Images on the Main Page are protected due to their high'
.. ' visibility. Please discuss any necessary changes on the ${TALKPAGE}.'
.. '<br /><span style="font-size:90%;">'
.. "'''Administrators:''' Once this image is definitely off the Main Page,"
.. ' please unprotect this file, or reduce to semi-protection,'
.. ' as appropriate.</span>',
},
office = {
description = 'For pages protected by the Wikimedia Foundation',
text = function (protectionObj, args)
local ret = 'This ${PAGETYPE} is currently under the'
.. ' scrutiny of the'
.. ' [[Wikipedia:Office actions|Wikimedia Foundation Office]]'
.. ' and is protected.'
if protectionObj.protectionDate then
ret = ret .. ' It has been protected since ${PROTECTIONDATE}.'
end
return ret
end,
explanation = "If you can edit this page, please discuss all changes and"
.. " additions on the ${TALKPAGE} first. '''Do not remove protection from this"
.. " page unless you are authorized by the Wikimedia Foundation to do"
.. " so.'''",
image = 'Office-protection-shackle.svg',
},
reset = {
description = 'For pages protected by the Wikimedia Foundation and'
.. ' "reset" to a bare-bones version',
text = 'This ${PAGETYPE} is currently under the'
.. ' scrutiny of the'
.. ' [[Wikipedia:Office actions|Wikimedia Foundation Office]]'
.. ' and is protected.',
explanation = function (protectionObj, args)
local ret = ''
if protectionObj.protectionDate then
ret = ret .. 'On ${PROTECTIONDATE} this ${PAGETYPE} was'
else
ret = ret .. 'This ${PAGETYPE} has been'
end
ret = ret .. ' reduced to a'
.. ' simplified, "bare bones" version so that it may be completely'
.. ' rewritten to ensure it meets the policies of'
.. ' [[WP:NPOV|Neutral Point of View]] and [[WP:V|Verifiability]].'
.. ' Standard Wikipedia policies will apply to its rewriting—which'
.. ' will eventually be open to all editors—and will be strictly'
.. ' enforced. The ${PAGETYPE} has been ${PROTECTIONLEVEL} while'
.. ' it is being rebuilt.\n\n'
.. 'Any insertion of material directly from'
.. ' pre-protection revisions of the ${PAGETYPE} will be removed, as'
.. ' will any material added to the ${PAGETYPE} that is not properly'
.. ' sourced. The associated talk page(s) were also cleared on the'
.. " same date.\n\n"
.. "If you can edit this page, please discuss all changes and"
.. " additions on the ${TALKPAGE} first. '''Do not override"
.. " this action, and do not remove protection from this page,"
.. " unless you are authorized by the Wikimedia Foundation"
.. " to do so. No editor may remove this notice.'''"
return ret
end,
image = 'Office-protection-shackle.svg',
},
sock = {
description = 'For pages protected due to'
.. ' [[Wikipedia:Sock puppetry|sock puppetry]]',
text = '${INTROFRAGMENT} to prevent [[Wikipedia:Sock puppetry|sock puppets]] of'
.. ' [[Wikipedia:Blocking policy|blocked]] or'
.. ' [[Wikipedia:Banning policy|banned users]]'
.. ' from editing it.',
tooltip = '${TOOLTIPFRAGMENT} to prevent sock puppets of blocked or banned users from'
.. ' editing it',
},
template = {
description = 'For [[Wikipedia:High-risk templates|high-risk]]'
.. ' templates and Lua modules',
text = 'This is a permanently [[Help:Protection|protected]] ${PAGETYPE},'
.. ' as it is [[Wikipedia:High-risk templates|high-risk]].',
explanation = 'Please discuss any changes on the ${TALKPAGE}; you may'
.. ' ${EDITREQUEST} to ask an'
.. ' [[Wikipedia:Administrators|administrator]] or'
.. ' [[Wikipedia:Template editor|template editor]] to make an edit if'
.. ' it is [[Help:Minor edit#When to mark an edit as a minor edit'
.. '|uncontroversial]] or supported by'
.. ' [[Wikipedia:Consensus|consensus]]. You can also'
.. ' [[Wikipedia:Requests for page protection|request]] that the page be'
.. ' unprotected.',
tooltip = 'This high-risk ${PAGETYPE} is permanently ${PROTECTIONLEVEL}'
.. ' to prevent vandalism',
alt = 'Permanently protected ${PAGETYPE}',
},
usertalk = {
description = 'For pages protected against disruptive edits by a'
.. ' particular user',
text = '${INTROFRAGMENT} to prevent ${VANDAL} from using it to make disruptive edits,'
.. ' such as abusing the'
.. ' {{[[Template:unblock|unblock]]}} template.',
explanation = 'If you cannot edit this user talk page and you need to'
.. ' make a change or leave a message, you can'
.. ' [[Wikipedia:Requests for page protection'
.. '#Current requests for edits to a protected page'
.. '|request an edit]],'
.. ' [[Wikipedia:Requests for page protection'
.. '#Current requests for reduction in protection level'
.. '|request unprotection]],'
.. ' [[Special:Userlogin|log in]],'
.. ' or [[Special:UserLogin/signup|create an account]].',
},
vandalism = {
description = 'For pages protected against'
.. ' [[Wikipedia:Vandalism|vandalism]]',
text = '${INTROFRAGMENT} due to [[Wikipedia:Vandalism|vandalism]].',
explanation = function (protectionObj, args)
local ret = ''
if protectionObj.level == 'sysop' then
ret = ret .. "This protection is '''not''' an endorsement of the"
.. ' ${CURRENTVERSION}. '
end
return ret .. '${EXPLANATIONBLURB}'
end,
tooltip = '${TOOLTIPFRAGMENT} due to vandalism',
}
},
move = {
dispute = {
description = 'For pages protected against page moves due to'
.. ' disputes over the page title',
explanation = "This protection is '''not''' an endorsement of the"
.. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}',
image = 'Move-protection-shackle.svg'
},
vandalism = {
description = 'For pages protected against'
.. ' [[Wikipedia:Vandalism#Page-move vandalism'
.. ' |page-move vandalism]]'
}
},
autoreview = {},
upload = {}
},
--------------------------------------------------------------------------------
--
-- GENERAL DATA TABLES
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Protection blurbs
--------------------------------------------------------------------------------
-- This table produces the protection blurbs available with the
-- ${PROTECTIONBLURB} parameter. It is sorted by protection action and
-- protection level, and is checked by the module in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
protectionBlurbs = {
edit = {
default = 'This ${PAGETYPE} is currently [[Help:Protection|'
.. 'protected]] from editing',
autoconfirmed = 'Editing of this ${PAGETYPE} by [[Wikipedia:User access'
.. ' levels#New users|new]] or [[Wikipedia:User access levels#Unregistered'
.. ' users|unregistered]] users is currently [[Help:Protection|disabled]]',
extendedconfirmed = 'This ${PAGETYPE} is currently under extended confirmed protection',
},
move = {
default = 'This ${PAGETYPE} is currently [[Help:Protection|protected]]'
.. ' from [[Help:Moving a page|page moves]]'
},
autoreview = {
default = 'All edits made to this ${PAGETYPE} by'
.. ' [[Wikipedia:User access levels#New users|new]] or'
.. ' [[Wikipedia:User access levels#Unregistered users|unregistered]]'
.. ' users are currently'
.. ' [[Wikipedia:Pending changes|subject to review]]'
},
upload = {
default = 'Uploading new versions of this ${PAGETYPE} is currently disabled'
}
},
--------------------------------------------------------------------------------
-- Explanation blurbs
--------------------------------------------------------------------------------
-- This table produces the explanation blurbs available with the
-- ${EXPLANATIONBLURB} parameter. It is sorted by protection action,
-- protection level, and whether the page is a talk page or not. If the page is
-- a talk page it will have a talk key of "talk"; otherwise it will have a talk
-- key of "subject". The table is checked in the following order:
-- 1. page's protection action, page's protection level, page's talk key
-- 2. page's protection action, page's protection level, default talk key
-- 3. page's protection action, default protection level, page's talk key
-- 4. page's protection action, default protection level, default talk key
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
explanationBlurbs = {
edit = {
autoconfirmed = {
subject = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details. If you'
.. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can'
.. ' ${EDITREQUEST}, discuss changes on the ${TALKPAGE},'
.. ' [[Wikipedia:Requests for page protection'
.. '#Current requests for reduction in protection level'
.. '|request unprotection]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].',
default = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details. If you'
.. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can'
.. ' [[Wikipedia:Requests for page protection'
.. '#Current requests for reduction in protection level'
.. '|request unprotection]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].',
},
extendedconfirmed = {
default = 'Extended confirmed protection prevents edits from all unregistered editors'
.. ' and registered users with fewer than 30 days tenure and 500 edits.'
.. ' The [[Wikipedia:Protection policy#extended|policy on community use]]'
.. ' specifies that extended confirmed protection can be applied to combat'
.. ' disruption, if semi-protection has proven to be ineffective.'
.. ' Extended confirmed protection may also be applied to enforce'
.. ' [[Wikipedia:Arbitration Committee|arbitration sanctions]].'
.. ' Please discuss any changes on the ${TALKPAGE}; you may'
.. ' ${EDITREQUEST} to ask for uncontroversial changes supported by'
.. ' [[Wikipedia:Consensus|consensus]].'
},
default = {
subject = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Please discuss any changes on the ${TALKPAGE}; you'
.. ' may ${EDITREQUEST} to ask an'
.. ' [[Wikipedia:Administrators|administrator]] to make an edit if it'
.. ' is [[Help:Minor edit#When to mark an edit as a minor edit'
.. '|uncontroversial]] or supported by [[Wikipedia:Consensus'
.. '|consensus]]. You may also [[Wikipedia:Requests for'
.. ' page protection#Current requests for reduction in protection level'
.. '|request]] that this page be unprotected.',
default = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' You may [[Wikipedia:Requests for page'
.. ' protection#Current requests for edits to a protected page|request an'
.. ' edit]] to this page, or [[Wikipedia:Requests for'
.. ' page protection#Current requests for reduction in protection level'
.. '|ask]] for it to be unprotected.'
}
},
move = {
default = {
subject = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' The page may still be edited but cannot be moved'
.. ' until unprotected. Please discuss any suggested moves on the'
.. ' ${TALKPAGE} or at [[Wikipedia:Requested moves]]. You can also'
.. ' [[Wikipedia:Requests for page protection|request]] that the page be'
.. ' unprotected.',
default = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' The page may still be edited but cannot be moved'
.. ' until unprotected. Please discuss any suggested moves at'
.. ' [[Wikipedia:Requested moves]]. You can also'
.. ' [[Wikipedia:Requests for page protection|request]] that the page be'
.. ' unprotected.'
}
},
autoreview = {
default = {
default = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Edits to this ${PAGETYPE} by new and unregistered users'
.. ' will not be visible to readers until they are accepted by'
.. ' a reviewer. To avoid the need for your edits to be'
.. ' reviewed, you may'
.. ' [[Wikipedia:Requests for page protection'
.. '#Current requests for reduction in protection level'
.. '|request unprotection]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].'
},
},
upload = {
default = {
default = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' The page may still be edited but new versions of the file'
.. ' cannot be uploaded until it is unprotected. You can'
.. ' request that a new version be uploaded by using a'
.. ' [[Wikipedia:Edit requests|protected edit request]], or you'
.. ' can [[Wikipedia:Requests for page protection|request]]'
.. ' that the file be unprotected.'
}
}
},
--------------------------------------------------------------------------------
-- Protection levels
--------------------------------------------------------------------------------
-- This table provides the data for the ${PROTECTIONLEVEL} parameter, which
-- produces a short label for different protection levels. It is sorted by
-- protection action and protection level, and is checked in the following
-- order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
protectionLevels = {
edit = {
default = 'protected',
templateeditor = 'template-protected',
extendedconfirmed = 'extended-protected',
autoconfirmed = 'semi-protected',
},
move = {
default = 'move-protected'
},
autoreview = {
},
upload = {
default = 'upload-protected'
}
},
--------------------------------------------------------------------------------
-- Images
--------------------------------------------------------------------------------
-- This table lists different padlock images for each protection action and
-- protection level. It is used if an image is not specified in any of the
-- banner data tables, and if the page does not satisfy the conditions for using
-- the ['image-filename-indef'] image. It is checked in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
images = {
edit = {
default = 'Full-protection-shackle.svg',
templateeditor = 'Template-protection-shackle.svg',
extendedconfirmed = 'Extended-protection-shackle.svg',
autoconfirmed = 'Semi-protection-shackle.svg'
},
move = {
default = 'Move-protection-shackle.svg',
},
autoreview = {
default = 'Pending-protection-shackle.svg'
},
upload = {
default = 'Upload-protection-shackle.svg'
}
},
-- Pages with a reason specified in this table will show the special "indef"
-- padlock, defined in the 'image-filename-indef' message, if no expiry is set.
indefImageReasons = {
template = true
},
--------------------------------------------------------------------------------
-- Image links
--------------------------------------------------------------------------------
-- This table provides the data for the ${IMAGELINK} parameter, which gets
-- the image link for small padlock icons based on the page's protection action
-- and protection level. It is checked in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
imageLinks = {
edit = {
default = 'Wikipedia:Protection policy#full',
templateeditor = 'Wikipedia:Protection policy#template',
extendedconfirmed = 'Wikipedia:Protection policy#extended',
autoconfirmed = 'Wikipedia:Protection policy#semi'
},
move = {
default = 'Wikipedia:Protection policy#move'
},
autoreview = {
default = 'Wikipedia:Protection policy#pending'
},
upload = {
default = 'Wikipedia:Protection policy#upload'
}
},
--------------------------------------------------------------------------------
-- Padlock indicator names
--------------------------------------------------------------------------------
-- This table provides the "name" attribute for the <indicator> extension tag
-- with which small padlock icons are generated. All indicator tags on a page
-- are displayed in alphabetical order based on this attribute, and with
-- indicator tags with duplicate names, the last tag on the page wins.
-- The attribute is chosen based on the protection action; table keys must be a
-- protection action name or the string "default".
padlockIndicatorNames = {
autoreview = 'pp-autoreview',
default = 'pp-default'
},
--------------------------------------------------------------------------------
-- Protection categories
--------------------------------------------------------------------------------
--[[
-- The protection categories are stored in the protectionCategories table.
-- Keys to this table are made up of the following strings:
--
-- 1. the expiry date
-- 2. the namespace
-- 3. the protection reason (e.g. "dispute" or "vandalism")
-- 4. the protection level (e.g. "sysop" or "autoconfirmed")
-- 5. the action (e.g. "edit" or "move")
--
-- When the module looks up a category in the table, first it will will check to
-- see a key exists that corresponds to all five parameters. For example, a
-- user page semi-protected from vandalism for two weeks would have the key
-- "temp-user-vandalism-autoconfirmed-edit". If no match is found, the module
-- changes the first part of the key to "all" and checks the table again. It
-- keeps checking increasingly generic key combinations until it finds the
-- field, or until it reaches the key "all-all-all-all-all".
--
-- The module uses a binary matrix to determine the order in which to search.
-- This is best demonstrated by a table. In this table, the "0" values
-- represent "all", and the "1" values represent the original data (e.g.
-- "indef" or "file" or "vandalism").
--
-- expiry namespace reason level action
-- order
-- 1 1 1 1 1 1
-- 2 0 1 1 1 1
-- 3 1 0 1 1 1
-- 4 0 0 1 1 1
-- 5 1 1 0 1 1
-- 6 0 1 0 1 1
-- 7 1 0 0 1 1
-- 8 0 0 0 1 1
-- 9 1 1 1 0 1
-- 10 0 1 1 0 1
-- 11 1 0 1 0 1
-- 12 0 0 1 0 1
-- 13 1 1 0 0 1
-- 14 0 1 0 0 1
-- 15 1 0 0 0 1
-- 16 0 0 0 0 1
-- 17 1 1 1 1 0
-- 18 0 1 1 1 0
-- 19 1 0 1 1 0
-- 20 0 0 1 1 0
-- 21 1 1 0 1 0
-- 22 0 1 0 1 0
-- 23 1 0 0 1 0
-- 24 0 0 0 1 0
-- 25 1 1 1 0 0
-- 26 0 1 1 0 0
-- 27 1 0 1 0 0
-- 28 0 0 1 0 0
-- 29 1 1 0 0 0
-- 30 0 1 0 0 0
-- 31 1 0 0 0 0
-- 32 0 0 0 0 0
--
-- In this scheme the action has the highest priority, as it is the last
-- to change, and the expiry has the least priority, as it changes the most.
-- The priorities of the expiry, the protection level and the action are
-- fixed, but the priorities of the reason and the namespace can be swapped
-- through the use of the cfg.bannerDataNamespaceHasPriority table.
--]]
-- If the reason specified to the template is listed in this table,
-- namespace data will take priority over reason data in the protectionCategories
-- table.
reasonsWithNamespacePriority = {
vandalism = true,
},
-- The string to use as a namespace key for the protectionCategories table for each
-- namespace number.
categoryNamespaceKeys = {
[ 2] = 'user',
[ 3] = 'user',
[ 4] = 'project',
[ 6] = 'file',
[ 8] = 'mediawiki',
[ 10] = 'template',
[ 12] = 'project',
[ 14] = 'category',
[100] = 'portal',
[828] = 'module',
},
protectionCategories = {
['all|all|all|all|all'] = 'Wikipedia fully protected pages',
['all|all|office|all|all'] = 'Wikipedia Office-protected pages',
['all|all|reset|all|all'] = 'Wikipedia Office-protected pages',
['all|all|dmca|all|all'] = 'Wikipedia Office-protected pages',
['all|all|mainpage|all|all'] = 'Wikipedia fully protected main page files',
['all|all|all|extendedconfirmed|all'] = 'Wikipedia extended-confirmed-protected pages',
['all|all|ecp|extendedconfirmed|all'] = 'Wikipedia extended-confirmed-protected pages',
['all|template|all|all|edit'] = 'Wikipedia fully protected templates',
['all|all|all|autoconfirmed|edit'] = 'Wikipedia semi-protected pages',
['indef|all|all|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected pages',
['all|all|blp|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected biographies of living people',
['temp|all|blp|autoconfirmed|edit'] = 'Wikipedia temporarily semi-protected biographies of living people',
['all|all|dispute|autoconfirmed|edit'] = 'Wikipedia pages semi-protected due to dispute',
['all|all|sock|autoconfirmed|edit'] = 'Wikipedia pages semi-protected from banned users',
['all|all|vandalism|autoconfirmed|edit'] = 'Wikipedia pages semi-protected against vandalism',
['all|category|all|autoconfirmed|edit'] = 'Wikipedia semi-protected categories',
['all|file|all|autoconfirmed|edit'] = 'Wikipedia semi-protected files',
['all|portal|all|autoconfirmed|edit'] = 'Wikipedia semi-protected portals',
['all|project|all|autoconfirmed|edit'] = 'Wikipedia semi-protected project pages',
['all|talk|all|autoconfirmed|edit'] = 'Wikipedia semi-protected talk pages',
['all|template|all|autoconfirmed|edit'] = 'Wikipedia semi-protected templates',
['all|user|all|autoconfirmed|edit'] = 'Wikipedia semi-protected user and user talk pages',
['all|all|all|templateeditor|edit'] = 'Wikipedia template-protected pages other than templates and modules',
['all|template|all|templateeditor|edit'] = 'Wikipedia template-protected templates',
['all|template|all|templateeditor|move'] = 'Wikipedia template-protected templates', -- move-protected templates
['all|all|blp|sysop|edit'] = 'Wikipedia indefinitely protected biographies of living people',
['temp|all|blp|sysop|edit'] = 'Wikipedia temporarily protected biographies of living people',
['all|all|dispute|sysop|edit'] = 'Wikipedia pages protected due to dispute',
['all|all|sock|sysop|edit'] = 'Wikipedia pages protected from banned users',
['all|all|vandalism|sysop|edit'] = 'Wikipedia pages protected against vandalism',
['all|category|all|sysop|edit'] = 'Wikipedia fully protected categories',
['all|file|all|sysop|edit'] = 'Wikipedia fully protected files',
['all|project|all|sysop|edit'] = 'Wikipedia fully protected project pages',
['all|talk|all|sysop|edit'] = 'Wikipedia fully protected talk pages',
['all|template|all|extendedconfirmed|edit'] = 'Wikipedia extended-confirmed-protected templates',
['all|template|all|sysop|edit'] = 'Wikipedia fully protected templates',
['all|user|all|sysop|edit'] = 'Wikipedia fully protected user and user talk pages',
['all|module|all|all|edit'] = 'Wikipedia fully protected modules',
['all|module|all|templateeditor|edit'] = 'Wikipedia template-protected modules',
['all|module|all|extendedconfirmed|edit'] = 'Wikipedia extended-confirmed-protected modules',
['all|module|all|autoconfirmed|edit'] = 'Wikipedia semi-protected modules',
['all|all|all|sysop|move'] = 'Wikipedia move-protected pages',
['indef|all|all|sysop|move'] = 'Wikipedia indefinitely move-protected pages',
['all|all|dispute|sysop|move'] = 'Wikipedia pages move-protected due to dispute',
['all|all|vandalism|sysop|move'] = 'Wikipedia pages move-protected due to vandalism',
['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals',
['all|project|all|sysop|move'] = 'Wikipedia move-protected project pages',
['all|talk|all|sysop|move'] = 'Wikipedia move-protected talk pages',
['all|template|all|sysop|move'] = 'Wikipedia move-protected templates',
['all|user|all|sysop|move'] = 'Wikipedia move-protected user and user talk pages',
['all|all|all|autoconfirmed|autoreview'] = 'Wikipedia pending changes protected pages',
['all|file|all|all|upload'] = 'Wikipedia upload-protected files',
},
--------------------------------------------------------------------------------
-- Expiry category config
--------------------------------------------------------------------------------
-- This table configures the expiry category behaviour for each protection
-- action.
-- * If set to true, setting that action will always categorise the page if
-- an expiry parameter is not set.
-- * If set to false, setting that action will never categorise the page.
-- * If set to nil, the module will categorise the page if:
-- 1) an expiry parameter is not set, and
-- 2) a reason is provided, and
-- 3) the specified reason is not blacklisted in the reasonsWithoutExpiryCheck
-- table.
expiryCheckActions = {
edit = nil,
move = false,
autoreview = true,
upload = false
},
reasonsWithoutExpiryCheck = {
blp = true,
template = true,
},
--------------------------------------------------------------------------------
-- Pagetypes
--------------------------------------------------------------------------------
-- This table produces the page types available with the ${PAGETYPE} parameter.
-- Keys are namespace numbers, or the string "default" for the default value.
pagetypes = {
[0] = 'article',
[6] = 'file',
[10] = 'template',
[14] = 'category',
[828] = 'module',
default = 'page'
},
--------------------------------------------------------------------------------
-- Strings marking indefinite protection
--------------------------------------------------------------------------------
-- This table contains values passed to the expiry parameter that mean the page
-- is protected indefinitely.
indefStrings = {
['indef'] = true,
['indefinite'] = true,
['indefinitely'] = true,
['infinite'] = true,
},
--------------------------------------------------------------------------------
-- Group hierarchy
--------------------------------------------------------------------------------
-- This table maps each group to all groups that have a superset of the original
-- group's page editing permissions.
hierarchy = {
sysop = {},
reviewer = {'sysop'},
filemover = {'sysop'},
templateeditor = {'sysop'},
extendedconfirmed = {'sysop'},
autoconfirmed = {'reviewer', 'filemover', 'templateeditor', 'extendedconfirmed'},
user = {'autoconfirmed'},
['*'] = {'user'}
},
--------------------------------------------------------------------------------
-- Wrapper templates and their default arguments
--------------------------------------------------------------------------------
-- This table contains wrapper templates used with the module, and their
-- default arguments. Templates specified in this table should contain the
-- following invocation, and no other template content:
--
-- {{#invoke:Protection banner|main}}
--
-- If other content is desired, it can be added between
-- <noinclude>...</noinclude> tags.
--
-- When a user calls one of these wrapper templates, they will use the
-- default arguments automatically. However, users can override any of the
-- arguments.
wrappers = {
['Template:Pp'] = {},
['Template:Pp-extended'] = {'ecp'},
['Template:Pp-blp'] = {'blp'},
-- we don't need Template:Pp-create
['Template:Pp-dispute'] = {'dispute'},
['Template:Pp-main-page'] = {'mainpage'},
['Template:Pp-move'] = {action = 'move', catonly = 'yes'},
['Template:Pp-move-dispute'] = {'dispute', action = 'move', catonly = 'yes'},
-- we don't need Template:Pp-move-indef
['Template:Pp-move-vandalism'] = {'vandalism', action = 'move', catonly = 'yes'},
['Template:Pp-office'] = {'office'},
['Template:Pp-office-dmca'] = {'dmca'},
['Template:Pp-pc'] = {action = 'autoreview', small = true},
['Template:Pp-pc1'] = {action = 'autoreview', small = true},
['Template:Pp-reset'] = {'reset'},
['Template:Pp-semi-indef'] = {small = true},
['Template:Pp-sock'] = {'sock'},
['Template:Pp-template'] = {'template', small = true},
['Template:Pp-upload'] = {action = 'upload'},
['Template:Pp-usertalk'] = {'usertalk'},
['Template:Pp-vandalism'] = {'vandalism'},
},
--------------------------------------------------------------------------------
--
-- MESSAGES
--
--------------------------------------------------------------------------------
msg = {
--------------------------------------------------------------------------------
-- Intro blurb and intro fragment
--------------------------------------------------------------------------------
-- These messages specify what is produced by the ${INTROBLURB} and
-- ${INTROFRAGMENT} parameters. If the protection is temporary they use the
-- intro-blurb-expiry or intro-fragment-expiry, and if not they use
-- intro-blurb-noexpiry or intro-fragment-noexpiry.
-- It is possible to use banner parameters in these messages.
['intro-blurb-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY}.',
['intro-blurb-noexpiry'] = '${PROTECTIONBLURB}.',
['intro-fragment-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY},',
['intro-fragment-noexpiry'] = '${PROTECTIONBLURB}',
--------------------------------------------------------------------------------
-- Tooltip blurb
--------------------------------------------------------------------------------
-- These messages specify what is produced by the ${TOOLTIPBLURB} parameter.
-- If the protection is temporary the tooltip-blurb-expiry message is used, and
-- if not the tooltip-blurb-noexpiry message is used.
-- It is possible to use banner parameters in these messages.
['tooltip-blurb-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY}.',
['tooltip-blurb-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}.',
['tooltip-fragment-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY},',
['tooltip-fragment-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}',
--------------------------------------------------------------------------------
-- Special explanation blurb
--------------------------------------------------------------------------------
-- An explanation blurb for pages that cannot be unprotected, e.g. for pages
-- in the MediaWiki namespace.
-- It is possible to use banner parameters in this message.
['explanation-blurb-nounprotect'] = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Please discuss any changes on the ${TALKPAGE}; you'
.. ' may ${EDITREQUEST} to ask an'
.. ' [[Wikipedia:Administrators|administrator]] to make an edit if it'
.. ' is [[Help:Minor edit#When to mark an edit as a minor edit'
.. '|uncontroversial]] or supported by [[Wikipedia:Consensus'
.. '|consensus]].',
--------------------------------------------------------------------------------
-- Protection log display values
--------------------------------------------------------------------------------
-- These messages determine the display values for the protection log link
-- or the pending changes log link produced by the ${PROTECTIONLOG} parameter.
-- It is possible to use banner parameters in these messages.
['protection-log-display'] = 'protection log',
['pc-log-display'] = 'pending changes log',
--------------------------------------------------------------------------------
-- Current version display values
--------------------------------------------------------------------------------
-- These messages determine the display values for the page history link
-- or the move log link produced by the ${CURRENTVERSION} parameter.
-- It is possible to use banner parameters in these messages.
['current-version-move-display'] = 'current title',
['current-version-edit-display'] = 'current version',
--------------------------------------------------------------------------------
-- Talk page
--------------------------------------------------------------------------------
-- This message determines the display value of the talk page link produced
-- with the ${TALKPAGE} parameter.
-- It is possible to use banner parameters in this message.
['talk-page-link-display'] = 'talk page',
--------------------------------------------------------------------------------
-- Edit requests
--------------------------------------------------------------------------------
-- This message determines the display value of the edit request link produced
-- with the ${EDITREQUEST} parameter.
-- It is possible to use banner parameters in this message.
['edit-request-display'] = 'submit an edit request',
--------------------------------------------------------------------------------
-- Expiry date format
--------------------------------------------------------------------------------
-- This is the format for the blurb expiry date. It should be valid input for
-- the first parameter of the #time parser function.
['expiry-date-format'] = 'F j, Y "at" H:i e',
--------------------------------------------------------------------------------
-- Tracking categories
--------------------------------------------------------------------------------
-- These messages determine which tracking categories the module outputs.
['tracking-category-incorrect'] = 'Wikipedia pages with incorrect protection templates',
['tracking-category-template'] = 'Wikipedia template-protected pages other than templates and modules',
--------------------------------------------------------------------------------
-- Images
--------------------------------------------------------------------------------
-- These are images that are not defined by their protection action and protection level.
['image-filename-indef'] = 'Full-protection-shackle.svg',
['image-filename-default'] = 'Transparent.gif',
--------------------------------------------------------------------------------
-- End messages
--------------------------------------------------------------------------------
}
--------------------------------------------------------------------------------
-- End configuration
--------------------------------------------------------------------------------
}
a20552ae38cb5253a4fa29aa126abc74215a589f
Module:Sidebar
828
108
208
207
2023-12-24T02:07:40Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Sidebar]]
Scribunto
text/plain
require('strict')
local cfg = mw.loadData('Module:Sidebar/configuration')
local p = {}
local getArgs = require('Module:Arguments').getArgs
--[[
Categorizes calling templates and modules with a 'style' parameter of any sort
for tracking to convert to TemplateStyles.
TODO after a long cleanup: Catch sidebars in other namespaces than Template and Module.
TODO would probably want to remove /log and /archive as CS1 does
]]
local function categorizeTemplatesWithInlineStyles(args)
local title = mw.title.getCurrentTitle()
if title.namespace ~= 10 and title.namespace ~= 828 then return '' end
for _, pattern in ipairs (cfg.i18n.pattern.uncategorized_conversion_titles) do
if title.text:match(pattern) then return '' end
end
for key, _ in pairs(args) do
if mw.ustring.find(key, cfg.i18n.pattern.style_conversion) or key == 'width' then
return cfg.i18n.category.conversion
end
end
end
--[[
For compatibility with the original {{sidebar with collapsible lists}}
implementation, which passed some parameters through {{#if}} to trim their
whitespace. This also triggered the automatic newline behavior.
]]
-- See ([[meta:Help:Newlines and spaces#Automatic newline]])
local function trimAndAddAutomaticNewline(s)
s = mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1")
if mw.ustring.find(s, '^[#*:;]') or mw.ustring.find(s, '^{|') then
return '\n' .. s
else
return s
end
end
--[[
Finds whether a sidebar has a subgroup sidebar.
]]
local function hasSubgroup(s)
if mw.ustring.find(s, cfg.i18n.pattern.subgroup) then
return true
else
return false
end
end
local function has_navbar(navbar_mode, sidebar_name)
return navbar_mode ~= cfg.i18n.navbar_none and
navbar_mode ~= cfg.i18n.navbar_off and
(
sidebar_name or
mw.getCurrentFrame():getParent():getTitle():gsub(cfg.i18n.pattern.sandbox, '') ~=
cfg.i18n.title_not_to_add_navbar
)
end
local function has_list_class(args, htmlclass)
local patterns = {
'^' .. htmlclass .. '$',
'%s' .. htmlclass .. '$',
'^' .. htmlclass .. '%s',
'%s' .. htmlclass .. '%s'
}
for arg, value in pairs(args) do
if type(arg) == 'string' and mw.ustring.find(arg, 'class') then
for _, pattern in ipairs(patterns) do
if mw.ustring.find(args[arg] or '', pattern) then
return true
end
end
end
end
return false
end
-- there are a lot of list classes in the wild, so we add their TemplateStyles
local function add_list_styles(args)
local frame = mw.getCurrentFrame()
local function add_list_templatestyles(htmlclass, templatestyles)
if has_list_class(args, htmlclass) then
return frame:extensionTag{
name = 'templatestyles', args = { src = templatestyles }
}
else
return ''
end
end
local plainlist_styles = add_list_templatestyles('plainlist', cfg.i18n.plainlist_templatestyles)
local hlist_styles = add_list_templatestyles('hlist', cfg.i18n.hlist_templatestyles)
-- a second workaround for [[phab:T303378]]
-- when that issue is fixed, we can actually use has_navbar not to emit the
-- tag here if we want
if has_navbar(args.navbar, args.name) and hlist_styles == '' then
hlist_styles = frame:extensionTag{
name = 'templatestyles', args = { src = cfg.i18n.hlist_templatestyles}
}
end
-- hlist -> plainlist is best-effort to preserve old Common.css ordering. [hlist_note]
return hlist_styles .. plainlist_styles
end
-- work around [[phab:T303378]]
-- for each arg: find all the templatestyles strip markers, insert them into a
-- table. then remove all templatestyles markers from the arg
local function move_hiding_templatestyles(args)
local gfind = string.gfind
local gsub = string.gsub
local templatestyles_markers = {}
local strip_marker_pattern = '(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)'
for k, arg in pairs(args) do
for marker in gfind(arg, strip_marker_pattern) do
table.insert(templatestyles_markers, marker)
end
args[k] = gsub(arg, strip_marker_pattern, '')
end
return templatestyles_markers
end
--[[
Main sidebar function. Takes the frame, args, and an optional collapsibleClass.
The collapsibleClass is and should be used only for sidebars with collapsible
lists, as in p.collapsible.
]]
function p.sidebar(frame, args, collapsibleClass)
if not args then
args = getArgs(frame)
end
local hiding_templatestyles = table.concat(move_hiding_templatestyles(args))
local root = mw.html.create()
local child = args.child and mw.text.trim(args.child) == cfg.i18n.child_yes
root = root:tag('table')
if not child then
root
:addClass(cfg.i18n.class.sidebar)
-- force collapsibleclass to be sidebar-collapse otherwise output nothing
:addClass(collapsibleClass == cfg.i18n.class.collapse and cfg.i18n.class.collapse or nil)
:addClass('nomobile')
:addClass(args.float == cfg.i18n.float_none and cfg.i18n.class.float_none or nil)
:addClass(args.float == cfg.i18n.float_left and cfg.i18n.class.float_left or nil)
:addClass(args.wraplinks ~= cfg.i18n.wrap_true and cfg.i18n.class.wraplinks or nil)
:addClass(args.bodyclass or args.class)
:css('width', args.width or nil)
:cssText(args.bodystyle or args.style)
if args.outertitle then
root
:tag('caption')
:addClass(cfg.i18n.class.outer_title)
:addClass(args.outertitleclass)
:cssText(args.outertitlestyle)
:wikitext(args.outertitle)
end
if args.topimage then
local imageCell = root:tag('tr'):tag('td')
imageCell
:addClass(cfg.i18n.class.top_image)
:addClass(args.topimageclass)
:cssText(args.topimagestyle)
:wikitext(args.topimage)
if args.topcaption then
imageCell
:tag('div')
:addClass(cfg.i18n.class.top_caption)
:cssText(args.topcaptionstyle)
:wikitext(args.topcaption)
end
end
if args.pretitle then
root
:tag('tr')
:tag('td')
:addClass(args.topimage and cfg.i18n.class.pretitle_with_top_image
or cfg.i18n.class.pretitle)
:addClass(args.pretitleclass)
:cssText(args.basestyle)
:cssText(args.pretitlestyle)
:wikitext(args.pretitle)
end
else
root
:addClass(cfg.i18n.class.subgroup)
:addClass(args.bodyclass or args.class)
:cssText(args.bodystyle or args.style)
end
if args.title then
if child then
root
:wikitext(args.title)
else
root
:tag('tr')
:tag('th')
:addClass(args.pretitle and cfg.i18n.class.title_with_pretitle
or cfg.i18n.class.title)
:addClass(args.titleclass)
:cssText(args.basestyle)
:cssText(args.titlestyle)
:wikitext(args.title)
end
end
if args.image then
local imageCell = root:tag('tr'):tag('td')
imageCell
:addClass(cfg.i18n.class.image)
:addClass(args.imageclass)
:cssText(args.imagestyle)
:wikitext(args.image)
if args.caption then
imageCell
:tag('div')
:addClass(cfg.i18n.class.caption)
:cssText(args.captionstyle)
:wikitext(args.caption)
end
end
if args.above then
root
:tag('tr')
:tag('td')
:addClass(cfg.i18n.class.above)
:addClass(args.aboveclass)
:cssText(args.abovestyle)
:newline() -- newline required for bullet-points to work
:wikitext(args.above)
end
local rowNums = {}
for k, v in pairs(args) do
k = '' .. k
local num = k:match('^heading(%d+)$') or k:match('^content(%d+)$')
if num then table.insert(rowNums, tonumber(num)) end
end
table.sort(rowNums)
-- remove duplicates from the list (e.g. 3 will be duplicated if both heading3
-- and content3 are specified)
for i = #rowNums, 1, -1 do
if rowNums[i] == rowNums[i - 1] then
table.remove(rowNums, i)
end
end
for i, num in ipairs(rowNums) do
local heading = args['heading' .. num]
if heading then
root
:tag('tr')
:tag('th')
:addClass(cfg.i18n.class.heading)
:addClass(args.headingclass)
:addClass(args['heading' .. num .. 'class'])
:cssText(args.basestyle)
:cssText(args.headingstyle)
:cssText(args['heading' .. num .. 'style'])
:newline()
:wikitext(heading)
end
local content = args['content' .. num]
if content then
root
:tag('tr')
:tag('td')
:addClass(hasSubgroup(content) and cfg.i18n.class.content_with_subgroup
or cfg.i18n.class.content)
:addClass(args.contentclass)
:addClass(args['content' .. num .. 'class'])
:cssText(args.contentstyle)
:cssText(args['content' .. num .. 'style'])
:newline()
:wikitext(content)
:done()
-- Without a linebreak after the </td>, a nested list like
-- "* {{hlist| ...}}" doesn't parse correctly.
:newline()
end
end
if args.below then
root
:tag('tr')
:tag('td')
:addClass(cfg.i18n.class.below)
:addClass(args.belowclass)
:cssText(args.belowstyle)
:newline()
:wikitext(args.below)
end
if not child and has_navbar(args.navbar, args.name) then
root
:tag('tr')
:tag('td')
:addClass(cfg.i18n.class.navbar)
:cssText(args.navbarstyle)
:wikitext(require('Module:Navbar')._navbar{
args.name,
mini = 1,
fontstyle = args.navbarfontstyle
})
end
local base_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = cfg.i18n.templatestyles }
}
local templatestyles = ''
if args['templatestyles'] and args['templatestyles'] ~= '' then
templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['templatestyles'] }
}
end
local child_templatestyles = ''
if args['child templatestyles'] and args['child templatestyles'] ~= '' then
child_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['child templatestyles'] }
}
end
local grandchild_templatestyles = ''
if args['grandchild templatestyles'] and args['grandchild templatestyles'] ~= '' then
grandchild_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['grandchild templatestyles'] }
}
end
return table.concat({
add_list_styles(args), -- see [hlist_note] above about ordering
base_templatestyles,
templatestyles,
child_templatestyles,
grandchild_templatestyles,
hiding_templatestyles,
tostring(root),
(child and cfg.i18n.category.child or ''),
categorizeTemplatesWithInlineStyles(args)
})
end
local function list_title(args, is_centered_list_titles, num)
local title_text = trimAndAddAutomaticNewline(args['list' .. num .. 'title']
or cfg.i18n.default_list_title)
local title
if is_centered_list_titles then
-- collapsible can be finicky, so provide some CSS/HTML to support
title = mw.html.create('div')
:addClass(cfg.i18n.class.list_title_centered)
:wikitext(title_text)
else
title = mw.html.create()
:wikitext(title_text)
end
local title_container = mw.html.create('div')
:addClass(cfg.i18n.class.list_title)
-- don't /need/ a listnumtitleclass because you can do
-- .templateclass .listnumclass .sidebar-list-title
:addClass(args.listtitleclass)
:cssText(args.basestyle)
:cssText(args.listtitlestyle)
:cssText(args['list' .. num .. 'titlestyle'])
:node(title)
:done()
return title_container
end
--[[
Main entry point for sidebar with collapsible lists.
Does the work of creating the collapsible lists themselves and including them
into the args.
]]
function p.collapsible(frame)
local args = getArgs(frame)
if not args.name and
frame:getParent():getTitle():gsub(cfg.i18n.pattern.collapse_sandbox, '') ==
cfg.i18n.collapse_title_not_to_add_navbar then
args.navbar = cfg.i18n.navbar_none
end
local contentArgs = {}
local is_centered_list_titles = false
if args['centered list titles'] and args['centered list titles'] ~= '' then
is_centered_list_titles = true
end
for k, v in pairs(args) do
local num = string.match(k, '^list(%d+)$')
if num then
local expand = args.expanded and
(args.expanded == 'all' or args.expanded == args['list' .. num .. 'name'])
local row = mw.html.create('div')
row
:addClass(cfg.i18n.class.list)
:addClass('mw-collapsible')
:addClass((not expand) and 'mw-collapsed' or nil)
:addClass(args['list' .. num .. 'class'])
:cssText(args.listframestyle)
:cssText(args['list' .. num .. 'framestyle'])
:node(list_title(args, is_centered_list_titles, num))
:tag('div')
:addClass(cfg.i18n.class.list_content)
:addClass('mw-collapsible-content')
-- don't /need/ a listnumstyleclass because you can do
-- .templatename .listnumclass .sidebar-list
:addClass(args.listclass)
:cssText(args.liststyle)
:cssText(args['list' .. num .. 'style'])
:wikitext(trimAndAddAutomaticNewline(args['list' .. num]))
contentArgs['content' .. num] = tostring(row)
end
end
for k, v in pairs(contentArgs) do
args[k] = v
end
return p.sidebar(frame, args, cfg.i18n.class.collapse)
end
return p
71fe765846593e025ca2f94371315e9dbb5bb4d2
Module:Sidebar/configuration
828
109
210
209
2023-12-24T02:07:41Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Sidebar/configuration]]
Scribunto
text/plain
return {
i18n = {
child_yes = 'yes',
float_none = 'none',
float_left = 'left',
wrap_true = 'true',
navbar_none = 'none',
navbar_off = 'off',
default_list_title = 'List',
title_not_to_add_navbar = 'Template:Sidebar',
collapse_title_not_to_add_navbar = 'Template:Sidebar with collapsible lists',
templatestyles = 'Module:Sidebar/styles.css',
hlist_templatestyles = 'Hlist/styles.css',
plainlist_templatestyles = 'Plainlist/styles.css',
category = {
child = '[[Category:Pages using sidebar with the child parameter]]',
conversion = '[[Category:Sidebars with styles needing conversion]]'
},
pattern = {
collapse_sandbox = '/sandbox$',
sandbox = '/sandbox$',
subgroup = 'sidebar%-subgroup',
style_conversion = 'style$',
uncategorized_conversion_titles = {
'/[Ss]andbox',
'/[Tt]estcases',
'/[Dd]oc$'
}
},
class = {
sidebar = 'sidebar',
subgroup = 'sidebar-subgroup',
collapse = 'sidebar-collapse',
float_none = 'sidebar-none',
float_left = 'sidebar-left',
wraplinks = 'nowraplinks',
outer_title = 'sidebar-outer-title',
top_image = 'sidebar-top-image',
top_caption = 'sidebar-top-caption',
pretitle = 'sidebar-pretitle',
pretitle_with_top_image = 'sidebar-pretitle-with-top-image',
title = 'sidebar-title',
title_with_pretitle = 'sidebar-title-with-pretitle',
image = 'sidebar-image',
caption = 'sidebar-caption',
above = 'sidebar-above',
heading = 'sidebar-heading',
content = 'sidebar-content',
content_with_subgroup = 'sidebar-content-with-subgroup',
below = 'sidebar-below',
navbar = 'sidebar-navbar',
list = 'sidebar-list',
list_title = 'sidebar-list-title',
list_title_centered = 'sidebar-list-title-c',
list_content = 'sidebar-list-content'
}
}
}
dc2a980ac2162a898f7c21e6d6ba7e994dfeb315
Module:Sidebar/styles.css
828
110
212
211
2023-12-24T02:07:42Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Sidebar/styles.css]]
sanitized-css
text/css
/* {{pp-template}} */
/* TODO: Invert width design to be "mobile first" */
.sidebar {
/* TODO: Ask if we should have max-width 22em instead */
width: 22em;
/* @noflip */
float: right;
/* @noflip */
clear: right;
/* @noflip */
margin: 0.5em 0 1em 1em;
background: #f8f9fa;
border: 1px solid #aaa;
padding: 0.2em;
text-align: center;
line-height: 1.4em;
font-size: 88%;
border-collapse: collapse;
/* Timeless has display: none on .nomobile at mobile resolutions, so we
* unhide it with display: table and let precedence and proximity win.
*/
display: table;
}
/* Unfortunately, so does Minerva desktop, except Minerva drops an
* !important on the declaration. So we have to be mean for Minerva users.
* Mobile removes the element entirely with `wgMFRemovableClasses` in
* https://github.com/wikimedia/operations-mediawiki-config/blob/master/
wmf-config/InitialiseSettings.php#L16992
* which is why displaying it categorically with display: table works.
* We don't really want to expose the generic user in the wild on mobile to have
* to deal with sidebars. (Maybe the ones with collapsible lists, so that
* might be an improvement. That is blocked on [[:phab:T111565]].)
*/
body.skin-minerva .sidebar {
display: table !important;
/* also, minerva is way too aggressive about other stylings on tables.
* TODO remove when this template gets moved to a div. plans on talk page.
* We always float right on Minerva because that's a lot of extra CSS
* otherwise. */
float: right !important;
margin: 0.5em 0 1em 1em !important;
}
.sidebar-subgroup {
width: 100%;
margin: 0;
border-spacing: 0;
}
.sidebar-left {
/* @noflip */
float: left;
/* @noflip */
clear: left;
/* @noflip */
margin: 0.5em 1em 1em 0;
}
.sidebar-none {
float: none;
clear: both;
/* @noflip */
margin: 0.5em 1em 1em 0;
}
.sidebar-outer-title {
padding: 0 0.4em 0.2em;
font-size: 125%;
line-height: 1.2em;
font-weight: bold;
}
.sidebar-top-image {
padding: 0.4em;
}
.sidebar-top-caption,
.sidebar-pretitle-with-top-image,
.sidebar-caption {
padding: 0.2em 0.4em 0;
line-height: 1.2em;
}
.sidebar-pretitle {
padding: 0.4em 0.4em 0;
line-height: 1.2em;
}
.sidebar-title,
.sidebar-title-with-pretitle {
padding: 0.2em 0.8em;
font-size: 145%;
line-height: 1.2em;
}
.sidebar-title-with-pretitle {
padding: 0.1em 0.4em;
}
.sidebar-image {
padding: 0.2em 0.4em 0.4em;
}
.sidebar-heading {
padding: 0.1em 0.4em;
}
.sidebar-content {
padding: 0 0.5em 0.4em;
}
.sidebar-content-with-subgroup {
padding: 0.1em 0.4em 0.2em;
}
.sidebar-above,
.sidebar-below {
padding: 0.3em 0.8em;
font-weight: bold;
}
.sidebar-collapse .sidebar-above,
.sidebar-collapse .sidebar-below {
border-top: 1px solid #aaa;
border-bottom: 1px solid #aaa;
}
.sidebar-navbar {
text-align: right;
font-size: 115%;
padding: 0 0.4em 0.4em;
}
.sidebar-list-title {
padding: 0 0.4em;
text-align: left;
font-weight: bold;
line-height: 1.6em;
font-size: 105%;
}
/* centered text with mw-collapsible headers is finicky */
.sidebar-list-title-c {
padding: 0 0.4em;
text-align: center;
margin: 0 3.3em;
}
@media (max-width: 720px) {
/* users have wide latitude to set arbitrary width and margin :(
"Super-specific" selector to prevent overriding this appearance by
lower level sidebars too */
body.mediawiki .sidebar {
width: 100% !important;
clear: both;
float: none !important; /* Remove when we div based; Minerva is dumb */
margin-left: 0 !important;
margin-right: 0 !important;
}
/* TODO: We might consider making all links wrap at small resolutions and then
* only introduce nowrap at higher resolutions. Do when we invert the media
* query.
*/
}
7d621b35a37807a103b59075851fe36201204ceb
Template:Div col
10
111
214
213
2023-12-24T02:07:42Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Div_col]]
wikitext
text/x-wiki
<includeonly><templatestyles src="Div col/styles.css"/><!--
--><div class="div-col {{#ifeq:{{{small|}}}|yes|div-col-small}} {{#ifeq:{{{rules|}}}|yes|div-col-rules}} {{{class|}}}" <!--
-->{{#if:{{{colwidth|}}}{{{gap|}}}{{{style|}}}|<!--
-->style="{{#if:{{{colwidth|}}}|column-width: {{{colwidth}}};}}{{#if:{{{gap|}}}|column-gap: {{{gap}}};}}{{#if:{{{style|}}}|{{{style}}}}}"<!--
-->}}><!--
-->{{#if:{{{content|}}}|{{{content}}}</div>}}<!-- Inventory how many pages use small=yes
-->{{#ifeq:{{{small|}}}|yes|[[Category:Pages using div col with small parameter]]}}<!--
--></includeonly>{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using div col with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Div col]] with unknown parameter "_VALUE_"; use colwidth= to specify column size |ignoreblank=y | class | colwidth | content | gap | rules | small | style }}<noinclude>
{{Documentation}}
</noinclude>
6e84133dd867d6c701e7b161878cf66665bb7eb7
Template:Div col/styles.css
10
112
216
215
2023-12-24T02:07:42Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Div_col/styles.css]]
sanitized-css
text/css
/* {{pp|small=yes}} */
.div-col {
margin-top: 0.3em;
column-width: 30em;
}
.div-col-small {
font-size: 90%;
}
.div-col-rules {
column-rule: 1px solid #aaa;
}
/* Reset top margin for lists in div col */
.div-col dl,
.div-col ol,
.div-col ul {
margin-top: 0;
}
/* Avoid elements breaking between columns
See also Template:No col break */
.div-col li,
.div-col dd {
page-break-inside: avoid; /* Removed from CSS in favor of break-inside c. 2020 */
break-inside: avoid-column;
}
c6c2dc0cb2bab7a5f7b4eb938eebc5c67df087bc
Template:Div col end
10
113
218
217
2023-12-24T02:07:43Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Div_col_end]]
wikitext
text/x-wiki
<includeonly></div></includeonly><noinclude>
{{Documentation|Template:Div col/doc}}
</noinclude>
78088d41c21d779e3722f220fcc9773dfbbc1e4f
Template:Yesno-no
10
114
220
219
2023-12-24T02:07:44Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Yesno-no]]
wikitext
text/x-wiki
{{safesubst:<noinclude />yesno|{{{1}}}|yes={{{yes|yes}}}|no={{{no|no}}}|blank={{{blank|no}}}|¬={{{¬|no}}}|def={{{def|no}}}}}<noinclude>
{{Documentation|Template:Yesno/doc}}
<!--Categories go in the doc page referenced above; interwikis go in Wikidata.-->
</noinclude>
1ad7b7800da1b867ead8f6ff8cef76e6201b3b56
Template:Para
10
115
222
221
2023-12-24T02:07:44Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Para]]
wikitext
text/x-wiki
<code class="tpl-para" style="word-break:break-word;{{SAFESUBST:<noinclude />#if:{{{plain|}}}|border: none; background-color: inherit;}} {{SAFESUBST:<noinclude />#if:{{{plain|}}}{{{mxt|}}}{{{green|}}}{{{!mxt|}}}{{{red|}}}|color: {{SAFESUBST:<noinclude />#if:{{{mxt|}}}{{{green|}}}|#006400|{{SAFESUBST:<noinclude />#if:{{{!mxt|}}}{{{red|}}}|#8B0000|inherit}}}};}} {{SAFESUBST:<noinclude />#if:{{{style|}}}|{{{style}}}}}">|{{SAFESUBST:<noinclude />#if:{{{1|}}}|{{{1}}}=}}{{{2|}}}</code><noinclude>
{{Documentation}}
<!--Categories and interwikis go near the bottom of the /doc subpage.-->
</noinclude>
06006deea2ed5d552aab61b4332321ab749ae7e8
Template:Documentation
10
116
224
223
2023-12-24T02:07:44Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Documentation]]
wikitext
text/x-wiki
{{#invoke:documentation|main|_content={{ {{#invoke:documentation|contentTitle}}}}}}<noinclude>
<!-- Add categories to the /doc subpage -->
</noinclude>
9e62b964e96c4e3d478edecbfcb3c0338ae8a276
Module:Documentation
828
117
226
225
2023-12-24T02:07:45Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Documentation]]
Scribunto
text/plain
-- This module implements {{documentation}}.
-- Get required modules.
local getArgs = require('Module:Arguments').getArgs
-- Get the config table.
local cfg = mw.loadData('Module:Documentation/config')
local p = {}
-- Often-used functions.
local ugsub = mw.ustring.gsub
local format = mw.ustring.format
----------------------------------------------------------------------------
-- Helper functions
--
-- These are defined as local functions, but are made available in the p
-- table for testing purposes.
----------------------------------------------------------------------------
local function message(cfgKey, valArray, expectType)
--[[
-- Gets a message from the cfg table and formats it if appropriate.
-- The function raises an error if the value from the cfg table is not
-- of the type expectType. The default type for expectType is 'string'.
-- If the table valArray is present, strings such as $1, $2 etc. in the
-- message are substituted with values from the table keys [1], [2] etc.
-- For example, if the message "foo-message" had the value 'Foo $2 bar $1.',
-- message('foo-message', {'baz', 'qux'}) would return "Foo qux bar baz."
--]]
local msg = cfg[cfgKey]
expectType = expectType or 'string'
if type(msg) ~= expectType then
error('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2)
end
if not valArray then
return msg
end
local function getMessageVal(match)
match = tonumber(match)
return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. cfgKey, 4)
end
return ugsub(msg, '$([1-9][0-9]*)', getMessageVal)
end
p.message = message
local function makeWikilink(page, display)
if display then
return format('[[%s|%s]]', page, display)
else
return format('[[%s]]', page)
end
end
p.makeWikilink = makeWikilink
local function makeCategoryLink(cat, sort)
local catns = mw.site.namespaces[14].name
return makeWikilink(catns .. ':' .. cat, sort)
end
p.makeCategoryLink = makeCategoryLink
local function makeUrlLink(url, display)
return format('[%s %s]', url, display)
end
p.makeUrlLink = makeUrlLink
local function makeToolbar(...)
local ret = {}
local lim = select('#', ...)
if lim < 1 then
return nil
end
for i = 1, lim do
ret[#ret + 1] = select(i, ...)
end
-- 'documentation-toolbar'
return format(
'<span class="%s">(%s)</span>',
message('toolbar-class'),
table.concat(ret, ' | ')
)
end
p.makeToolbar = makeToolbar
----------------------------------------------------------------------------
-- Argument processing
----------------------------------------------------------------------------
local function makeInvokeFunc(funcName)
return function (frame)
local args = getArgs(frame, {
valueFunc = function (key, value)
if type(value) == 'string' then
value = value:match('^%s*(.-)%s*$') -- Remove whitespace.
if key == 'heading' or value ~= '' then
return value
else
return nil
end
else
return value
end
end
})
return p[funcName](args)
end
end
----------------------------------------------------------------------------
-- Entry points
----------------------------------------------------------------------------
function p.nonexistent(frame)
if mw.title.getCurrentTitle().subpageText == 'testcases' then
return frame:expandTemplate{title = 'module test cases notice'}
else
return p.main(frame)
end
end
p.main = makeInvokeFunc('_main')
function p._main(args)
--[[
-- This function defines logic flow for the module.
-- @args - table of arguments passed by the user
--]]
local env = p.getEnvironment(args)
local root = mw.html.create()
root
:wikitext(p._getModuleWikitext(args, env))
:wikitext(p.protectionTemplate(env))
:wikitext(p.sandboxNotice(args, env))
:tag('div')
-- 'documentation-container'
:addClass(message('container'))
:attr('role', 'complementary')
:attr('aria-labelledby', args.heading ~= '' and 'documentation-heading' or nil)
:attr('aria-label', args.heading == '' and 'Documentation' or nil)
:newline()
:tag('div')
-- 'documentation'
:addClass(message('main-div-classes'))
:newline()
:wikitext(p._startBox(args, env))
:wikitext(p._content(args, env))
:tag('div')
-- 'documentation-clear'
:addClass(message('clear'))
:done()
:newline()
:done()
:wikitext(p._endBox(args, env))
:done()
:wikitext(p.addTrackingCategories(env))
-- 'Module:Documentation/styles.css'
return mw.getCurrentFrame():extensionTag (
'templatestyles', '', {src=cfg['templatestyles']
}) .. tostring(root)
end
----------------------------------------------------------------------------
-- Environment settings
----------------------------------------------------------------------------
function p.getEnvironment(args)
--[[
-- Returns a table with information about the environment, including title
-- objects and other namespace- or path-related data.
-- @args - table of arguments passed by the user
--
-- Title objects include:
-- env.title - the page we are making documentation for (usually the current title)
-- env.templateTitle - the template (or module, file, etc.)
-- env.docTitle - the /doc subpage.
-- env.sandboxTitle - the /sandbox subpage.
-- env.testcasesTitle - the /testcases subpage.
--
-- Data includes:
-- env.protectionLevels - the protection levels table of the title object.
-- env.subjectSpace - the number of the title's subject namespace.
-- env.docSpace - the number of the namespace the title puts its documentation in.
-- env.docpageBase - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace.
-- env.compareUrl - URL of the Special:ComparePages page comparing the sandbox with the template.
--
-- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value
-- returned will be nil.
--]]
local env, envFuncs = {}, {}
-- Set up the metatable. If triggered we call the corresponding function in the envFuncs table. The value
-- returned by that function is memoized in the env table so that we don't call any of the functions
-- more than once. (Nils won't be memoized.)
setmetatable(env, {
__index = function (t, key)
local envFunc = envFuncs[key]
if envFunc then
local success, val = pcall(envFunc)
if success then
env[key] = val -- Memoise the value.
return val
end
end
return nil
end
})
function envFuncs.title()
-- The title object for the current page, or a test page passed with args.page.
local title
local titleArg = args.page
if titleArg then
title = mw.title.new(titleArg)
else
title = mw.title.getCurrentTitle()
end
return title
end
function envFuncs.templateTitle()
--[[
-- The template (or module, etc.) title object.
-- Messages:
-- 'sandbox-subpage' --> 'sandbox'
-- 'testcases-subpage' --> 'testcases'
--]]
local subjectSpace = env.subjectSpace
local title = env.title
local subpage = title.subpageText
if subpage == message('sandbox-subpage') or subpage == message('testcases-subpage') then
return mw.title.makeTitle(subjectSpace, title.baseText)
else
return mw.title.makeTitle(subjectSpace, title.text)
end
end
function envFuncs.docTitle()
--[[
-- Title object of the /doc subpage.
-- Messages:
-- 'doc-subpage' --> 'doc'
--]]
local title = env.title
local docname = args[1] -- User-specified doc page.
local docpage
if docname then
docpage = docname
else
docpage = env.docpageBase .. '/' .. message('doc-subpage')
end
return mw.title.new(docpage)
end
function envFuncs.sandboxTitle()
--[[
-- Title object for the /sandbox subpage.
-- Messages:
-- 'sandbox-subpage' --> 'sandbox'
--]]
return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage'))
end
function envFuncs.testcasesTitle()
--[[
-- Title object for the /testcases subpage.
-- Messages:
-- 'testcases-subpage' --> 'testcases'
--]]
return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage'))
end
function envFuncs.protectionLevels()
-- The protection levels table of the title object.
return env.title.protectionLevels
end
function envFuncs.subjectSpace()
-- The subject namespace number.
return mw.site.namespaces[env.title.namespace].subject.id
end
function envFuncs.docSpace()
-- The documentation namespace number. For most namespaces this is the
-- same as the subject namespace. However, pages in the Article, File,
-- MediaWiki or Category namespaces must have their /doc, /sandbox and
-- /testcases pages in talk space.
local subjectSpace = env.subjectSpace
if subjectSpace == 0 or subjectSpace == 6 or subjectSpace == 8 or subjectSpace == 14 then
return subjectSpace + 1
else
return subjectSpace
end
end
function envFuncs.docpageBase()
-- The base page of the /doc, /sandbox, and /testcases subpages.
-- For some namespaces this is the talk page, rather than the template page.
local templateTitle = env.templateTitle
local docSpace = env.docSpace
local docSpaceText = mw.site.namespaces[docSpace].name
-- Assemble the link. docSpace is never the main namespace, so we can hardcode the colon.
return docSpaceText .. ':' .. templateTitle.text
end
function envFuncs.compareUrl()
-- Diff link between the sandbox and the main template using [[Special:ComparePages]].
local templateTitle = env.templateTitle
local sandboxTitle = env.sandboxTitle
if templateTitle.exists and sandboxTitle.exists then
local compareUrl = mw.uri.canonicalUrl(
'Special:ComparePages',
{ page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText}
)
return tostring(compareUrl)
else
return nil
end
end
return env
end
----------------------------------------------------------------------------
-- Auxiliary templates
----------------------------------------------------------------------------
p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')
function p._getModuleWikitext(args, env)
local currentTitle = mw.title.getCurrentTitle()
if currentTitle.contentModel ~= 'Scribunto' then return end
pcall(require, currentTitle.prefixedText) -- if it fails, we don't care
local moduleWikitext = package.loaded["Module:Module wikitext"]
if moduleWikitext then
return moduleWikitext.main()
end
end
function p.sandboxNotice(args, env)
--[=[
-- Generates a sandbox notice for display above sandbox pages.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'sandbox-notice-image' --> '[[File:Sandbox.svg|50px|alt=|link=]]'
-- 'sandbox-notice-blurb' --> 'This is the $1 for $2.'
-- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).'
-- 'sandbox-notice-pagetype-template' --> '[[Wikipedia:Template test cases|template sandbox]] page'
-- 'sandbox-notice-pagetype-module' --> '[[Wikipedia:Template test cases|module sandbox]] page'
-- 'sandbox-notice-pagetype-other' --> 'sandbox page'
-- 'sandbox-notice-compare-link-display' --> 'diff'
-- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.'
-- 'sandbox-notice-testcases-link-display' --> 'test cases'
-- 'sandbox-category' --> 'Template sandboxes'
-- 'module-sandbox-category' --> 'Module sandboxes'
-- 'other-sandbox-category' --> 'Sandboxes outside of template or module namespace'
--]=]
local title = env.title
local sandboxTitle = env.sandboxTitle
local templateTitle = env.templateTitle
local subjectSpace = env.subjectSpace
if not (subjectSpace and title and sandboxTitle and templateTitle
and mw.title.equals(title, sandboxTitle)) then
return nil
end
-- Build the table of arguments to pass to {{ombox}}. We need just two fields, "image" and "text".
local omargs = {}
omargs.image = message('sandbox-notice-image')
-- Get the text. We start with the opening blurb, which is something like
-- "This is the template sandbox for [[Template:Foo]] (diff)."
local text = ''
local pagetype, sandboxCat
if subjectSpace == 10 then
pagetype = message('sandbox-notice-pagetype-template')
sandboxCat = message('sandbox-category')
elseif subjectSpace == 828 then
pagetype = message('sandbox-notice-pagetype-module')
sandboxCat = message('module-sandbox-category')
else
pagetype = message('sandbox-notice-pagetype-other')
sandboxCat = message('other-sandbox-category')
end
local templateLink = makeWikilink(templateTitle.prefixedText)
local compareUrl = env.compareUrl
if compareUrl then
local compareDisplay = message('sandbox-notice-compare-link-display')
local compareLink = makeUrlLink(compareUrl, compareDisplay)
text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink})
else
text = text .. message('sandbox-notice-blurb', {pagetype, templateLink})
end
-- Get the test cases page blurb if the page exists. This is something like
-- "See also the companion subpage for [[Template:Foo/testcases|test cases]]."
local testcasesTitle = env.testcasesTitle
if testcasesTitle and testcasesTitle.exists then
if testcasesTitle.contentModel == "Scribunto" then
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink})
else
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink})
end
end
-- Add the sandbox to the sandbox category.
omargs.text = text .. makeCategoryLink(sandboxCat)
-- 'documentation-clear'
return '<div class="' .. message('clear') .. '"></div>'
.. require('Module:Message box').main('ombox', omargs)
end
function p.protectionTemplate(env)
-- Generates the padlock icon in the top right.
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'protection-template' --> 'pp-template'
-- 'protection-template-args' --> {docusage = 'yes'}
local protectionLevels = env.protectionLevels
if not protectionLevels then
return nil
end
local editProt = protectionLevels.edit and protectionLevels.edit[1]
local moveProt = protectionLevels.move and protectionLevels.move[1]
if editProt then
-- The page is edit-protected.
return require('Module:Protection banner')._main{
message('protection-reason-edit'), small = true
}
elseif moveProt and moveProt ~= 'autoconfirmed' then
-- The page is move-protected but not edit-protected. Exclude move
-- protection with the level "autoconfirmed", as this is equivalent to
-- no move protection at all.
return require('Module:Protection banner')._main{
action = 'move', small = true
}
else
return nil
end
end
----------------------------------------------------------------------------
-- Start box
----------------------------------------------------------------------------
p.startBox = makeInvokeFunc('_startBox')
function p._startBox(args, env)
--[[
-- This function generates the start box.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- The actual work is done by p.makeStartBoxLinksData and p.renderStartBoxLinks which make
-- the [view] [edit] [history] [purge] links, and by p.makeStartBoxData and p.renderStartBox
-- which generate the box HTML.
--]]
env = env or p.getEnvironment(args)
local links
local content = args.content
if not content or args[1] then
-- No need to include the links if the documentation is on the template page itself.
local linksData = p.makeStartBoxLinksData(args, env)
if linksData then
links = p.renderStartBoxLinks(linksData)
end
end
-- Generate the start box html.
local data = p.makeStartBoxData(args, env, links)
if data then
return p.renderStartBox(data)
else
-- User specified no heading.
return nil
end
end
function p.makeStartBoxLinksData(args, env)
--[[
-- Does initial processing of data to make the [view] [edit] [history] [purge] links.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'view-link-display' --> 'view'
-- 'edit-link-display' --> 'edit'
-- 'history-link-display' --> 'history'
-- 'purge-link-display' --> 'purge'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'docpage-preload' --> 'Template:Documentation/preload'
-- 'create-link-display' --> 'create'
--]]
local subjectSpace = env.subjectSpace
local title = env.title
local docTitle = env.docTitle
if not title or not docTitle then
return nil
end
if docTitle.isRedirect then
docTitle = docTitle.redirectTarget
end
-- Create link if /doc doesn't exist.
local preload = args.preload
if not preload then
if subjectSpace == 828 then -- Module namespace
preload = message('module-preload')
else
preload = message('docpage-preload')
end
end
return {
title = title,
docTitle = docTitle,
-- View, display, edit, and purge links if /doc exists.
viewLinkDisplay = message('view-link-display'),
editLinkDisplay = message('edit-link-display'),
historyLinkDisplay = message('history-link-display'),
purgeLinkDisplay = message('purge-link-display'),
preload = preload,
createLinkDisplay = message('create-link-display')
}
end
function p.renderStartBoxLinks(data)
--[[
-- Generates the [view][edit][history][purge] or [create][purge] links from the data table.
-- @data - a table of data generated by p.makeStartBoxLinksData
--]]
local docTitle = data.docTitle
-- yes, we do intend to purge the template page on which the documentation appears
local purgeLink = makeWikilink("Special:Purge/" .. data.title.prefixedText, data.purgeLinkDisplay)
if docTitle.exists then
local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay)
local editLink = makeWikilink("Special:EditPage/" .. docTitle.prefixedText, data.editLinkDisplay)
local historyLink = makeWikilink("Special:PageHistory/" .. docTitle.prefixedText, data.historyLinkDisplay)
return "[" .. viewLink .. "] [" .. editLink .. "] [" .. historyLink .. "] [" .. purgeLink .. "]"
else
local createLink = makeUrlLink(docTitle:canonicalUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay)
return "[" .. createLink .. "] [" .. purgeLink .. "]"
end
return ret
end
function p.makeStartBoxData(args, env, links)
--[=[
-- Does initial processing of data to pass to the start-box render function, p.renderStartBox.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error.
--
-- Messages:
-- 'documentation-icon-wikitext' --> '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]'
-- 'template-namespace-heading' --> 'Template documentation'
-- 'module-namespace-heading' --> 'Module documentation'
-- 'file-namespace-heading' --> 'Summary'
-- 'other-namespaces-heading' --> 'Documentation'
-- 'testcases-create-link-display' --> 'create'
--]=]
local subjectSpace = env.subjectSpace
if not subjectSpace then
-- Default to an "other namespaces" namespace, so that we get at least some output
-- if an error occurs.
subjectSpace = 2
end
local data = {}
-- Heading
local heading = args.heading -- Blank values are not removed.
if heading == '' then
-- Don't display the start box if the heading arg is defined but blank.
return nil
end
if heading then
data.heading = heading
elseif subjectSpace == 10 then -- Template namespace
data.heading = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading')
elseif subjectSpace == 828 then -- Module namespace
data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading')
elseif subjectSpace == 6 then -- File namespace
data.heading = message('file-namespace-heading')
else
data.heading = message('other-namespaces-heading')
end
-- Heading CSS
local headingStyle = args['heading-style']
if headingStyle then
data.headingStyleText = headingStyle
else
-- 'documentation-heading'
data.headingClass = message('main-div-heading-class')
end
-- Data for the [view][edit][history][purge] or [create] links.
if links then
-- 'mw-editsection-like plainlinks'
data.linksClass = message('start-box-link-classes')
data.links = links
end
return data
end
function p.renderStartBox(data)
-- Renders the start box html.
-- @data - a table of data generated by p.makeStartBoxData.
local sbox = mw.html.create('div')
sbox
-- 'documentation-startbox'
:addClass(message('start-box-class'))
:newline()
:tag('span')
:addClass(data.headingClass)
:attr('id', 'documentation-heading')
:cssText(data.headingStyleText)
:wikitext(data.heading)
local links = data.links
if links then
sbox:tag('span')
:addClass(data.linksClass)
:attr('id', data.linksId)
:wikitext(links)
end
return tostring(sbox)
end
----------------------------------------------------------------------------
-- Documentation content
----------------------------------------------------------------------------
p.content = makeInvokeFunc('_content')
function p._content(args, env)
-- Displays the documentation contents
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
local content = args.content
if not content and docTitle and docTitle.exists then
content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText}
end
-- The line breaks below are necessary so that "=== Headings ===" at the start and end
-- of docs are interpreted correctly.
return '\n' .. (content or '') .. '\n'
end
p.contentTitle = makeInvokeFunc('_contentTitle')
function p._contentTitle(args, env)
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
if not args.content and docTitle and docTitle.exists then
return docTitle.prefixedText
else
return ''
end
end
----------------------------------------------------------------------------
-- End box
----------------------------------------------------------------------------
p.endBox = makeInvokeFunc('_endBox')
function p._endBox(args, env)
--[=[
-- This function generates the end box (also known as the link box).
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
--]=]
-- Get environment data.
env = env or p.getEnvironment(args)
local subjectSpace = env.subjectSpace
local docTitle = env.docTitle
if not subjectSpace or not docTitle then
return nil
end
-- Check whether we should output the end box at all. Add the end
-- box by default if the documentation exists or if we are in the
-- user, module or template namespaces.
local linkBox = args['link box']
if linkBox == 'off'
or not (
docTitle.exists
or subjectSpace == 2
or subjectSpace == 828
or subjectSpace == 10
)
then
return nil
end
-- Assemble the link box.
local text = ''
if linkBox then
text = text .. linkBox
else
text = text .. (p.makeDocPageBlurb(args, env) or '') -- "This documentation is transcluded from [[Foo]]."
if subjectSpace == 2 or subjectSpace == 10 or subjectSpace == 828 then
-- We are in the user, template or module namespaces.
-- Add sandbox and testcases links.
-- "Editors can experiment in this template's sandbox and testcases pages."
text = text .. (p.makeExperimentBlurb(args, env) or '') .. '<br />'
if not args.content and not args[1] then
-- "Please add categories to the /doc subpage."
-- Don't show this message with inline docs or with an explicitly specified doc page,
-- as then it is unclear where to add the categories.
text = text .. (p.makeCategoriesBlurb(args, env) or '')
end
text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or '') --"Subpages of this template"
end
end
local box = mw.html.create('div')
-- 'documentation-metadata'
box:attr('role', 'note')
:addClass(message('end-box-class'))
-- 'plainlinks'
:addClass(message('end-box-plainlinks'))
:wikitext(text)
:done()
return '\n' .. tostring(box)
end
function p.makeDocPageBlurb(args, env)
--[=[
-- Makes the blurb "This documentation is transcluded from [[Template:Foo]] (edit, history)".
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'edit-link-display' --> 'edit'
-- 'history-link-display' --> 'history'
-- 'transcluded-from-blurb' -->
-- 'The above [[Wikipedia:Template documentation|documentation]]
-- is [[Help:Transclusion|transcluded]] from $1.'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'create-link-display' --> 'create'
-- 'create-module-doc-blurb' -->
-- 'You might want to $1 a documentation page for this [[Wikipedia:Lua|Scribunto module]].'
--]=]
local docTitle = env.docTitle
if not docTitle then
return nil
end
local ret
if docTitle.exists then
-- /doc exists; link to it.
local docLink = makeWikilink(docTitle.prefixedText)
local editDisplay = message('edit-link-display')
local editLink = makeWikilink("Special:EditPage/" .. docTitle.prefixedText, editDisplay)
local historyDisplay = message('history-link-display')
local historyLink = makeWikilink("Special:PageHistory/" .. docTitle.prefixedText, historyDisplay)
ret = message('transcluded-from-blurb', {docLink})
.. ' '
.. makeToolbar(editLink, historyLink)
.. '<br />'
elseif env.subjectSpace == 828 then
-- /doc does not exist; ask to create it.
local createUrl = docTitle:canonicalUrl{action = 'edit', preload = message('module-preload')}
local createDisplay = message('create-link-display')
local createLink = makeUrlLink(createUrl, createDisplay)
ret = message('create-module-doc-blurb', {createLink})
.. '<br />'
end
return ret
end
function p.makeExperimentBlurb(args, env)
--[[
-- Renders the text "Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages."
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'sandbox-link-display' --> 'sandbox'
-- 'sandbox-edit-link-display' --> 'edit'
-- 'compare-link-display' --> 'diff'
-- 'module-sandbox-preload' --> 'Template:Documentation/preload-module-sandbox'
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'
-- 'sandbox-create-link-display' --> 'create'
-- 'mirror-edit-summary' --> 'Create sandbox version of $1'
-- 'mirror-link-display' --> 'mirror'
-- 'mirror-link-preload' --> 'Template:Documentation/mirror'
-- 'sandbox-link-display' --> 'sandbox'
-- 'testcases-link-display' --> 'testcases'
-- 'testcases-edit-link-display'--> 'edit'
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'
-- 'testcases-create-link-display' --> 'create'
-- 'testcases-link-display' --> 'testcases'
-- 'testcases-edit-link-display' --> 'edit'
-- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases'
-- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases'
-- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.'
-- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.'
--]]
local subjectSpace = env.subjectSpace
local templateTitle = env.templateTitle
local sandboxTitle = env.sandboxTitle
local testcasesTitle = env.testcasesTitle
local templatePage = templateTitle.prefixedText
if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then
return nil
end
-- Make links.
local sandboxLinks, testcasesLinks
if sandboxTitle.exists then
local sandboxPage = sandboxTitle.prefixedText
local sandboxDisplay = message('sandbox-link-display')
local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay)
local sandboxEditDisplay = message('sandbox-edit-link-display')
local sandboxEditLink = makeWikilink("Special:EditPage/" .. sandboxPage, sandboxEditDisplay)
local compareUrl = env.compareUrl
local compareLink
if compareUrl then
local compareDisplay = message('compare-link-display')
compareLink = makeUrlLink(compareUrl, compareDisplay)
end
sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink)
else
local sandboxPreload
if subjectSpace == 828 then
sandboxPreload = message('module-sandbox-preload')
else
sandboxPreload = message('template-sandbox-preload')
end
local sandboxCreateUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = sandboxPreload}
local sandboxCreateDisplay = message('sandbox-create-link-display')
local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay)
local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)})
local mirrorPreload = message('mirror-link-preload')
local mirrorUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary}
if subjectSpace == 828 then
mirrorUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary}
end
local mirrorDisplay = message('mirror-link-display')
local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay)
sandboxLinks = message('sandbox-link-display') .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink)
end
if testcasesTitle.exists then
local testcasesPage = testcasesTitle.prefixedText
local testcasesDisplay = message('testcases-link-display')
local testcasesLink = makeWikilink(testcasesPage, testcasesDisplay)
local testcasesEditUrl = testcasesTitle:canonicalUrl{action = 'edit'}
local testcasesEditDisplay = message('testcases-edit-link-display')
local testcasesEditLink = makeWikilink("Special:EditPage/" .. testcasesPage, testcasesEditDisplay)
-- for Modules, add testcases run link if exists
if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then
local testcasesRunLinkDisplay = message('testcases-run-link-display')
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink)
else
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink)
end
else
local testcasesPreload
if subjectSpace == 828 then
testcasesPreload = message('module-testcases-preload')
else
testcasesPreload = message('template-testcases-preload')
end
local testcasesCreateUrl = testcasesTitle:canonicalUrl{action = 'edit', preload = testcasesPreload}
local testcasesCreateDisplay = message('testcases-create-link-display')
local testcasesCreateLink = makeUrlLink(testcasesCreateUrl, testcasesCreateDisplay)
testcasesLinks = message('testcases-link-display') .. ' ' .. makeToolbar(testcasesCreateLink)
end
local messageName
if subjectSpace == 828 then
messageName = 'experiment-blurb-module'
else
messageName = 'experiment-blurb-template'
end
return message(messageName, {sandboxLinks, testcasesLinks})
end
function p.makeCategoriesBlurb(args, env)
--[[
-- Generates the text "Please add categories to the /doc subpage."
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'doc-link-display' --> '/doc'
-- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.'
--]]
local docTitle = env.docTitle
if not docTitle then
return nil
end
local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display'))
return message('add-categories-blurb', {docPathLink})
end
function p.makeSubpagesBlurb(args, env)
--[[
-- Generates the "Subpages of this template" link.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'template-pagetype' --> 'template'
-- 'module-pagetype' --> 'module'
-- 'default-pagetype' --> 'page'
-- 'subpages-link-display' --> 'Subpages of this $1'
--]]
local subjectSpace = env.subjectSpace
local templateTitle = env.templateTitle
if not subjectSpace or not templateTitle then
return nil
end
local pagetype
if subjectSpace == 10 then
pagetype = message('template-pagetype')
elseif subjectSpace == 828 then
pagetype = message('module-pagetype')
else
pagetype = message('default-pagetype')
end
local subpagesLink = makeWikilink(
'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/',
message('subpages-link-display', {pagetype})
)
return message('subpages-blurb', {subpagesLink})
end
----------------------------------------------------------------------------
-- Tracking categories
----------------------------------------------------------------------------
function p.addTrackingCategories(env)
--[[
-- Check if {{documentation}} is transcluded on a /doc or /testcases page.
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'display-strange-usage-category' --> true
-- 'doc-subpage' --> 'doc'
-- 'testcases-subpage' --> 'testcases'
-- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage'
--
-- /testcases pages in the module namespace are not categorised, as they may have
-- {{documentation}} transcluded automatically.
--]]
local title = env.title
local subjectSpace = env.subjectSpace
if not title or not subjectSpace then
return nil
end
local subpage = title.subpageText
local ret = ''
if message('display-strange-usage-category', nil, 'boolean')
and (
subpage == message('doc-subpage')
or subjectSpace ~= 828 and subpage == message('testcases-subpage')
)
then
ret = ret .. makeCategoryLink(message('strange-usage-category'))
end
return ret
end
return p
0f0f558e631e573a8b022c2a20bfc47c4137d640
Module:Documentation/config
828
118
228
227
2023-12-24T02:07:46Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Documentation/config]]
Scribunto
text/plain
----------------------------------------------------------------------------------------------------
--
-- Configuration for Module:Documentation
--
-- Here you can set the values of the parameters and messages used in Module:Documentation to
-- localise it to your wiki and your language. Unless specified otherwise, values given here
-- should be string values.
----------------------------------------------------------------------------------------------------
local cfg = {} -- Do not edit this line.
----------------------------------------------------------------------------------------------------
-- Protection template configuration
----------------------------------------------------------------------------------------------------
-- cfg['protection-reason-edit']
-- The protection reason for edit-protected templates to pass to
-- [[Module:Protection banner]].
cfg['protection-reason-edit'] = 'template'
--[[
----------------------------------------------------------------------------------------------------
-- Sandbox notice configuration
--
-- On sandbox pages the module can display a template notifying users that the current page is a
-- sandbox, and the location of test cases pages, etc. The module decides whether the page is a
-- sandbox or not based on the value of cfg['sandbox-subpage']. The following settings configure the
-- messages that the notices contains.
----------------------------------------------------------------------------------------------------
--]]
-- cfg['sandbox-notice-image']
-- The image displayed in the sandbox notice.
cfg['sandbox-notice-image'] = '[[File:Sandbox.svg|50px|alt=|link=]]'
--[[
-- cfg['sandbox-notice-pagetype-template']
-- cfg['sandbox-notice-pagetype-module']
-- cfg['sandbox-notice-pagetype-other']
-- The page type of the sandbox page. The message that is displayed depends on the current subject
-- namespace. This message is used in either cfg['sandbox-notice-blurb'] or
-- cfg['sandbox-notice-diff-blurb'].
--]]
cfg['sandbox-notice-pagetype-template'] = '[[Wikipedia:Template test cases|template sandbox]] page'
cfg['sandbox-notice-pagetype-module'] = '[[Wikipedia:Template test cases|module sandbox]] page'
cfg['sandbox-notice-pagetype-other'] = 'sandbox page'
--[[
-- cfg['sandbox-notice-blurb']
-- cfg['sandbox-notice-diff-blurb']
-- cfg['sandbox-notice-diff-display']
-- Either cfg['sandbox-notice-blurb'] or cfg['sandbox-notice-diff-blurb'] is the opening sentence
-- of the sandbox notice. The latter has a diff link, but the former does not. $1 is the page
-- type, which is either cfg['sandbox-notice-pagetype-template'],
-- cfg['sandbox-notice-pagetype-module'] or cfg['sandbox-notice-pagetype-other'] depending what
-- namespace we are in. $2 is a link to the main template page, and $3 is a diff link between
-- the sandbox and the main template. The display value of the diff link is set by
-- cfg['sandbox-notice-compare-link-display'].
--]]
cfg['sandbox-notice-blurb'] = 'This is the $1 for $2.'
cfg['sandbox-notice-diff-blurb'] = 'This is the $1 for $2 ($3).'
cfg['sandbox-notice-compare-link-display'] = 'diff'
--[[
-- cfg['sandbox-notice-testcases-blurb']
-- cfg['sandbox-notice-testcases-link-display']
-- cfg['sandbox-notice-testcases-run-blurb']
-- cfg['sandbox-notice-testcases-run-link-display']
-- cfg['sandbox-notice-testcases-blurb'] is a sentence notifying the user that there is a test cases page
-- corresponding to this sandbox that they can edit. $1 is a link to the test cases page.
-- cfg['sandbox-notice-testcases-link-display'] is the display value for that link.
-- cfg['sandbox-notice-testcases-run-blurb'] is a sentence notifying the user that there is a test cases page
-- corresponding to this sandbox that they can edit, along with a link to run it. $1 is a link to the test
-- cases page, and $2 is a link to the page to run it.
-- cfg['sandbox-notice-testcases-run-link-display'] is the display value for the link to run the test
-- cases.
--]]
cfg['sandbox-notice-testcases-blurb'] = 'See also the companion subpage for $1.'
cfg['sandbox-notice-testcases-link-display'] = 'test cases'
cfg['sandbox-notice-testcases-run-blurb'] = 'See also the companion subpage for $1 ($2).'
cfg['sandbox-notice-testcases-run-link-display'] = 'run'
-- cfg['sandbox-category'] - A category to add to all template sandboxes.
-- cfg['module-sandbox-category'] - A category to add to all module sandboxes.
-- cfg['module-sandbox-category'] - A category to add to all sandboxe not in templates or modules.
cfg['sandbox-category'] = 'Template sandboxes'
cfg['module-sandbox-category'] = 'Module sandboxes'
cfg['other-sandbox-category'] = 'Sandboxes outside of template or module namespace'
----------------------------------------------------------------------------------------------------
-- Start box configuration
----------------------------------------------------------------------------------------------------
-- cfg['documentation-icon-wikitext']
-- The wikitext for the icon shown at the top of the template.
cfg['documentation-icon-wikitext'] = '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]'
-- cfg['template-namespace-heading']
-- The heading shown in the template namespace.
cfg['template-namespace-heading'] = 'Template documentation'
-- cfg['module-namespace-heading']
-- The heading shown in the module namespace.
cfg['module-namespace-heading'] = 'Module documentation'
-- cfg['file-namespace-heading']
-- The heading shown in the file namespace.
cfg['file-namespace-heading'] = 'Summary'
-- cfg['other-namespaces-heading']
-- The heading shown in other namespaces.
cfg['other-namespaces-heading'] = 'Documentation'
-- cfg['view-link-display']
-- The text to display for "view" links.
cfg['view-link-display'] = 'view'
-- cfg['edit-link-display']
-- The text to display for "edit" links.
cfg['edit-link-display'] = 'edit'
-- cfg['history-link-display']
-- The text to display for "history" links.
cfg['history-link-display'] = 'history'
-- cfg['purge-link-display']
-- The text to display for "purge" links.
cfg['purge-link-display'] = 'purge'
-- cfg['create-link-display']
-- The text to display for "create" links.
cfg['create-link-display'] = 'create'
----------------------------------------------------------------------------------------------------
-- Link box (end box) configuration
----------------------------------------------------------------------------------------------------
-- cfg['transcluded-from-blurb']
-- Notice displayed when the docs are transcluded from another page. $1 is a wikilink to that page.
cfg['transcluded-from-blurb'] = 'The above [[Wikipedia:Template documentation|documentation]] is [[Help:Transclusion|transcluded]] from $1.'
--[[
-- cfg['create-module-doc-blurb']
-- Notice displayed in the module namespace when the documentation subpage does not exist.
-- $1 is a link to create the documentation page with the preload cfg['module-preload'] and the
-- display cfg['create-link-display'].
--]]
cfg['create-module-doc-blurb'] = 'You might want to $1 a documentation page for this [[Wikipedia:Lua|Scribunto module]].'
----------------------------------------------------------------------------------------------------
-- Experiment blurb configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['experiment-blurb-template']
-- cfg['experiment-blurb-module']
-- The experiment blurb is the text inviting editors to experiment in sandbox and test cases pages.
-- It is only shown in the template and module namespaces. With the default English settings, it
-- might look like this:
--
-- Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.
--
-- In this example, "sandbox", "edit", "diff", "testcases", and "edit" would all be links.
--
-- There are two versions, cfg['experiment-blurb-template'] and cfg['experiment-blurb-module'], depending
-- on what namespace we are in.
--
-- Parameters:
--
-- $1 is a link to the sandbox page. If the sandbox exists, it is in the following format:
--
-- cfg['sandbox-link-display'] (cfg['sandbox-edit-link-display'] | cfg['compare-link-display'])
--
-- If the sandbox doesn't exist, it is in the format:
--
-- cfg['sandbox-link-display'] (cfg['sandbox-create-link-display'] | cfg['mirror-link-display'])
--
-- The link for cfg['sandbox-create-link-display'] link preloads the page with cfg['template-sandbox-preload']
-- or cfg['module-sandbox-preload'], depending on the current namespace. The link for cfg['mirror-link-display']
-- loads a default edit summary of cfg['mirror-edit-summary'].
--
-- $2 is a link to the test cases page. If the test cases page exists, it is in the following format:
--
-- cfg['testcases-link-display'] (cfg['testcases-edit-link-display'] | cfg['testcases-run-link-display'])
--
-- If the test cases page doesn't exist, it is in the format:
--
-- cfg['testcases-link-display'] (cfg['testcases-create-link-display'])
--
-- If the test cases page doesn't exist, the link for cfg['testcases-create-link-display'] preloads the
-- page with cfg['template-testcases-preload'] or cfg['module-testcases-preload'], depending on the current
-- namespace.
--]]
cfg['experiment-blurb-template'] = "Editors can experiment in this template's $1 and $2 pages."
cfg['experiment-blurb-module'] = "Editors can experiment in this module's $1 and $2 pages."
----------------------------------------------------------------------------------------------------
-- Sandbox link configuration
----------------------------------------------------------------------------------------------------
-- cfg['sandbox-subpage']
-- The name of the template subpage typically used for sandboxes.
cfg['sandbox-subpage'] = 'sandbox'
-- cfg['template-sandbox-preload']
-- Preload file for template sandbox pages.
cfg['template-sandbox-preload'] = 'Template:Documentation/preload-sandbox'
-- cfg['module-sandbox-preload']
-- Preload file for Lua module sandbox pages.
cfg['module-sandbox-preload'] = 'Template:Documentation/preload-module-sandbox'
-- cfg['sandbox-link-display']
-- The text to display for "sandbox" links.
cfg['sandbox-link-display'] = 'sandbox'
-- cfg['sandbox-edit-link-display']
-- The text to display for sandbox "edit" links.
cfg['sandbox-edit-link-display'] = 'edit'
-- cfg['sandbox-create-link-display']
-- The text to display for sandbox "create" links.
cfg['sandbox-create-link-display'] = 'create'
-- cfg['compare-link-display']
-- The text to display for "compare" links.
cfg['compare-link-display'] = 'diff'
-- cfg['mirror-edit-summary']
-- The default edit summary to use when a user clicks the "mirror" link. $1 is a wikilink to the
-- template page.
cfg['mirror-edit-summary'] = 'Create sandbox version of $1'
-- cfg['mirror-link-display']
-- The text to display for "mirror" links.
cfg['mirror-link-display'] = 'mirror'
-- cfg['mirror-link-preload']
-- The page to preload when a user clicks the "mirror" link.
cfg['mirror-link-preload'] = 'Template:Documentation/mirror'
----------------------------------------------------------------------------------------------------
-- Test cases link configuration
----------------------------------------------------------------------------------------------------
-- cfg['testcases-subpage']
-- The name of the template subpage typically used for test cases.
cfg['testcases-subpage'] = 'testcases'
-- cfg['template-testcases-preload']
-- Preload file for template test cases pages.
cfg['template-testcases-preload'] = 'Template:Documentation/preload-testcases'
-- cfg['module-testcases-preload']
-- Preload file for Lua module test cases pages.
cfg['module-testcases-preload'] = 'Template:Documentation/preload-module-testcases'
-- cfg['testcases-link-display']
-- The text to display for "testcases" links.
cfg['testcases-link-display'] = 'testcases'
-- cfg['testcases-edit-link-display']
-- The text to display for test cases "edit" links.
cfg['testcases-edit-link-display'] = 'edit'
-- cfg['testcases-run-link-display']
-- The text to display for test cases "run" links.
cfg['testcases-run-link-display'] = 'run'
-- cfg['testcases-create-link-display']
-- The text to display for test cases "create" links.
cfg['testcases-create-link-display'] = 'create'
----------------------------------------------------------------------------------------------------
-- Add categories blurb configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['add-categories-blurb']
-- Text to direct users to add categories to the /doc subpage. Not used if the "content" or
-- "docname fed" arguments are set, as then it is not clear where to add the categories. $1 is a
-- link to the /doc subpage with a display value of cfg['doc-link-display'].
--]]
cfg['add-categories-blurb'] = 'Add categories to the $1 subpage.'
-- cfg['doc-link-display']
-- The text to display when linking to the /doc subpage.
cfg['doc-link-display'] = '/doc'
----------------------------------------------------------------------------------------------------
-- Subpages link configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['subpages-blurb']
-- The "Subpages of this template" blurb. $1 is a link to the main template's subpages with a
-- display value of cfg['subpages-link-display']. In the English version this blurb is simply
-- the link followed by a period, and the link display provides the actual text.
--]]
cfg['subpages-blurb'] = '$1.'
--[[
-- cfg['subpages-link-display']
-- The text to display for the "subpages of this page" link. $1 is cfg['template-pagetype'],
-- cfg['module-pagetype'] or cfg['default-pagetype'], depending on whether the current page is in
-- the template namespace, the module namespace, or another namespace.
--]]
cfg['subpages-link-display'] = 'Subpages of this $1'
-- cfg['template-pagetype']
-- The pagetype to display for template pages.
cfg['template-pagetype'] = 'template'
-- cfg['module-pagetype']
-- The pagetype to display for Lua module pages.
cfg['module-pagetype'] = 'module'
-- cfg['default-pagetype']
-- The pagetype to display for pages other than templates or Lua modules.
cfg['default-pagetype'] = 'page'
----------------------------------------------------------------------------------------------------
-- Doc link configuration
----------------------------------------------------------------------------------------------------
-- cfg['doc-subpage']
-- The name of the subpage typically used for documentation pages.
cfg['doc-subpage'] = 'doc'
-- cfg['docpage-preload']
-- Preload file for template documentation pages in all namespaces.
cfg['docpage-preload'] = 'Template:Documentation/preload'
-- cfg['module-preload']
-- Preload file for Lua module documentation pages.
cfg['module-preload'] = 'Template:Documentation/preload-module-doc'
----------------------------------------------------------------------------------------------------
-- HTML and CSS configuration
----------------------------------------------------------------------------------------------------
-- cfg['templatestyles']
-- The name of the TemplateStyles page where CSS is kept.
-- Sandbox CSS will be at Module:Documentation/sandbox/styles.css when needed.
cfg['templatestyles'] = 'Module:Documentation/styles.css'
-- cfg['container']
-- Class which can be used to set flex or grid CSS on the
-- two child divs documentation and documentation-metadata
cfg['container'] = 'documentation-container'
-- cfg['main-div-classes']
-- Classes added to the main HTML "div" tag.
cfg['main-div-classes'] = 'documentation'
-- cfg['main-div-heading-class']
-- Class for the main heading for templates and modules and assoc. talk spaces
cfg['main-div-heading-class'] = 'documentation-heading'
-- cfg['start-box-class']
-- Class for the start box
cfg['start-box-class'] = 'documentation-startbox'
-- cfg['start-box-link-classes']
-- Classes used for the [view][edit][history] or [create] links in the start box.
-- mw-editsection-like is per [[Wikipedia:Village pump (technical)/Archive 117]]
cfg['start-box-link-classes'] = 'mw-editsection-like plainlinks'
-- cfg['end-box-class']
-- Class for the end box.
cfg['end-box-class'] = 'documentation-metadata'
-- cfg['end-box-plainlinks']
-- Plainlinks
cfg['end-box-plainlinks'] = 'plainlinks'
-- cfg['toolbar-class']
-- Class added for toolbar links.
cfg['toolbar-class'] = 'documentation-toolbar'
-- cfg['clear']
-- Just used to clear things.
cfg['clear'] = 'documentation-clear'
----------------------------------------------------------------------------------------------------
-- Tracking category configuration
----------------------------------------------------------------------------------------------------
-- cfg['display-strange-usage-category']
-- Set to true to enable output of cfg['strange-usage-category'] if the module is used on a /doc subpage
-- or a /testcases subpage. This should be a boolean value (either true or false).
cfg['display-strange-usage-category'] = true
-- cfg['strange-usage-category']
-- Category to output if cfg['display-strange-usage-category'] is set to true and the module is used on a
-- /doc subpage or a /testcases subpage.
cfg['strange-usage-category'] = 'Wikipedia pages with strange ((documentation)) usage'
--[[
----------------------------------------------------------------------------------------------------
-- End configuration
--
-- Don't edit anything below this line.
----------------------------------------------------------------------------------------------------
--]]
return cfg
56b6127664e31128dea1cecf2e392cf9313df6a3
Module:Documentation/styles.css
828
119
230
229
2023-12-24T02:07:46Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Documentation/styles.css]]
sanitized-css
text/css
/* {{pp|small=yes}} */
.documentation,
.documentation-metadata {
border: 1px solid #a2a9b1;
background-color: #ecfcf4;
clear: both;
}
.documentation {
margin: 1em 0 0 0;
padding: 1em;
}
.documentation-metadata {
margin: 0.2em 0; /* same margin left-right as .documentation */
font-style: italic;
padding: 0.4em 1em; /* same padding left-right as .documentation */
}
.documentation-startbox {
padding-bottom: 3px;
border-bottom: 1px solid #aaa;
margin-bottom: 1ex;
}
.documentation-heading {
font-weight: bold;
font-size: 125%;
}
.documentation-clear { /* Don't want things to stick out where they shouldn't. */
clear: both;
}
.documentation-toolbar {
font-style: normal;
font-size: 85%;
}
ce0e629c92e3d825ab9fd927fe6cc37d9117b6cb
Template:Sandbox other
10
120
232
231
2023-12-24T02:07:49Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Sandbox_other]]
wikitext
text/x-wiki
{{#if:{{#ifeq:{{#invoke:String|sublength|s={{SUBPAGENAME}}|i=0|len=7}}|sandbox|1}}{{#ifeq:{{SUBPAGENAME}}|doc|1}}{{#invoke:String|match|{{PAGENAME}}|/sandbox/styles.css$|plain=false|nomatch=}}|{{{1|}}}|{{{2|}}}}}<!--
--><noinclude>{{documentation}}</noinclude>
91e4ae891d6b791615152c1fbc971414961ba872
Template:Documentation subpage
10
121
234
233
2023-12-24T02:07:49Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Documentation_subpage]]
wikitext
text/x-wiki
<includeonly><!--
-->{{#ifeq:{{lc:{{SUBPAGENAME}}}} |{{{override|doc}}}
| <!--(this template has been transcluded on a /doc or /{{{override}}} page)-->
</includeonly><!--
-->{{#ifeq:{{{doc-notice|show}}} |show
| {{Mbox
| type = notice
| style = margin-bottom:1.0em;
| image = [[File:Edit-copy green.svg|40px|alt=|link=]]
| text =
{{strong|This is a [[Wikipedia:Template documentation|documentation]] [[Wikipedia:Subpages|subpage]]}} for {{terminate sentence|{{{1|[[:{{SUBJECTSPACE}}:{{BASEPAGENAME}}]]}}}}}<br />It may contain usage information, [[Wikipedia:Categorization|categories]] and other content that is not part of the original {{#if:{{{text2|}}} |{{{text2}}} |{{#if:{{{text1|}}} |{{{text1}}} |{{#ifeq:{{SUBJECTSPACE}} |{{ns:User}} |{{lc:{{SUBJECTSPACE}}}} template page |{{#if:{{SUBJECTSPACE}} |{{lc:{{SUBJECTSPACE}}}} page|article}}}}}}}}.
}}
}}<!--
-->{{DEFAULTSORT:{{{defaultsort|{{PAGENAME}}}}}}}<!--
-->{{#if:{{{inhibit|}}} |<!--(don't categorize)-->
| <includeonly><!--
-->{{#ifexist:{{NAMESPACE}}:{{BASEPAGENAME}}
| [[Category:{{#switch:{{SUBJECTSPACE}} |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
| [[Category:Documentation subpages without corresponding pages]]
}}<!--
--></includeonly>
}}<!--
(completing initial #ifeq: at start of template:)
--><includeonly>
| <!--(this template has not been transcluded on a /doc or /{{{override}}} page)-->
}}<!--
--></includeonly><noinclude>{{Documentation}}</noinclude>
41ca90af0945442788a2dbd08c8c54a61a23c057
Template:Template link with link off
10
122
236
235
2023-12-24T02:07:50Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Template_link_with_link_off]]
wikitext
text/x-wiki
<includeonly>{{#Invoke:Template link general|main|nowrap=yes|nolink=yes}}</includeonly><noinclude>
{{Documentation|1=Template:Tlg/doc
|content = {{tlg/doc|tlf}}
}}
<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
b099fea5d1f36b0b4b9cb253ad3a9f4e095f6851
Template:Tlf
10
123
238
237
2023-12-24T02:07:50Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Tlf]]
wikitext
text/x-wiki
#REDIRECT [[Template:Template link with link off]]
{{Redirect category shell|
{{R from move}}
}}
52759e1d3f7c9aa4a03d0b7d4f84f4c6adf53edf
Template:High-use
10
124
240
239
2023-12-24T02:07:51Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:High-use]]
wikitext
text/x-wiki
{{#invoke:High-use|main|1={{{1|}}}|2={{{2|}}}|info={{{info|}}}|demo={{{demo|}}}|form={{{form|}}}|expiry={{{expiry|}}}|system={{{system|}}}}}<noinclude>
{{Documentation}}
<!-- Add categories to the /doc subpage; interwiki links go to Wikidata, thank you! -->
</noinclude>
a3322d1bd47ac03df14fa2090855cff4fede9bc7
Template:TemplateData header
10
125
242
241
2023-12-24T02:07:52Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:TemplateData_header]]
wikitext
text/x-wiki
<div class="templatedata-header">{{#if:{{{noheader|}}}|<!--
noheader:
-->{{Template parameter usage|{{{1|{{BASEPAGENAME}}}}}|based=y}}|<!--
+header:
-->This is the {{#if:{{{nolink|}}}|<!--
+header, nolink TD
-->TemplateData|<!--
+header, +link [[TD]]; DEFAULT:
-->[[Wikipedia:TemplateData|TemplateData]]}}<!--
e.o. #if:nolink; DEFAULT:
--> for this template used by [[mw:Extension:TemplateWizard|TemplateWizard]], [[Wikipedia:VisualEditor|VisualEditor]] and other tools. {{Template parameter usage|{{{1|{{BASEPAGENAME}}}}}|based=y}}<!--
e.o. #if:noheader
-->}}
'''TemplateData for {{{1|{{BASEPAGENAME}}}}}'''
</div><includeonly><!--
check parameters
-->{{#invoke:Check for unknown parameters|check
|unknown={{template other|1=[[Category:Pages using TemplateData header with unknown parameters|_VALUE_]]}}
|template=Template:TemplateData header
|1 |nolink |noheader
|preview=<div class="error" style="font-weight:normal">Unknown parameter '_VALUE_' in [[Template:TemplateData header]].</div>
}}<!--
-->{{template other|{{sandbox other||
[[Category:Templates using TemplateData]]
}}}}</includeonly><!--
--><noinclude>{{Documentation}}</noinclude>
748b89c815a11e78b365c5617460ea569f3f96cb
Template:Template parameter usage
10
126
244
243
2023-12-24T02:07:53Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Template_parameter_usage]]
wikitext
text/x-wiki
{{#switch:{{{label|}}}
|=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template={{Urlencode:{{#if:{{{1|}}}|{{ROOTPAGENAME:{{{1|}}}}}|{{ROOTPAGENAME}}}}}} {{#ifeq:{{yesno-no|{{{lc}}}}}|no|S|s}}ee a monthly parameter usage report] for {{#if:{{{1|}}}|[[Template:{{ROOTPAGENAME:{{{1|}}}}}]]|this template}} in articles{{#ifeq:{{yesno-no|{{{based}}}}}|yes| based on {{#if:{{{1|}}}|its|this}} TemplateData}}.
|None|none=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template={{Urlencode:{{#if:{{{1|}}}|{{ROOTPAGENAME:{{{1|}}}}}|{{ROOTPAGENAME}}}}}} {{#ifeq:{{yesno-no|{{{lc}}}}}|no|P|p}}arameter usage report]{{#ifeq:{{yesno-no|{{{based}}}}}|yes| based on {{#if:{{{1|}}}|its|this}} TemplateData}}
|for|For=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template={{Urlencode:{{#if:{{{1|}}}|{{ROOTPAGENAME:{{{1|}}}}}|{{ROOTPAGENAME}}}}}} {{#ifeq:{{yesno-no|{{{lc}}}}}|no|P|p}}arameter usage report] for {{#if:{{{1|}}}|[[Template:{{ROOTPAGENAME:{{{1|}}}}}]]|[[Template:{{ROOTPAGENAME}}]]}}{{#ifeq:{{yesno-no|{{{based}}}}}|yes| based on {{#if:{{{1|}}}|its|this}} TemplateData}}.
|#default=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template={{Urlencode:{{#if:{{{1|}}}|{{ROOTPAGENAME:{{{1|}}}}}|{{ROOTPAGENAME}}}}}} {{{label|}}}]{{#ifeq:{{yesno-no|{{{based}}}}}|yes| based on {{#if:{{{1|}}}|its|this}} TemplateData}}
}}<noinclude>
{{documentation}}
</noinclude>
83e574f5e031df639a2cdcef5b91d6b1094ae648
Module:High-use
828
127
246
245
2023-12-24T02:07:53Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:High-use]]
Scribunto
text/plain
local p = {}
-- _fetch looks at the "demo" argument.
local _fetch = require('Module:Transclusion_count').fetch
local yesno = require('Module:Yesno')
function p.num(frame, count)
if count == nil then
if yesno(frame.args['fetch']) == false then
if (frame.args[1] or '') ~= '' then count = tonumber(frame.args[1]) end
else
count = _fetch(frame)
end
end
-- Build output string
local return_value = ""
if count == nil then
if frame.args[1] == "risk" then
return_value = "a very large number of"
else
return_value = "many"
end
else
-- Use 2 significant figures for smaller numbers and 3 for larger ones
local sigfig = 2
if count >= 100000 then
sigfig = 3
end
-- Prepare to round to appropriate number of sigfigs
local f = math.floor(math.log10(count)) - sigfig + 1
-- Round and insert "approximately" or "+" when appropriate
if (frame.args[2] == "yes") or (mw.ustring.sub(frame.args[1],-1) == "+") then
-- Round down
return_value = string.format("%s+", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) ) * (10^(f))) )
else
-- Round to nearest
return_value = string.format("approximately %s", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) + 0.5) * (10^(f))) )
end
-- Insert percentage of pages if that is likely to be >= 1% and when |no-percent= not set to yes
if count and count > 250000 and not yesno (frame:getParent().args['no-percent']) then
local percent = math.floor( ( (count/frame:callParserFunction('NUMBEROFPAGES', 'R') ) * 100) + 0.5)
if percent >= 1 then
return_value = string.format("%s pages, or roughly %s%% of all", return_value, percent)
end
end
end
return return_value
end
-- Actions if there is a large (greater than or equal to 100,000) transclusion count
function p.risk(frame)
local return_value = ""
if frame.args[1] == "risk" then
return_value = "risk"
else
local count = _fetch(frame)
if count and count >= 100000 then return_value = "risk" end
end
return return_value
end
function p.text(frame, count)
-- Only show the information about how this template gets updated if someone
-- is actually editing the page and maybe trying to update the count.
local bot_text = (frame:preprocess("{{REVISIONID}}") == "") and "\n\n----\n'''Preview message''': Transclusion count updated automatically ([[Template:High-use/doc#Technical details|see documentation]])." or ''
if count == nil then
if yesno(frame.args['fetch']) == false then
if (frame.args[1] or '') ~= '' then count = tonumber(frame.args[1]) end
else
count = _fetch(frame)
end
end
local title = mw.title.getCurrentTitle()
if title.subpageText == "doc" or title.subpageText == "sandbox" then
title = title.basePageTitle
end
local systemMessages = frame.args['system']
if frame.args['system'] == '' then
systemMessages = nil
end
-- This retrieves the project URL automatically to simplify localiation.
local templateCount = ('on [https://linkcount.toolforge.org/index.php?project=%s&page=%s %s pages]'):format(
mw.title.getCurrentTitle():fullUrl():gsub('//(.-)/.*', '%1'),
mw.uri.encode(title.fullText), p.num(frame, count))
local used_on_text = "'''This " .. (mw.title.getCurrentTitle().namespace == 828 and "Lua module" or "template") .. ' is used ';
if systemMessages then
used_on_text = used_on_text .. systemMessages ..
((count and count > 2000) and ("''', and " .. templateCount) or ("'''"))
else
used_on_text = used_on_text .. templateCount .. "'''"
end
local sandbox_text = ("%s's [[%s/sandbox|/sandbox]] or [[%s/testcases|/testcases]] subpages, or in your own [[%s]]. "):format(
(mw.title.getCurrentTitle().namespace == 828 and "module" or "template"),
title.fullText, title.fullText,
mw.title.getCurrentTitle().namespace == 828 and "Module:Sandbox|module sandbox" or "Wikipedia:User pages#SUB|user subpage"
)
local infoArg = frame.args["info"] ~= "" and frame.args["info"]
if (systemMessages or frame.args[1] == "risk" or (count and count >= 100000) ) then
local info = systemMessages and '.<br/>Changes to it can cause immediate changes to the Wikipedia user interface.' or '.'
if infoArg then
info = info .. "<br />" .. infoArg
end
sandbox_text = info .. '<br /> To avoid major disruption' ..
(count and count >= 100000 and ' and server load' or '') ..
', any changes should be tested in the ' .. sandbox_text ..
'The tested changes can be added to this page in a single edit. '
else
sandbox_text = (infoArg and ('.<br />' .. infoArg .. ' C') or ' and c') ..
'hanges may be widely noticed. Test changes in the ' .. sandbox_text
end
local discussion_text = systemMessages and 'Please discuss changes ' or 'Consider discussing changes '
if frame.args["2"] and frame.args["2"] ~= "" and frame.args["2"] ~= "yes" then
discussion_text = string.format("%sat [[%s]]", discussion_text, frame.args["2"])
else
discussion_text = string.format("%son the [[%s|talk page]]", discussion_text, title.talkPageTitle.fullText )
end
return used_on_text .. sandbox_text .. discussion_text .. " before implementing them." .. bot_text
end
function p.main(frame)
local count = nil
if yesno(frame.args['fetch']) == false then
if (frame.args[1] or '') ~= '' then count = tonumber(frame.args[1]) end
else
count = _fetch(frame)
end
local image = "[[File:Ambox warning yellow.svg|40px|alt=Warning|link=]]"
local type_param = "style"
local epilogue = ''
if frame.args['system'] and frame.args['system'] ~= '' then
image = "[[File:Ambox important.svg|40px|alt=Warning|link=]]"
type_param = "content"
local nocat = frame:getParent().args['nocat'] or frame.args['nocat']
local categorise = (nocat == '' or not yesno(nocat))
if categorise then
epilogue = frame:preprocess('{{Sandbox other||{{#switch:{{#invoke:Effective protection level|{{#switch:{{NAMESPACE}}|File=upload|#default=edit}}|{{FULLPAGENAME}}}}|sysop|templateeditor|interfaceadmin=|#default=[[Category:Pages used in system messages needing protection]]}}}}')
end
elseif (frame.args[1] == "risk" or (count and count >= 100000)) then
image = "[[File:Ambox warning orange.svg|40px|alt=Warning|link=]]"
type_param = "content"
end
if frame.args["form"] == "editnotice" then
return frame:expandTemplate{
title = 'editnotice',
args = {
["image"] = image,
["text"] = p.text(frame, count),
["expiry"] = (frame.args["expiry"] or "")
}
} .. epilogue
else
return require('Module:Message box').main('ombox', {
type = type_param,
image = image,
text = p.text(frame, count),
expiry = (frame.args["expiry"] or "")
}) .. epilogue
end
end
return p
134551888e066954a89c109d2faa8af71a4454a4
Module:Transclusion count
828
128
248
247
2023-12-24T02:07:54Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Transclusion_count]]
Scribunto
text/plain
local p = {}
function p.fetch(frame)
local template = nil
local return_value = nil
-- Use demo parameter if it exists, otherswise use current template name
local namespace = mw.title.getCurrentTitle().namespace
if frame.args["demo"] and frame.args["demo"] ~= "" then
template = mw.ustring.gsub(frame.args["demo"],"^[Tt]emplate:","")
elseif namespace == 10 then -- Template namespace
template = mw.title.getCurrentTitle().text
elseif namespace == 828 then -- Module namespace
template = (mw.site.namespaces[828].name .. ":" .. mw.title.getCurrentTitle().text)
end
-- If in template or module namespace, look up count in /data
if template ~= nil then
namespace = mw.title.new(template, "Template").namespace
if namespace == 10 or namespace == 828 then
template = mw.ustring.gsub(template, "/doc$", "") -- strip /doc from end
template = mw.ustring.gsub(template, "/sandbox$", "") -- strip /sandbox from end
local index = mw.ustring.sub(mw.title.new(template).text,1,1)
local status, data = pcall(function ()
return(mw.loadData('Module:Transclusion_count/data/' .. (mw.ustring.find(index, "%a") and index or "other")))
end)
if status then
return_value = tonumber(data[mw.ustring.gsub(template, " ", "_")])
end
end
end
-- If database value doesn't exist, use value passed to template
if return_value == nil and frame.args[1] ~= nil then
local arg1=mw.ustring.match(frame.args[1], '[%d,]+')
if arg1 and arg1 ~= '' then
return_value = tonumber(frame:callParserFunction('formatnum', arg1, 'R'))
end
end
return return_value
end
-- Tabulate this data for [[Wikipedia:Database reports/Templates transcluded on the most pages]]
function p.tabulate(frame)
local list = {}
for i = 65, 91 do
local data = mw.loadData('Module:Transclusion count/data/' .. ((i == 91) and 'other' or string.char(i)))
for name, count in pairs(data) do
table.insert(list, {mw.title.new(name, "Template").fullText, count})
end
end
table.sort(list, function(a, b)
return (a[2] == b[2]) and (a[1] < b[1]) or (a[2] > b[2])
end)
local lang = mw.getContentLanguage();
for i = 1, #list do
list[i] = ('|-\n| %d || [[%s]] || %s\n'):format(i, list[i][1]:gsub('_', ' '), lang:formatNum(list[i][2]))
end
return table.concat(list)
end
return p
000ef6bcbf7b66e727870b0c300c4009da300513
Module:Lua banner
828
129
250
249
2023-12-24T02:07:55Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Lua_banner]]
Scribunto
text/plain
-- This module implements the {{lua}} template.
local yesno = require('Module:Yesno')
local mList = require('Module:List')
local mTableTools = require('Module:TableTools')
local mMessageBox = require('Module:Message box')
local p = {}
function p.main(frame)
local origArgs = frame:getParent().args
local args = {}
for k, v in pairs(origArgs) do
v = v:match('^%s*(.-)%s*$')
if v ~= '' then
args[k] = v
end
end
return p._main(args)
end
function p._main(args)
local modules = mTableTools.compressSparseArray(args)
local box = p.renderBox(modules)
local trackingCategories = p.renderTrackingCategories(args, modules)
return box .. trackingCategories
end
function p.renderBox(modules)
local boxArgs = {}
if #modules < 1 then
boxArgs.text = '<strong class="error">Error: no modules specified</strong>'
else
local moduleLinks = {}
for i, module in ipairs(modules) do
moduleLinks[i] = string.format('[[:%s]]', module)
local maybeSandbox = mw.title.new(module .. '/sandbox')
if maybeSandbox.exists then
moduleLinks[i] = moduleLinks[i] .. string.format(' ([[:%s|sandbox]])', maybeSandbox.fullText)
end
end
local moduleList = mList.makeList('bulleted', moduleLinks)
local title = mw.title.getCurrentTitle()
if title.subpageText == "doc" then
title = title.basePageTitle
end
if title.contentModel == "Scribunto" then
boxArgs.text = 'This module depends on the following other modules:' .. moduleList
else
boxArgs.text = 'This template uses [[Wikipedia:Lua|Lua]]:\n' .. moduleList
end
end
boxArgs.type = 'notice'
boxArgs.small = true
boxArgs.image = '[[File:Lua-Logo.svg|30px|alt=|link=]]'
return mMessageBox.main('mbox', boxArgs)
end
function p.renderTrackingCategories(args, modules, titleObj)
if yesno(args.nocat) then
return ''
end
local cats = {}
-- Error category
if #modules < 1 then
cats[#cats + 1] = 'Lua templates with errors'
end
-- Lua templates category
titleObj = titleObj or mw.title.getCurrentTitle()
local subpageBlacklist = {
doc = true,
sandbox = true,
sandbox2 = true,
testcases = true
}
if not subpageBlacklist[titleObj.subpageText] then
local protCatName
if titleObj.namespace == 10 then
local category = args.category
if not category then
local categories = {
['Module:String'] = 'Templates based on the String Lua module',
['Module:Math'] = 'Templates based on the Math Lua module',
['Module:BaseConvert'] = 'Templates based on the BaseConvert Lua module',
['Module:Citation/CS1'] = 'Templates based on the Citation/CS1 Lua module'
}
category = modules[1] and categories[modules[1]]
category = category or 'Lua-based templates'
end
cats[#cats + 1] = category
protCatName = "Templates using under-protected Lua modules"
elseif titleObj.namespace == 828 then
protCatName = "Modules depending on under-protected modules"
end
if not args.noprotcat and protCatName then
local protLevels = {
autoconfirmed = 1,
extendedconfirmed = 2,
templateeditor = 3,
sysop = 4
}
local currentProt
if titleObj.id ~= 0 then
-- id is 0 (page does not exist) if am previewing before creating a template.
currentProt = titleObj.protectionLevels["edit"][1]
end
if currentProt == nil then currentProt = 0 else currentProt = protLevels[currentProt] end
for i, module in ipairs(modules) do
if module ~= "WP:libraryUtil" then
local moduleProt = mw.title.new(module).protectionLevels["edit"][1]
if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end
if moduleProt < currentProt then
cats[#cats + 1] = protCatName
break
end
end
end
end
end
for i, cat in ipairs(cats) do
cats[i] = string.format('[[Category:%s]]', cat)
end
return table.concat(cats)
end
return p
03ec1b34a40121efc562c0c64a67ebbf57d56dff
Module:Parameter names example
828
130
252
251
2023-12-24T02:07:55Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Parameter_names_example]]
Scribunto
text/plain
-- This module implements {{parameter names example}}.
local p = {}
local function makeParam(s)
local lb = '{'
local rb = '}'
return lb:rep(3) .. s .. rb:rep(3)
end
local function italicize(s)
return "''" .. s .. "''"
end
local function plain(s)
return s
end
function p._main(args, frame)
-- Find how we want to format the arguments to the template.
local formatFunc
if args._display == 'italics' or args._display == 'italic' then
formatFunc = italicize
elseif args._display == 'plain' then
formatFunc = plain
else
formatFunc = makeParam
end
-- Build the table of template arguments.
local targs = {}
for k, v in pairs(args) do
if type(k) == 'number' then
targs[v] = formatFunc(v)
elseif not k:find('^_') then
targs[k] = v
end
end
--targs['nocat'] = 'yes';
--targs['categories'] = 'no';
--targs['demo'] = 'yes';
-- Find the template name.
local template
if args._template then
template = args._template
else
local currentTitle = mw.title.getCurrentTitle()
if currentTitle.prefixedText:find('/sandbox$') then
template = currentTitle.prefixedText
else
template = currentTitle.basePageTitle.prefixedText
end
end
-- Call the template with the arguments.
frame = frame or mw.getCurrentFrame()
local success, result = pcall(
frame.expandTemplate,
frame,
{title = template, args = targs}
)
if success then
return result
else
return ''
end
end
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:Parameter names example'
})
return p._main(args, frame)
end
return p
fdf94fb7a5dc1fabf118d60488a02f1e65b0df24
Template:Lua
10
131
254
253
2023-12-24T02:07:56Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Lua]]
wikitext
text/x-wiki
<includeonly>{{#invoke:Lua banner|main}}</includeonly><noinclude>
{{Lua|Module:Lua banner}}
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
dba3962144dacd289dbc34f50fbe0a7bf6d7f2f7
Template:Parameter names example
10
132
256
255
2023-12-24T02:07:57Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Parameter_names_example]]
wikitext
text/x-wiki
<includeonly>{{#invoke:Parameter names example|main}}</includeonly><noinclude>
{{documentation}}<!-- Add categories to the /doc subpage, interwikis to Wikidata, not here -->
</noinclude>
256a11b9ae7ac7e492b3d9de86ade1ffa96bffd1
Template:Category link with count
10
133
258
257
2023-12-24T02:07:58Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Category_link_with_count]]
wikitext
text/x-wiki
[[:Category:{{#invoke:string|replace|1={{{1}}}|2=^:?[Cc]ategory:|3=|plain=false}}|<!--
-->{{#if:{{{name|}}}|{{{name}}}|Category:{{#invoke:string|replace|1={{{1}}}|2=^:?[Cc]ategory:|3=|plain=false}}}}<!--
-->]] ({{PAGESINCATEGORY:{{#invoke:string|replace|1={{{1}}}|2=^:?[Cc]ategory:|3=|plain=false}}|{{{2|all}}}}})<noinclude>
{{Documentation}}
</noinclude>
f93f1540b8c157703bd6d24ae35c35bef745981d
Template:Suppress categories
10
134
260
259
2023-12-24T02:07:58Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Suppress_categories]]
wikitext
text/x-wiki
<includeonly>{{{{{|safesubst:}}}#invoke:Suppress categories|main}}</includeonly><noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
1f9c6065201d31d4c70f982129b5babbb809ae8c
Module:Suppress categories
828
135
262
261
2023-12-24T02:07:58Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Suppress_categories]]
Scribunto
text/plain
-- This is a simple module to strip categories from wikitext. It does
-- not support nested links or magic words like __TOC__, etc. Even so,
-- it should still handle most categories.
local p = {}
-- Detects if a category link is valid or not. If it is valid,
-- the function returns the blank string. If not, the input
-- is returned with no changes.
local function processCategory( all, submatch )
local beforePipe = mw.ustring.match( submatch, '^(.-)[%s_]*|[%s_]*.-$' )
beforePipe = beforePipe or submatch
if mw.ustring.match( beforePipe, '[%[%]<>{}%c\n]' ) then
return all
else
return ''
end
end
-- Preprocess the content if we aren't being called from #invoke,
-- and pass it to gsub to remove valid category links.
local function suppress( content, isPreprocessed )
if not isPreprocessed then
content = mw.getCurrentFrame():preprocess( content )
end
content = mw.ustring.gsub(
content,
'(%[%[[%s_]*[cC][aA][tT][eE][gG][oO][rR][yY][%s_]*:[%s_]*(.-)[%s_]*%]%])',
processCategory
)
return content
end
-- Get the content to suppress categories from, and find
-- whether the content has already been preprocessed. (If the
-- module is called from #invoke, it has been preprocessed already.)
function p.main( frame )
local content, isPreprocessed
if frame == mw.getCurrentFrame() then
content = frame:getParent().args[1]
if frame.args[1] then
content = frame.args[1]
end
isPreprocessed = true
else
content = frame
isPreprocessed = false
end
return suppress( content, isPreprocessed )
end
return p
0ec3903841c489357a879434c5dc23c11d182c78
Module:Transclusion count/data/I
828
136
264
263
2023-12-24T02:07:59Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Transclusion_count/data/I]]
Scribunto
text/plain
return {
["IAST"] = 6600,
["IBDB_name"] = 9200,
["ICD10"] = 4700,
["ICD9"] = 4400,
["ICS"] = 2900,
["IDN"] = 3400,
["IMDb_episode"] = 10000,
["IMDb_episodes"] = 2700,
["IMDb_name"] = 155000,
["IMDb_title"] = 191000,
["IMO_Number"] = 4100,
["IMSLP"] = 8300,
["INA"] = 2200,
["IND"] = 7700,
["INR"] = 6600,
["INRConvert"] = 5700,
["INRConvert/CurrentRate"] = 5700,
["INRConvert/USD"] = 5700,
["INRConvert/out"] = 5700,
["IOC_profile"] = 5000,
["IP"] = 2700,
["IPA"] = 144000,
["IPA-de"] = 8300,
["IPA-es"] = 7900,
["IPA-fr"] = 44000,
["IPA-it"] = 5900,
["IPA-nl"] = 3900,
["IPA-pl"] = 4100,
["IPA-pt"] = 3300,
["IPA-sl"] = 6900,
["IPA-th"] = 3000,
["IPA_audio_link"] = 3500,
["IPA_link"] = 3600,
["IPAc-cmn"] = 2300,
["IPAc-en"] = 49000,
["IPAc-pl"] = 51000,
["IPC_athlete"] = 2800,
["IPSummary"] = 79000,
["IP_summary"] = 79000,
["IPtalk"] = 18000,
["IPuser"] = 7100,
["IPvandal"] = 2900,
["IRC"] = 7300,
["IRI"] = 2300,
["IRL"] = 5500,
["IRN"] = 3700,
["ISBN"] = 463000,
["ISBN?"] = 2100,
["ISBNT"] = 39000,
["ISBN_missing"] = 2600,
["ISFDB_name"] = 4100,
["ISFDB_title"] = 4600,
["ISL"] = 2100,
["ISO_15924/script-example-character"] = 2800,
["ISO_15924/wp-article"] = 2800,
["ISO_15924/wp-article/format"] = 2800,
["ISO_15924/wp-article/label"] = 2700,
["ISO_3166_code"] = 497000,
["ISO_3166_name"] = 16000,
["ISO_639_name"] = 8200,
["ISP"] = 5300,
["ISR"] = 4900,
["ISSN"] = 12000,
["ISSN_link"] = 30000,
["ISTAT"] = 8100,
["ISU_figure_skater"] = 2500,
["ITA"] = 17000,
["ITF"] = 6300,
["ITF_profile"] = 9100,
["ITIS"] = 4400,
["ITN_talk"] = 10000,
["ITN_talk/date"] = 10000,
["IUCN_banner"] = 15000,
["I_sup"] = 4600,
["Ice_hockey"] = 19000,
["Ice_hockey_stats"] = 19000,
["Icehockeystats"] = 12000,
["Icon"] = 585000,
["If"] = 279000,
["If_all"] = 6500,
["If_between"] = 3800,
["If_both"] = 130000,
["If_empty"] = 3720000,
["If_first_display_both"] = 73000,
["If_in_page"] = 11000,
["If_last_display_both"] = 30000,
["If_number"] = 2200,
["If_preview"] = 58000,
["If_then_show"] = 297000,
["Ifempty"] = 4000,
["Ifeq"] = 17000,
["Iferror_then_show"] = 3300,
["Ifexist_not_redirect"] = 1320000,
["Ifnotempty"] = 15000,
["Ifnumber"] = 37000,
["Ifsubst"] = 459000,
["Ih"] = 7600,
["Ill"] = 124000,
["Illm"] = 6600,
["Image_frame"] = 5000,
["Image_label"] = 4500,
["Image_label_begin"] = 3900,
["Image_label_end"] = 3800,
["Image_label_small"] = 2600,
["Image_needed"] = 4500,
["Image_other"] = 273000,
["Image_requested"] = 169000,
["Image_requested/Category_helper"] = 161000,
["Imbox"] = 924000,
["Imdb_name"] = 5500,
["Imdb_title"] = 3900,
["Import_style"] = 12000,
["Import_style/inputbox.css"] = 11000,
["Importance"] = 5680000,
["Importance/colour"] = 5690000,
["Importance_mask"] = 10500000,
["Improve_categories"] = 7600,
["Improve_documentation"] = 2700,
["In_class"] = 5700,
["In_lang"] = 359000,
["In_progress"] = 3300,
["In_string"] = 78000,
["In_title"] = 20000,
["Inactive_userpage_blanked"] = 4900,
["Include-USGov"] = 29000,
["Incomplete_list"] = 23000,
["Inconclusive"] = 2100,
["Increase"] = 44000,
["Incumbent_pope"] = 4300,
["Indent"] = 4600,
["IndexFungorum"] = 2200,
["Indian_English"] = 4300,
["Indian_Rupee"] = 10000,
["Indian_railway_code"] = 3200,
["Inflation"] = 21000,
["Inflation-fn"] = 5400,
["Inflation-year"] = 4500,
["Inflation/IN/startyear"] = 5700,
["Inflation/UK"] = 4400,
["Inflation/UK/dataset"] = 4400,
["Inflation/UK/startyear"] = 4400,
["Inflation/US"] = 12000,
["Inflation/US-GDP"] = 2400,
["Inflation/US-GDP/dataset"] = 2400,
["Inflation/US-GDP/startyear"] = 2400,
["Inflation/US/dataset"] = 12000,
["Inflation/US/startyear"] = 12000,
["Inflation/fn"] = 6300,
["Inflation/year"] = 26000,
["Info"] = 7200,
["Infobox"] = 3260000,
["Infobox/Columns"] = 2500,
["Infobox/mobileviewfix.css"] = 146000,
["Infobox3cols"] = 17000,
["Infobox_AFL_biography"] = 14000,
["Infobox_Aircraft_Begin"] = 5300,
["Infobox_Aircraft_Type"] = 4700,
["Infobox_Athletics_Championships"] = 2700,
["Infobox_Australian_place"] = 15000,
["Infobox_CFL_biography"] = 2100,
["Infobox_COA_wide"] = 3300,
["Infobox_Canada_electoral_district"] = 2500,
["Infobox_Canadian_Football_League_biography"] = 5700,
["Infobox_Canadian_Football_League_biography/position"] = 5600,
["Infobox_Chinese"] = 21000,
["Infobox_Chinese/Chinese"] = 2800,
["Infobox_Chinese/Footer"] = 8700,
["Infobox_Chinese/Header"] = 8700,
["Infobox_Chinese/Korean"] = 17000,
["Infobox_Christian_leader"] = 18000,
["Infobox_French_commune"] = 38000,
["Infobox_GAA_player"] = 2700,
["Infobox_Gaelic_games_player"] = 5000,
["Infobox_German_location"] = 13000,
["Infobox_German_place"] = 14000,
["Infobox_Grand_Prix_race_report"] = 2000,
["Infobox_Greece_place"] = 2900,
["Infobox_Greek_Dimos"] = 2800,
["Infobox_Hindu_temple"] = 2500,
["Infobox_Indian_constituency"] = 4700,
["Infobox_Indian_constituency/defaultdata"] = 4700,
["Infobox_Italian_comune"] = 8100,
["Infobox_Korean_name"] = 15000,
["Infobox_Korean_name/categories"] = 15000,
["Infobox_NASCAR_race_report"] = 2300,
["Infobox_NCAA_team_season"] = 17000,
["Infobox_NFL_biography"] = 28000,
["Infobox_NFL_player"] = 7600,
["Infobox_NFL_team_season"] = 3900,
["Infobox_NRHP"] = 73000,
["Infobox_NRHP/conv"] = 18000,
["Infobox_NRHP/locmapin2region"] = 66000,
["Infobox_Officeholder"] = 4700,
["Infobox_Olympic_event"] = 7400,
["Infobox_Olympic_event/games_text"] = 7400,
["Infobox_Pan_American_Games_event"] = 2300,
["Infobox_Paralympic_event"] = 2600,
["Infobox_Paralympic_event/games_text"] = 2600,
["Infobox_Politician"] = 2200,
["Infobox_Romanian_subdivision"] = 3200,
["Infobox_Russian_district"] = 2000,
["Infobox_Russian_inhabited_locality"] = 4500,
["Infobox_SCOTUS_case"] = 3700,
["Infobox_Site_of_Special_Scientific_Interest"] = 2000,
["Infobox_Swiss_town"] = 2800,
["Infobox_Switzerland_municipality"] = 2900,
["Infobox_Turkey_place"] = 19000,
["Infobox_U.S._county"] = 3000,
["Infobox_U.S._county/district"] = 3000,
["Infobox_UK_constituency"] = 2100,
["Infobox_UK_constituency/year"] = 2100,
["Infobox_UK_legislation"] = 3500,
["Infobox_UK_place"] = 26000,
["Infobox_UK_place/NoDialCode"] = 8100,
["Infobox_UK_place/NoPostCode"] = 3200,
["Infobox_UK_place/area"] = 2400,
["Infobox_UK_place/dist"] = 2500,
["Infobox_UK_place/local"] = 26000,
["Infobox_UK_place/styles.css"] = 26000,
["Infobox_UN_resolution"] = 2300,
["Infobox_US_Supreme_Court_case"] = 3900,
["Infobox_US_Supreme_Court_case/courts"] = 3800,
["Infobox_Wikipedia_user"] = 9900,
["Infobox_YouTube_personality"] = 2700,
["Infobox_YouTube_personality/styles.css"] = 2700,
["Infobox_academic"] = 14000,
["Infobox_aircraft_begin"] = 14000,
["Infobox_aircraft_occurrence"] = 2300,
["Infobox_aircraft_type"] = 13000,
["Infobox_airline"] = 4600,
["Infobox_airport"] = 15000,
["Infobox_airport/datatable"] = 15000,
["Infobox_album"] = 163000,
["Infobox_album/color"] = 193000,
["Infobox_album/link"] = 163000,
["Infobox_anatomy"] = 4500,
["Infobox_ancient_site"] = 5500,
["Infobox_animanga/Footer"] = 6900,
["Infobox_animanga/Header"] = 6900,
["Infobox_animanga/Print"] = 5500,
["Infobox_animanga/Video"] = 4800,
["Infobox_architect"] = 3700,
["Infobox_artist"] = 29000,
["Infobox_artist_discography"] = 6000,
["Infobox_artwork"] = 11000,
["Infobox_athlete"] = 2800,
["Infobox_automobile"] = 8500,
["Infobox_award"] = 13000,
["Infobox_badminton_player"] = 3200,
["Infobox_baseball_biography"] = 28000,
["Infobox_baseball_biography/style"] = 28000,
["Infobox_baseball_biography/styles.css"] = 28000,
["Infobox_baseball_team_season"] = 3300,
["Infobox_baseball_team_season/leagueseason"] = 3200,
["Infobox_baseball_team_season/season"] = 3200,
["Infobox_baseball_team_season/styles.css"] = 3200,
["Infobox_basketball_biography"] = 21000,
["Infobox_basketball_biography/style"] = 21000,
["Infobox_basketball_club"] = 3000,
["Infobox_basketball_club/styles.css"] = 3000,
["Infobox_beauty_pageant"] = 2400,
["Infobox_bilateral_relations"] = 4500,
["Infobox_body_of_water"] = 18000,
["Infobox_book"] = 53000,
["Infobox_boxer"] = 5700,
["Infobox_bridge"] = 6100,
["Infobox_building"] = 28000,
["Infobox_character"] = 7500,
["Infobox_chess_biography"] = 4000,
["Infobox_chess_player"] = 3300,
["Infobox_church"] = 15000,
["Infobox_church/denomination"] = 15000,
["Infobox_church/font_color"] = 15000,
["Infobox_civil_conflict"] = 2400,
["Infobox_civilian_attack"] = 5600,
["Infobox_college_coach"] = 12000,
["Infobox_college_football_game"] = 2100,
["Infobox_college_football_player"] = 2200,
["Infobox_college_sports_team_season"] = 40000,
["Infobox_college_sports_team_season/link"] = 40000,
["Infobox_college_sports_team_season/name"] = 40000,
["Infobox_college_sports_team_season/succession"] = 40000,
["Infobox_college_sports_team_season/team"] = 40000,
["Infobox_comic_book_title"] = 3000,
["Infobox_comics_character"] = 3500,
["Infobox_comics_creator"] = 3500,
["Infobox_comics_creator/styles.css"] = 3500,
["Infobox_company"] = 84000,
["Infobox_computing_device"] = 2400,
["Infobox_concert"] = 3300,
["Infobox_constituency"] = 5500,
["Infobox_country"] = 6500,
["Infobox_country/formernext"] = 6100,
["Infobox_country/imagetable"] = 5300,
["Infobox_country/multirow"] = 8400,
["Infobox_country/status_text"] = 2800,
["Infobox_country/styles.css"] = 6500,
["Infobox_country_at_games"] = 15000,
["Infobox_country_at_games/core"] = 15000,
["Infobox_country_at_games/see_also"] = 12000,
["Infobox_court_case"] = 4700,
["Infobox_court_case/images"] = 2400,
["Infobox_cricket_tournament"] = 2400,
["Infobox_cricketer"] = 32000,
["Infobox_cricketer/career"] = 32000,
["Infobox_cricketer/national_side"] = 7500,
["Infobox_criminal"] = 6500,
["Infobox_curler"] = 2600,
["Infobox_cycling_race_report"] = 4500,
["Infobox_cyclist"] = 16000,
["Infobox_dam"] = 5700,
["Infobox_deity"] = 2000,
["Infobox_deity/color"] = 2000,
["Infobox_designation_list"] = 20000,
["Infobox_designation_list/entry"] = 17000,
["Infobox_dim"] = 7000,
["Infobox_dim/core"] = 7000,
["Infobox_diocese"] = 3800,
["Infobox_drug"] = 10000,
["Infobox_drug/chemical_formula"] = 10000,
["Infobox_drug/data_page_link"] = 10000,
["Infobox_drug/formatATC"] = 9900,
["Infobox_drug/formatCASnumber"] = 10000,
["Infobox_drug/formatChEBI"] = 10000,
["Infobox_drug/formatChEMBL"] = 10000,
["Infobox_drug/formatChemDBNIAID"] = 10000,
["Infobox_drug/formatChemSpider"] = 10000,
["Infobox_drug/formatCompTox"] = 10000,
["Infobox_drug/formatDrugBank"] = 10000,
["Infobox_drug/formatIUPHARBPS"] = 10000,
["Infobox_drug/formatJmol"] = 10000,
["Infobox_drug/formatKEGG"] = 10000,
["Infobox_drug/formatPDBligand"] = 9300,
["Infobox_drug/formatPubChemCID"] = 10000,
["Infobox_drug/formatPubChemSID"] = 10000,
["Infobox_drug/formatUNII"] = 10000,
["Infobox_drug/legal_status"] = 10000,
["Infobox_drug/licence"] = 10000,
["Infobox_drug/maintenance_categories"] = 10000,
["Infobox_drug/non-ref-space"] = 4300,
["Infobox_drug/pregnancy_category"] = 10000,
["Infobox_drug/title"] = 10000,
["Infobox_election"] = 30000,
["Infobox_election/row"] = 30000,
["Infobox_election/shortname"] = 28000,
["Infobox_enzyme"] = 5100,
["Infobox_ethnic_group"] = 7300,
["Infobox_event"] = 5500,
["Infobox_family"] = 2200,
["Infobox_figure_skater"] = 4200,
["Infobox_film"] = 158000,
["Infobox_film/short_description"] = 154000,
["Infobox_film_awards"] = 2700,
["Infobox_film_awards/link"] = 2700,
["Infobox_film_awards/style"] = 2700,
["Infobox_food"] = 7000,
["Infobox_football_biography"] = 207000,
["Infobox_football_club"] = 28000,
["Infobox_football_club_season"] = 21000,
["Infobox_football_league"] = 2600,
["Infobox_football_league_season"] = 20000,
["Infobox_football_match"] = 5900,
["Infobox_football_tournament_season"] = 8100,
["Infobox_former_subdivision"] = 3400,
["Infobox_former_subdivision/styles.css"] = 3400,
["Infobox_galaxy"] = 2100,
["Infobox_game"] = 2600,
["Infobox_game_score"] = 3500,
["Infobox_gene"] = 13000,
["Infobox_given_name"] = 4100,
["Infobox_golfer"] = 4500,
["Infobox_golfer/highest_ranking"] = 4500,
["Infobox_government_agency"] = 11000,
["Infobox_government_cabinet"] = 2700,
["Infobox_gridiron_football_person"] = 2400,
["Infobox_gridiron_football_person/position"] = 5600,
["Infobox_gymnast"] = 3500,
["Infobox_handball_biography"] = 4900,
["Infobox_historic_site"] = 12000,
["Infobox_horseraces"] = 2600,
["Infobox_hospital"] = 6300,
["Infobox_hospital/care_system"] = 6300,
["Infobox_hospital/lists"] = 6300,
["Infobox_ice_hockey_biography"] = 20000,
["Infobox_ice_hockey_player"] = 19000,
["Infobox_ice_hockey_team"] = 3000,
["Infobox_ice_hockey_team_season"] = 2000,
["Infobox_international_football_competition"] = 5800,
["Infobox_islands"] = 8900,
["Infobox_islands/area"] = 9300,
["Infobox_islands/density"] = 9300,
["Infobox_islands/length"] = 8900,
["Infobox_islands/styles.css"] = 8900,
["Infobox_journal"] = 9800,
["Infobox_journal/Abbreviation_search"] = 9600,
["Infobox_journal/Bluebook_check"] = 9400,
["Infobox_journal/Former_check"] = 9400,
["Infobox_journal/ISO_4_check"] = 9400,
["Infobox_journal/ISSN-eISSN"] = 9500,
["Infobox_journal/Indexing_search"] = 9600,
["Infobox_journal/MathSciNet_check"] = 9400,
["Infobox_journal/NLM_check"] = 9400,
["Infobox_journal/frequency"] = 8600,
["Infobox_lake"] = 4300,
["Infobox_language"] = 9600,
["Infobox_language/family-color"] = 11000,
["Infobox_language/genetic"] = 6600,
["Infobox_language/linguistlist"] = 9600,
["Infobox_language/ref"] = 7100,
["Infobox_legislation"] = 2000,
["Infobox_legislature"] = 3700,
["Infobox_library"] = 2200,
["Infobox_lighthouse"] = 2600,
["Infobox_lighthouse/light"] = 2600,
["Infobox_locomotive"] = 5000,
["Infobox_magazine"] = 7700,
["Infobox_manner_of_address"] = 3400,
["Infobox_mapframe"] = 81000,
["Infobox_martial_artist"] = 5700,
["Infobox_martial_artist/record"] = 5700,
["Infobox_medal_templates"] = 422000,
["Infobox_medical_condition"] = 10000,
["Infobox_medical_condition_(new)"] = 8100,
["Infobox_medical_details"] = 2100,
["Infobox_military_conflict"] = 22000,
["Infobox_military_installation"] = 9800,
["Infobox_military_person"] = 45000,
["Infobox_military_unit"] = 26000,
["Infobox_mine"] = 2100,
["Infobox_model"] = 2300,
["Infobox_monument"] = 2100,
["Infobox_mountain"] = 28000,
["Infobox_multi-sport_competition_event"] = 2400,
["Infobox_museum"] = 11000,
["Infobox_musical_artist"] = 122000,
["Infobox_musical_artist/color"] = 122000,
["Infobox_musical_artist/hCard_class"] = 315000,
["Infobox_musical_composition"] = 3000,
["Infobox_name"] = 7500,
["Infobox_name_module"] = 7200,
["Infobox_newspaper"] = 9800,
["Infobox_nobility"] = 2300,
["Infobox_noble"] = 7400,
["Infobox_officeholder"] = 223000,
["Infobox_officeholder/office"] = 229000,
["Infobox_official_post"] = 8200,
["Infobox_organization"] = 36000,
["Infobox_pageant_titleholder"] = 3000,
["Infobox_park"] = 7600,
["Infobox_person"] = 485000,
["Infobox_person/Wikidata"] = 4600,
["Infobox_person/height"] = 104000,
["Infobox_person/length"] = 7000,
["Infobox_person/weight"] = 67000,
["Infobox_philosopher"] = 3500,
["Infobox_planet"] = 4700,
["Infobox_play"] = 4000,
["Infobox_political_party"] = 14000,
["Infobox_power_station"] = 3100,
["Infobox_prepared_food"] = 3100,
["Infobox_professional_wrestler"] = 4300,
["Infobox_professional_wrestling_event"] = 2700,
["Infobox_protected_area"] = 14000,
["Infobox_protein_family"] = 2100,
["Infobox_publisher"] = 2400,
["Infobox_racehorse"] = 5600,
["Infobox_racing_driver"] = 4000,
["Infobox_racing_driver_series_section"] = 2100,
["Infobox_radio_station"] = 22000,
["Infobox_rail"] = 2900,
["Infobox_rail_line"] = 7300,
["Infobox_rail_service"] = 3000,
["Infobox_rail_service/doc"] = 2900,
["Infobox_reality_competition_season"] = 3600,
["Infobox_record_label"] = 4000,
["Infobox_recurring_event"] = 6500,
["Infobox_religious_biography"] = 5300,
["Infobox_religious_building"] = 13000,
["Infobox_religious_building/color"] = 18000,
["Infobox_restaurant"] = 3000,
["Infobox_river"] = 30000,
["Infobox_river/calcunit"] = 30000,
["Infobox_river/discharge"] = 30000,
["Infobox_river/row-style"] = 30000,
["Infobox_river/source"] = 30000,
["Infobox_road"] = 24000,
["Infobox_road/meta/mask/category"] = 24000,
["Infobox_road/meta/mask/country"] = 24000,
["Infobox_road/styles.css"] = 25000,
["Infobox_road_small"] = 2300,
["Infobox_rockunit"] = 6400,
["Infobox_royalty"] = 22000,
["Infobox_royalty/short_description"] = 12000,
["Infobox_rugby_biography"] = 16000,
["Infobox_rugby_biography/correct_date"] = 16000,
["Infobox_rugby_biography/depcheck"] = 16000,
["Infobox_rugby_league_biography"] = 10000,
["Infobox_rugby_league_biography/PLAYER"] = 9900,
["Infobox_rugby_team"] = 2600,
["Infobox_sailboat_specifications"] = 2300,
["Infobox_saint"] = 5000,
["Infobox_school"] = 38000,
["Infobox_school/short_description"] = 38000,
["Infobox_school_district"] = 5700,
["Infobox_school_district/styles.css"] = 5700,
["Infobox_scientist"] = 49000,
["Infobox_service_record"] = 2600,
["Infobox_settlement"] = 563000,
["Infobox_settlement/areadisp"] = 239000,
["Infobox_settlement/columns"] = 95000,
["Infobox_settlement/columns/styles.css"] = 95000,
["Infobox_settlement/densdisp"] = 439000,
["Infobox_settlement/impus"] = 82000,
["Infobox_settlement/lengthdisp"] = 169000,
["Infobox_settlement/link"] = 95000,
["Infobox_settlement/metric"] = 212000,
["Infobox_settlement/pref"] = 294000,
["Infobox_settlement/styles.css"] = 563000,
["Infobox_ship_begin"] = 41000,
["Infobox_ship_career"] = 37000,
["Infobox_ship_characteristics"] = 41000,
["Infobox_ship_class_overview"] = 4100,
["Infobox_ship_image"] = 40000,
["Infobox_shopping_mall"] = 3500,
["Infobox_short_story"] = 2400,
["Infobox_skier"] = 2500,
["Infobox_soap_character"] = 2900,
["Infobox_software"] = 14000,
["Infobox_software/simple"] = 14000,
["Infobox_song"] = 76000,
["Infobox_song/color"] = 76000,
["Infobox_song/link"] = 76000,
["Infobox_spaceflight"] = 3600,
["Infobox_spaceflight/styles.css"] = 3600,
["Infobox_sport_event"] = 2200,
["Infobox_sports_competition_event"] = 18000,
["Infobox_sports_competition_event/medalrow"] = 12000,
["Infobox_sports_league"] = 5100,
["Infobox_sports_season"] = 5500,
["Infobox_sports_team"] = 2200,
["Infobox_sportsperson"] = 108000,
["Infobox_stadium"] = 3300,
["Infobox_station"] = 55000,
["Infobox_station/doc"] = 55000,
["Infobox_station/services"] = 55000,
["Infobox_station/styles.css"] = 55000,
["Infobox_street"] = 3500,
["Infobox_swimmer"] = 9400,
["Infobox_television"] = 57000,
["Infobox_television/Short_description"] = 55000,
["Infobox_television_channel"] = 6200,
["Infobox_television_episode"] = 12000,
["Infobox_television_episode/styles.css"] = 12000,
["Infobox_television_season"] = 9600,
["Infobox_television_station"] = 3700,
["Infobox_tennis_biography"] = 10000,
["Infobox_tennis_event"] = 2600,
["Infobox_tennis_tournament_event"] = 19000,
["Infobox_tennis_tournament_year"] = 9300,
["Infobox_tennis_tournament_year/color"] = 28000,
["Infobox_tennis_tournament_year/footer"] = 28000,
["Infobox_tournament_season"] = 11000,
["Infobox_train"] = 2300,
["Infobox_union"] = 2000,
["Infobox_university"] = 26000,
["Infobox_user"] = 2700,
["Infobox_venue"] = 18000,
["Infobox_video_game"] = 28000,
["Infobox_video_game/styles.css"] = 28000,
["Infobox_volleyball_biography"] = 5500,
["Infobox_weapon"] = 7400,
["Infobox_weather_event"] = 2100,
["Infobox_weather_event/Effects"] = 2000,
["Infobox_weather_event/Footer"] = 2100,
["Infobox_weather_event/styles.css"] = 2100,
["Infobox_website"] = 7700,
["Infobox_writer"] = 39000,
["Information"] = 101000,
["Information/styles.css"] = 101000,
["Inline_block"] = 4700,
["Inprogress"] = 2400,
["Input_link"] = 32000,
["Instagram"] = 11000,
["Interlanguage_link"] = 161000,
["Interlanguage_link_multi"] = 18000,
["Internet_Archive_author"] = 19000,
["Internet_Archive_film"] = 2500,
["Intitle"] = 13000,
["Iptalk"] = 17000,
["IranCensus2006"] = 46000,
["IranNCSGN"] = 3200,
["Iran_Census_2006"] = 46000,
["Irc"] = 2100,
["Irish_place_name"] = 2700,
["IsIPAddress"] = 36000,
["IsValidPageName"] = 2600,
["Is_MLB_league"] = 3200,
["Is_NPB_league"] = 3200,
["Is_country_in_Central_America"] = 13000,
["Is_country_in_the_Caribbean"] = 14000,
["Is_interwiki_link"] = 6000,
["Is_italic_taxon"] = 495000,
["Is_redirect"] = 28000,
["Isbn"] = 7900,
["Isfdb_name"] = 3600,
["Isfdb_title"] = 4400,
["Isnumeric"] = 142000,
["Iso2continent"] = 36000,
["Iso2country"] = 23000,
["Iso2country/article"] = 22000,
["Iso2country/data"] = 23000,
["Iso2nationality"] = 204000,
["Issubst"] = 72000,
["Isu_name"] = 2200,
["Italic_dab2"] = 5300,
["Italic_title"] = 277000,
["Italic_title_prefixed"] = 8600,
["Italics_colon"] = 3800,
["Italictitle"] = 4000,
["Ivm"] = 5700,
["Ivm/styles.css"] = 5700,
["Ivmbox"] = 124000,
["Ivory_messagebox"] = 145000,
["Module:I18n/complex_date"] = 67000,
["Module:IP"] = 132000,
["Module:IPA"] = 144000,
["Module:IPA/data"] = 129000,
["Module:IPA/styles.css"] = 115000,
["Module:IPA_symbol"] = 4900,
["Module:IPA_symbol/data"] = 4900,
["Module:IPAc-en"] = 49000,
["Module:IPAc-en/data"] = 49000,
["Module:IPAc-en/phonemes"] = 49000,
["Module:IPAc-en/pronunciation"] = 49000,
["Module:IPAddress"] = 188000,
["Module:ISO_3166"] = 1020000,
["Module:ISO_3166/data/AT"] = 2500,
["Module:ISO_3166/data/BA"] = 3400,
["Module:ISO_3166/data/CA"] = 2500,
["Module:ISO_3166/data/CN"] = 2100,
["Module:ISO_3166/data/DE"] = 15000,
["Module:ISO_3166/data/ES"] = 3600,
["Module:ISO_3166/data/FR"] = 38000,
["Module:ISO_3166/data/GB"] = 6400,
["Module:ISO_3166/data/GR"] = 3100,
["Module:ISO_3166/data/IN"] = 29000,
["Module:ISO_3166/data/IR"] = 9200,
["Module:ISO_3166/data/National"] = 1020000,
["Module:ISO_3166/data/PL"] = 6900,
["Module:ISO_3166/data/RS"] = 3200,
["Module:ISO_3166/data/RU"] = 25000,
["Module:ISO_3166/data/US"] = 85000,
["Module:ISO_639_name"] = 20000,
["Module:ISOdate"] = 67000,
["Module:Icon"] = 585000,
["Module:Icon/data"] = 585000,
["Module:If_empty"] = 3720000,
["Module:If_in_page"] = 11000,
["Module:If_preview"] = 301000,
["Module:If_preview/configuration"] = 301000,
["Module:If_preview/styles.css"] = 301000,
["Module:Import_style"] = 12000,
["Module:In_lang"] = 360000,
["Module:Indent"] = 4600,
["Module:Infobox"] = 4140000,
["Module:Infobox/dates"] = 69000,
["Module:Infobox/styles.css"] = 4400000,
["Module:Infobox3cols"] = 299000,
["Module:InfoboxImage"] = 4460000,
["Module:Infobox_body_of_water_tracking"] = 18000,
["Module:Infobox_cyclist_tracking"] = 16000,
["Module:Infobox_gene"] = 13000,
["Module:Infobox_mapframe"] = 417000,
["Module:Infobox_military_conflict"] = 22000,
["Module:Infobox_military_conflict/styles.css"] = 22000,
["Module:Infobox_multi-lingual_name"] = 21000,
["Module:Infobox_multi-lingual_name/data"] = 21000,
["Module:Infobox_power_station"] = 3100,
["Module:Infobox_road"] = 25000,
["Module:Infobox_road/browselinks"] = 25000,
["Module:Infobox_road/errors"] = 24000,
["Module:Infobox_road/length"] = 25000,
["Module:Infobox_road/locations"] = 24000,
["Module:Infobox_road/map"] = 25000,
["Module:Infobox_road/route"] = 25000,
["Module:Infobox_road/sections"] = 24000,
["Module:Infobox_television"] = 57000,
["Module:Infobox_television_disambiguation_check"] = 64000,
["Module:Infobox_television_episode"] = 12000,
["Module:Infobox_television_season_disambiguation_check"] = 9100,
["Module:Infobox_television_season_name"] = 9600,
["Module:Internet_Archive"] = 19000,
["Module:IrelandByCountyCatNav"] = 3400,
["Module:Is_article"] = 2000,
["Module:Is_infobox_in_lead"] = 378000,
["Module:Is_instance"] = 337000,
["Module:Italic_title"] = 1130000,
["Module:Italic_title2"] = 5300,
}
443e44fe177c5d88fb74f56ec7a0c9bf2d02c30a
Template:Infobox/doc
10
137
266
265
2023-12-24T02:08:02Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Infobox/doc]]
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{distinguish|Template:Userbox}}
{{#ifeq:{{SUBPAGENAME}}|sandbox||{{High-use}}}}
{{Lua|Module:Infobox}}
{{Parameter names example
|name={{PAGENAME}} <!--|child |subbox |decat--> |title |above |subheader |subheader1 |subheader2={{{subheader2}}}<br/>......
|image|caption |image1|caption1 |image2|caption2={{{caption2}}}<br/>......
|header1=<div style="border-top:1px dashed #ccc;">{{{header1}}}<br/>{{nobold|( ''or'' )}}</div>
|label2={{{label1}}} |data2={{{data1}}}
|data3=( ''or'' ) |data4=<div style="padding-bottom:0.25em;border-bottom:1px dashed #ccc;">{{{data1}}}</div>
|header5={{{header2}}}<br/><div style="padding:0.75em 0 0.5em;">{{nobold|( ''or'' )}}</div>
|label6={{{label2}}} |data6={{{data2}}}
|data7=( ''or'' ) |data8=<div style="padding-bottom:0.25em;border-bottom:1px dashed #ccc;">{{{data2}}}</div>
|data9=<div style="padding:0.75em 0 0.5em;">( ''etc'' )</div>
|below
}}
This template is intended as a meta template: a template used for constructing other templates. '''Note''': In general, it is not meant for use directly in an article, but can be used on a one-off basis if required. [[Help:Infobox]] contains an introduction about the recommended content and design of infoboxes; [[Wikipedia:Manual of Style/Infoboxes]] contains additional style guidelines. See [[WP:List of infoboxes]] and [[:Category:Infobox templates]] for lists of prepared topic-specific infoboxes.
== Usage ==
{{tlf|Infobox}} is a meta-template: used to organise an actual <nowiki>{{Infobox sometopic}}</nowiki> template (like {{tl|Infobox building}}).
For <code><nowiki>[[Template:Infobox sometopic]]</nowiki></code>, template code then looks like this, simplified:
<syntaxhighlight lang="wikitext">
{{Infobox
| name = {{{name|{{PAGENAME}}}}}
| image = {{{image|}}}
| caption1 = {{{caption|}}}
| label1 = Former names
| data1 = {{{former_names|}}}
| header2 = General information
| label3 = Status
| data3 = {{{status|}}}
... <!-- etc. -->
}}
</syntaxhighlight>
== Optional control parameters ==
; name : If this parameter is present, "view/talk/edit" links will be added to the bottom of the infobox pointing to the named page, prefixed by <code>Template:</code> if no namespace is specified. You may use the value <nowiki>{{subst:PAGENAME}}</nowiki>; however, this is rarely what you want because it will send users clicking these links in an infobox to the template code rather than the data in the infobox they probably want to change.
; child : See the [[#Embedding|Embedding]] section for details. If this is set to "yes", this child infobox should be titled but have no name parameter. This parameter is empty by default, set it to "yes" to activate it.
; subbox : See the [[#Subboxes|Subboxes]] section for details. If this is set to "yes", this subbox should be titled but have no name parameter. This parameter is empty by default, set to "yes" to activate it. It has no effect if the '''child''' parameter is also set to "yes".
; decat : If this is set to "yes", the current page will not be autocategorized in a maintenance category when the generated infobox has some problems or no visible data section. Leave empty by default or set to "yes" to activate it.
; autoheaders: If this is set to any non-blank value, headers which are not followed by data fields are suppressed. See the "[[#Hiding headers when all its data fields are empty|hiding headers when all its data fields are empty]]" section for more details.
== Content parameters ==
=== Title ===
There are two different ways to put a title on an infobox. One contains the title inside the infobox's border in the uppermost cell of the table, the other puts it as a caption on top of the table. You can use them both together, or just one or the other, or neither (though this is not recommended):
; title : Text to put in the caption over the top of the table (or as section header before the whole content of this table, if this is a child infobox). For [[Wikipedia:Manual of Style/Accessibility#Tables|accessibility reasons]], this is the most recommended alternative.
; above : Text to put within the uppermost cell of the table.
; subheader(n) : additional title fields which fit below {{{title}}} and {{{above}}}, but before images.
Examples:
{{Infobox
| name = Infobox/doc
| title = Text in caption over infobox
| subheader = Subheader of the infobox
| header = (the rest of the infobox goes here)
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox
| name = {{subst:PAGENAME}}
| title = Text in caption over infobox
| subheader = Subheader of the infobox
| header = (the rest of the infobox goes here)
}}
</syntaxhighlight>{{clear}}
{{Infobox
| name = Infobox/doc
| above = Text in uppermost cell of infobox
| subheader = Subheader of the infobox
| subheader2 = Second subheader of the infobox
| header = (the rest of the infobox goes here)
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox
| name = {{subst:PAGENAME}}
| above = Text in uppermost cell of infobox
| subheader = Subheader of the infobox
| subheader2 = Second subheader of the infobox
| header = (the rest of the infobox goes here)
}}
</syntaxhighlight>{{clear}}
=== Illustration images ===
; image(n) : images to display at the top of the template. Use full image syntax, for example <nowiki>[[File:example.png|200px|alt=Example alt text]]</nowiki>. Image is centered by default. See [[WP:ALT]] for more on alt text.
; caption(n) : Text to put underneath the images.
=== Main data ===
; header(n) : Text to use as a header in row n.
; label(n) : Text to use as a label in row n.
; data(n) : Text to display as data in row n.
Note: for any given value for (n), not all combinations of parameters are permitted. The presence of a {{para|header''(n)''}} will cause the corresponding {{para|data''(n)''}} (and {{para|rowclass''(n)''}} {{para|label''(n)''}}, see below) to be ignored; the absence of a {{para|data''(n)''}} will cause the corresponding {{para|label''(n)''}} to be ignored. Valid combinations for any single row are:
* {{para|class''(n)''}} {{para|header''(n)''}}
* {{para|rowclass''(n)''}} {{para|class''(n)''}} {{para|data''(n)''}}
* {{para|rowclass''(n)''}} {{para|label''(n)''}} {{para|class''(n)''}} {{para|data''(n)''}}
See the rendering of header4, label4, and data4 in the [[#Examples|Examples]] section below.
==== Number ranges ====
To allow flexibility when the layout of an infobox is changed, it may be helpful when developing an infobox to use non-contiguous numbers for header and label/data rows. Parameters for new rows can then be inserted in future without having to renumber existing parameters. For example:
<syntaxhighlight lang="wikitext" style="overflow:auto">
| header3 = Section 1
| label5 = Label A
| data5 = Data A
| label7 = Label C
| data7 = Data C
| header10 = Section 2
| label12 = Label D
| data12 = Data D
</syntaxhighlight>{{clear}}
It is also possible to automatically renumber parameter names by using [[User:Frietjes/infoboxgap.js]] or [[Module:IncrementParams]].
There is no upper limit on numbers but there must be at most 50 between each used number.
==== Making data fields optional ====
A row with a label but no data is not displayed. This allows for the easy creation of optional infobox content rows. To make a row optional use a parameter that defaults to an empty string, like so:
<syntaxhighlight lang="wikitext" style="overflow:auto">
| label5 = Population
| data5 = {{{population|}}}
</syntaxhighlight>{{clear}}
This way if an article doesn't define the population parameter in its infobox the row won't be displayed.
For more complex fields with pre-formatted contents that would still be present even if the parameter wasn't set, you can wrap it all in an "#if" statement to make the whole thing vanish when the parameter is not used. For instance, the "#if" statement in the following example reads "#if:the parameter ''mass'' has been supplied |then display it, followed by 'kg'":
<syntaxhighlight lang="wikitext" style="overflow:auto">
| label6 = Mass
| data6 = {{ #if: {{{mass|}}} | {{{mass}}} kg }}
</syntaxhighlight>{{clear}}
For more on #if, see [[meta:ParserFunctions##if:|here]].
==== Hiding headers when all its data fields are empty ====
You can also make headers automatically hide when their section is empty (has no data-row showing).
Consider this situation:
{{Infobox
| title = Example: header with & without data
| headerstyle = background:lightgrey
| header1 = Header1 with empty section
| label2 = label2 text | data2 =
| label3 = label3 text | data3 =
| label4 = label4 text | data4 =
| header5 = Header5 with data below
| label6 = label6 text | data6 = Some value
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox
| title = Example: header with & without data
| headerstyle = background:lightgrey
| header1 = Header1 with empty section
| label2 = label2 text | data2 =
| label3 = label3 text | data3 =
| label4 = label4 text | data4 =
| header5 = Header5 with data below
| label6 = label6 text | data6 = Some value
}}
</syntaxhighlight>{{clear}}
If you want hide the header when no {{para|data''N''}} values are present, use '''{{para|autoheaders|y}}''':
{{Infobox
| title = Example: header with & without data
| autoheaders = y
| headerstyle = background:lightgrey
| header1 = Header1 with empty section
| label2 = label2 text | data2 =
| label3 = label3 text | data3 =
| label4 = label4 text | data4 =
| header5 = Header5 with data below
| label6 = label6 text | data6 = Some value
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox
| title = Example: header with & without data
| autoheaders = y
| headerstyle = background:lightgrey
| header1 = Header1 with empty section
| label2 = label2 text | data2 =
| label3 = label3 text | data3 =
| label4 = label4 text | data4 =
| header5 = Header5 with data below
| label6 = label6 text | data6 = Some value
}}
</syntaxhighlight>{{clear}}
So, header1 will be shown if any of item1, item2, or item3 is defined. If none of the three parameters are defined the header won't be shown and no empty row appears before the next visible content.
Note: if the data has empty css elements, like {{para|data|2=<span style="background:yellow;"></span>}}, this will be treated as non-empty (having data).
If {{para|autoheaders|y}} but there are items that you ''do not'' want to trigger a header, place {{para|headerX|_BLANK_}}. This will serve as an empty header and separate it from the subsequent items.
{{Infobox
| title = Example: blank header with & without data
| autoheaders = y
| headerstyle = background:lightgrey
| header1 = Header1 with empty section
| label2 = label2 text | data2 =
| label3 = label3 text | data3 =
| label4 = label4 text | data4 =
| header5 = _BLANK_
| label6 = label6 text | data6 = Some value, but does not trigger header1 or show header5
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox
| title = Example: header with & without data
| autoheaders = y
| headerstyle = background:lightgrey
| header1 = Header1 with empty section
| label2 = label2 text | data2 =
| label3 = label3 text | data3 =
| label4 = label4 text | data4 =
| header5 = _BLANK_
| label6 = label6 text | data6 = Some value, but does not trigger header1 or show header5
}}
</syntaxhighlight>{{clear}}
=== Footer ===
; below : Text to put in the bottom cell. The bottom cell is intended for footnotes, see-also, and other such information.
== Presentation parameters ==
=== Italic titles ===
Titles of articles with infoboxes may be made italic, in line with [[WP:ITALICTITLE]], by passing the <code>italic title</code> parameter.
* Turn on italic titles by passing {{para|italic title|<nowiki>{{{italic title|}}}</nowiki>}} from the infobox.
* Turn off by default (notably because only Latin script may be safely rendered in this style and italic may be needed to distinguish foreign language from local English language only in that script, but would be difficult to read for other scripts) but allow some instances to be made italic by passing {{para|italic title|<nowiki>{{{italic title|no}}}</nowiki>}}
* Do not make any titles italic by not passing the parameter at all.
=== CSS styling ===
{{div col}}
; bodystyle : Applies to the infobox table as a whole
; titlestyle : Applies only to the title caption. Adding a background color is usually inadvisable since the text is rendered "outside" the infobox.
; abovestyle : Applies only to the "above" cell at the top. The default style has font-size:125%; since this cell is usually used for a title, if you want to use the above cell for regular-sized text include "font-size:100%;" in the abovestyle.
; imagestyle : Applies to the cell the image is in. This includes the text of the image caption, but you should set text properties with captionstyle instead of imagestyle in case the caption is moved out of this cell in the future.
; captionstyle : Applies to the text of the image caption.
; rowstyle(n) : This parameter is inserted into the <code>style</code> attribute for the specified row.
; headerstyle : Applies to all header cells
; subheaderstyle : Applies to all subheader cells
; labelstyle : Applies to all label cells
; datastyle : Applies to all data cells
; belowstyle : Applies only to the below cell
{{div col end}}
=== HTML classes and microformats ===
{{div col}}
; bodyclass : This parameter is inserted into the <code>class</code> attribute for the infobox as a whole.
; titleclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''title''' caption.
<!-- currently not implemented in Lua module
; aboverowclass : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''above''' cell is on.
-->
; aboveclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''above''' cell.
; subheaderrowclass(n) : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''subheader''' is on.
; subheaderclass(n) : This parameter is inserted into the <code>class</code> attribute for the infobox's '''subheader'''.
; imagerowclass(n) : These parameters are inserted into the <code>class</code> attribute for the complete table row their respective '''image''' is on.
; imageclass : This parameter is inserted into the <code>class</code> attribute for the '''image'''.
; rowclass(n) : This parameter is inserted into the <code>class</code> attribute for the specified row including the '''label''' and '''data''' cells.
; class(n) : This parameter is inserted into the <code>class</code> attribute for the '''data''' cell of the specified row. If there's no '''data''' cell it has no effect.
<!-- currently not implemented in Lua module
; belowrowclass : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''below''' cell is on.
-->
; belowclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''below''' cell.
{{div col end}}
This template supports the addition of microformat information. This is done by adding "class" attributes to various data cells, indicating what kind of information is contained within. Multiple class names may be specified, separated by spaces, some of them being used as selectors for custom styling according to a project policy or to the skin selected in user preferences, others being used for microformats.
To flag an infobox as containing [[hCard]] information, for example, add the following parameter:
<syntaxhighlight lang="wikitext" style="overflow:auto">
| bodyclass = vcard
</syntaxhighlight>{{clear}}
And for each row containing a data cell that's part of the vcard, add a corresponding class parameter:
<syntaxhighlight lang="wikitext" style="overflow:auto">
| class1 = fn
| class2 = org
| class3 = tel
</syntaxhighlight>{{clear}}
...and so forth. "above" and "title" can also be given classes, since these are usually used to display the name of the subject of the infobox.
See [[Wikipedia:WikiProject Microformats]] for more information on adding microformat information to Wikipedia, and [[microformat]] for more information on microformats in general.
== Examples ==
Notice how the row doesn't appear in the displayed infobox when a '''label''' is defined without an accompanying '''data''' cell, and how all of them are displayed when a '''header''' is defined on the same row as a '''data''' cell. Also notice that '''subheaders''' are not bold by default like the '''headers''' used to split the main data section, because this role is meant to be for the '''above''' cell :
{{Suppress categories|
{{Infobox
|name = Infobox/doc
|bodystyle =
|titlestyle =
|abovestyle = background:#cfc;
|subheaderstyle =
|title = Test Infobox
|above = Above text
|subheader = Subheader above image
|subheader2 = Second subheader
|imagestyle =
|captionstyle =
|image = [[File:Example-serious.jpg|200px|alt=Example alt text]]
|caption = Caption displayed below File:Example-serious.jpg
|headerstyle = background:#ccf;
|labelstyle = background:#ddf;
|datastyle =
|header1 = Header defined alone
| label1 =
| data1 =
|header2 =
| label2 = Label defined alone does not display (needs data, or is suppressed)
| data2 =
|header3 =
| label3 =
| data3 = Data defined alone
|header4 = All three defined (header, label, data, all with same number)
| label4 = does not display (same number as a header)
| data4 = does not display (same number as a header)
|header5 =
| label5 = Label and data defined (label)
| data5 = Label and data defined (data)
|belowstyle = background:#ddf;
|below = Below text
}}
}}
<syntaxhighlight lang="wikitext">
{{Infobox
|name = Infobox/doc
|bodystyle =
|titlestyle =
|abovestyle = background:#cfc;
|subheaderstyle =
|title = Test Infobox
|above = Above text
|subheader = Subheader above image
|subheader2 = Second subheader
|imagestyle =
|captionstyle =
|image = [[File:Example-serious.jpg|200px|alt=Example alt text]]
|caption = Caption displayed below File:Example-serious.jpg
|headerstyle = background:#ccf;
|labelstyle = background:#ddf;
|datastyle =
|header1 = Header defined alone
| label1 =
| data1 =
|header2 =
| label2 = Label defined alone does not display (needs data, or is suppressed)
| data2 =
|header3 =
| label3 =
| data3 = Data defined alone
|header4 = All three defined (header, label, data, all with same number)
| label4 = does not display (same number as a header)
| data4 = does not display (same number as a header)
|header5 =
| label5 = Label and data defined (label)
| data5 = Label and data defined (data)
|belowstyle = background:#ddf;
|below = Below text
}}
</syntaxhighlight>
For this example, the {{para|bodystyle}} and {{para|labelstyle}} parameters are used to adjust the infobox width and define a default width for the column of labels:
{{Infobox
|name = Infobox/doc
|bodystyle = width:20em
|titlestyle =
|title = Test Infobox
|headerstyle =
|labelstyle = width:33%
|datastyle =
|header1 =
| label1 = Label 1
| data1 = Data 1
|header2 =
| label2 = Label 2
| data2 = Data 2
|header3 =
| label3 = Label 3
| data3 = Data 3
|header4 = Header 4
| label4 =
| data4 =
|header5 =
| label5 = Label 5
| data5 = Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|belowstyle =
|below = Below text
}}
<syntaxhighlight lang="wikitext">
{{Infobox
|name = Infobox/doc
|bodystyle = width:20em
|titlestyle =
|title = Test Infobox
|headerstyle =
|labelstyle = width:33%
|datastyle =
|header1 =
| label1 = Label 1
| data1 = Data 1
|header2 =
| label2 = Label 2
| data2 = Data 2
|header3 =
| label3 = Label 3
| data3 = Data 3
|header4 = Header 4
| label4 =
| data4 =
|header5 =
| label5 = Label 5
| data5 = Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|belowstyle =
|below = Below text
}}
</syntaxhighlight>
== Embedding ==
<!--Linked from [[Template:Subinfobox bodystyle/doc]]-->
One infobox template can be embedded into another using the {{para|child}} parameter. This feature can be used to create a modular infobox, or to create better-defined logical sections. Long ago, it was necessary to use embedding in order to create infoboxes with more than 99 rows; but nowadays there's no limit to the number of rows that can be defined in a single instance of <code><nowiki>{{infobox}}</nowiki></code>.
{{Infobox
| title = Top level title
| data1 = {{Infobox | decat = yes | child = yes
| title = First subsection
| label1= Label 1.1
| data1 = Data 1.1
}}
| data2 = {{Infobox | decat = yes | child = yes
|title = Second subsection
| label1= Label 2.1
| data1 = Data 2.1
}}
| belowstyle =
| below = Below text
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox
| title = Top level title
| data1 = {{Infobox | decat = yes | child = yes
| title = First subsection
| label1= Label 1.1
| data1 = Data 1.1
}}
| data2 = {{Infobox | decat = yes | child = yes
|title = Second subsection
| label1= Label 2.1
| data1 = Data 2.1
}}
| belowstyle =
| below = Below text
}}
</syntaxhighlight>{{clear}}
Note, in the examples above, the child infobox is placed in a <code>data</code> field, not a <code>header</code> field. Notice that the section subheadings are not in bold font if bolding is not explicitly specified. To obtain bold section headings, place the child infobox in a '''header''' field (but not in a '''label''' field because it would not be displayed!), either using
{{Infobox
| title = Top level title
| header1 = {{Infobox | decat = yes | child = yes
| title = First subsection
| label1= Label 1.1
| data1 = Data 1.1
}}
| header2 = {{Infobox | decat = yes | child = yes
| title = Second subsection
| label1= Label 2.1
| data1 = Data 2.1
}}
| belowstyle =
| below = Below text
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox
| title = Top level title
| header1 = {{Infobox | decat = yes | child = yes
| title = First subsection
| label1= Label 1.1
| data1 = Data 1.1
}}
| header2 = {{Infobox | decat = yes | child = yes
| title = Second subsection
| label1= Label 2.1
| data1 = Data 2.1
}}
| belowstyle =
| below = Below text
}}
</syntaxhighlight>{{clear}}
or,
{{Infobox
| title = Top level title
| header1 = First subsection
{{Infobox | decat = yes | child = yes
| label1 = Label 1.1
| data1 = Data 1.1
}}
| header2 = Second subsection
{{Infobox | decat = yes | child = yes
| label1 = Label 2.1
| data1 = Data 2.1
}}
| belowstyle =
| below = Below text
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox
| title = Top level title
| header1 = First subsection
{{Infobox | decat = yes | child = yes
| label1 = Label 1.1
| data1 = Data 1.1
}}
| header2 = Second subsection
{{Infobox | decat = yes | child = yes
| label1 = Label 2.1
| data1 = Data 2.1
}}
| belowstyle =
| below = Below text
}}
</syntaxhighlight>{{clear}}
Note that omitting the {{para|title}} parameter, and not including any text preceding the embedded infobox, may result in spurious blank table rows, creating gaps in the visual presentation. The garbage output can be suppressed using {{para|rowstyleN|display: none}}, replacing N with the data/header number.
[[Wikipedia:WikiProject Infoboxes/embed]] includes some links to Wikipedia articles which include infoboxes embedded within other infoboxes.
== Subboxes ==
An alternative method for embedding is to use {{para|subbox|yes}}, which removes the outer border from the infobox, but preserves the interior structure. One feature of this approach is that the parent and child boxes need not have the same structure, and the label and data fields are not aligned between the parent and child boxes because they are not in the same parent table.
{{Infobox
| headerstyle = background-color:#eee;
| labelstyle = background-color:#eee;
| header1 = Main 1
| header2 = Main 2
| data3 = {{Infobox | subbox = yes
| headerstyle = background-color:#ccc;
| labelstyle = background-color:#ddd;
| header1 = Sub 3-1
| header2 = Sub 3-2
| label3 = Label 3-3 | data3 = Data 3-3
}}
| data4 = {{Infobox | subbox = yes
| labelstyle = background-color:#ccc;
| label1 = Label 4-1 | data1 = Data 4-1
}}
| label5 = Label 5 | data5 = Data 5
| header6 = Main 6
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox
| headerstyle = background-color:#eee;
| labelstyle = background-color:#eee;
| header1 = Main 1
| header2 = Main 2
| data3 = {{Infobox | subbox = yes
| headerstyle = background-color:#ccc;
| labelstyle = background-color:#ddd;
| header1 = Sub 3-1
| header2 = Sub 3-2
| label3 = Label 3-3 | data3 = Data 3-3
}}
| data4 = {{Infobox | subbox = yes
| labelstyle = background-color:#ccc;
| label1 = Label 4-1 | data1 = Data 4-1
}}
| label5 = Label 5 | data5 = Data 5
| header6 = Main 6
}}
</syntaxhighlight>{{clear}}
Similar embedding techniques may be used within content parameters of some other templates generating tables (such as [[:Template:Sidebar|Sidebar]]) :
{{Sidebar
| navbar = off
| headingstyle = background-color:#eee;
| heading1 = Heading 1
| heading2 = Heading 2
| content3 = {{Infobox | subbox = yes
| headerstyle = background-color:#ccc;
| labelstyle = background-color:#ddd;
| header1 = Sub 3-1
| header2 = Sub 3-2
| label3 = Label 3-3 | data3 = Data 3-3
}}
| content4 = {{Infobox | subbox = yes
| labelstyle = background-color:#ccc;
| label1 = Label 4-1 | data1 = Data 4-1
}}
| heading5 = Heading 5
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Sidebar
| navbar = off
| headingstyle = background-color:#eee;
| heading1 = Heading 1
| heading2 = Heading 2
| content3 = {{Infobox | subbox = yes
| headerstyle = background-color:#ccc;
| labelstyle = background-color:#ddd;
| header1 = Sub 3-1
| header2 = Sub 3-2
| label3 = Label 3-3 | data3 = Data 3-3
}}
| content4 = {{Infobox | subbox = yes
| labelstyle = background-color:#ccc;
| label1 = Label 4-1 | data1 = Data 4-1
}}
| heading5 = Heading 5
}}
</syntaxhighlight>{{clear}}
Note that the default padding of the parent data cell containing each subbox is still visible, so the subboxes are slightly narrower than the parent box and there's a higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.
== Controlling line-breaking in embedded bulletless lists ==
Template {{tlx|nbsp}} may be used with {{tlx|wbr}} and {{tlx|nowrap}} to control line-breaking in bulletless lists embedded in infoboxes (e.g. cast list in {{tlx|Infobox film}}), to prevent wrapped long entries from being confused with multiple entries. See [[Template:Wbr/doc#Controlling line-breaking in infoboxes]] for details.
== Full blank syntax ==
(Note: there is no limit to the number of possible rows; only 20 are given below since infoboxes larger than that will be relatively rare. Just extend the numbering as needed. The microformat "class" parameters are also omitted as they are not commonly used.)
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox
| name = {{subst:PAGENAME}}
| child = {{{child|}}}
| subbox = {{{subbox|}}}
| italic title = {{{italic title|no}}}
| templatestyles =
| child templatestyles =
| grandchild templatestyles =
| bodystyle =
| titlestyle =
| abovestyle =
| subheaderstyle =
| title =
| above =
| subheader =
| imagestyle =
| captionstyle =
| image =
| caption =
| image2 =
| caption2 =
| headerstyle =
| labelstyle =
| datastyle =
| header1 =
| label1 =
| data1 =
| header2 =
| label2 =
| data2 =
| header3 =
| label3 =
| data3 =
| header4 =
| label4 =
| data4 =
| header5 =
| label5 =
| data5 =
| header6 =
| label6 =
| data6 =
| header7 =
| label7 =
| data7 =
| header8 =
| label8 =
| data8 =
| header9 =
| label9 =
| data9 =
| header10 =
| label10 =
| data10 =
| header11 =
| label11 =
| data11 =
| header12 =
| label12 =
| data12 =
| header13 =
| label13 =
| data13 =
| header14 =
| label14 =
| data14 =
| header15 =
| label15 =
| data15 =
| header16 =
| label16 =
| data16 =
| header17 =
| label17 =
| data17 =
| header18 =
| label18 =
| data18 =
| header19 =
| label19 =
| data19 =
| header20 =
| label20 =
| data20 =
| belowstyle =
| below =
}}
</syntaxhighlight>{{clear}}
{{Help:Infobox/user style}}
== Porting to other MediaWikis ==
The infobox template requires the [[:mw:Extension:Scribunto|Scribunto]] and [[:mw:Extension:TemplateStyles|TemplateStyles]] extensions. [[Wikipedia:WikiProject Transwiki|WikiProject Transwiki]] has a version of this template that has been modified to work on other MediaWikis.
== TemplateData ==
{{TemplateData header}}
<templatedata>
{
"description": "This template is intended as a meta template, a template used for constructing other templates. In general, it is not meant for use directly in an article but can be used on a one-off basis if required.",
"format": "{{_\n| ________________ = _\n}}\n",
"params": {
"title": {
"label": "Title",
"description": "Title displayed above the infobox",
"type": "string",
"suggested": true
},
"image": {
"label": "Image",
"description": "Image illustrating the topic. Use full image syntax.",
"type": "content",
"suggested": true,
"example": "[[File:example.png|200px|alt=Example alt text]]"
},
"caption": {
"label": "Caption",
"description": "caption for the image",
"type": "content",
"suggested": true
}
},
"paramOrder": [
"title",
"image",
"caption"
]
}
</templatedata>
==Tracking categories==
* {{Category link with count|Articles with missing Wikidata information}}
* {{Category link with count|Articles using infobox templates with no data rows}}
* {{Category link with count|Pages using embedded infobox templates with the title parameter}}
==See also==
* [[Module:Infobox]], the [[WP:LUA|Lua]] module on which this template is based
* [[Module:Check for unknown parameters]]
* {{tl|Infobox3cols}}
* {{tl|Navbox}} and {{tl|Sidebar}}
* [[Wikipedia:List of infoboxes|List of infoboxes]]
* [[:Module:InfoboxImage]]
<includeonly>{{Sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Infobox templates| ]]
[[Category:Wikipedia metatemplates|Infobox]]
[[Category:Templates generating microformats]]
[[Category:Templates that add a tracking category]]
[[Category:Templates based on the Infobox Lua module]]
}}</includeonly>
b7ba187ea76ee960bbe295ad01c44c646eaedadb
Help:Infobox/user style
12
138
268
267
2023-12-24T02:08:03Z
Floopymichael
2
1 revision imported from [[:wikipedia:Help:Infobox/user_style]]
wikitext
text/x-wiki
{{{heading|
==Infoboxes and user style ==
}}}
Users can have [[WP:User style|user CSS]] that hides<!--, moves, or makes collapsible--> any infoboxes in their own browsers.
To hide all infoboxes, add the following to [[Special:MyPage/common.css]] (for all [[WP:Skin|skins]], or [[Special:MyPage/skin.css]] for just the current skin), on a line by itself:
<syntaxhighlight lang="css">div.mw-parser-output .infobox { display: none; }</syntaxhighlight>
Alternatively, you can add the following code to [[Special:MyPage/common.js|your common.js]] or into a browser user script that is executed by an extension like [[Greasemonkey]]:
<syntaxhighlight lang="js">$('.infobox').hide();</syntaxhighlight>
Be aware that although{{#if:{{{guideline|}}}||, per [[WP:Manual of Style/Infoboxes]],}} all information in an infobox ideally should also be found in the main body of an article, there isn't perfect compliance with this guideline. For example, the full taxonomic hierarchy in {{tlx|Taxobox}}, and the OMIM and other medical database codes of {{tlx|Infobox disease}} are often not found in the main article content. The infobox is also often the location of the most significant, even only, image in an article. There is a userscript which removes infoboxes but moves the images contained to separate thumbnails: [[User:Maddy from Celeste/disinfobox.js]].<!--
Needs Special:Mypage/common.js options for:
* Making infoboxes collapsible
** Making them auto-collapsed
* Moving infoboxes to bottom of page
--><noinclude>
{{Documentation|content=
This documentation snippet is transcluded at [[Help:Infobox]], [[Template:Infobox/doc]], [[WP:Customisation#Hiding specific messages]], [[Help:User style]], [[WP:Manual of Style/Infoboxes]], and other places where this information is relevant.
As a template, this snippet takes a {{para|heading}} parameter to replace the level-2 <code>==Infoboxes and user style==</code> section heading code, as needed. E.g., for a <code>=== ... ===</code> level-3 heading: <code><nowiki>heading={{=}}{{=}}{{=}}Infoboxes and user style{{=}}{{=}}{{=}}</nowiki></code>
}}
</noinclude>
ba4dac68eb2bdc49a32f2a11b9afd52381bf06b5
Module:Message box/ombox.css
828
139
270
269
2023-12-24T02:08:03Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Message_box/ombox.css]]
sanitized-css
text/css
/* {{pp|small=y}} */
.ombox {
margin: 4px 0;
border-collapse: collapse;
border: 1px solid #a2a9b1; /* Default "notice" gray */
background-color: #f8f9fa;
box-sizing: border-box;
}
/* For the "small=yes" option. */
.ombox.mbox-small {
font-size: 88%;
line-height: 1.25em;
}
.ombox-speedy {
border: 2px solid #b32424; /* Red */
background-color: #fee7e6; /* Pink */
}
.ombox-delete {
border: 2px solid #b32424; /* Red */
}
.ombox-content {
border: 1px solid #f28500; /* Orange */
}
.ombox-style {
border: 1px solid #fc3; /* Yellow */
}
.ombox-move {
border: 1px solid #9932cc; /* Purple */
}
.ombox-protection {
border: 2px solid #a2a9b1; /* Gray-gold */
}
.ombox .mbox-text {
border: none;
/* @noflip */
padding: 0.25em 0.9em;
width: 100%;
}
.ombox .mbox-image {
border: none;
/* @noflip */
padding: 2px 0 2px 0.9em;
text-align: center;
}
.ombox .mbox-imageright {
border: none;
/* @noflip */
padding: 2px 0.9em 2px 0;
text-align: center;
}
/* An empty narrow cell */
.ombox .mbox-empty-cell {
border: none;
padding: 0;
width: 1px;
}
.ombox .mbox-invalid-type {
text-align: center;
}
@media (min-width: 720px) {
.ombox {
margin: 4px 10%;
}
.ombox.mbox-small {
/* @noflip */
clear: right;
/* @noflip */
float: right;
/* @noflip */
margin: 4px 0 4px 1em;
width: 238px;
}
}
8fe3df4bb607e699eab2dbd23bd4a1a446391002
Template:Hlist/styles.css
10
140
272
271
2023-12-24T02:08:03Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Hlist/styles.css]]
sanitized-css
text/css
/* {{pp-protected|reason=match parent|small=yes}} */
/*
* hlist styles are defined in core and Minerva and differ in Minerva. The
* current definitions here (2023-01-01) are sufficient to override Minerva
* without use of the hlist-separated class. The most problematic styles were
* related to margin, padding, and the bullet. Check files listed at
* [[MediaWiki talk:Common.css/to do#hlist-separated]]
*/
/*
* TODO: When the majority of readership supports it (or some beautiful world
* in which grade C support is above the minimum threshold), use :is()
*/
.hlist dl,
.hlist ol,
.hlist ul {
margin: 0;
padding: 0;
}
/* Display list items inline */
.hlist dd,
.hlist dt,
.hlist li {
/*
* don't trust the note that says margin doesn't work with inline
* removing margin: 0 makes dds have margins again
* We also want to reset margin-right in Minerva
*/
margin: 0;
display: inline;
}
/* Display requested top-level lists inline */
.hlist.inline,
.hlist.inline dl,
.hlist.inline ol,
.hlist.inline ul,
/* Display nested lists inline */
.hlist dl dl,
.hlist dl ol,
.hlist dl ul,
.hlist ol dl,
.hlist ol ol,
.hlist ol ul,
.hlist ul dl,
.hlist ul ol,
.hlist ul ul {
display: inline;
}
/* Hide empty list items */
.hlist .mw-empty-li {
display: none;
}
/* TODO: :not() can maybe be used here to remove the later rule. naive test
* seems to work. more testing needed. like so:
*.hlist dt:not(:last-child)::after {
* content: ": ";
*}
*.hlist dd:not(:last-child)::after,
*.hlist li:not(:last-child)::after {
* content: " · ";
* font-weight: bold;
*}
*/
/* Generate interpuncts */
.hlist dt::after {
content: ": ";
}
.hlist dd::after,
.hlist li::after {
content: " · ";
font-weight: bold;
}
.hlist dd:last-child::after,
.hlist dt:last-child::after,
.hlist li:last-child::after {
content: none;
}
/* Add parentheses around nested lists */
.hlist dd dd:first-child::before,
.hlist dd dt:first-child::before,
.hlist dd li:first-child::before,
.hlist dt dd:first-child::before,
.hlist dt dt:first-child::before,
.hlist dt li:first-child::before,
.hlist li dd:first-child::before,
.hlist li dt:first-child::before,
.hlist li li:first-child::before {
content: " (";
font-weight: normal;
}
.hlist dd dd:last-child::after,
.hlist dd dt:last-child::after,
.hlist dd li:last-child::after,
.hlist dt dd:last-child::after,
.hlist dt dt:last-child::after,
.hlist dt li:last-child::after,
.hlist li dd:last-child::after,
.hlist li dt:last-child::after,
.hlist li li:last-child::after {
content: ")";
font-weight: normal;
}
/* Put ordinals in front of ordered list items */
.hlist ol {
counter-reset: listitem;
}
.hlist ol > li {
counter-increment: listitem;
}
.hlist ol > li::before {
content: " " counter(listitem) "\a0";
}
.hlist dd ol > li:first-child::before,
.hlist dt ol > li:first-child::before,
.hlist li ol > li:first-child::before {
content: " (" counter(listitem) "\a0";
}
8c9dd9c9c00f30eead17fe10f51d183333e81f33
Template:Infobox officeholder
10
141
274
273
2023-12-24T02:08:30Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Infobox_officeholder]]
wikitext
text/x-wiki
{{#invoke:infobox|infoboxTemplate
| bodyclass = vcard {{{bodyclass|}}}
| bodystyle = {{#if:{{{mainwidth|}}}|width: {{{mainwidth}}}}}
| child = {{lc:{{{embed}}}}}
| abovestyle = font-size: 100%;
| above = {{#if:{{{honorific prefix|{{{honorific_prefix|{{{honorific-prefix|}}}}}}}}}|<div class="honorific-prefix" style="font-weight: normal;">{{{honorific prefix|{{{honorific_prefix|{{{honorific-prefix}}}}}}}}}</div>}}<!--
--><div class="fn" style="font-size:125%;">{{#if:{{{name|}}}|{{{name}}}|{{PAGENAMEBASE}}}}</div><!--
-->{{#if:{{{honorific suffix|{{{honorific_suffix|{{{honorific-suffix|}}}}}}}}}|<div class="honorific-suffix" style="font-weight: normal;">{{{honorific suffix|{{{honorific_suffix|{{{honorific-suffix}}}}}}}}}</div>}}
| subheaderstyle = font-size:125%; font-weight:bold;
| subheader = {{#ifeq:{{lc:{{{embed}}}}}|yes||{{#if:{{{native_name|}}}|{{#if:{{{native_name_lang|}}}|<div class="nickname" lang="{{{native_name_lang}}}">}}{{{native_name}}}{{#if:{{{native_name_lang|}}}|</div>}}}}}}
| image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{width|{{{imagesize|{{{image_size|}}}}}}}}}|sizedefault=frameless|upright={{{image_upright|1}}}|alt={{{alt|}}}|suppressplaceholder=yes}}
| image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image name|}}}|size={{{width|{{{imagesize|{{{image_size|}}}}}}}}}|sizedefault=frameless|upright={{{image_upright|1}}}|alt={{{image_name_alt|}}}|suppressplaceholder=yes}}
| image3 = {{#invoke:InfoboxImage|InfoboxImage|image={{{smallimage|}}}|sizedefault=frameless|upright={{{image_upright|1}}}|alt={{{smallimage_alt|}}}|suppressplaceholder=yes}}
| captionstyle = line-height:normal;padding-top:0.2em;
| caption{{#if:{{{smallimage|}}}|3|{{#if:{{{image name|}}}|2}}}} = {{{caption|}}}
| headerstyle = {{#ifeq:{{lc:{{{embed}}}}}|yes|background:#eee|background:lavender}}
| data1 =
{{#if:{{{speaker|}}}|
{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname2|}}}
| 1namedata = {{{1namedata2|}}}
| 2blankname = {{{2blankname2|}}}
| 2namedata = {{{2namedata2|}}}
| 3blankname = {{{3blankname2|}}}
| 3namedata = {{{3namedata2|}}}
| 4blankname = {{{4blankname2|}}}
| 4namedata = {{{4namedata2|}}}
| 5blankname = {{{5blankname2|}}}
| 5namedata = {{{5namedata2|}}}
| alongside = {{{alongside2|}}}
| ambassador_from = {{{ambassador_from2|}}}
| appointer = {{#if: {{{appointer2|}}} | {{{appointer2}}} | {{{appointed2|}}} }}
| assembly = {{{assembly2|}}}
| assuming = {{{assuming2|}}}
| chancellor = {{{chancellor2|}}}
| co-leader = {{{co-leader2|}}}
| constituency_{{#if:{{{constituency_AM2|}}}|AM|MP}} = {{#if: {{{constituency_AM2|}}} | {{{constituency_AM2}}} | {{{constituency_MP2|}}} }}
| constituency = {{{constituency2|}}}
| convocation = {{{convocation2|}}}
| country = {{{country2|}}}
| deputy = {{{deputy2|}}}
| district = {{{district2|}}}
| firstminister = {{{firstminister2|}}}
| governor-general = {{{governor-general2|}}}
| governor_general = {{{governor_general2|}}}
| governor = {{{governor2|}}}
| jr/sr = {{{jr/sr2|}}}
| jr/sr and state = {{{jr/sr and state2|}}}
| leader = {{{leader2|}}}
| legislature = {{{legislature2|}}}
| lieutenant_governor = {{{lieutenant_governor2|}}}
| lieutenant = {{{lieutenant2|}}}
| majority_leader = {{#if: {{{majorityleader2|}}} | {{{majorityleader2}}} | {{{majority_leader2|}}} }}
| minister_from = {{{minister_from2|}}}
| minority_floor_leader = {{{minority_floor_leader2|}}}
| majority_floor_leader = {{{majority_floor_leader2|}}}
| majority = {{{majority2|}}}
| minister = {{{minister2|}}}
| minority_leader = {{#if: {{{minorityleader2|}}} | {{{minorityleader2}}} | {{{minority_leader2|}}} }}
| monarch = {{{monarch2|}}}
| nominator = {{{nominator2|}}}
| office = {{{office2|}}}
| order = {{{order2|}}}
| parliament = {{{parliament2|}}}
| parliamentarygroup = {{{parliamentarygroup2|}}}
| predecessor = {{{predecessor2|}}}
| preceding = {{{preceding2|}}}
| preceded = {{{preceded2|}}}
| premier = {{{premier2|}}}
| president = {{{president2|}}}
| primeminister = {{{primeminister2|}}}
| riding = {{{riding2|}}}
| speaker = {{{speaker|}}}
| speaker_office = {{{speaker_office|}}}
| state_assembly = {{{state_assembly|}}}
| state_delegate = {{{state_delegate|}}}
| state_house = {{{state_house|}}}
| state_legislature = {{{state_legislature|}}}
| state_senate = {{{state_senate|}}}
| state = {{{state|}}}
| subterm = {{nobold|{{{subterm|}}}}}
| suboffice = {{{suboffice|}}}
| succeeded = {{{succeeded2|}}}
| succeeding = {{{succeeding2|}}}
| successor = {{{successor2|}}}
| taoiseach = {{{taoiseach2|}}}
| termlabel = {{{term_label2|{{{termlabel2|In office}}}}}}
| termend = {{#if:{{{termend2|}}}|{{{termend2}}}|{{{term_end2|}}}}}
| termstart = {{#if:{{{termstart2|}}}|{{{termstart2}}}|{{{term_start2|}}}}}
| term = {{{term2|}}}
| title = {{{title2|}}}
| vicegovernor = {{{vicegovernor2|}}}
| vicepresident = {{{vicepresident2|}}}
| vicepremier = {{{vicepremier2|}}}
| viceprimeminister = {{{viceprimeminister2|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term|}}}
}}}}}}<!--
-->{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname|}}}
| 1namedata = {{{1namedata|}}}
| 2blankname = {{{2blankname|}}}
| 2namedata = {{{2namedata|}}}
| 3blankname = {{{3blankname|}}}
| 3namedata = {{{3namedata|}}}
| 4blankname = {{{4blankname|}}}
| 4namedata = {{{4namedata|}}}
| 5blankname = {{{5blankname|}}}
| 5namedata = {{{5namedata|}}}
| alongside = {{{alongside|}}}
| ambassador_from = {{{ambassador_from|}}}
| appointer = {{#if: {{{appointer|}}} | {{{appointer}}} | {{{appointed|}}} }}
| assembly = {{{assembly|}}}
| assuming = {{{assuming|}}}
| candidate = {{{candidate|}}}
| chancellor = {{{chancellor|}}}
| co-leader = {{{co-leader|}}}
| constituency_{{#if:{{{constituency_AM|}}}|AM|MP}} = {{#if: {{{constituency_AM|}}} | {{{constituency_AM}}} | {{{constituency_MP|}}} }}
| constituency = {{{constituency|}}}
| convocation = {{{convocation|}}}
| country = {{{country|}}}
| deputy = {{{deputy|}}}
| district = {{{district|}}}
| election_date = {{{election_date|}}}
| firstminister = {{{firstminister|}}}
| governor-general = {{{governor-general|}}}
| governor_general = {{{governor_general|}}}
| governor = {{{governor|}}}
| incumbent = {{{incumbent|}}}
| jr/sr = {{{jr/sr|}}}
| jr/sr and state = {{{jr/sr and state|}}}
| leader = {{{leader|}}}
| legislature = {{{legislature|}}}
| lieutenant_governor = {{{lieutenant_governor|}}}
| lieutenant = {{{lieutenant|}}}
| majority_leader = {{#if: {{{majorityleader|}}} | {{{majorityleader}}} | {{{majority_leader|}}} }}
| majority = {{{majority|}}}
| minister = {{{minister|}}}
| minister_from = {{{minister_from|}}}
| minority_floor_leader = {{{minority_floor_leader|}}}
| majority_floor_leader = {{{majority_floor_leader|}}}
| minority_leader = {{#if: {{{minorityleader|}}} | {{{minorityleader}}} | {{{minority_leader|}}} }}
| monarch = {{{monarch|}}}
| nominator = {{{nominator|}}}
| nominee = {{{nominee|}}}
| office = {{{office|}}}
| opponent = {{{opponent|}}}
| order = {{{order|}}}
| parliament = {{{parliament|}}}
| parliamentarygroup = {{{parliamentarygroup|}}}
| party_election = {{{party_election|}}}
| predecessor = {{{predecessor|}}}
| preceding = {{{preceding|}}}
| preceded = {{{preceded|}}}
| premier = {{{premier|}}}
| president = {{{president|}}}
| primeminister = {{{primeminister|}}}
| riding = {{{riding|}}}
| runningmate = {{{runningmate|}}}
| state_assembly = {{{state_assembly|}}}
| state_delegate = {{{state_delegate|}}}
| state_house = {{{state_house|}}}
| state_legislature = {{{state_legislature|}}}
| state_senate = {{{state_senate|}}}
| state = {{{state|}}}
| status = {{{status|}}}
| suboffice = {{{suboffice|}}}
| subterm = {{nobold|{{{subterm|}}}}}
| succeeded = {{{succeeded|}}}
| succeeding = {{{succeeding|}}}
| successor = {{{successor|}}}
| taoiseach = {{{taoiseach|}}}
| termlabel = {{{term_label|{{{termlabel|In office}}}}}}
| termend = {{#if: {{{termend|}}} | {{{termend}}} | {{{term_end|}}} }}
| termstart = {{#if: {{{termstart|}}} | {{{termstart}}} | {{{term_start|}}} }}
| term = {{{term|}}}
| title = {{{title|}}}
| vicegovernor = {{{vicegovernor|}}}
| vicepresident = {{{vicepresident|}}}
| vicepremier = {{{vicepremier|}}}
| viceprimeminister = {{{viceprimeminister|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term|}}}
}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname1|}}}
| 1namedata = {{{1namedata1|}}}
| 2blankname = {{{2blankname1|}}}
| 2namedata = {{{2namedata1|}}}
| 3blankname = {{{3blankname1|}}}
| 3namedata = {{{3namedata1|}}}
| 4blankname = {{{4blankname1|}}}
| 4namedata = {{{4namedata1|}}}
| 5blankname = {{{5blankname1|}}}
| 5namedata = {{{5namedata1|}}}
| alongside = {{{alongside1|}}}
| ambassador_from = {{{ambassador_from1|}}}
| appointer = {{#if: {{{appointer1|}}} | {{{appointer1}}} | {{{appointed1|}}} }}
| assembly = {{{assembly1|}}}
| assuming = {{{assuming1|}}}
| chancellor = {{{chancellor1|}}}
| co-leader = {{{co-leader1|}}}
| constituency_{{#if:{{{constituency_AM1|}}}|AM|MP}} = {{#if: {{{constituency_AM1|}}} | {{{constituency_AM1}}} | {{{constituency_MP1|}}} }}
| constituency = {{{constituency1|}}}
| convocation = {{{convocation1|}}}
| country = {{{country1|}}}
| deputy = {{{deputy1|}}}
| district = {{{district1|}}}
| firstminister = {{{firstminister1|}}}
| governor-general = {{{governor-general1|}}}
| governor_general = {{{governor_general1|}}}
| governor = {{{governor1|}}}
| jr/sr = {{{jr/sr1|}}}
| jr/sr and state = {{{jr/sr and state1|}}}
| leader = {{{leader1|}}}
| legislature = {{{legislature1|}}}
| lieutenant_governor = {{{lieutenant_governor1|}}}
| lieutenant = {{{lieutenant1|}}}
| minority_floor_leader = {{{minority_floor_leader1|}}}
| minister_from = {{{minister_from1|}}}
| majority_floor_leader = {{{majority_floor_leader1|}}}
| majority_leader = {{#if: {{{majorityleader1|}}} | {{{majorityleader1}}} | {{{majority_leader1|}}} }}
| majority = {{{majority1|}}}
| minister = {{{minister1|}}}
| minority_leader = {{#if: {{{minorityleader1|}}} | {{{minorityleader1}}} | {{{minority_leader1|}}} }}
| monarch = {{{monarch1|}}}
| nominator = {{{nominator1|}}}
| office = {{{office1|}}}
| order = {{{order1|}}}
| parliament = {{{parliament1|}}}
| parliamentarygroup = {{{parliamentarygroup1|}}}
| predecessor = {{{predecessor1|}}}
| preceding = {{{preceding1|}}}
| preceded = {{{preceded1|}}}
| premier = {{{premier1|}}}
| president = {{{president1|}}}
| primeminister = {{{primeminister1|}}}
| riding = {{{riding1|}}}
| state_assembly = {{{state_assembly1|}}}
| state_delegate = {{{state_delegate1|}}}
| state_house = {{{state_house1|}}}
| state_legislature = {{{state_legislature1|}}}
| state_senate = {{{state_senate1|}}}
| state = {{{state1|}}}
| status = {{{status1|}}}
| subterm = {{nobold|{{{subterm1|}}}}}
| suboffice = {{{suboffice1|}}}
| succeeded = {{{succeeded1|}}}
| succeeding = {{{succeeding1|}}}
| successor = {{{successor1|}}}
| taoiseach = {{{taoiseach1|}}}
| termlabel = {{{term_label1|{{{termlabel1|In office}}}}}}
| termend = {{#if:{{{termend1|}}}|{{{termend1}}}|{{{term_end1|}}}}}
| termstart = {{#if:{{{termstart1|}}}|{{{termstart1}}}|{{{term_start1|}}}}}
| term = {{{term1|}}}
| title = {{{title1|}}}
| vicegovernor = {{{vicegovernor1|}}}
| vicepresident = {{{vicepresident1|}}}
| vicepremier = {{{vicepremier1|}}}
| viceprimeminister = {{{viceprimeminister1|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term1|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{#if:{{{speaker|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname2|}}}
| 1namedata = {{{1namedata2|}}}
| 2blankname = {{{2blankname2|}}}
| 2namedata = {{{2namedata2|}}}
| 3blankname = {{{3blankname2|}}}
| 3namedata = {{{3namedata2|}}}
| 4blankname = {{{4blankname2|}}}
| 4namedata = {{{4namedata2|}}}
| 5blankname = {{{5blankname2|}}}
| 5namedata = {{{5namedata2|}}}
| alongside = {{{alongside2|}}}
| ambassador_from = {{{ambassador_from2|}}}
| appointer = {{#if: {{{appointer2|}}} | {{{appointer2}}} | {{{appointed2|}}} }}
| assembly = {{{assembly2|}}}
| assuming = {{{assuming2|}}}
| chancellor = {{{chancellor2|}}}
| co-leader = {{{co-leader2|}}}
| constituency_{{#if:{{{constituency_AM2|}}}|AM|MP}} = {{#if: {{{constituency_AM2|}}} | {{{constituency_AM2}}} | {{{constituency_MP2|}}} }}
| constituency = {{{constituency2|}}}
| convocation = {{{convocation2|}}}
| country = {{{country2|}}}
| deputy = {{{deputy2|}}}
| district = {{{district2|}}}
| firstminister = {{{firstminister2|}}}
| governor-general = {{{governor-general2|}}}
| governor_general = {{{governor_general2|}}}
| governor = {{{governor2|}}}
| jr/sr = {{{jr/sr2|}}}
| jr/sr and state = {{{jr/sr and state2|}}}
| leader = {{{leader2|}}}
| legislature = {{{legislature2|}}}
| lieutenant_governor = {{{lieutenant_governor2|}}}
| lieutenant = {{{lieutenant2|}}}
| majority_leader = {{#if: {{{majorityleader2|}}} | {{{majorityleader2}}} | {{{majority_leader2|}}} }}
| minister_from = {{{minister_from2|}}}
| minority_floor_leader = {{{minority_floor_leader2|}}}
| majority_floor_leader = {{{majority_floor_leader2|}}}
| majority = {{{majority2|}}}
| minister = {{{minister2|}}}
| minority_leader = {{#if: {{{minorityleader2|}}} | {{{minorityleader2}}} | {{{minority_leader2|}}} }}
| monarch = {{{monarch2|}}}
| nominator = {{{nominator2|}}}
| office = {{{office2|}}}
| order = {{{order2|}}}
| parliament = {{{parliament2|}}}
| parliamentarygroup = {{{parliamentarygroup2|}}}
| predecessor = {{{predecessor2|}}}
| preceding = {{{preceding2|}}}
| preceded = {{{preceded2|}}}
| premier = {{{premier2|}}}
| president = {{{president2|}}}
| primeminister = {{{primeminister2|}}}
| riding = {{{riding2|}}}
| state_assembly = {{{state_assembly2|}}}
| state_delegate = {{{state_delegate2|}}}
| state_house = {{{state_house2|}}}
| state_legislature = {{{state_legislature2|}}}
| state_senate = {{{state_senate2|}}}
| state = {{{state2|}}}
| status = {{{status2|}}}
| subterm = {{nobold|{{{subterm2|}}}}}
| suboffice = {{{suboffice2|}}}
| succeeded = {{{succeeded2|}}}
| succeeding = {{{succeeding2|}}}
| successor = {{{successor2|}}}
| taoiseach = {{{taoiseach2|}}}
| termlabel = {{{term_label2|{{{termlabel2|In office}}}}}}
| termend = {{#if:{{{termend2|}}}|{{{termend2}}}|{{{term_end2|}}}}}
| termstart = {{#if:{{{termstart2|}}}|{{{termstart2}}}|{{{term_start2|}}}}}
| term = {{{term2|}}}
| title = {{{title2|}}}
| vicegovernor = {{{vicegovernor2|}}}
| vicepresident = {{{vicepresident2|}}}
| vicepremier = {{{vicepremier2|}}}
| viceprimeminister = {{{viceprimeminister2|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term2|}}}
}}}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname3|}}}
| 1namedata = {{{1namedata3|}}}
| 2blankname = {{{2blankname3|}}}
| 2namedata = {{{2namedata3|}}}
| 3blankname = {{{3blankname3|}}}
| 3namedata = {{{3namedata3|}}}
| 4blankname = {{{4blankname3|}}}
| 4namedata = {{{4namedata3|}}}
| 5blankname = {{{5blankname3|}}}
| 5namedata = {{{5namedata3|}}}
| alongside = {{{alongside3|}}}
| ambassador_from = {{{ambassador_from3|}}}
| appointer = {{#if: {{{appointer3|}}} | {{{appointer3}}} | {{{appointed3|}}} }}
| assembly = {{{assembly3|}}}
| assuming = {{{assuming3|}}}
| chancellor = {{{chancellor3|}}}
| co-leader = {{{co-leader3|}}}
| constituency_{{#if:{{{constituency_AM3|}}}|AM|MP}} = {{#if: {{{constituency_AM3|}}} | {{{constituency_AM3}}} | {{{constituency_MP3|}}} }}
| constituency = {{{constituency3|}}}
| convocation = {{{convocation3|}}}
| country = {{{country3|}}}
| deputy = {{{deputy3|}}}
| district = {{{district3|}}}
| firstminister = {{{firstminister3|}}}
| governor-general = {{{governor-general3|}}}
| governor_general = {{{governor_general3|}}}
| governor = {{{governor3|}}}
| jr/sr = {{{jr/sr3|}}}
| jr/sr and state = {{{jr/sr and state3|}}}
| leader = {{{leader3|}}}
| legislature = {{{legislature3|}}}
| lieutenant_governor = {{{lieutenant_governor3|}}}
| lieutenant = {{{lieutenant3|}}}
| minority_floor_leader = {{{minority_floor_leader3|}}}
| minister_from = {{{minister_from3|}}}
| majority_floor_leader = {{{majority_floor_leader3|}}}
| majority_leader = {{#if: {{{majorityleader3|}}} | {{{majorityleader3}}} | {{{majority_leader3|}}} }}
| majority = {{{majority3|}}}
| minister = {{{minister3|}}}
| minority_leader = {{#if: {{{minorityleader3|}}} | {{{minorityleader3}}} | {{{minority_leader3|}}} }}
| monarch = {{{monarch3|}}}
| nominator = {{{nominator3|}}}
| office = {{{office3|}}}
| order = {{{order3|}}}
| parliament = {{{parliament3|}}}
| parliamentarygroup = {{{parliamentarygroup3|}}}
| predecessor = {{{predecessor3|}}}
| preceding = {{{preceding3|}}}
| preceded = {{{preceded3|}}}
| premier = {{{premier3|}}}
| president = {{{president3|}}}
| primeminister = {{{primeminister3|}}}
| riding = {{{riding3|}}}
| state_assembly = {{{state_assembly3|}}}
| state_delegate = {{{state_delegate3|}}}
| state_house = {{{state_house3|}}}
| state_legislature = {{{state_legislature3|}}}
| state_senate = {{{state_senate3|}}}
| state = {{{state3|}}}
| status = {{{status3|}}}
| subterm = {{nobold|{{{subterm3|}}}}}
| suboffice = {{{suboffice3|}}}
| succeeded = {{{succeeded3|}}}
| succeeding = {{{succeeding3|}}}
| successor = {{{successor3|}}}
| taoiseach = {{{taoiseach3|}}}
| termlabel = {{{term_label3|{{{termlabel3|In office}}}}}}
| termend = {{#if:{{{termend3|}}}|{{{termend3}}}|{{{term_end3|}}}}}
| termstart = {{#if:{{{termstart3|}}}|{{{termstart3}}}|{{{term_start3|}}}}}
| term = {{{term3|}}}
| title = {{{title3|}}}
| vicegovernor = {{{vicegovernor3|}}}
| vicepresident = {{{vicepresident3|}}}
| vicepremier = {{{vicepremier3|}}}
| viceprimeminister = {{{viceprimeminister3|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term3|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname4|}}}
| 1namedata = {{{1namedata4|}}}
| 2blankname = {{{2blankname4|}}}
| 2namedata = {{{2namedata4|}}}
| 3blankname = {{{3blankname4|}}}
| 3namedata = {{{3namedata4|}}}
| 4blankname = {{{4blankname4|}}}
| 4namedata = {{{4namedata4|}}}
| 5blankname = {{{5blankname4|}}}
| 5namedata = {{{5namedata4|}}}
| alongside = {{{alongside4|}}}
| ambassador_from = {{{ambassador_from4|}}}
| appointer = {{#if: {{{appointer4|}}} | {{{appointer4}}} | {{{appointed4|}}} }}
| assembly = {{{assembly4|}}}
| assuming = {{{assuming4|}}}
| chancellor = {{{chancellor4|}}}
| co-leader = {{{co-leader4|}}}
| constituency_{{#if:{{{constituency_AM4|}}}|AM|MP}} = {{#if: {{{constituency_AM4|}}} | {{{constituency_AM4}}} | {{{constituency_MP4|}}} }}
| constituency = {{{constituency4|}}}
| convocation = {{{convocation4|}}}
| country = {{{country4|}}}
| deputy = {{{deputy4|}}}
| district = {{{district4|}}}
| firstminister = {{{firstminister4|}}}
| governor-general = {{{governor-general4|}}}
| governor_general = {{{governor_general4|}}}
| governor = {{{governor4|}}}
| jr/sr = {{{jr/sr4|}}}
| jr/sr and state = {{{jr/sr and state4|}}}
| leader = {{{leader4|}}}
| legislature = {{{legislature4|}}}
| lieutenant_governor = {{{lieutenant_governor4|}}}
| lieutenant = {{{lieutenant4|}}}
| minister_from = {{{minister_from4|}}}
| minority_floor_leader = {{{minority_floor_leader4|}}}
| majority_floor_leader = {{{majority_floor_leader4|}}}
| majority_leader = {{#if: {{{majorityleader4|}}} | {{{majorityleader4}}} | {{{majority_leader4|}}} }}
| majority = {{{majority4|}}}
| minister = {{{minister4|}}}
| minority_leader = {{#if: {{{minorityleader4|}}} | {{{minorityleader4}}} | {{{minority_leader4|}}} }}
| monarch = {{{monarch4|}}}
| nominator = {{{nominator4|}}}
| office = {{{office4|}}}
| order = {{{order4|}}}
| parliament = {{{parliament4|}}}
| parliamentarygroup = {{{parliamentarygroup4|}}}
| predecessor = {{{predecessor4|}}}
| preceding = {{{preceding4|}}}
| preceded = {{{preceded4|}}}
| premier = {{{premier4|}}}
| president = {{{president4|}}}
| primeminister = {{{primeminister4|}}}
| riding = {{{riding4|}}}
| state_assembly = {{{state_assembly4|}}}
| state_delegate = {{{state_delegate4|}}}
| state_house = {{{state_house4|}}}
| state_legislature = {{{state_legislature4|}}}
| state_senate = {{{state_senate4|}}}
| state = {{{state4|}}}
| status = {{{status4|}}}
| subterm = {{nobold|{{{subterm4|}}}}}
| suboffice = {{{suboffice4|}}}
| succeeded = {{{succeeded4|}}}
| succeeding = {{{succeeding4|}}}
| successor = {{{successor4|}}}
| taoiseach = {{{taoiseach4|}}}
| termlabel = {{{term_label4|{{{termlabel4|In office}}}}}}
| termend = {{#if:{{{termend4|}}}|{{{termend4}}}|{{{term_end4|}}}}}
| termstart = {{#if:{{{termstart4|}}}|{{{termstart4}}}|{{{term_start4|}}}}}
| term = {{{term4|}}}
| title = {{{title4|}}}
| vicegovernor = {{{vicegovernor4|}}}
| vicepresident = {{{vicepresident4|}}}
| vicepremier = {{{vicepremier4|}}}
| viceprimeminister = {{{viceprimeminister4|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term4|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname5|}}}
| 1namedata = {{{1namedata5|}}}
| 2blankname = {{{2blankname5|}}}
| 2namedata = {{{2namedata5|}}}
| 3blankname = {{{3blankname5|}}}
| 3namedata = {{{3namedata5|}}}
| 4blankname = {{{4blankname5|}}}
| 4namedata = {{{4namedata5|}}}
| 5blankname = {{{5blankname5|}}}
| 5namedata = {{{5namedata5|}}}
| alongside = {{{alongside5|}}}
| ambassador_from = {{{ambassador_from5|}}}
| appointer = {{#if: {{{appointer5|}}} | {{{appointer5}}} | {{{appointed5|}}} }}
| assembly = {{{assembly5|}}}
| assuming = {{{assuming5|}}}
| chancellor = {{{chancellor5|}}}
| co-leader = {{{co-leader5|}}}
| constituency_{{#if:{{{constituency_AM5|}}}|AM|MP}} = {{#if: {{{constituency_AM5|}}} | {{{constituency_AM5}}} | {{{constituency_MP5|}}} }}
| constituency = {{{constituency5|}}}
| convocation = {{{convocation5|}}}
| country = {{{country5|}}}
| deputy = {{{deputy5|}}}
| district = {{{district5|}}}
| firstminister = {{{firstminister5|}}}
| governor-general = {{{governor-general5|}}}
| governor_general = {{{governor_general5|}}}
| governor = {{{governor5|}}}
| jr/sr = {{{jr/sr5|}}}
| jr/sr and state = {{{jr/sr and state5|}}}
| leader = {{{leader5|}}}
| legislature = {{{legislature5|}}}
| lieutenant_governor = {{{lieutenant_governor5|}}}
| lieutenant = {{{lieutenant5|}}}
| minister_from = {{{minister_from5|}}}
| minority_floor_leader = {{{minority_floor_leader5|}}}
| majority_floor_leader = {{{majority_floor_leader5|}}}
| majority_leader = {{#if: {{{majorityleader5|}}} | {{{majorityleader5}}} | {{{majority_leader5|}}} }}
| majority = {{{majority5|}}}
| minister = {{{minister5|}}}
| minority_leader = {{#if: {{{minorityleader5|}}} | {{{minorityleader5}}} | {{{minority_leader5|}}} }}
| monarch = {{{monarch5|}}}
| nominator = {{{nominator5|}}}
| office = {{{office5|}}}
| order = {{{order5|}}}
| parliament = {{{parliament5|}}}
| parliamentarygroup = {{{parliamentarygroup5|}}}
| predecessor = {{{predecessor5|}}}
| preceding = {{{preceding5|}}}
| preceded = {{{preceded5|}}}
| premier = {{{premier5|}}}
| president = {{{president5|}}}
| primeminister = {{{primeminister5|}}}
| riding = {{{riding5|}}}
| state_assembly = {{{state_assembly5|}}}
| state_delegate = {{{state_delegate5|}}}
| state_house = {{{state_house5|}}}
| state_legislature = {{{state_legislature5|}}}
| state_senate = {{{state_senate5|}}}
| state = {{{state5|}}}
| status = {{{status5|}}}
| subterm = {{nobold|{{{subterm5|}}}}}
| suboffice = {{{suboffice5|}}}
| succeeded = {{{succeeded5|}}}
| succeeding = {{{succeeding5|}}}
| successor = {{{successor5|}}}
| taoiseach = {{{taoiseach5|}}}
| termlabel = {{{term_label5|{{{termlabel5|In office}}}}}}
| termend = {{#if:{{{termend5|}}}|{{{termend5}}}|{{{term_end5|}}}}}
| termstart = {{#if:{{{termstart5|}}}|{{{termstart5}}}|{{{term_start5|}}}}}
| term = {{{term5|}}}
| title = {{{title5|}}}
| vicegovernor = {{{vicegovernor5|}}}
| vicepresident = {{{vicepresident5|}}}
| vicepremier = {{{vicepremier5|}}}
| viceprimeminister = {{{viceprimeminister5|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term5|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname6|}}}
| 1namedata = {{{1namedata6|}}}
| 2blankname = {{{2blankname6|}}}
| 2namedata = {{{2namedata6|}}}
| 3blankname = {{{3blankname6|}}}
| 3namedata = {{{3namedata6|}}}
| 4blankname = {{{4blankname6|}}}
| 4namedata = {{{4namedata6|}}}
| 5blankname = {{{5blankname6|}}}
| 5namedata = {{{5namedata6|}}}
| alongside = {{{alongside6|}}}
| ambassador_from = {{{ambassador_from6|}}}
| appointer = {{#if: {{{appointer6|}}} | {{{appointer6}}} | {{{appointed6|}}} }}
| assembly = {{{assembly6|}}}
| assuming = {{{assuming6|}}}
| chancellor = {{{chancellor6|}}}
| co-leader = {{{co-leader6|}}}
| constituency_{{#if:{{{constituency_AM6|}}}|AM|MP}} = {{#if: {{{constituency_AM6|}}} | {{{constituency_AM6}}} | {{{constituency_MP6|}}} }}
| constituency = {{{constituency6|}}}
| convocation = {{{convocation6|}}}
| country = {{{country6|}}}
| deputy = {{{deputy6|}}}
| district = {{{district6|}}}
| firstminister = {{{firstminister6|}}}
| governor-general = {{{governor-general6|}}}
| governor_general = {{{governor_general6|}}}
| governor = {{{governor6|}}}
| jr/sr = {{{jr/sr6|}}}
| jr/sr and state = {{{jr/sr and state6|}}}
| leader = {{{leader6|}}}
| legislature = {{{legislature6|}}}
| lieutenant_governor = {{{lieutenant_governor6|}}}
| lieutenant = {{{lieutenant6|}}}
| minority_floor_leader = {{{minority_floor_leader6|}}}
| minister_from = {{{minister_from6|}}}
| majority_floor_leader = {{{majority_floor_leader6|}}}
| majority_leader = {{#if: {{{majorityleader6|}}} | {{{majorityleader6}}} | {{{majority_leader6|}}} }}
| majority = {{{majority6|}}}
| minister = {{{minister6|}}}
| minority_leader = {{#if: {{{minorityleader6|}}} | {{{minorityleader6}}} | {{{minority_leader6|}}} }}
| monarch = {{{monarch6|}}}
| nominator = {{{nominator6|}}}
| office = {{{office6|}}}
| order = {{{order6|}}}
| parliament = {{{parliament6|}}}
| parliamentarygroup = {{{parliamentarygroup6|}}}
| predecessor = {{{predecessor6|}}}
| preceding = {{{preceding6|}}}
| preceded = {{{preceded6|}}}
| premier = {{{premier6|}}}
| president = {{{president6|}}}
| primeminister = {{{primeminister6|}}}
| riding = {{{riding6|}}}
| state_assembly = {{{state_assembly6|}}}
| state_delegate = {{{state_delegate6|}}}
| state_house = {{{state_house6|}}}
| state_legislature = {{{state_legislature6|}}}
| state_senate = {{{state_senate6|}}}
| state = {{{state6|}}}
| status = {{{status6|}}}
| subterm = {{nobold|{{{subterm6|}}}}}
| suboffice = {{{suboffice6|}}}
| succeeded = {{{succeeded6|}}}
| succeeding = {{{succeeding6|}}}
| successor = {{{successor6|}}}
| taoiseach = {{{taoiseach6|}}}
| termlabel = {{{term_label6|{{{termlabel6|In office}}}}}}
| termend = {{#if:{{{termend6|}}}|{{{termend6}}}|{{{term_end6|}}}}}
| termstart = {{#if:{{{termstart6|}}}|{{{termstart6}}}|{{{term_start6|}}}}}
| term = {{{term6|}}}
| title = {{{title6|}}}
| vicegovernor = {{{vicegovernor6|}}}
| vicepresident = {{{vicepresident6|}}}
| vicepremier = {{{vicepremier6|}}}
| viceprimeminister = {{{viceprimeminister6|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term6|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname7|}}}
| 1namedata = {{{1namedata7|}}}
| 2blankname = {{{2blankname7|}}}
| 2namedata = {{{2namedata7|}}}
| 3blankname = {{{3blankname7|}}}
| 3namedata = {{{3namedata7|}}}
| 4blankname = {{{4blankname7|}}}
| 4namedata = {{{4namedata7|}}}
| 5blankname = {{{5blankname7|}}}
| 5namedata = {{{5namedata7|}}}
| alongside = {{{alongside7|}}}
| ambassador_from = {{{ambassador_from7|}}}
| appointer = {{#if: {{{appointer7|}}} | {{{appointer7}}} | {{{appointed7|}}} }}
| assembly = {{{assembly7|}}}
| assuming = {{{assuming7|}}}
| chancellor = {{{chancellor7|}}}
| co-leader = {{{co-leader7|}}}
| constituency_{{#if:{{{constituency_AM7|}}}|AM|MP}} = {{#if: {{{constituency_AM7|}}} | {{{constituency_AM7}}} | {{{constituency_MP7|}}} }}
| constituency = {{{constituency7|}}}
| convocation = {{{convocation7|}}}
| country = {{{country7|}}}
| deputy = {{{deputy7|}}}
| district = {{{district7|}}}
| firstminister = {{{firstminister7|}}}
| governor-general = {{{governor-general7|}}}
| governor_general = {{{governor_general7|}}}
| governor = {{{governor7|}}}
| jr/sr = {{{jr/sr7|}}}
| jr/sr and state = {{{jr/sr and state7|}}}
| leader = {{{leader7|}}}
| legislature = {{{legislature7|}}}
| lieutenant_governor = {{{lieutenant_governor7|}}}
| lieutenant = {{{lieutenant7|}}}
| minister_from = {{{minister_from7|}}}
| minority_floor_leader = {{{minority_floor_leader7|}}}
| majority_floor_leader = {{{majority_floor_leader7|}}}
| majority_leader = {{#if: {{{majorityleader7|}}} | {{{majorityleader7}}} | {{{majority_leader7|}}} }}
| majority = {{{majority7|}}}
| minister = {{{minister7|}}}
| minority_leader = {{#if: {{{minorityleader7|}}} | {{{minorityleader7}}} | {{{minority_leader7|}}} }}
| monarch = {{{monarch7|}}}
| nominator = {{{nominator7|}}}
| office = {{{office7|}}}
| order = {{{order7|}}}
| parliament = {{{parliament7|}}}
| parliamentarygroup = {{{parliamentarygroup7|}}}
| predecessor = {{{predecessor7|}}}
| preceding = {{{preceding7|}}}
| preceded = {{{preceded7|}}}
| premier = {{{premier7|}}}
| president = {{{president7|}}}
| primeminister = {{{primeminister7|}}}
| riding = {{{riding7|}}}
| state_assembly = {{{state_assembly7|}}}
| state_delegate = {{{state_delegate7|}}}
| state_house = {{{state_house7|}}}
| state_legislature = {{{state_legislature7|}}}
| state_senate = {{{state_senate7|}}}
| state = {{{state7|}}}
| status = {{{status7|}}}
| subterm = {{nobold|{{{subterm7|}}}}}
| suboffice = {{{suboffice7|}}}
| succeeded = {{{succeeded7|}}}
| succeeding = {{{succeeding7|}}}
| successor = {{{successor7|}}}
| taoiseach = {{{taoiseach7|}}}
| termlabel = {{{term_label7|{{{termlabel7|In office}}}}}}
| termend = {{#if:{{{termend7|}}}|{{{termend7}}}|{{{term_end7|}}}}}
| termstart = {{#if:{{{termstart7|}}}|{{{termstart7}}}|{{{term_start7|}}}}}
| term = {{{term7|}}}
| title = {{{title7|}}}
| vicegovernor = {{{vicegovernor7|}}}
| vicepresident = {{{vicepresident7|}}}
| vicepremier = {{{vicepremier7|}}}
| viceprimeminister = {{{viceprimeminister7|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term7|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname8|}}}
| 1namedata = {{{1namedata8|}}}
| 2blankname = {{{2blankname8|}}}
| 2namedata = {{{2namedata8|}}}
| 3blankname = {{{3blankname8|}}}
| 3namedata = {{{3namedata8|}}}
| 4blankname = {{{4blankname8|}}}
| 4namedata = {{{4namedata8|}}}
| 5blankname = {{{5blankname8|}}}
| 5namedata = {{{5namedata8|}}}
| alongside = {{{alongside8|}}}
| ambassador_from = {{{ambassador_from8|}}}
| appointer = {{#if: {{{appointer8|}}} | {{{appointer8}}} | {{{appointed8|}}} }}
| assembly = {{{assembly8|}}}
| assuming = {{{assuming8|}}}
| chancellor = {{{chancellor8|}}}
| co-leader = {{{co-leader8|}}}
| constituency_{{#if:{{{constituency_AM8|}}}|AM|MP}} = {{#if: {{{constituency_AM8|}}} | {{{constituency_AM8}}} | {{{constituency_MP8|}}} }}
| constituency = {{{constituency8|}}}
| convocation = {{{convocation8|}}}
| country = {{{country8|}}}
| deputy = {{{deputy8|}}}
| district = {{{district8|}}}
| firstminister = {{{firstminister8|}}}
| governor-general = {{{governor-general8|}}}
| governor_general = {{{governor_general8|}}}
| governor = {{{governor8|}}}
| jr/sr = {{{jr/sr8|}}}
| jr/sr and state = {{{jr/sr and state8|}}}
| leader = {{{leader8|}}}
| legislature = {{{legislature8|}}}
| lieutenant_governor = {{{lieutenant_governor8|}}}
| lieutenant = {{{lieutenant8|}}}
| minister_from = {{{minister_from8|}}}
| minority_floor_leader = {{{minority_floor_leader8|}}}
| majority_floor_leader = {{{majority_floor_leader8|}}}
| majority_leader = {{#if: {{{majorityleader8|}}} | {{{majorityleader8}}} | {{{majority_leader8|}}} }}
| majority = {{{majority8|}}}
| minister = {{{minister8|}}}
| minority_leader = {{#if: {{{minorityleader8|}}} | {{{minorityleader8}}} | {{{minority_leader8|}}} }}
| monarch = {{{monarch8|}}}
| nominator = {{{nominator8|}}}
| office = {{{office8|}}}
| order = {{{order8|}}}
| parliament = {{{parliament8|}}}
| parliamentarygroup = {{{parliamentarygroup8|}}}
| predecessor = {{{predecessor8|}}}
| preceding = {{{preceding8|}}}
| preceded = {{{preceded8|}}}
| premier = {{{premier8|}}}
| president = {{{president8|}}}
| primeminister = {{{primeminister8|}}}
| riding = {{{riding8|}}}
| state_assembly = {{{state_assembly8|}}}
| state_delegate = {{{state_delegate8|}}}
| state_house = {{{state_house8|}}}
| state_legislature = {{{state_legislature8|}}}
| state_senate = {{{state_senate8|}}}
| state = {{{state8|}}}
| status = {{{status8|}}}
| subterm = {{nobold|{{{subterm8|}}}}}
| suboffice = {{{suboffice8|}}}
| succeeded = {{{succeeded8|}}}
| succeeding = {{{succeeding8|}}}
| successor = {{{successor8|}}}
| taoiseach = {{{taoiseach8|}}}
| termlabel = {{{term_label8|{{{termlabel8|In office}}}}}}
| termend = {{#if:{{{termend8|}}}|{{{termend8}}}|{{{term_end8|}}}}}
| termstart = {{#if:{{{termstart8|}}}|{{{termstart8}}}|{{{term_start8|}}}}}
| term = {{{term8|}}}
| title = {{{title8|}}}
| vicegovernor = {{{vicegovernor8|}}}
| vicepresident = {{{vicepresident8|}}}
| vicepremier = {{{vicepremier8|}}}
| viceprimeminister = {{{viceprimeminister8|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term8|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname9|}}}
| 1namedata = {{{1namedata9|}}}
| 2blankname = {{{2blankname9|}}}
| 2namedata = {{{2namedata9|}}}
| 3blankname = {{{3blankname9|}}}
| 3namedata = {{{3namedata9|}}}
| 4blankname = {{{4blankname9|}}}
| 4namedata = {{{4namedata9|}}}
| 5blankname = {{{5blankname9|}}}
| 5namedata = {{{5namedata9|}}}
| alongside = {{{alongside9|}}}
| ambassador_from = {{{ambassador_from9|}}}
| appointer = {{#if: {{{appointer9|}}} | {{{appointer9}}} | {{{appointed9|}}} }}
| assembly = {{{assembly9|}}}
| assuming = {{{assuming9|}}}
| chancellor = {{{chancellor9|}}}
| co-leader = {{{co-leader9|}}}
| constituency_{{#if:{{{constituency_AM9|}}}|AM|MP}} = {{#if: {{{constituency_AM9|}}} | {{{constituency_AM9}}} | {{{constituency_MP9|}}} }}
| constituency = {{{constituency9|}}}
| convocation = {{{convocation9|}}}
| country = {{{country9|}}}
| deputy = {{{deputy9|}}}
| district = {{{district9|}}}
| firstminister = {{{firstminister9|}}}
| governor-general = {{{governor-general9|}}}
| governor_general = {{{governor_general9|}}}
| governor = {{{governor9|}}}
| jr/sr = {{{jr/sr9|}}}
| jr/sr and state = {{{jr/sr and state9|}}}
| leader = {{{leader9|}}}
| legislature = {{{legislature9|}}}
| lieutenant_governor = {{{lieutenant_governor9|}}}
| lieutenant = {{{lieutenant9|}}}
| minister_from = {{{minister_from9|}}}
| minority_floor_leader = {{{minority_floor_leader9|}}}
| majority_floor_leader = {{{majority_floor_leader9|}}}
| majority_leader = {{#if: {{{majorityleader9|}}} | {{{majorityleader9}}} | {{{majority_leader9|}}} }}
| majority = {{{majority9|}}}
| minister = {{{minister9|}}}
| minority_leader = {{#if: {{{minorityleader9|}}} | {{{minorityleader9}}} | {{{minority_leader9|}}} }}
| monarch = {{{monarch9|}}}
| nominator = {{{nominator9|}}}
| office = {{{office9|}}}
| order = {{{order9|}}}
| parliament = {{{parliament9|}}}
| parliamentarygroup = {{{parliamentarygroup9|}}}
| predecessor = {{{predecessor9|}}}
| preceding = {{{preceding9|}}}
| preceded = {{{preceded9|}}}
| premier = {{{premier9|}}}
| president = {{{president9|}}}
| primeminister = {{{primeminister9|}}}
| riding = {{{riding9|}}}
| state_assembly = {{{state_assembly9|}}}
| state_delegate = {{{state_delegate9|}}}
| state_house = {{{state_house9|}}}
| state_legislature = {{{state_legislature9|}}}
| state_senate = {{{state_senate9|}}}
| state = {{{state9|}}}
| status = {{{status9|}}}
| subterm = {{nobold|{{{subterm9|}}}}}
| suboffice = {{{suboffice9|}}}
| succeeded = {{{succeeded9|}}}
| succeeding = {{{succeeding9|}}}
| successor = {{{successor9|}}}
| taoiseach = {{{taoiseach9|}}}
| termlabel = {{{term_label9|{{{termlabel9|In office}}}}}}
| termend = {{#if:{{{termend9|}}}|{{{termend9}}}|{{{term_end9|}}}}}
| termstart = {{#if:{{{termstart9|}}}|{{{termstart9}}}|{{{term_start9|}}}}}
| term = {{{term9|}}}
| title = {{{title9|}}}
| vicegovernor = {{{vicegovernor9|}}}
| vicepresident = {{{vicepresident9|}}}
| vicepremier = {{{vicepremier9|}}}
| viceprimeminister = {{{viceprimeminister9|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term9|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname10|}}}
| 1namedata = {{{1namedata10|}}}
| 2blankname = {{{2blankname10|}}}
| 2namedata = {{{2namedata10|}}}
| 3blankname = {{{3blankname10|}}}
| 3namedata = {{{3namedata10|}}}
| 4blankname = {{{4blankname10|}}}
| 4namedata = {{{4namedata10|}}}
| 5blankname = {{{5blankname10|}}}
| 5namedata = {{{5namedata10|}}}
| alongside = {{{alongside10|}}}
| ambassador_from = {{{ambassador_from10|}}}
| appointer = {{#if: {{{appointer10|}}} | {{{appointer10}}} | {{{appointed10|}}} }}
| assembly = {{{assembly10|}}}
| assuming = {{{assuming10|}}}
| chancellor = {{{chancellor10|}}}
| co-leader = {{{co-leader10|}}}
| constituency_{{#if:{{{constituency_AM10|}}}|AM|MP}} = {{#if: {{{constituency_AM10|}}} | {{{constituency_AM10}}} | {{{constituency_MP10|}}} }}
| constituency = {{{constituency10|}}}
| convocation = {{{convocation10|}}}
| country = {{{country10|}}}
| deputy = {{{deputy10|}}}
| district = {{{district10|}}}
| firstminister = {{{firstminister10|}}}
| governor-general = {{{governor-general10|}}}
| governor_general = {{{governor_general10|}}}
| governor = {{{governor10|}}}
| jr/sr = {{{jr/sr10|}}}
| jr/sr and state = {{{jr/sr and state10|}}}
| leader = {{{leader10|}}}
| legislature = {{{legislature10|}}}
| lieutenant_governor = {{{lieutenant_governor10|}}}
| lieutenant = {{{lieutenant10|}}}
| minister_from = {{{minister_from10|}}}
| minority_floor_leader = {{{minority_floor_leader10|}}}
| majority_floor_leader = {{{majority_floor_leader10|}}}
| majority_leader = {{#if: {{{majorityleader10|}}} | {{{majorityleader10}}} | {{{majority_leader10|}}} }}
| majority = {{{majority10|}}}
| minister = {{{minister10|}}}
| minority_leader = {{#if: {{{minorityleader10|}}} | {{{minorityleader10}}} | {{{minority_leader10|}}} }}
| monarch = {{{monarch10|}}}
| nominator = {{{nominator10|}}}
| office = {{{office10|}}}
| order = {{{order10|}}}
| parliament = {{{parliament10|}}}
| parliamentarygroup = {{{parliamentarygroup10|}}}
| predecessor = {{{predecessor10|}}}
| preceding = {{{preceding10|}}}
| preceded = {{{preceded10|}}}
| premier = {{{premier10|}}}
| president = {{{president10|}}}
| primeminister = {{{primeminister10|}}}
| riding = {{{riding10|}}}
| state_assembly = {{{state_assembly10|}}}
| state_delegate = {{{state_delegate10|}}}
| state_house = {{{state_house10|}}}
| state_legislature = {{{state_legislature10|}}}
| state_senate = {{{state_senate10|}}}
| state = {{{state10|}}}
| status = {{{status10|}}}
| subterm = {{nobold|{{{subterm10|}}}}}
| suboffice = {{{suboffice10|}}}
| succeeded = {{{succeeded10|}}}
| succeeding = {{{succeeding10|}}}
| successor = {{{successor10|}}}
| taoiseach = {{{taoiseach10|}}}
| termlabel = {{{term_label10|{{{termlabel10|In office}}}}}}
| termend = {{#if:{{{termend10|}}}|{{{termend10}}}|{{{term_end10|}}}}}
| termstart = {{#if:{{{termstart10|}}}|{{{termstart10}}}|{{{term_start10|}}}}}
| term = {{{term10|}}}
| title = {{{title10|}}}
| vicegovernor = {{{vicegovernor10|}}}
| vicepresident = {{{vicepresident10|}}}
| vicepremier = {{{vicepremier10|}}}
| viceprimeminister = {{{viceprimeminister10|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term10|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname11|}}}
| 1namedata = {{{1namedata11|}}}
| 2blankname = {{{2blankname11|}}}
| 2namedata = {{{2namedata11|}}}
| 3blankname = {{{3blankname11|}}}
| 3namedata = {{{3namedata11|}}}
| 4blankname = {{{4blankname11|}}}
| 4namedata = {{{4namedata11|}}}
| 5blankname = {{{5blankname11|}}}
| 5namedata = {{{5namedata11|}}}
| alongside = {{{alongside11|}}}
| ambassador_from = {{{ambassador_from11|}}}
| appointer = {{#if: {{{appointer11|}}} | {{{appointer11}}} | {{{appointed11|}}} }}
| assembly = {{{assembly11|}}}
| assuming = {{{assuming11|}}}
| chancellor = {{{chancellor11|}}}
| co-leader = {{{co-leader11|}}}
| constituency_{{#if:{{{constituency_AM11|}}}|AM|MP}} = {{#if: {{{constituency_AM11|}}} | {{{constituency_AM11}}} | {{{constituency_MP11|}}} }}
| constituency = {{{constituency11|}}}
| convocation = {{{convocation11|}}}
| country = {{{country11|}}}
| deputy = {{{deputy11|}}}
| district = {{{district11|}}}
| firstminister = {{{firstminister11|}}}
| governor-general = {{{governor-general11|}}}
| governor_general = {{{governor_general11|}}}
| governor = {{{governor11|}}}
| jr/sr = {{{jr/sr11|}}}
| jr/sr and state = {{{jr/sr and state11|}}}
| leader = {{{leader11|}}}
| legislature = {{{legislature11|}}}
| lieutenant_governor = {{{lieutenant_governor11|}}}
| lieutenant = {{{lieutenant11|}}}
| minister_from = {{{minister_from11|}}}
| minority_floor_leader = {{{minority_floor_leader11|}}}
| majority_floor_leader = {{{majority_floor_leader11|}}}
| majority_leader = {{#if: {{{majorityleader11|}}} | {{{majorityleader11}}} | {{{majority_leader11|}}} }}
| majority = {{{majority11|}}}
| minister = {{{minister11|}}}
| minority_leader = {{#if: {{{minorityleader11|}}} | {{{minorityleader11}}} | {{{minority_leader11|}}} }}
| monarch = {{{monarch11|}}}
| nominator = {{{nominator11|}}}
| office = {{{office11|}}}
| order = {{{order11|}}}
| parliament = {{{parliament11|}}}
| parliamentarygroup = {{{parliamentarygroup11|}}}
| predecessor = {{{predecessor11|}}}
| preceding = {{{preceding11|}}}
| preceded = {{{preceded11|}}}
| premier = {{{premier11|}}}
| president = {{{president11|}}}
| primeminister = {{{primeminister11|}}}
| riding = {{{riding11|}}}
| state_assembly = {{{state_assembly11|}}}
| state_delegate = {{{state_delegate11|}}}
| state_house = {{{state_house11|}}}
| state_legislature = {{{state_legislature11|}}}
| state_senate = {{{state_senate11|}}}
| state = {{{state11|}}}
| status = {{{status11|}}}
| subterm = {{nobold|{{{subterm11|}}}}}
| suboffice = {{{suboffice11|}}}
| succeeded = {{{succeeded11|}}}
| succeeding = {{{succeeding11|}}}
| successor = {{{successor11|}}}
| taoiseach = {{{taoiseach11|}}}
| termlabel = {{{term_label11|{{{termlabel11|In office}}}}}}
| termend = {{#if:{{{termend11|}}}|{{{termend11}}}|{{{term_end11|}}}}}
| termstart = {{#if:{{{termstart11|}}}|{{{termstart11}}}|{{{term_start11|}}}}}
| term = {{{term11|}}}
| title = {{{title11|}}}
| vicegovernor = {{{vicegovernor11|}}}
| vicepresident = {{{vicepresident11|}}}
| vicepremier = {{{vicepremier11|}}}
| viceprimeminister = {{{viceprimeminister11|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term11|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname12|}}}
| 1namedata = {{{1namedata12|}}}
| 2blankname = {{{2blankname12|}}}
| 2namedata = {{{2namedata12|}}}
| 3blankname = {{{3blankname12|}}}
| 3namedata = {{{3namedata12|}}}
| 4blankname = {{{4blankname12|}}}
| 4namedata = {{{4namedata12|}}}
| 5blankname = {{{5blankname12|}}}
| 5namedata = {{{5namedata12|}}}
| alongside = {{{alongside12|}}}
| ambassador_from = {{{ambassador_from12|}}}
| appointer = {{#if: {{{appointer12|}}} | {{{appointer12}}} | {{{appointed12|}}} }}
| assembly = {{{assembly12|}}}
| assuming = {{{assuming12|}}}
| chancellor = {{{chancellor12|}}}
| co-leader = {{{co-leader12|}}}
| constituency_{{#if:{{{constituency_AM12|}}}|AM|MP}} = {{#if: {{{constituency_AM12|}}} | {{{constituency_AM12}}} | {{{constituency_MP12|}}} }}
| constituency = {{{constituency12|}}}
| convocation = {{{convocation12|}}}
| country = {{{country12|}}}
| deputy = {{{deputy12|}}}
| district = {{{district12|}}}
| firstminister = {{{firstminister12|}}}
| governor-general = {{{governor-general12|}}}
| governor_general = {{{governor_general12|}}}
| governor = {{{governor12|}}}
| jr/sr = {{{jr/sr12|}}}
| jr/sr and state = {{{jr/sr and state12|}}}
| leader = {{{leader12|}}}
| legislature = {{{legislature12|}}}
| lieutenant_governor = {{{lieutenant_governor12|}}}
| lieutenant = {{{lieutenant12|}}}
| minister_from = {{{minister_from12|}}}
| minority_floor_leader = {{{minority_floor_leader12|}}}
| majority_floor_leader = {{{majority_floor_leader12|}}}
| majority_leader = {{#if: {{{majorityleader12|}}} | {{{majorityleader12}}} | {{{majority_leader12|}}} }}
| majority = {{{majority12|}}}
| minister = {{{minister12|}}}
| minority_leader = {{#if: {{{minorityleader12|}}} | {{{minorityleader12}}} | {{{minority_leader12|}}} }}
| monarch = {{{monarch12|}}}
| nominator = {{{nominator12|}}}
| office = {{{office12|}}}
| order = {{{order12|}}}
| parliament = {{{parliament12|}}}
| parliamentarygroup = {{{parliamentarygroup12|}}}
| predecessor = {{{predecessor12|}}}
| preceding = {{{preceding12|}}}
| preceded = {{{preceded12|}}}
| premier = {{{premier12|}}}
| president = {{{president12|}}}
| primeminister = {{{primeminister12|}}}
| riding = {{{riding12|}}}
| state_assembly = {{{state_assembly12|}}}
| state_delegate = {{{state_delegate12|}}}
| state_house = {{{state_house12|}}}
| state_legislature = {{{state_legislature12|}}}
| state_senate = {{{state_senate12|}}}
| state = {{{state12|}}}
| status = {{{status12|}}}
| subterm = {{nobold|{{{subterm12|}}}}}
| suboffice = {{{suboffice12|}}}
| succeeded = {{{succeeded12|}}}
| succeeding = {{{succeeding12|}}}
| successor = {{{successor12|}}}
| taoiseach = {{{taoiseach12|}}}
| termlabel = {{{term_label12|{{{termlabel12|In office}}}}}}
| termend = {{#if:{{{termend12|}}}|{{{termend12}}}|{{{term_end12|}}}}}
| termstart = {{#if:{{{termstart12|}}}|{{{termstart12}}}|{{{term_start12|}}}}}
| term = {{{term12|}}}
| title = {{{title12|}}}
| vicegovernor = {{{vicegovernor12|}}}
| vicepresident = {{{vicepresident12|}}}
| vicepremier = {{{vicepremier12|}}}
| viceprimeminister = {{{viceprimeminister12|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term12|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname13|}}}
| 1namedata = {{{1namedata13|}}}
| 2blankname = {{{2blankname13|}}}
| 2namedata = {{{2namedata13|}}}
| 3blankname = {{{3blankname13|}}}
| 3namedata = {{{3namedata13|}}}
| 4blankname = {{{4blankname13|}}}
| 4namedata = {{{4namedata13|}}}
| 5blankname = {{{5blankname13|}}}
| 5namedata = {{{5namedata13|}}}
| alongside = {{{alongside13|}}}
| ambassador_from = {{{ambassador_from13|}}}
| appointer = {{#if: {{{appointer13|}}} | {{{appointer13}}} | {{{appointed13|}}} }}
| assembly = {{{assembly13|}}}
| assuming = {{{assuming13|}}}
| chancellor = {{{chancellor13|}}}
| co-leader = {{{co-leader13|}}}
| constituency_{{#if:{{{constituency_AM13|}}}|AM|MP}} = {{#if: {{{constituency_AM13|}}} | {{{constituency_AM13}}} | {{{constituency_MP13|}}} }}
| constituency = {{{constituency13|}}}
| convocation = {{{convocation13|}}}
| country = {{{country13|}}}
| deputy = {{{deputy13|}}}
| district = {{{district13|}}}
| firstminister = {{{firstminister13|}}}
| governor-general = {{{governor-general13|}}}
| governor_general = {{{governor_general13|}}}
| governor = {{{governor13|}}}
| jr/sr = {{{jr/sr13|}}}
| jr/sr and state = {{{jr/sr and state13|}}}
| leader = {{{leader13|}}}
| legislature = {{{legislature13|}}}
| lieutenant_governor = {{{lieutenant_governor13|}}}
| lieutenant = {{{lieutenant13|}}}
| minister_from = {{{minister_from13|}}}
| minority_floor_leader = {{{minority_floor_leader13|}}}
| majority_floor_leader = {{{majority_floor_leader13|}}}
| majority_leader = {{#if: {{{majorityleader13|}}} | {{{majorityleader13}}} | {{{majority_leader13|}}} }}
| majority = {{{majority13|}}}
| minister = {{{minister13|}}}
| minority_leader = {{#if: {{{minorityleader13|}}} | {{{minorityleader13}}} | {{{minority_leader13|}}} }}
| monarch = {{{monarch13|}}}
| nominator = {{{nominator13|}}}
| office = {{{office13|}}}
| order = {{{order13|}}}
| parliament = {{{parliament13|}}}
| parliamentarygroup = {{{parliamentarygroup13|}}}
| predecessor = {{{predecessor13|}}}
| preceding = {{{preceding13|}}}
| preceded = {{{preceded13|}}}
| premier = {{{premier13|}}}
| president = {{{president13|}}}
| primeminister = {{{primeminister13|}}}
| riding = {{{riding13|}}}
| state_assembly = {{{state_assembly13|}}}
| state_delegate = {{{state_delegate13|}}}
| state_house = {{{state_house13|}}}
| state_legislature = {{{state_legislature13|}}}
| state_senate = {{{state_senate13|}}}
| state = {{{state13|}}}
| status = {{{status13|}}}
| subterm = {{nobold|{{{subterm13|}}}}}
| suboffice = {{{suboffice13|}}}
| succeeded = {{{succeeded13|}}}
| succeeding = {{{succeeding13|}}}
| successor = {{{successor13|}}}
| taoiseach = {{{taoiseach13|}}}
| termlabel = {{{term_label13|{{{termlabel13|In office}}}}}}
| termend = {{#if:{{{termend13|}}}|{{{termend13}}}|{{{term_end13|}}}}}
| termstart = {{#if:{{{termstart13|}}}|{{{termstart13}}}|{{{term_start13|}}}}}
| term = {{{term13|}}}
| title = {{{title13|}}}
| vicegovernor = {{{vicegovernor13|}}}
| vicepresident = {{{vicepresident13|}}}
| vicepremier = {{{vicepremier13|}}}
| viceprimeminister = {{{viceprimeminister13|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term13|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname14|}}}
| 1namedata = {{{1namedata14|}}}
| 2blankname = {{{2blankname14|}}}
| 2namedata = {{{2namedata14|}}}
| 3blankname = {{{3blankname14|}}}
| 3namedata = {{{3namedata14|}}}
| 4blankname = {{{4blankname14|}}}
| 4namedata = {{{4namedata14|}}}
| 5blankname = {{{5blankname14|}}}
| 5namedata = {{{5namedata14|}}}
| alongside = {{{alongside14|}}}
| ambassador_from = {{{ambassador_from14|}}}
| appointer = {{#if: {{{appointer14|}}} | {{{appointer14}}} | {{{appointed14|}}} }}
| assembly = {{{assembly14|}}}
| assuming = {{{assuming14|}}}
| chancellor = {{{chancellor14|}}}
| co-leader = {{{co-leader14|}}}
| constituency_{{#if:{{{constituency_AM14|}}}|AM|MP}} = {{#if: {{{constituency_AM14|}}} | {{{constituency_AM14}}} | {{{constituency_MP14|}}} }}
| constituency = {{{constituency14|}}}
| convocation = {{{convocation14|}}}
| country = {{{country14|}}}
| deputy = {{{deputy14|}}}
| district = {{{district14|}}}
| firstminister = {{{firstminister14|}}}
| governor-general = {{{governor-general14|}}}
| governor_general = {{{governor_general14|}}}
| governor = {{{governor14|}}}
| jr/sr = {{{jr/sr14|}}}
| jr/sr and state = {{{jr/sr and state14|}}}
| leader = {{{leader14|}}}
| legislature = {{{legislature14|}}}
| lieutenant_governor = {{{lieutenant_governor14|}}}
| lieutenant = {{{lieutenant14|}}}
| minister_from = {{{minister_from14|}}}
| minority_floor_leader = {{{minority_floor_leader14|}}}
| majority_floor_leader = {{{majority_floor_leader14|}}}
| majority_leader = {{#if: {{{majorityleader14|}}} | {{{majorityleader14}}} | {{{majority_leader14|}}} }}
| majority = {{{majority14|}}}
| minister = {{{minister14|}}}
| minority_leader = {{#if: {{{minorityleader14|}}} | {{{minorityleader14}}} | {{{minority_leader14|}}} }}
| monarch = {{{monarch14|}}}
| nominator = {{{nominator14|}}}
| office = {{{office14|}}}
| order = {{{order14|}}}
| parliament = {{{parliament14|}}}
| parliamentarygroup = {{{parliamentarygroup14|}}}
| predecessor = {{{predecessor14|}}}
| preceding = {{{preceding14|}}}
| preceded = {{{preceded14|}}}
| premier = {{{premier14|}}}
| president = {{{president14|}}}
| primeminister = {{{primeminister14|}}}
| riding = {{{riding14|}}}
| state_assembly = {{{state_assembly14|}}}
| state_delegate = {{{state_delegate14|}}}
| state_house = {{{state_house14|}}}
| state_legislature = {{{state_legislature14|}}}
| state_senate = {{{state_senate14|}}}
| state = {{{state14|}}}
| status = {{{status14|}}}
| subterm = {{nobold|{{{subterm14|}}}}}
| suboffice = {{{suboffice14|}}}
| succeeded = {{{succeeded14|}}}
| succeeding = {{{succeeding14|}}}
| successor = {{{successor14|}}}
| taoiseach = {{{taoiseach14|}}}
| termlabel = {{{term_label14|{{{termlabel14|In office}}}}}}
| termend = {{#if:{{{termend14|}}}|{{{termend14}}}|{{{term_end14|}}}}}
| termstart = {{#if:{{{termstart14|}}}|{{{termstart14}}}|{{{term_start14|}}}}}
| term = {{{term14|}}}
| title = {{{title14|}}}
| vicegovernor = {{{vicegovernor14|}}}
| vicepresident = {{{vicepresident14|}}}
| vicepremier = {{{vicepremier14|}}}
| viceprimeminister = {{{viceprimeminister14|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term14|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname15|}}}
| 1namedata = {{{1namedata15|}}}
| 2blankname = {{{2blankname15|}}}
| 2namedata = {{{2namedata15|}}}
| 3blankname = {{{3blankname15|}}}
| 3namedata = {{{3namedata15|}}}
| 4blankname = {{{4blankname15|}}}
| 4namedata = {{{4namedata15|}}}
| 5blankname = {{{5blankname15|}}}
| 5namedata = {{{5namedata15|}}}
| alongside = {{{alongside15|}}}
| ambassador_from = {{{ambassador_from15|}}}
| appointer = {{#if: {{{appointer15|}}} | {{{appointer15}}} | {{{appointed15|}}} }}
| assembly = {{{assembly15|}}}
| assuming = {{{assuming15|}}}
| chancellor = {{{chancellor15|}}}
| co-leader = {{{co-leader15|}}}
| constituency_{{#if:{{{constituency_AM15|}}}|AM|MP}} = {{#if: {{{constituency_AM15|}}} | {{{constituency_AM15}}} | {{{constituency_MP15|}}} }}
| constituency = {{{constituency15|}}}
| convocation = {{{convocation15|}}}
| country = {{{country15|}}}
| deputy = {{{deputy15|}}}
| district = {{{district15|}}}
| firstminister = {{{firstminister15|}}}
| governor-general = {{{governor-general15|}}}
| governor_general = {{{governor_general15|}}}
| governor = {{{governor15|}}}
| jr/sr = {{{jr/sr15|}}}
| jr/sr and state = {{{jr/sr and state15|}}}
| leader = {{{leader15|}}}
| legislature = {{{legislature15|}}}
| lieutenant_governor = {{{lieutenant_governor15|}}}
| lieutenant = {{{lieutenant15|}}}
| minister_from = {{{minister_from15|}}}
| minority_floor_leader = {{{minority_floor_leader15|}}}
| majority_floor_leader = {{{majority_floor_leader15|}}}
| majority_leader = {{#if: {{{majorityleader15|}}} | {{{majorityleader15}}} | {{{majority_leader15|}}} }}
| majority = {{{majority15|}}}
| minister = {{{minister15|}}}
| minority_leader = {{#if: {{{minorityleader15|}}} | {{{minorityleader15}}} | {{{minority_leader15|}}} }}
| monarch = {{{monarch15|}}}
| nominator = {{{nominator15|}}}
| office = {{{office15|}}}
| order = {{{order15|}}}
| parliament = {{{parliament15|}}}
| parliamentarygroup = {{{parliamentarygroup15|}}}
| predecessor = {{{predecessor15|}}}
| preceding = {{{preceding15|}}}
| preceded = {{{preceded15|}}}
| premier = {{{premier15|}}}
| president = {{{president15|}}}
| primeminister = {{{primeminister15|}}}
| riding = {{{riding15|}}}
| state_assembly = {{{state_assembly15|}}}
| state_delegate = {{{state_delegate15|}}}
| state_house = {{{state_house15|}}}
| state_legislature = {{{state_legislature15|}}}
| state_senate = {{{state_senate15|}}}
| state = {{{state15|}}}
| status = {{{status15|}}}
| subterm = {{nobold|{{{subterm15|}}}}}
| suboffice = {{{suboffice15|}}}
| succeeded = {{{succeeded15|}}}
| succeeding = {{{succeeding15|}}}
| successor = {{{successor15|}}}
| taoiseach = {{{taoiseach15|}}}
| termlabel = {{{term_label15|{{{termlabel15|In office}}}}}}
| termend = {{#if:{{{termend15|}}}|{{{termend15}}}|{{{term_end15|}}}}}
| termstart = {{#if:{{{termstart15|}}}|{{{termstart15}}}|{{{term_start15|}}}}}
| term = {{{term15|}}}
| title = {{{title15|}}}
| vicegovernor = {{{vicegovernor15|}}}
| vicepresident = {{{vicepresident15|}}}
| vicepremier = {{{vicepremier15|}}}
| viceprimeminister = {{{viceprimeminister15|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term15|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office|color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname16|}}}
| 1namedata = {{{1namedata16|}}}
| 2blankname = {{{2blankname16|}}}
| 2namedata = {{{2namedata16|}}}
| 3blankname = {{{3blankname16|}}}
| 3namedata = {{{3namedata16|}}}
| 4blankname = {{{4blankname16|}}}
| 4namedata = {{{4namedata16|}}}
| 5blankname = {{{5blankname16|}}}
| 5namedata = {{{5namedata16|}}}
| alongside = {{{alongside16|}}}
| ambassador_from = {{{ambassador_from16|}}}
| appointer = {{#if: {{{appointer16|}}} | {{{appointer16}}} | {{{appointed16|}}} }}
| assembly = {{{assembly16|}}}
| assuming = {{{assuming16|}}}
| chancellor = {{{chancellor16|}}}
| co-leader = {{{co-leader16|}}}
| constituency_{{#if:{{{constituency_AM16|}}}|AM|MP}} = {{#if: {{{constituency_AM16|}}} | {{{constituency_AM16}}} | {{{constituency_MP16|}}} }}
| constituency = {{{constituency16|}}}
| convocation = {{{convocation16|}}}
| country = {{{country16|}}}
| deputy = {{{deputy16|}}}
| district = {{{district16|}}}
| firstminister = {{{firstminister16|}}}
| governor-general = {{{governor-general16|}}}
| governor_general = {{{governor_general16|}}}
| governor = {{{governor16|}}}
| jr/sr = {{{jr/sr16|}}}
| jr/sr and state = {{{jr/sr and state16|}}}
| leader = {{{leader16|}}}
| legislature = {{{legislature16|}}}
| lieutenant_governor = {{{lieutenant_governor16|}}}
| lieutenant = {{{lieutenant16|}}}
| minister_from = {{{minister_from16|}}}
| minority_floor_leader = {{{minority_floor_leader16|}}}
| majority_floor_leader = {{{majority_floor_leader16|}}}
| majority_leader = {{#if: {{{majorityleader16|}}} | {{{majorityleader16}}} | {{{majority_leader16|}}} }}
| majority = {{{majority16|}}}
| minister = {{{minister16|}}}
| minority_leader = {{#if: {{{minorityleader16|}}} | {{{minorityleader16}}} | {{{minority_leader16|}}} }}
| monarch = {{{monarch16|}}}
| nominator = {{{nominator16|}}}
| office = {{{office16|}}}
| order = {{{order16|}}}
| parliament = {{{parliament16|}}}
| parliamentarygroup = {{{parliamentarygroup16|}}}
| predecessor = {{{predecessor16|}}}
| preceding = {{{preceding16|}}}
| preceded = {{{preceded16|}}}
| premier = {{{premier16|}}}
| president = {{{president16|}}}
| primeminister = {{{primeminister16|}}}
| riding = {{{riding16|}}}
| state_assembly = {{{state_assembly16|}}}
| state_delegate = {{{state_delegate16|}}}
| state_house = {{{state_house16|}}}
| state_legislature = {{{state_legislature16|}}}
| state_senate = {{{state_senate16|}}}
| state = {{{state16|}}}
| status = {{{status16|}}}
| subterm = {{nobold|{{{subterm16|}}}}}
| suboffice = {{{suboffice16|}}}
| succeeded = {{{succeeded16|}}}
| succeeding = {{{succeeding16|}}}
| successor = {{{successor16|}}}
| taoiseach = {{{taoiseach16|}}}
| termlabel = {{{term_label16|{{{termlabel16|In office}}}}}}
| termend = {{#if:{{{termend16|}}}|{{{termend16}}}|{{{term_end16|}}}}}
| termstart = {{#if:{{{termstart16|}}}|{{{termstart16}}}|{{{term_start16|}}}}}
| term = {{{term16|}}}
| title = {{{title16|}}}
| vicegovernor = {{{vicegovernor16|}}}
| vicepresident = {{{vicepresident16|}}}
| vicepremier = {{{vicepremier16|}}}
| viceprimeminister = {{{viceprimeminister16|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term16|}}}
}}}}
| data2 = {{{module0|}}}
<!----------Personal data---------->
| header3 = {{#if:{{{pronunciation|}}}{{{birth_name|{{{birthname|}}}}}}{{{birth_date|}}}{{{birth_place|}}}{{{death_date|}}}{{{death_place|}}}{{{resting_place|{{{restingplace|}}}}}}{{{resting_place_coordinates|{{{restingplacecoordinates|}}}}}}{{{citizenship|}}}{{{nationality|}}}{{{party|}}}{{{otherparty|}}}{{{spouse|}}}{{{spouses|}}}{{{partner|}}}{{{relations|}}}{{{children|}}}{{{parents|}}}{{{mother|}}}{{{father|}}}{{{relatives|}}}{{{residence|}}}{{{education|}}}{{{alma_mater|}}}{{{occupation|}}}{{{profession|}}}{{{known_for|}}}{{{salary|}}}{{{cabinet|}}}{{{committees|}}}{{{portfolio|}}}{{{awards|}}}{{{data1|}}}{{{data2|}}}{{{data3|}}}{{{data4|}}}{{{data5|}}}|Personal details}}
| label4 = Pronunciation
| data4 = {{{pronunciation|}}}
| label5 = Born
| data5 = {{#invoke:Separated entries|br
|1 = {{#if:{{{birth_name|{{{birthname|}}}}}}|<div style="display:inline" class="nickname">{{{birth_name|{{{birthname}}}}}}</div>}}
|2 = {{{birth_date|}}}
|3 = {{{birth_place|}}}
}}
| label6 = Died
| data6 = {{#invoke:Separated entries|br|{{{death_date|}}}|{{{death_place|}}}}}
| label7 = {{#ifexpr: {{strfind short|
{{{death_cause|}}}|Assassination}}
| Manner |{{#if:{{{death_manner|}}}|Manner|Cause}} }} of death
| data7 = {{#if:{{{death_manner|}}}|{{{death_manner|}}}|{{{death_cause|}}}}}
| label8 = Resting place
| class8 = label
| data8 = {{#invoke:Separated entries|br|{{{resting_place|{{{restingplace|}}}}}}|{{{resting_place_coordinates|{{{restingplacecoordinates|}}}}}}}}
| label9 = Citizenship
| data9 = {{{citizenship|}}}
| label10 = Nationality
| data10 = {{#switch:{{#invoke:delink|delink|{{{nationality|}}}}}
| {{#ifeq:{{Country2nationality|{{Find country|{{#invoke:delink|delink|{{{birth_place|}}}}}}}}}|{{#invoke:delink|delink|{{{nationality|}}}}}|{{#invoke:delink|delink|{{{nationality|}}}}}}} = <!-- not displayed -->
| {{#ifeq:{{Find country|{{{birth_place|}}}}}|England|British}} = <!-- not displayed -->
| #default = {{{nationality|}}} }}
| label11 = Political party
| data11 = {{#switch:{{{party|}}}
| =
| [[United States Democratic Party|Democrat]]
| [[Democratic Party (United States)|Democratic]]
| [[Democratic Party (United States)|Democrat]] = [[Democratic Party (United States)|Democratic]]
| [[Republican Party (United States)|Republican]]
| [[United States Republican Party]]
| [[United States Republican Party|Republican]]
| [[Republican Party (United States)|Republican Party]] = [[Republican Party (United States)|Republican]]
| [[Conservative Party (UK)|Conservative Party]]
| [[Conservative Party (UK)|Conservative]] = [[Conservative Party (UK)|Conservative]]
| [[Labour Party (UK)|Labour Party]]
| [[Labour Party (UK)|Labour]] = [[Labour Party (UK)|Labour]]
| [[Conservative Party of Canada|Conservative Party]]
| [[Conservative Party of Canada|Conservative]] = [[Conservative Party of Canada|Conservative]]
| [[Liberal Party of Canada|Liberal Party]]
| [[Liberal Party of Canada|Liberal]] = [[Liberal Party of Canada|Liberal]]
| KMT
| Kuomintang
| [[KMT]]
| [[Kuomintang|KMT]]
| [[Kuomintang]]
| Kuomintang (KMT)
| [[Kuomintang]] (KMT) = [[Kuomintang]]
| DPP
| [[Democratic Progressive Party|DPP]]
| [[Democratic Progressive Party]] = [[Democratic Progressive Party]]
| #default = {{{party|}}} }}
| label12 = Other political<br />affiliations
| data12 = {{{otherparty|}}}
| label13 = Height
| data13 = {{#if:{{{height|}}}|{{Infobox person/height|{{{height|}}}}}}}
| label14 = Spouse{{#if:{{{spouses|}}}|s|{{#invoke:Detect singular|pluralize|{{{spouse|{{{spouse(s)|}}}}}}|likely=(s)|plural=s}}}}
| data14 = {{{spouse|{{{spouses|{{{spouse(s)|}}}}}}}}}
| label15 = Domestic partner{{#invoke:Detect singular|pluralize|{{{partner|}}}|likely=(s)|plural=s}}
| data15 = {{{partner|}}}
| label16 = Relations
| data16 = {{{relations|}}}
| label17 = Children
| data17 = {{{children|}}}
| label18 = Parent{{#if:{{{parents|}}}|{{#invoke:Detect singular|pluralize|{{{parents|}}}|likely=(s)|plural=s}}|<!--
-->{{#ifexpr:{{count|{{{father|}}}|{{{mother|}}}}} > 1|s}}}}
| data18 = {{#if:{{{parents|}}}|{{{parents}}}|{{#invoke:list|unbulleted|{{#if:{{{father|}}}|{{{father}}} (father)}}|{{#if:{{{mother|}}}|{{{mother}}} (mother)}}}}}}
| label19 = Relatives
| data19 = {{{relatives|}}}
| label20 = Residence{{#invoke:Detect singular|pluralize|{{{residence|}}}|likely=(s)|plural=s}}
| class20 = {{#if:{{{death_date|}}}{{{death_place|}}}||label}}
| data20 = {{{residence|}}}
| label21 = Education
| data21 = {{{education|}}}
| label22 = [[Alma mater]]
| data22 = {{{alma_mater|}}}
| label23 = Occupation
| data23 = {{{occupation|}}}
| label24 = Profession
| data24 = {{{profession|}}}
| label25 = Known for
| data25 = {{{known_for|}}}
| label26 = Salary
| data26 = {{{salary|}}}
| label27 = Cabinet
| data27 = {{{cabinet|}}}
| label28 = Committees
| data28 = {{{committees|}}}
| label29 = Portfolio
| data29 = {{{portfolio|}}}
| label30 = {{#if:{{{mawards|}}}|Civilian awards|Awards}}
| data30 = {{{awards|}}}
| label31 = {{{blank1}}}
| data31 = {{{data1|}}}
| label32 = {{{blank2}}}
| data32 = {{{data2|}}}
| label33 = {{{blank3}}}
| data33 = {{{data3|}}}
| label34 = {{{blank4}}}
| data34 = {{{data4|}}}
| label35 = {{{blank5}}}
| data35 = {{{data5|}}}
| label36 = Signature
| data36 = {{#if:{{{signature|}}}|[[File:{{{signature}}}|{{#if:{{{signature_size|}}}|{{{signature_size}}}|128x80px}}|alt={{{signature_alt|}}}|{{PAGENAME}}'s signature]]}}
| label37 = Website
| data37 = {{{website|}}}
| label38 = Nickname{{#invoke:Detect singular|pluralize|{{{nickname|}}}|likely=(s)|plural=s}}
| data38 = {{{nickname|}}}
| header39 = {{#if:{{{allegiance|}}}{{{branch|}}}{{{serviceyears|}}}{{{rank|}}}{{{unit|}}}{{{commands|}}}{{{battles|}}}{{{military_blank1|}}}|Military service}}
| label40 = Allegiance
| data40 = {{{allegiance|}}}
| label41 = {{#if:{{{branch_label|}}}|{{{branch_label|}}}|Branch/service}}
| data41 = {{{branch|}}}
| label42 = {{#if:{{{serviceyears_label|}}}|{{{serviceyears_label|}}}|Years of service}}
| data42 = {{{serviceyears|}}}
| label43 = {{#if:{{{rank_label|}}}|{{{rank_label|}}}|Rank}}
| data43 = {{{rank|}}}
| label44 = {{#if:{{{unit_label|}}}|{{{unit_label|}}}|Unit}}
| data44 = {{{unit|}}}
| label45 = Commands
| data45 = {{{commands|}}}
| label46 = {{#if:{{{battles_label|}}}|{{{battles_label|}}}|Battles/wars}}
| data46 = {{{battles|}}}
| label47 = {{#if:{{{awards|}}}|Military awards|Awards}}
| data47 = {{{mawards|}}}
| label48 = {{{military_blank1}}}
| data48 = {{{military_data1|}}}
| label49 = {{{military_blank2}}}
| data49 = {{{military_data2|}}}
| label50 = {{{military_blank3}}}
| data50 = {{{military_data3|}}}
| label51 = {{{military_blank4}}}
| data51 = {{{military_data4|}}}
| label52 = {{{military_blank5}}}
| data52 = {{{military_data5|}}}
| data53 = {{{module|}}}
| data54 = {{{module2|}}}
| data55 = {{{module3|}}}
| data56 = {{{module4|}}}
| data57 = {{{module5|}}}
| data58 = {{{footnotes|}}}
| belowstyle = border-top: 1px solid right;
| below = <div>{{#if:{{{date|}}}| As of {{{date}}}{{#if:{{{year|}}}|, {{{year}}}}}}}</div>{{#if:{{{source|}}}|Source: [{{{source}}}]}}
}}{{#if:{{{pronunciation|}}}|{{#ifeq:{{{nocat|{{{demo|{{#ifeq:{{{categories|}}}|no|yes}}}}}}}}|yes||[[Category:Biography template using pronunciation]]}}
}}{{#if:{{{1blankname0|}}}{{{1namedata0|}}}{{{2blankname0|}}}{{{2namedata0|}}}{{{3blankname0|}}}{{{3namedata0|}}}{{{4blankname0|}}}{{{4namedata0|}}}{{{5blankname0|}}}{{{5namedata0|}}}{{{alongside0|}}}{{{ambassador_from0|}}}{{{appointer0|}}}{{{assembly0|}}}{{{assuming0|}}}{{{chancellor0|}}}{{{co-leader0|}}}{{{constituency_AM0|}}}{{{constituency0|}}}{{{country0|}}}{{{deputy0|}}}{{{district0|}}}{{{firstminister0|}}}{{{governor-general0|}}}{{{governor0|}}}{{{jr/sr0|}}}{{{jr/sr and state0|}}}{{{leader0|}}}{{{legislature0|}}}{{{lieutenant_governor0|}}}{{{lieutenant0|}}}{{{minister_from0|}}}{{{minority_floor_leader0|}}}{{{majority_floor_leader0|}}}{{{majorityleader0|}}}{{{majority0|}}}{{{minister0|}}}{{{minorityleader0|}}}{{{monarch0|}}}{{{nominator0|}}}{{{office0|}}}{{{order0|}}}{{{parliament0|}}}{{{predecessor0|}}}{{{preceding0|}}}{{{preceded0|}}}{{{premier0|}}}{{{president0|}}}{{{primeminister0|}}}{{{riding0|}}}{{{state_assembly0|}}}{{{state_delegate0|}}}{{{state_house0|}}}{{{state_legislature0|}}}{{{state_senate0|}}}{{{state0|}}}{{{suboffice0|}}}{{{subterm0|}}}{{{succeeded0|}}}{{{succeeding0|}}}{{{successor0|}}}{{{taoiseach0|}}}{{{termend0|}}}{{{termstart0|}}}{{{term0|}}}{{{title0|}}}{{{vicegovernor0|}}}{{{vicepresident0|}}}{{{vicepremier0|}}}{{{viceprimeminister0|}}}{{{prior_term0|}}}{{{appointe0|}}}{{{constituency_0|}}}|{{#ifeq:{{{nocat|{{{demo|{{#ifeq:{{{categories|}}}|no|yes}}}}}}}}|yes||[[Category:Pages using infobox officeholder with office0]]}}
}}{{#if:{{{speaker|}}}|{{#if:{{{nominee|}}}{{{candidate|}}}||{{#ifeq:{{{nocat|{{{demo|{{#ifeq:{{{categories|}}}|no|yes}}}}}}}}|yes||[[Category:Pages using infobox officeholder with speaker]]}}}}
}}{{#invoke:Check for unknown parameters|check|unknown={{main other|{{#ifeq:{{{nocat|{{{demo|{{#ifeq:{{{categories|}}}|no|yes}}}}}}}}|yes||[[Category:Pages using infobox officeholder with unknown parameters|_VALUE_{{PAGENAME}}]]}}}}|preview=Page using [[Template:Infobox officeholder]] with unknown parameter "_VALUE_"|ignoreblank=y| regexp1 = 1blankname[%d]* | regexp2 = 1namedata[%d]* | regexp3 = 2blankname[%d]* | regexp4 = 2namedata[%d]* | regexp5 = 3blankname[%d]* | regexp6 = 3namedata[%d]* | regexp7 = 4blankname[%d]* | regexp8 = 4namedata[%d]* | regexp9 = 5blankname[%d]* | regexp10 = 5namedata[%d]* | allegiance | alma_mater | regexp11 = alongside[%d]* | alt | regexp12 = ambassador_from[%d]* | regexp13 = appointed[%d]* | regexp14 = appointer[%d]* | regexp15 = assembly[%d]* | awards | battles | battles_label | birth_date | birth_name | birth_place | birthname | regexp16 = blank[%d]* | bodyclass | branch | branch_label | cabinet | candidate | caption | categories | regexp17 = chancellor[%d]* | children | citizenship | regexp18 = co%-leader[%d]* | commands | committees | regexp19 = constituency[%d]* | regexp20 = constituency_AM[%d]* | regexp21 = constituency_MP[%d]* | regexp22 = convocation[%d]* | regexp23 = country[%d]* | regexp24 = data[%d]* | date | death_cause | death_date | death_manner | death_place | demo | regexp25 = deputy[%d]* | regexp26 = district[%d]* | education | election_date | embed | father | regexp28 = firstminister[%d]* | footnotes | regexp29 = governor[%d]* | regexp30 = governor_general[%d]* | regexp31 = governor%-general[%d]* | height | honorific_prefix | honorific-prefix | honorific_suffix | honorific-suffix | image | image name | image_name_alt | image_size | imagesize | image_upright | incumbent | regexp32 = jr/sr[%d]* | regexp33 = jr/sr and state[%d]* | known_for | regexp34 = leader[%d]* | regexp35 = legislature[%d]* | regexp36 = lieutenant[%d]* | regexp37 = lieutenant_governor[%d]* | mainwidth | regexp38 = majority[%d]* | regexp39 = majority_floor_leader[%d]* | regexp40 = majority_leader[%d]* | regexp41 = majorityleader[%d]* | mawards | regexp42 = military_blank[%d]* | regexp43 = military_data[%d]* | regexp44 = minister[%d]* | regexp45 = minister_from[%d]* | regexp46 = minority_floor_leader[%d]* | regexp47 = minority_leader[%d]* | regexp48 = minorityleader[%d]* | regexp49 = module[%d]* | regexp50 = monarch[%d]* | mother | name | nationality | native_name | native_name_lang | nickname | nocat | regexp51 = nominator[%d]* | nominee | occupation | regexp52 = office[%d]* | opponent | regexp53 = order[%d]* | otherparty | parents | regexp54 = parliament[%d]* | regexp55 = parliamentarygroup[%d]* | partner | party | party_election | portfolio | regexp56 = preceded[%d]* | regexp57 = preceding[%d]* | regexp58 = predecessor[%d]* | regexp59 = premier[%d]* | regexp60 = president[%d]* | regexp61 = primeminister[%d]* | regexp62 = prior_term[%d]* | profession | pronunciation | rank | rank_label | relations | relatives | residence | resting_place | resting_place_coordinates | restingplace | restingplacecoordinates | regexp63 = riding[%d]* | runningmate | salary | serviceyears | serviceyears_label | signature | signature_alt | signature_size | smallimage | smallimage_alt | source | speaker | speaker_office | spouse | spouses | regexp64 = state[%d]* | regexp65 = state_assembly[%d]* | regexp66 = state_delegate[%d]* | regexp67 = state_house[%d]* | regexp68 = state_legislature[%d]* | regexp69 = state_senate[%d]* | regexp70 = status[%d]* | regexp71 = suboffice[%d]* | regexp72 = subterm[%d]* | regexp73 = succeeded[%d]* | regexp74 = succeeding[%d]* | regexp75 = successor[%d]* | regexp76 = taoiseach[%d]* | regexp77 = term[%d]* | regexp78 = term_end[%d]* | regexp79 = term_label[%d]* | regexp80 = term_start[%d]* | regexp81 = termend[%d]* | regexp82 = termlabel[%d]* | regexp83 = termstart[%d]* | regexp84 = title[%d]* | unit | unit_label | regexp85 = vicegovernor[%d]* | regexp86 = vicepremier[%d]* | regexp87 = vicepresident[%d]* | regexp88 = viceprimeminister[%d]* | regexp89 = assuming[%d]* | website | width | year }}<noinclude>
{{Documentation}}
</noinclude>
7154c31bda4e74e6aa002e72637816c1e0b41834
Template:Nowrap
10
142
276
275
2023-12-24T02:08:30Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Nowrap]]
wikitext
text/x-wiki
<span class="nowrap">{{{1}}}</span><noinclude>
{{documentation}}
<!-- Categories go on the /doc page; interwikis go to Wikidata. -->
</noinclude>
5d0dc6b6d89b37f4356242404f46138a4017f015
Template:Mbox
10
143
278
277
2023-12-24T02:08:32Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Mbox]]
wikitext
text/x-wiki
{{#invoke:Message box|mbox}}<noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage; interwikis go to Wikidata, thank you! -->
</noinclude>
5bfb2becf8bed35974b47e3ff8660dc14bee40c7
Template:Flatlist
10
144
280
279
2023-12-24T02:08:36Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Flatlist]]
wikitext
text/x-wiki
<templatestyles src="Hlist/styles.css"/><div class="hlist {{{class|}}}" {{#if:{{{style|}}}{{{indent|}}}|style="{{#if:{{{indent|}}}|margin-left: {{#expr:{{{indent}}}*1.6}}em;}} {{{style|}}}"}}>{{#if:{{{1|}}}|
{{{1}}}
</div>}}<noinclude></div>
{{documentation}}
</noinclude>
cf60aa4aef920d48fa394e786f72fe5f6dcd3169
Template:Infobox officeholder/office
10
145
282
281
2023-12-24T02:08:37Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Infobox_officeholder/office]]
wikitext
text/x-wiki
{{#if:{{{speaker|}}}{{{state_legislature|}}}{{{state_assembly|}}}{{{speaker_office|}}}{{{state_delegate|}}}{{{state_house|}}}{{{prior_term|}}}{{{nominee|}}}{{{candidate|}}}{{{termstart|}}}{{{election_date|}}}{{{majority_leader|}}}{{{minority_floor_leader|}}}{{{minority_leader|}}}{{{majority_floor_leader|}}}{{{jr/sr|}}}{{{succeeding|}}}{{{assuming|}}}{{{state|}}}{{{jr/sr and state|}}}{{{state_senate|}}}{{{district|}}}{{{ambassador_from|}}}{{{minister_from|}}}{{{order|}}}{{{office|}}}{{{title|}}}{{{country|}}}{{{constituency_AM|}}}{{{constituency_MP|}}}{{{parliament|}}}{{{assembly|}}}{{{constituency_|}}}{{{riding|}}}{{{term|}}}{{{termend|}}}{{{alongside|}}}{{{co-leader|}}}
|{{#invoke:infobox|infoboxTemplate|child=yes|decat=yes
| headerstyle = background:{{{color|lavender}}};line-height:normal;padding:0.2em;
| datastyle = border-bottom:none
<!--------Speaker of the House--------->
| header1 = {{#if:{{{speaker|}}}|
{{{speaker}}} {{#if:{{{state_legislature|}}}
|[[Speaker of the {{{state_legislature}}} Legislature]]
|{{#if:{{{state_assembly|}}}
|[[Speaker of the {{{state_assembly|}}} {{#ifeq:{{{state_assembly|}}}|Nevada||{{#ifeq:{{{state_assembly|}}}|New Jersey|General|State}}}} Assembly]]
|{{#if:{{{speaker_office|}}}|{{{speaker_office}}}|[[Speaker of the {{#if:{{{state_delegate|}}} |{{{state_delegate}}}|{{#if:{{{state_house|}}} |{{{state_house}}}|United States}}}} House of {{#if:{{{state_delegate|}}}|Delegates|Representatives}}|Speaker of the {{#if:{{{state_delegate|}}} |{{{state_delegate}}}|{{#if:{{{state_house|}}} |{{{state_house}}}|U.S.}}}} House of {{#if:{{{state_delegate|}}}|Delegates|Representatives}}]]}}
}}
}}{{#if:{{{prior_term|}}}|
<br />{{{prior_term}}}}}
}}
<!--------Office--------->
| header2 = {{#if:{{{nominee|}}}{{{candidate|}}}|
{{#if:{{{party_election|}}}{{{party|}}}
|{{#if:{{{party_election|}}}|{{{party_election}}}|{{{party}}}}} {{#if:{{{nominee|}}}|nominee for<br />{{{nominee}}}|candidate for<br />{{{candidate}}}}}
|{{#if:{{{nominee|}}}|Nominee for<br />{{{nominee}}}|Candidate for<br />{{{candidate}}}}}
}} }}
| data3 = {{#if:{{{nominee|}}}{{{candidate|}}}|
{{#if:{{{termstart|}}}{{{election_date|}}} | <span class="nowrap">'''Election date'''</span><br />{{#if:{{{election_date|}}}|{{{election_date}}}|{{{termstart}}}}}
}} }}
| header4 = {{#if:{{{majority_leader|}}}{{{minority_floor_leader|}}}{{{minority_leader|}}}{{{majority_floor_leader|}}}||
{{#if:{{{jr/sr|}}}|[[United States Senate|<!--Changed code to eliminate "Junior/Senior" distinction for U.S. Senators per [[Template talk:Infobox Officeholder/Archive 9#Senior/Junior U.S. Senators]]{{{jr/sr}}}-->United States Senator{{#if:{{{succeeding|}}}{{{assuming|}}}|-elect}}]]<br />from {{{state}}}
}} }}
| header5 = {{#if:{{{majority_leader|}}}{{{minority_floor_leader|}}}{{{minority_leader|}}}{{{majority_floor_leader|}}}||
{{{jr/sr and state|}}}
}}
| header6 = {{#if:{{{majority_leader|}}}{{{minority_floor_leader|}}}{{{minority_leader|}}}{{{majority_floor_leader|}}}||
{{#if:{{{state_senate|}}}|Member{{#if:{{{succeeding|}}}{{{assuming|}}}|-elect}} of the <span style="display: inline-block;">[[{{{state_senate}}} Senate]]</span>{{#if:{{{district|}}}|<br />from the {{{district}}} district}}{{#if:{{{prior_term|}}}|
<br />{{{prior_term}}}}}
}} }}
| header7 = {{#if:{{{majority_leader|}}}{{{minority_floor_leader|}}}{{{minority_leader|}}}{{{majority_floor_leader|}}}||
{{#if:{{{state_legislature|}}}|Member{{#if:{{{succeeding|}}}{{{assuming|}}}|-elect}} of the <span style="display: inline-block;">[[{{{state_legislature}}} Legislature]]</span><br />from the {{{district}}} district
}} }}
| header8 = {{#if:{{{ambassador_from|}}}{{{minister_from|}}}||
{{#if:{{{order|}}}
|{{{order}}}{{#if:{{{office|}}} | [[{{{office}}}]]}}{{#if:{{{state|}}} | [[{{{state}}}]]}}{{#if:{{{title|}}} | {{{title}}}}}
|{{{office|}}}
}} }}
| header9 = {{#if:{{{ambassador_from|}}}{{{minister_from|}}}||
{{#if:{{{order|}}}
||{{{title|}}}
}} }}
<!--------Ambassador--------->
| header10 = {{#if:{{both|{{{ambassador_from|}}}{{{minister_from|}}}|{{{country|}}}}}
|{{#if:{{{order|}}}|{{{order}}}}} {{#if:{{{minister_from|}}}
|[[{{{minister_from}}} Ambassador to {{CountryPrefixThe|{{{country}}}}}|{{{minister_from}}} Minister to <span class="nowrap">{{CountryPrefixThe|{{{country}}}}}</span>]]
|[[{{{ambassador_from}}} Ambassador to {{CountryPrefixThe|{{{country}}}}}|{{{ambassador_from}}} Ambassador to <span class="nowrap">{{CountryPrefixThe|{{{country}}}}}</span>]]
}} [[Category:Pages using infobox officeholder with ambassador from or minister from]]
}}
<!--------MP--------->
| header11 = {{#if:{{{constituency_AM|}}}{{{constituency_MP|}}}|
{{#switch:{{{parliament|}}}
|Australian = Member of the <span style="display: inline-block;">[[Australian House of Representatives|Australian Parliament]]</span>
|European = [[Member of the European Parliament]]
|Scottish = [[Member of the Scottish Parliament]]
|Sri Lanka|Sri Lankan = [[Member of Parliament (Sri Lanka)|Member of Parliament]]
|United Kingdom|UK = [[Member of Parliament (United Kingdom)|Member of Parliament]]
|#default = {{#if:{{{constituency_AM|}}}|{{#if:{{{assembly|}}}|Member of the <span style="display: inline-block;">[[{{{assembly}}} Assembly]]</span>|Assembly Member}}|Member of {{#if:{{{parliament|}}}|the <span style="display: inline-block;">[[{{{parliament}}} Parliament]]</span>|Parliament}}}}}}<br />for {{#ifeq:{{Title disambig text|{{{constituency_MP|}}}}}|UK Parliament constituency
|{{{constituency_MP|}}}
|{{#if:{{#switch:{{{parliament|}}} |United Kingdom|UK| = {{Linkless exists|{{#invoke:delink|delink|{{{constituency_MP|}}}}} (UK Parliament constituency)}} }}
|{{#if:{{Constlk|{{#invoke:delink|delink|{{{constituency_MP|}}}}}}}
|{{Constlk|{{#invoke:delink|delink|{{{constituency_MP|}}}}}}}
|{{{constituency_{{#if:{{{constituency_AM|}}}|AM|MP}}}}}}}
|{{{constituency_{{#if:{{{constituency_AM|}}}|AM|MP}}}}}}}
}}{{#if:{{{prior_term|}}}|
<div style="font-weight:normal;">{{{prior_term}}}</div>}}
}}
| header12 = {{#if:{{{riding|}}}|{{#if:{{{constituency_AM|}}}|{{#if:{{{assembly|}}}|Member of the <span style="display: inline-block;">[[{{{assembly}}} Assembly]]</span>|Assembly Member}}|
{{#switch:{{{parliament|}}}
|Canadian = [[Member of Parliament (Canada)|Member of Parliament]]
|#default = Member of {{#if:{{{parliament|}}}|the <span style="display: inline-block;">[[{{{parliament}}} Parliament]]</span>|Parliament}}}}}}<br />for {{{riding}}}
}}
<!--------Majority Leader (State Senate)--------->
| header13 = {{#if:{{{majority_leader|}}}|{{{majority_leader}}} {{#if:{{{state_senate|}}}|[[Majority Leader of the {{{state_senate}}} Senate]]|[[United States Senate Majority Leader]]}}
}}
<!--------Majority Floor Leader (State Senate)--------->
| header14 = {{#if:{{{majority_floor_leader|}}}|{{{majority_floor_leader}}} [[Majority Floor Leader of the {{{state_senate}}} Senate]]
}}
<!--------Minority Leader (State Senate)--------->
| header15 = {{#if:{{{minority_leader|}}}|{{{minority_leader}}} [[Minority Leader of the {{{state_senate}}} Senate]]
}}
<!--------Minority Floor Leader (State Senate)--------->
| header16 = {{#if:{{{minority_floor_leader|}}}|{{{minority_floor_leader}}} [[Minority Floor Leader of the {{{state_senate}}} Senate]]
}}
<!--------Congressman--------->
| header17 = {{#if:{{{state_legislature|}}}{{{state_senate|}}}{{{jr/sr|}}}{{{jr/sr and state|}}}||
{{#if:{{#if:{{{state|}}}|{{{constituency|}}}}}{{{district|}}}{{{state_house|}}}|{{#if:{{{state_assembly|}}}
|Member{{#if:{{{succeeding|}}}{{{assuming|}}}|-elect}} of the <span style="display: inline-block;">[[{{{state_assembly|}}} {{#ifeq:{{{state_assembly|}}}|Nevada||{{#ifeq:{{{state_assembly|}}}|New Jersey|General|State}}}} Assembly]]</span><br />from the
|Member{{#if:{{{succeeding|}}}{{{assuming|}}}|-elect}} of the <span style="display: inline-block;">[[{{#if:{{{state_house|}}} |{{{state_house}}}|{{#if:{{{state_delegate|}}}|{{{state_delegate}}}|United States }}}} {{#if:{{{state_delegate|}}}|House of Delegates|House of Representatives}}|{{#if:{{{state_house|}}} |{{{state_house}}}|{{#if:{{{state_delegate|}}}|{{{state_delegate}}}|U.S.}}}} {{#if:{{{state_delegate|}}}|House of Delegates|{{#if:{{{state_house|}}}| }}House of Representatives}}]]</span>{{#if:{{{district|}}}{{{state|}}}{{{state_delegate|}}}|<br />from {{#if:{{{state_delegate|}}}|the |{{#if:{{{state_house|}}}|{{#if:{{{district|}}}|the|{{{state|}}}}}|{{{state|}}}{{#if:{{{district|}}}|'s}}}}}}
}}}} {{#if:{{{district|}}}|{{{district}}} district|{{#if:{{{state_house|}}}|{{{constituency|}}}}}}}{{#if:{{{prior_term|}}}|
<br />{{{prior_term}}}}}
}}
}}
<!--------Convocation--------->
| header18 = {{#if:{{{convocation|}}}|{{{convocation}}}}}
<!--------Term--------->
| data19 = {{#if:{{{termend|}}}{{{succeeding|}}}{{{assuming|}}}|
{{#if:{{{status|}}}
| <div style="width:100%; margin:0; background-color: {{{color|lavender}}}">'''{{{status}}}'''</div>|}}|
}}
| data20 = {{#if:{{{nominee|}}}{{{candidate|}}}||
{{#if:{{{succeeding|}}}{{{assuming|}}}
| <span class="nowrap">'''Assuming office'''</span><br />{{{termstart}}}{{#if:{{{term|}}}{{{termend|}}}|[[Category:Pages using infobox officeholder with succeeding and term or termend]]}}
| {{#if: {{{term|}}} | <span class="nowrap">'''{{{termlabel|In office}}}'''</span><br />{{{term}}} }}
}} }}
| data21 = {{#if:{{{nominee|}}}{{{candidate|}}}||
{{#if:{{{succeeding|}}}{{{assuming|}}}
|
|{{#if:{{{termstart|}}}
| {{#if:{{{termend|}}}
|<!--then: term has start and end:--><span class="nowrap">'''{{{termlabel|In office}}}'''</span><br />{{en dash range|{{{termstart}}}|{{{termend}}}}}{{#if:{{{alongside|}}}{{{co-leader|}}}|<div style="line-height:normal; padding-top:0.2em; padding-bottom:0.1em">{{#if:{{{alongside|}}}|Serving|Co-leading}} with {{#if:{{{alongside|}}}|{{{alongside}}}|{{{co-leader}}}}}</div>}}
|{{#if:{{{status|}}}|<div style="width:100%; margin:0; background-color: {{{color|lavender}}}">'''{{{status}}}'''</div>|<!--else: term is ongoing--><div style="width:100%; margin:0; background-color: {{{color|lavender}}}">'''[[Incumbent]]'''</div>}}
}}
}}
}} }}
| data22 = {{#if:{{{nominee|}}}{{{candidate|}}}||
{{#if:{{{succeeding|}}}{{{assuming|}}}
|
|{{#if:{{{termstart|}}}
|{{#if:{{{termend|}}}
|<!--then nothing else; term has ended-->
|<!--else term is ongoing:--><span class="nowrap">'''{{#if:{{{termlabel|}}}|{{#invoke:String|replace|source={{{termlabel}}}|In office|Assumed office}}|Assumed office}}'''</span> <br />{{{termstart}}}{{#if:{{{alongside|}}}{{{co-leader|}}}|<div style="line-height:normal; padding-top:0.2em; padding-bottom:0.1em">{{#if:{{{alongside|}}}|Serving|Co-leader}} with {{#if:{{{alongside|}}}|{{{alongside}}}|{{{co-leader}}}}}</div>}}
}}
}}
}} }}
}} }}<!--
end infobox1 / start infobox2
-->{{#if:{{{monarch|}}}{{{president|}}}{{{governor-general|}}}{{{governor_general|}}}{{{primeminister|}}}{{{chancellor|}}}{{{minister|}}}{{{taoiseach|}}}{{{firstminister|}}}{{{chiefminister|}}}{{{premier|}}}{{{governor|}}}{{{lieutenant_governor|}}}{{{vicepresident|}}}{{{vicegovernor|}}}{{{viceprimeminister|}}}{{{vicepremier|}}}{{{deputy|}}}{{{leader|}}}{{{lieutenant|}}}{{{nominator|}}}{{{appointer|}}}{{{opponent|}}}{{{incumbent|}}}{{{succeeding|}}}{{{assuming|}}}{{{preceding|}}}{{{predecessor|}}}{{{preceded|}}}{{{successor|}}}{{{succeeded|}}}{{{parliamentarygroup|}}}{{{constituency|}}}{{{majority|}}}{{{suboffice|}}}{{{1namedata|}}}{{{2namedata|}}}{{{3namedata|}}}{{{4namedata|}}}{{{5namedata|}}}{{{runningmate|}}}|
{{#invoke:infobox|infoboxTemplate|child=yes
| labelstyle = text-align:left
| label1 = <span class="nowrap">Nominated by</span>
| data1 = {{{nominator|}}}
| label2 = <span class="nowrap">Appointed by</span>
| data2 = {{{appointer|}}}
<!--------President, Prime Minister, Governor--------->
| label3 = Monarch{{#if:{{detect singular|{{{monarch|}}}}}||s}}
| data3 = {{{monarch|}}}
| label4 = President
| data4 = {{{president|}}}
| label5 = {{#if:{{{governor_general|}}}|Governor{{#if:{{detect singular|{{{governor_general}}}}}||s}} General|Governor{{#if:{{detect singular|{{{governor-general}}}}}||s}}-General}}
| data5 = {{#if:{{{governor_general|}}}|{{{governor_general}}}|{{{governor-general|}}}}}
| label6 = <span class="nowrap">Prime Minister</span>
| data6 = {{{primeminister|}}}
| label7 = Chancellor
| data7 = {{{chancellor|}}}
| label8 = Minister
| data8 = {{{minister|}}}
| label9 = Taoiseach
| data9 = {{{taoiseach|}}}
| label10 = <span class="nowrap">First Minister</span>
| data10 = {{{firstminister|}}}
| label11 = <span class="nowrap">Chief Minister</span>
| data11 = {{{chiefminister|}}}
| label12 = Premier
| data12 = {{{premier|}}}
| label13 = Governor
| data13 = {{{governor|}}}
| label14 = Lieutenant Governor
| data14 = {{{lieutenant_governor|}}}
<!--------Vice president/s, Vice Prime Minister/s, Deputy/ies, Lieutenant/s--------->
| label15 = <span class="nowrap">{{#if:{{{vicepresident|}}}|{{#ifeq:{{Linkless exists|Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}|{{#ifeq:{{#invoke:Redirect|main|fulltext=1|{{#ifeq:Vice|Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}||Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}}}|{{#invoke:Redirect|main|fulltext=1|{{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}||{{#if:{{#invoke:Disambiguation|isDisambiguationPage|Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}||true}} }}|[[Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}|Vice President]]|Vice President}}|Vice President}}</span>
| data15 = {{{vicepresident|}}}
| label16 = <span class="nowrap">{{#if:{{{vicegovernor|}}}|{{#ifeq:{{Linkless exists|Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}|{{#ifeq:{{#invoke:Redirect|main|fulltext=1|{{#ifeq:Vice|Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}||Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}}}|{{#invoke:Redirect|main|fulltext=1|{{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}||{{#if:{{#invoke:Disambiguation|isDisambiguationPage|Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}||true}} }}|[[Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}|Vice Governor]]|Vice Governor}}|Vice Governor}}</span>
| data16 = {{{vicegovernor|}}}
| label17 = <span class="nowrap">{{#if:{{{viceprimeminister|}}}|[[Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}|Vice PM]]|Vice [[Prime Minister|PM]]}}</span>
| data17 = {{{viceprimeminister|}}}
| label18 = <span class="nowrap">{{#if:{{{vicepremier|}}}|{{#ifeq:{{Linkless exists|Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}|{{#ifeq:{{#invoke:Redirect|main|fulltext=1|{{#ifeq:Vice|Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}||Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}}}|{{#invoke:Redirect|main|fulltext=1|{{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}||{{#if:{{#invoke:Disambiguation|isDisambiguationPage|Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}||true}} }}|[[Vice {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}|Vice Premier]]|Vice Premier}}|Vice Premier}}</span>
| data18 = {{{vicepremier|}}}
| label19 = {{#if:{{{deputy|}}}|{{#ifeq:{{Linkless exists|Deputy {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}|{{#ifeq:{{#invoke:Redirect|main|fulltext=1|{{#ifeq:Deputy|Deputy {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}||Deputy {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}}}|{{#invoke:Redirect|main|fulltext=1|{{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}||{{#if:{{#invoke:Disambiguation|isDisambiguationPage|Deputy {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}}}||true}} }}|[[Deputy {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}|Deputy]]|Deputy}}|Deputy}}
| data19 = {{{deputy|}}}
| label20 = Leader
| data20 = {{{leader|}}}
| label21 = {{#if:{{{office|}}}|[[Lieutenant {{#invoke:delink|delink|{{{office}}}|wikilinks=target}}|Lieutenant]]|Lieutenant}}
| data21 = {{{lieutenant|}}}
| label22 = {{nowrap|{{{subterm|}}}}}
| data22 = {{{suboffice|}}}
<!--------Blank fields--------->
| label23 = {{{1blankname|}}}
| data23 = {{{1namedata|}}}
| label24 = {{{2blankname|}}}
| data24 = {{{2namedata|}}}
| label25 = {{{3blankname|}}}
| data25 = {{{3namedata|}}}
| label26 = {{{4blankname|}}}
| data26 = {{{4namedata|}}}
| label27 = {{{5blankname|}}}
| data27 = {{{5namedata|}}}
<!--------Predecessor/successor--------->
| label28 = <span class="nowrap">Running mate</span>
| data28 = {{{runningmate|}}}
| label29 = Opponent{{#invoke:Detect singular|pluralize|{{{opponent|}}}|likely=(s)|plural=s}}
| data29 = {{{opponent|}}}
| label30 = Incumbent
| data30 = {{{incumbent|}}}
| label31 = {{#if:{{{succeeding|}}}|Succeeding|Preceding}}
| data31 = {{#if:{{{succeeding|}}}|{{{succeeding|}}}|{{{preceding|}}}}}
| label32 = <span class="nowrap">Preceded by</span>
| data32 = {{#if:{{{succeeding|}}}||{{#if:{{{predecessor|}}}|{{{predecessor}}}|{{{preceded|}}}}}}}
| label33 = <span class="nowrap">Succeeded by</span>
| data33 = {{#if:{{{succeeding|}}}||{{#switch:{{#if:{{{successor|}}}|{{{successor}}}|{{{succeeded|}}}}}
| Incumbent
| '''Incumbent'''
| ''Incumbent''
| [[Incumbent]]
| incumbent
| '''incumbent'''
| ''incumbent''
| [[incumbent]] =
| #default = {{#if:{{{successor|}}}|{{{successor}}}|{{{succeeded|}}}}}
}}}}
<!--------Constituency/Majority--------->
| label34 = [[Parliamentary group]]
| data34 = {{{parliamentarygroup|}}}
| label35 = Constituency
| data35 = {{#if:{{{state_house|}}}||{{{constituency|}}}}}
| label36 = Majority
| data36 = {{{majority|}}}
}} }}<noinclude>{{documentation}}</noinclude>
ab8bb519ec87eb4f25661e4d9e114ae8d99ea500
Template:Both
10
146
284
283
2023-12-24T02:08:37Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Both]]
wikitext
text/x-wiki
{{SAFESUBST:<noinclude />#if:{{{1|}}}|{{SAFESUBST:<noinclude />#if:{{{2|}}}|1}}}}<noinclude>
{{documentation}}
</noinclude>
57c3c0ffa811a7f31c675b2d79aedf4382e9b88d
Template:Title disambig text
10
147
286
285
2023-12-24T02:08:37Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Title_disambig_text]]
wikitext
text/x-wiki
{{safesubst<noinclude/>:#invoke:String|match|{{{1|{{PAGENAME}}}}}|%s%((.-%)?)%)||-1|ignore_errors=true}}<noinclude>
{{Documentation}}
</noinclude>
09be4d07c948b00ed15066030e4a7029dd966c0a
Module:InfoboxImage
828
148
288
287
2023-12-24T02:08:40Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:InfoboxImage]]
Scribunto
text/plain
-- Inputs:
-- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link
-- page - page to display for multipage images (DjVu)
-- size - size to display the image
-- maxsize - maximum size for image
-- sizedefault - default size to display the image if size param is blank
-- alt - alt text for image
-- title - title text for image
-- border - set to yes if border
-- center - set to yes, if the image has to be centered
-- upright - upright image param
-- suppressplaceholder - if yes then checks to see if image is a placeholder and suppresses it
-- link - page to visit when clicking on image
-- class - HTML classes to add to the image
-- Outputs:
-- Formatted image.
-- More details available at the "Module:InfoboxImage/doc" page
local i = {};
local placeholder_image = {
"Blue - Replace this image female.svg",
"Blue - Replace this image male.svg",
"Female no free image yet.png",
"Flag of None (square).svg",
"Flag of None.svg",
"Flag of.svg",
"Green - Replace this image female.svg",
"Green - Replace this image male.svg",
"Image is needed female.svg",
"Image is needed male.svg",
"Location map of None.svg",
"Male no free image yet.png",
"Missing flag.png",
"No flag.svg",
"No free portrait.svg",
"No portrait (female).svg",
"No portrait (male).svg",
"Red - Replace this image female.svg",
"Red - Replace this image male.svg",
"Replace this image female (blue).svg",
"Replace this image female.svg",
"Replace this image male (blue).svg",
"Replace this image male.svg",
"Silver - Replace this image female.svg",
"Silver - Replace this image male.svg",
"Replace this image.svg",
"Cricket no pic.png",
"CarersLogo.gif",
"Diagram Needed.svg",
"Example.jpg",
"Image placeholder.png",
"No male portrait.svg",
"Nocover-upload.png",
"NoDVDcover copy.png",
"Noribbon.svg",
"No portrait-BFD-test.svg",
"Placeholder barnstar ribbon.png",
"Project Trains no image.png",
"Image-request.png",
"Sin bandera.svg",
"Sin escudo.svg",
"Replace this image - temple.png",
"Replace this image butterfly.png",
"Replace this image.svg",
"Replace this image1.svg",
"Resolution angle.png",
"Image-No portrait-text-BFD-test.svg",
"Insert image here.svg",
"No image available.png",
"NO IMAGE YET square.png",
"NO IMAGE YET.png",
"No Photo Available.svg",
"No Screenshot.svg",
"No-image-available.jpg",
"Null.png",
"PictureNeeded.gif",
"Place holder.jpg",
"Unbenannt.JPG",
"UploadACopyrightFreeImage.svg",
"UploadAnImage.gif",
"UploadAnImage.svg",
"UploadAnImageShort.svg",
"CarersLogo.gif",
"Diagram Needed.svg",
"No male portrait.svg",
"NoDVDcover copy.png",
"Placeholder barnstar ribbon.png",
"Project Trains no image.png",
"Image-request.png",
"Noimage.gif",
}
function i.IsPlaceholder(image)
-- change underscores to spaces
image = mw.ustring.gsub(image, "_", " ");
assert(image ~= nil, 'mw.ustring.gsub(image, "_", " ") must not return nil')
-- if image starts with [[ then remove that and anything after |
if mw.ustring.sub(image,1,2) == "[[" then
image = mw.ustring.sub(image,3);
image = mw.ustring.gsub(image, "([^|]*)|.*", "%1");
assert(image ~= nil, 'mw.ustring.gsub(image, "([^|]*)|.*", "%1") must not return nil')
end
-- Trim spaces
image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1');
assert(image ~= nil, "mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1') must not return nil")
-- remove prefix if exists
local allNames = mw.site.namespaces[6].aliases
allNames[#allNames + 1] = mw.site.namespaces[6].name
allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName
for i, name in ipairs(allNames) do
if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then
image = mw.ustring.sub(image, mw.ustring.len(name) + 2);
break
end
end
-- Trim spaces
image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1');
-- capitalise first letter
image = mw.ustring.upper(mw.ustring.sub(image,1,1)) .. mw.ustring.sub(image,2);
for i,j in pairs(placeholder_image) do
if image == j then
return true
end
end
return false
end
function i.InfoboxImage(frame)
local image = frame.args["image"];
if image == "" or image == nil then
return "";
end
if image == " " then
return image;
end
if frame.args["suppressplaceholder"] ~= "no" then
if i.IsPlaceholder(image) == true then
return "";
end
end
if mw.ustring.lower(mw.ustring.sub(image,1,5)) == "http:" then
return "";
end
if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "[http:" then
return "";
end
if mw.ustring.lower(mw.ustring.sub(image,1,7)) == "[[http:" then
return "";
end
if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "https:" then
return "";
end
if mw.ustring.lower(mw.ustring.sub(image,1,7)) == "[https:" then
return "";
end
if mw.ustring.lower(mw.ustring.sub(image,1,8)) == "[[https:" then
return "";
end
if mw.ustring.sub(image,1,2) == "[[" then
-- search for thumbnail images and add to tracking cat if found
local cat = "";
if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]")) then
cat = "[[Category:Pages using infoboxes with thumbnail images]]";
end
return image .. cat;
elseif mw.ustring.sub(image,1,2) == "{{" and mw.ustring.sub(image,1,3) ~= "{{{" then
return image;
elseif mw.ustring.sub(image,1,1) == "<" then
return image;
elseif mw.ustring.sub(image,1,8) == mw.ustring.char(127).."'\"`UNIQ" then
-- Found strip marker at begining, so pass don't process at all
return image;
else
local result = "";
local page = frame.args["page"];
local size = frame.args["size"];
local maxsize = frame.args["maxsize"];
local sizedefault = frame.args["sizedefault"];
local alt = frame.args["alt"];
local link = frame.args["link"];
local title = frame.args["title"];
local border = frame.args["border"];
local upright = frame.args["upright"] or "";
local thumbtime = frame.args["thumbtime"] or "";
local center = frame.args["center"];
local class = frame.args["class"];
-- remove prefix if exists
local allNames = mw.site.namespaces[6].aliases
allNames[#allNames + 1] = mw.site.namespaces[6].name
allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName
for i, name in ipairs(allNames) do
if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then
image = mw.ustring.sub(image, mw.ustring.len(name) + 2);
break
end
end
if maxsize ~= "" and maxsize ~= nil then
-- if no sizedefault then set to maxsize
if sizedefault == "" or sizedefault == nil then
sizedefault = maxsize
end
-- check to see if size bigger than maxsize
if size ~= "" and size ~= nil then
local sizenumber = tonumber(mw.ustring.match(size,"%d*")) or 0;
local maxsizenumber = tonumber(mw.ustring.match(maxsize,"%d*")) or 0;
if sizenumber>maxsizenumber and maxsizenumber>0 then
size = maxsize;
end
end
end
-- add px to size if just a number
if (tonumber(size) or 0) > 0 then
size = size .. "px";
end
-- add px to sizedefault if just a number
if (tonumber(sizedefault) or 0) > 0 then
sizedefault = sizedefault .. "px";
end
result = "[[File:" .. image;
if page ~= "" and page ~= nil then
result = result .. "|page=" .. page;
end
if size ~= "" and size ~= nil then
result = result .. "|" .. size;
elseif sizedefault ~= "" and sizedefault ~= nil then
result = result .. "|" .. sizedefault;
else
result = result .. "|frameless";
end
if center == "yes" then
result = result .. "|center"
end
if alt ~= "" and alt ~= nil then
result = result .. "|alt=" .. alt;
end
if link ~= "" and link ~= nil then
result = result .. "|link=" .. link;
end
if border == "yes" then
result = result .. "|border";
end
if upright == "yes" then
result = result .. "|upright";
elseif upright ~= "" then
result = result .. "|upright=" .. upright;
end
if thumbtime ~= "" then
result = result .. "|thumbtime=" .. thumbtime;
end
if class ~= nil and class ~= "" then
result = result .. "|class=" .. class;
end
-- if alt value is a keyword then do not use as a description
if alt == "thumbnail" or alt == "thumb" or alt == "frameless" or alt == "left" or alt == "center" or alt == "right" or alt == "upright" or alt == "border" or mw.ustring.match(alt or "", '^[0-9]*px$', 1) ~= nil then
alt = nil;
end
if title ~= "" and title ~= nil then
-- does title param contain any templatestyles? If yes then set to blank.
if mw.ustring.match(frame:preprocess(title), 'UNIQ%-%-templatestyles', 1) ~= nil then
title = nil;
end
end
if title ~= "" and title ~= nil then
result = result .. "|" .. title;
end
result = result .. "]]";
return result;
end
end
return i;
35066ee19938554ca6eeb18d6e22d2063336b7e1
Module:Separated entries
828
149
290
289
2023-12-24T02:08:41Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Separated_entries]]
Scribunto
text/plain
-- This module takes positional parameters as input and concatenates them with
-- an optional separator. The final separator (the "conjunction") can be
-- specified independently, enabling natural-language lists like
-- "foo, bar, baz and qux". The starting parameter can also be specified.
local compressSparseArray = require('Module:TableTools').compressSparseArray
local p = {}
function p._main(args)
local separator = args.separator
-- Decode (convert to Unicode) HTML escape sequences, such as " " for space.
and mw.text.decode(args.separator) or ''
local conjunction = args.conjunction and mw.text.decode(args.conjunction) or separator
-- Discard values before the starting parameter.
local start = tonumber(args.start)
if start then
for i = 1, start - 1 do args[i] = nil end
end
-- Discard named parameters.
local values = compressSparseArray(args)
return mw.text.listToText(values, separator, conjunction)
end
local function makeInvokeFunction(separator, conjunction, first)
return function (frame)
local args = require('Module:Arguments').getArgs(frame)
args.separator = separator or args.separator
args.conjunction = conjunction or args.conjunction
args.first = first or args.first
return p._main(args)
end
end
p.main = makeInvokeFunction()
p.br = makeInvokeFunction('<br />')
p.comma = makeInvokeFunction(mw.message.new('comma-separator'):plain())
return p
e80231ff3de01afd7f62a94e0a34dc1e67504085
Template:En dash range
10
150
292
291
2023-12-24T02:08:42Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:En_dash_range]]
wikitext
text/x-wiki
{{{1}}}{{#ifeq:{{#invoke:String|find|source={{#invoke:Plain text|main|{{{1}}}{{{2}}}}}|target=[%s–—-]|plain=false}}|0|–| – }}{{{2}}}<noinclude>
{{Documentation}}
</noinclude>
4f0bde90a2efc3a10317f528ce19b0e0fd212808
Module:Plain text
828
151
294
293
2023-12-24T02:08:43Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Plain_text]]
Scribunto
text/plain
--converts text with wikilinks to plain text, e.g "[[foo|gah]] is [[bar]]" to "gah is bar"
--removes anything enclosed in tags that isn't nested, mediawiki strip markers (references etc), files, italic and bold markup
require[[strict]]
local p = {}
function p.main(frame)
local text = frame.args[1]
local encode = require('Module:yesno')(frame.args.encode)
return p._main(text, encode)
end
function p._main(text, encode)
if not text then return end
text = mw.text.killMarkers(text)
:gsub(' ', ' ') --replace nbsp spaces with regular spaces
:gsub('<br ?/?>', ', ') --replace br with commas
:gsub('<span.->(.-)</span>', '%1') --remove spans while keeping text inside
:gsub('<i.->(.-)</i>', '%1') --remove italics while keeping text inside
:gsub('<b.->(.-)</b>', '%1') --remove bold while keeping text inside
:gsub('<em.->(.-)</em>', '%1') --remove emphasis while keeping text inside
:gsub('<strong.->(.-)</strong>', '%1') --remove strong while keeping text inside
:gsub('<sub.->(.-)</sub>', '%1') --remove subscript markup; retain contents
:gsub('<sup.->(.-)</sup>', '%1') --remove superscript markup; retain contents
:gsub('<u.->(.-)</u>', '%1') --remove underline markup; retain contents
:gsub('<.->.-<.->', '') --strip out remaining tags and the text inside
:gsub('<.->', '') --remove any other tag markup
:gsub('%[%[%s*[Ff][Ii][Ll][Ee]%s*:.-%]%]', '') --strip out files
:gsub('%[%[%s*[Ii][Mm][Aa][Gg][Ee]%s*:.-%]%]', '') --strip out use of image:
:gsub('%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:.-%]%]', '') --strip out categories
:gsub('%[%[[^%]]-|', '') --strip out piped link text
:gsub('([^%[])%[[^%[%]][^%]]-%s', '%1') --strip out external link text
:gsub('^%[[^%[%]][^%]]-%s', '') --strip out external link text
:gsub('[%[%]]', '') --then strip out remaining [ and ]
:gsub("'''''", "") --strip out bold italic markup
:gsub("'''?", "") --not stripping out '''' gives correct output for bolded text in quotes
:gsub('----+', '') --remove ---- lines
:gsub("^%s+", "") --strip leading
:gsub("%s+$", "") --and trailing spaces
:gsub("%s+", " ") --strip redundant spaces
if encode then
return mw.text.encode(text)
else
return text
end
end
return p
8d406c43e8cf1dadf34be7d3b395f44ba4c48b75
Template:PAGENAMEBASE
10
152
296
295
2023-12-24T02:08:44Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:PAGENAMEBASE]]
wikitext
text/x-wiki
{{{{{|safesubst:}}}#Invoke:String|replace|{{{1|{{{{{|safesubst:}}}PAGENAME}}}}}|%s+%b()$||1|false}}<noinclude>
{{documentation}}
</noinclude>
f23a5d434cb5b0baac5e1f58e9ceef9118e6873f
Template:Ombox
10
153
298
297
2023-12-24T02:08:49Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Ombox]]
wikitext
text/x-wiki
{{#invoke:Message box|ombox}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
0e54065432d540737b9e56c4e3a8e7f74d4534ea
Template:For
10
154
300
299
2023-12-24T02:08:49Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:For]]
wikitext
text/x-wiki
<includeonly>{{#invoke:For|For}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
3f70c0fa7cd736071e7c6e7dcd90ff3704df26bb
Module:Detect singular
828
155
302
301
2023-12-24T02:08:50Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Detect_singular]]
Scribunto
text/plain
local p = {}
local getArgs = require('Module:Arguments').getArgs
local yesNo = require('Module:Yesno')
local getPlain = require('Module:Text').Text().getPlain
-- function to determine whether "sub" occurs in "s"
local function plainFind(s, sub)
return mw.ustring.find(s, sub, 1, true)
end
-- function to count the number of times "pattern" (a regex) occurs in "s"
local function countMatches(s, pattern)
local _, count = mw.ustring.gsub(s, pattern, '')
return count
end
local singular = 1
local likelyPlural = 2
local plural = 3
-- Determine whether a string is singular or plural (i.e., it represents one
-- item or many)
-- Arguments:
-- origArgs[1]: string to process
-- origArgs.no_comma: if false, use commas to detect plural (default false)
-- origArgs.parse_links: if false, treat wikilinks as opaque singular objects (default false)
-- Returns:
-- singular, likelyPlural, or plural (see constants above), or nil for completely unknown
function p._main(origArgs)
origArgs = type(origArgs) == 'table' and origArgs or {}
local args = {}
-- canonicalize boolean arguments
for key, default in pairs({no_comma=false,parse_links=false,any_comma=false,no_and=false}) do
if origArgs[key] == nil then
args[key] = default
else
args[key] = yesNo(origArgs[key],default)
end
end
local checkComma = not args.no_comma
local checkAnd = not args.no_and
local rewriteLinks = not args.parse_links
local anyComma = args.any_comma
local s = origArgs[1] -- the input string
if not s then
return nil -- empty input returns nil
end
s = tostring(s)
s = mw.text.decode(s,true) --- replace HTML entities (to avoid spurious semicolons)
if plainFind(s,'data-plural="0"') then -- magic data string to return true
return singular
end
if plainFind(s,'data-plural="1"') then -- magic data string to return false
return plural
end
-- count number of list items
local numListItems = countMatches(s,'<%s*li')
-- if exactly one, then singular, if more than one, then plural
if numListItems == 1 then
return singular
end
if numListItems > 1 then
return plural
end
-- if "list of" occurs inside of wlink, then it's plural
if mw.ustring.find(s:lower(), '%[%[[^%]]*list of[^%]]+%]%]') then
return plural
end
-- fix for trailing br tags passed through [[template:marriage]]
s = mw.ustring.gsub(s, '<%s*br[^>]*>%s*(</div>)', '%1')
-- replace all wikilinks with fixed string
if rewriteLinks then
s = mw.ustring.gsub(s,'%b[]','WIKILINK')
end
-- Five conditions: any one of them can make the string a likely plural or plural
local hasBreak = mw.ustring.find(s,'<%s*br')
-- For the last 4, evaluate on string stripped of wikimarkup
s = getPlain(s)
local hasBullets = countMatches(s,'%*+') > 1
local multipleQids = mw.ustring.find(s,'Q%d+[%p%s]+Q%d+') -- has multiple QIDs in a row
if hasBullets or multipleQids then
return plural
end
local commaPattern = anyComma and '[,;]' or '%D[,;]%D' -- semi-colon similar to comma
local hasComma = checkComma and mw.ustring.find(s, commaPattern)
local hasAnd = checkAnd and mw.ustring.find(s,'[,%s]and%s')
if hasBreak or hasComma or hasAnd then
return likelyPlural
end
return singular
end
function p._pluralize(args)
args = type(args) == 'table' and args or {}
local singularForm = args[3] or args.singular or ""
local pluralForm = args[4] or args.plural or ""
local likelyForm = args.likely or pluralForm
local link = args[5] or args.link
if link then
link = tostring(link)
singularForm = '[['..link..'|'..singularForm..']]'
pluralForm = '[['..link..'|'..pluralForm..']]'
likelyForm = '[['..link..'|'..likelyForm..']]'
end
if args[2] then
return pluralForm
end
local detect = p._main(args)
if detect == nil then
return "" -- return blank on complete failure
end
if detect == singular then
return singularForm
elseif detect == likelyPlural then
return likelyForm
else
return pluralForm
end
end
function p.main(frame)
local args = getArgs(frame)
-- For template, return 1 if singular, blank if plural or empty
local result = p._main(args)
if result == nil then
return 1
end
return result == singular and 1 or ""
end
function p.pluralize(frame)
local args = getArgs(frame)
return p._pluralize(args)
end
return p
6afb2e8c0bd8ddff094e2861b836521ee4a5a779
Module:For
828
156
304
303
2023-12-24T02:08:50Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:For]]
Scribunto
text/plain
local mArguments --initialize lazily
local mHatlist = require('Module:Hatnote list')
local mHatnote = require('Module:Hatnote')
local yesNo = require('Module:Yesno')
local p = {}
--Implements {{For}} from the frame
--uses capitalized "For" to avoid collision with Lua reserved word "for"
function p.For (frame)
mArguments = require('Module:Arguments')
return p._For(mArguments.getArgs(frame))
end
--Implements {{For}} but takes a manual arguments table
function p._For (args)
local use = args[1]
if (not use) then
return mHatnote.makeWikitextError(
'no context parameter provided. Use {{other uses}} for "other uses" hatnotes.',
'Template:For#Errors',
args.category
)
end
local pages = {}
function two (a, b) return a, b, 1 end --lets us run ipairs from 2
for k, v in two(ipairs(args)) do table.insert(pages, v) end
local title = mw.title.getCurrentTitle()
local skipCat = title.isTalkPage or title.namespace == 2 --don't categorise talk pages and userspace
local oddCat = skipCat and '' or '[[Category:Hatnote templates using unusual parameters]]'
local category = yesNo(args.category)
return mHatnote._hatnote(
mHatlist.forSeeTableToString({{use = use, pages = pages}}),
{selfref = args.selfref}
) .. (
(use == 'other uses') and ((category == true) or (category == nil)) and
oddCat or ''
)
end
return p
2faf1bd8c657f3425af829cbde9733a936d8d4f4
Module:Text
828
157
306
305
2023-12-24T02:08:51Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Text]]
Scribunto
text/plain
local yesNo = require("Module:Yesno")
local Text = { serial = "2022-07-21",
suite = "Text" }
--[=[
Text utilities
]=]
-- local globals
local PatternCJK = false
local PatternCombined = false
local PatternLatin = false
local PatternTerminated = false
local QuoteLang = false
local QuoteType = false
local RangesLatin = false
local SeekQuote = false
local function initLatinData()
if not RangesLatin then
RangesLatin = { { 7, 687 },
{ 7531, 7578 },
{ 7680, 7935 },
{ 8194, 8250 } }
end
if not PatternLatin then
local range
PatternLatin = "^["
for i = 1, #RangesLatin do
range = RangesLatin[ i ]
PatternLatin = PatternLatin ..
mw.ustring.char( range[ 1 ], 45, range[ 2 ] )
end -- for i
PatternLatin = PatternLatin .. "]*$"
end
end
local function initQuoteData()
-- Create quote definitions
if not QuoteLang then
QuoteLang =
{ af = "bd",
ar = "la",
be = "labd",
bg = "bd",
ca = "la",
cs = "bd",
da = "bd",
de = "bd",
dsb = "bd",
et = "bd",
el = "lald",
en = "ld",
es = "la",
eu = "la",
-- fa = "la",
fi = "rd",
fr = "laSPC",
ga = "ld",
he = "ldla",
hr = "bd",
hsb = "bd",
hu = "bd",
hy = "labd",
id = "rd",
is = "bd",
it = "ld",
ja = "x300C",
ka = "bd",
ko = "ld",
lt = "bd",
lv = "bd",
nl = "ld",
nn = "la",
no = "la",
pl = "bdla",
pt = "lald",
ro = "bdla",
ru = "labd",
sk = "bd",
sl = "bd",
sq = "la",
sr = "bx",
sv = "rd",
th = "ld",
tr = "ld",
uk = "la",
zh = "ld",
["de-ch"] = "la",
["en-gb"] = "lsld",
["en-us"] = "ld",
["fr-ch"] = "la",
["it-ch"] = "la",
["pt-br"] = "ldla",
["zh-tw"] = "x300C",
["zh-cn"] = "ld" }
end
if not QuoteType then
QuoteType =
{ bd = { { 8222, 8220 }, { 8218, 8217 } },
bdla = { { 8222, 8220 }, { 171, 187 } },
bx = { { 8222, 8221 }, { 8218, 8217 } },
la = { { 171, 187 }, { 8249, 8250 } },
laSPC = { { 171, 187 }, { 8249, 8250 }, true },
labd = { { 171, 187 }, { 8222, 8220 } },
lald = { { 171, 187 }, { 8220, 8221 } },
ld = { { 8220, 8221 }, { 8216, 8217 } },
ldla = { { 8220, 8221 }, { 171, 187 } },
lsld = { { 8216, 8217 }, { 8220, 8221 } },
rd = { { 8221, 8221 }, { 8217, 8217 } },
x300C = { { 0x300C, 0x300D },
{ 0x300E, 0x300F } } }
end
end -- initQuoteData()
local function fiatQuote( apply, alien, advance )
-- Quote text
-- Parameter:
-- apply -- string, with text
-- alien -- string, with language code
-- advance -- number, with level 1 or 2
local r = apply and tostring(apply) or ""
alien = alien or "en"
advance = tonumber(advance) or 0
local suite
initQuoteData()
local slang = alien:match( "^(%l+)-" )
suite = QuoteLang[alien] or slang and QuoteLang[slang] or QuoteLang["en"]
if suite then
local quotes = QuoteType[ suite ]
if quotes then
local space
if quotes[ 3 ] then
space = " "
else
space = ""
end
quotes = quotes[ advance ]
if quotes then
r = mw.ustring.format( "%s%s%s%s%s",
mw.ustring.char( quotes[ 1 ] ),
space,
apply,
space,
mw.ustring.char( quotes[ 2 ] ) )
end
else
mw.log( "fiatQuote() " .. suite )
end
end
return r
end -- fiatQuote()
Text.char = function ( apply, again, accept )
-- Create string from codepoints
-- Parameter:
-- apply -- table (sequence) with numerical codepoints, or nil
-- again -- number of repetitions, or nil
-- accept -- true, if no error messages to be appended
-- Returns: string
local r = ""
apply = type(apply) == "table" and apply or {}
again = math.floor(tonumber(again) or 1)
if again < 1 then
return ""
end
local bad = { }
local codes = { }
for _, v in ipairs( apply ) do
local n = tonumber(v)
if not n or (n < 32 and n ~= 9 and n ~= 10) then
table.insert(bad, tostring(v))
else
table.insert(codes, math.floor(n))
end
end
if #bad > 0 then
if not accept then
r = tostring( mw.html.create( "span" )
:addClass( "error" )
:wikitext( "bad codepoints: " .. table.concat( bad, " " )) )
end
return r
end
if #codes > 0 then
r = mw.ustring.char( unpack( codes ) )
if again > 1 then
r = r:rep(again)
end
end
return r
end -- Text.char()
local function trimAndFormat(args, fmt)
local result = {}
if type(args) ~= 'table' then
args = {args}
end
for _, v in ipairs(args) do
v = mw.text.trim(tostring(v))
if v ~= "" then
table.insert(result,fmt and mw.ustring.format(fmt, v) or v)
end
end
return result
end
Text.concatParams = function ( args, apply, adapt )
-- Concat list items into one string
-- Parameter:
-- args -- table (sequence) with numKey=string
-- apply -- string (optional); separator (default: "|")
-- adapt -- string (optional); format including "%s"
-- Returns: string
local collect = { }
return table.concat(trimAndFormat(args,adapt), apply or "|")
end -- Text.concatParams()
Text.containsCJK = function ( s )
-- Is any CJK code within?
-- Parameter:
-- s -- string
-- Returns: true, if CJK detected
s = s and tostring(s) or ""
if not patternCJK then
patternCJK = mw.ustring.char( 91,
4352, 45, 4607,
11904, 45, 42191,
43072, 45, 43135,
44032, 45, 55215,
63744, 45, 64255,
65072, 45, 65103,
65381, 45, 65500,
131072, 45, 196607,
93 )
end
return mw.ustring.find( s, patternCJK ) ~= nil
end -- Text.containsCJK()
Text.removeDelimited = function (s, prefix, suffix)
-- Remove all text in s delimited by prefix and suffix (inclusive)
-- Arguments:
-- s = string to process
-- prefix = initial delimiter
-- suffix = ending delimiter
-- Returns: stripped string
s = s and tostring(s) or ""
prefix = prefix and tostring(prefix) or ""
suffix = suffix and tostring(suffix) or ""
local prefixLen = mw.ustring.len(prefix)
local suffixLen = mw.ustring.len(suffix)
if prefixLen == 0 or suffixLen == 0 then
return s
end
local i = s:find(prefix, 1, true)
local r = s
local j
while i do
j = r:find(suffix, i + prefixLen)
if j then
r = r:sub(1, i - 1)..r:sub(j+suffixLen)
else
r = r:sub(1, i - 1)
end
i = r:find(prefix, 1, true)
end
return r
end
Text.getPlain = function ( adjust )
-- Remove wikisyntax from string, except templates
-- Parameter:
-- adjust -- string
-- Returns: string
local r = Text.removeDelimited(adjust,"<!--","-->")
r = r:gsub( "(</?%l[^>]*>)", "" )
:gsub( "'''", "" )
:gsub( "''", "" )
:gsub( " ", " " )
return r
end -- Text.getPlain()
Text.isLatinRange = function (s)
-- Are characters expected to be latin or symbols within latin texts?
-- Arguments:
-- s = string to analyze
-- Returns: true, if valid for latin only
s = s and tostring(s) or "" --- ensure input is always string
initLatinData()
return mw.ustring.match(s, PatternLatin) ~= nil
end -- Text.isLatinRange()
Text.isQuote = function ( s )
-- Is this character any quotation mark?
-- Parameter:
-- s = single character to analyze
-- Returns: true, if s is quotation mark
s = s and tostring(s) or ""
if s == "" then
return false
end
if not SeekQuote then
SeekQuote = mw.ustring.char( 34, -- "
39, -- '
171, -- laquo
187, -- raquo
8216, -- lsquo
8217, -- rsquo
8218, -- sbquo
8220, -- ldquo
8221, -- rdquo
8222, -- bdquo
8249, -- lsaquo
8250, -- rsaquo
0x300C, -- CJK
0x300D, -- CJK
0x300E, -- CJK
0x300F ) -- CJK
end
return mw.ustring.find( SeekQuote, s, 1, true ) ~= nil
end -- Text.isQuote()
Text.listToText = function ( args, adapt )
-- Format list items similar to mw.text.listToText()
-- Parameter:
-- args -- table (sequence) with numKey=string
-- adapt -- string (optional); format including "%s"
-- Returns: string
return mw.text.listToText(trimAndFormat(args, adapt))
end -- Text.listToText()
Text.quote = function ( apply, alien, advance )
-- Quote text
-- Parameter:
-- apply -- string, with text
-- alien -- string, with language code, or nil
-- advance -- number, with level 1 or 2, or nil
-- Returns: quoted string
apply = apply and tostring(apply) or ""
local mode, slang
if type( alien ) == "string" then
slang = mw.text.trim( alien ):lower()
else
slang = mw.title.getCurrentTitle().pageLanguage
if not slang then
-- TODO FIXME: Introduction expected 2017-04
slang = mw.language.getContentLanguage():getCode()
end
end
if advance == 2 then
mode = 2
else
mode = 1
end
return fiatQuote( mw.text.trim( apply ), slang, mode )
end -- Text.quote()
Text.quoteUnquoted = function ( apply, alien, advance )
-- Quote text, if not yet quoted and not empty
-- Parameter:
-- apply -- string, with text
-- alien -- string, with language code, or nil
-- advance -- number, with level 1 or 2, or nil
-- Returns: string; possibly quoted
local r = mw.text.trim( apply and tostring(apply) or "" )
local s = mw.ustring.sub( r, 1, 1 )
if s ~= "" and not Text.isQuote( s, advance ) then
s = mw.ustring.sub( r, -1, 1 )
if not Text.isQuote( s ) then
r = Text.quote( r, alien, advance )
end
end
return r
end -- Text.quoteUnquoted()
Text.removeDiacritics = function ( adjust )
-- Remove all diacritics
-- Parameter:
-- adjust -- string
-- Returns: string; all latin letters should be ASCII
-- or basic greek or cyrillic or symbols etc.
local cleanup, decomposed
if not PatternCombined then
PatternCombined = mw.ustring.char( 91,
0x0300, 45, 0x036F,
0x1AB0, 45, 0x1AFF,
0x1DC0, 45, 0x1DFF,
0xFE20, 45, 0xFE2F,
93 )
end
decomposed = mw.ustring.toNFD( adjust and tostring(adjust) or "" )
cleanup = mw.ustring.gsub( decomposed, PatternCombined, "" )
return mw.ustring.toNFC( cleanup )
end -- Text.removeDiacritics()
Text.sentenceTerminated = function ( analyse )
-- Is string terminated by dot, question or exclamation mark?
-- Quotation, link termination and so on granted
-- Parameter:
-- analyse -- string
-- Returns: true, if sentence terminated
local r
if not PatternTerminated then
PatternTerminated = mw.ustring.char( 91,
12290,
65281,
65294,
65311 )
.. "!%.%?…][\"'%]‹›«»‘’“”]*$"
end
if mw.ustring.find( analyse, PatternTerminated ) then
r = true
else
r = false
end
return r
end -- Text.sentenceTerminated()
Text.ucfirstAll = function ( adjust)
-- Capitalize all words
-- Arguments:
-- adjust = string to adjust
-- Returns: string with all first letters in upper case
adjust = adjust and tostring(adjust) or ""
local r = mw.text.decode(adjust,true)
local i = 1
local c, j, m
m = (r ~= adjust)
r = " "..r
while i do
i = mw.ustring.find( r, "%W%l", i )
if i then
j = i + 1
c = mw.ustring.upper( mw.ustring.sub( r, j, j ) )
r = string.format( "%s%s%s",
mw.ustring.sub( r, 1, i ),
c,
mw.ustring.sub( r, i + 2 ) )
i = j
end
end -- while i
r = r:sub( 2 )
if m then
r = mw.text.encode(r)
end
return r
end -- Text.ucfirstAll()
Text.uprightNonlatin = function ( adjust )
-- Ensure non-italics for non-latin text parts
-- One single greek letter might be granted
-- Precondition:
-- adjust -- string
-- Returns: string with non-latin parts enclosed in <span>
local r
initLatinData()
if mw.ustring.match( adjust, PatternLatin ) then
-- latin only, horizontal dashes, quotes
r = adjust
else
local c
local j = false
local k = 1
local m = false
local n = mw.ustring.len( adjust )
local span = "%s%s<span dir='auto' style='font-style:normal'>%s</span>"
local flat = function ( a )
-- isLatin
local range
for i = 1, #RangesLatin do
range = RangesLatin[ i ]
if a >= range[ 1 ] and a <= range[ 2 ] then
return true
end
end -- for i
end -- flat()
local focus = function ( a )
-- char is not ambivalent
local r = ( a > 64 )
if r then
r = ( a < 8192 or a > 8212 )
else
r = ( a == 38 or a == 60 ) -- '&' '<'
end
return r
end -- focus()
local form = function ( a )
return string.format( span,
r,
mw.ustring.sub( adjust, k, j - 1 ),
mw.ustring.sub( adjust, j, a ) )
end -- form()
r = ""
for i = 1, n do
c = mw.ustring.codepoint( adjust, i, i )
if focus( c ) then
if flat( c ) then
if j then
if m then
if i == m then
-- single greek letter.
j = false
end
m = false
end
if j then
local nx = i - 1
local s = ""
for ix = nx, 1, -1 do
c = mw.ustring.sub( adjust, ix, ix )
if c == " " or c == "(" then
nx = nx - 1
s = c .. s
else
break -- for ix
end
end -- for ix
r = form( nx ) .. s
j = false
k = i
end
end
elseif not j then
j = i
if c >= 880 and c <= 1023 then
-- single greek letter?
m = i + 1
else
m = false
end
end
elseif m then
m = m + 1
end
end -- for i
if j and ( not m or m < n ) then
r = form( n )
else
r = r .. mw.ustring.sub( adjust, k )
end
end
return r
end -- Text.uprightNonlatin()
Text.test = function ( about )
local r
if about == "quote" then
initQuoteData()
r = { }
r.QuoteLang = QuoteLang
r.QuoteType = QuoteType
end
return r
end -- Text.test()
-- Export
local p = { }
for _, func in ipairs({'containsCJK','isLatinRange','isQuote','sentenceTerminated'}) do
p[func] = function (frame)
return Text[func]( frame.args[ 1 ] or "" ) and "1" or ""
end
end
for _, func in ipairs({'getPlain','removeDiacritics','ucfirstAll','uprightNonlatin'}) do
p[func] = function (frame)
return Text[func]( frame.args[ 1 ] or "" )
end
end
function p.char( frame )
local params = frame:getParent().args
local story = params[ 1 ]
local codes, lenient, multiple
if not story then
params = frame.args
story = params[ 1 ]
end
if story then
local items = mw.text.split( mw.text.trim(story), "%s+" )
if #items > 0 then
local j
lenient = (yesNo(params.errors) == false)
codes = { }
multiple = tonumber( params[ "*" ] )
for _, v in ipairs( items ) do
j = tonumber((v:sub( 1, 1 ) == "x" and "0" or "") .. v)
table.insert( codes, j or v )
end
end
end
return Text.char( codes, multiple, lenient )
end
function p.concatParams( frame )
local args
local template = frame.args.template
if type( template ) == "string" then
template = mw.text.trim( template )
template = ( template == "1" )
end
if template then
args = frame:getParent().args
else
args = frame.args
end
return Text.concatParams( args,
frame.args.separator,
frame.args.format )
end
function p.listToFormat(frame)
local lists = {}
local pformat = frame.args["format"]
local sep = frame.args["sep"] or ";"
-- Parameter parsen: Listen
for k, v in pairs(frame.args) do
local knum = tonumber(k)
if knum then lists[knum] = v end
end
-- Listen splitten
local maxListLen = 0
for i = 1, #lists do
lists[i] = mw.text.split(lists[i], sep)
if #lists[i] > maxListLen then maxListLen = #lists[i] end
end
-- Ergebnisstring generieren
local result = ""
local result_line = ""
for i = 1, maxListLen do
result_line = pformat
for j = 1, #lists do
result_line = mw.ustring.gsub(result_line, "%%s", lists[j][i], 1)
end
result = result .. result_line
end
return result
end
function p.listToText( frame )
local args
local template = frame.args.template
if type( template ) == "string" then
template = mw.text.trim( template )
template = ( template == "1" )
end
if template then
args = frame:getParent().args
else
args = frame.args
end
return Text.listToText( args, frame.args.format )
end
function p.quote( frame )
local slang = frame.args[2]
if type( slang ) == "string" then
slang = mw.text.trim( slang )
if slang == "" then
slang = false
end
end
return Text.quote( frame.args[ 1 ] or "",
slang,
tonumber( frame.args[3] ) )
end
function p.quoteUnquoted( frame )
local slang = frame.args[2]
if type( slang ) == "string" then
slang = mw.text.trim( slang )
if slang == "" then
slang = false
end
end
return Text.quoteUnquoted( frame.args[ 1 ] or "",
slang,
tonumber( frame.args[3] ) )
end
function p.zip(frame)
local lists = {}
local seps = {}
local defaultsep = frame.args["sep"] or ""
local innersep = frame.args["isep"] or ""
local outersep = frame.args["osep"] or ""
-- Parameter parsen
for k, v in pairs(frame.args) do
local knum = tonumber(k)
if knum then lists[knum] = v else
if string.sub(k, 1, 3) == "sep" then
local sepnum = tonumber(string.sub(k, 4))
if sepnum then seps[sepnum] = v end
end
end
end
-- sofern keine expliziten Separatoren angegeben sind, den Standardseparator verwenden
for i = 1, math.max(#seps, #lists) do
if not seps[i] then seps[i] = defaultsep end
end
-- Listen splitten
local maxListLen = 0
for i = 1, #lists do
lists[i] = mw.text.split(lists[i], seps[i])
if #lists[i] > maxListLen then maxListLen = #lists[i] end
end
local result = ""
for i = 1, maxListLen do
if i ~= 1 then result = result .. outersep end
for j = 1, #lists do
if j ~= 1 then result = result .. innersep end
result = result .. (lists[j][i] or "")
end
end
return result
end
function p.failsafe()
return Text.serial
end
p.Text = function ()
return Text
end -- p.Text
return p
07f1fc4d39342fd92bdae1c5463bbfede7eeda1a
Template:Infobox person/height
10
158
308
307
2023-12-24T02:08:51Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Infobox_person/height]]
wikitext
text/x-wiki
{{#invoke:person height|main}}<noinclude>
{{Documentation}}
</noinclude>
7e4749e2788885b5a8760fedb7cc278e9a60a85a
Module:Person height
828
159
310
309
2023-12-24T02:08:52Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Person_height]]
Scribunto
text/plain
-- This module implements [[Template:Infobox person/height]]
local p = {}
local function splitsuffix(s)
local suffix = ''
if mw.ustring.match(s,'^(.-)(<sup.*)$') then
local a = mw.ustring.gsub(s, '^(.-)(<sup.*)$', '%1')
local b = mw.ustring.gsub(s, '^(.-)(<sup.*)$', '%2')
s = a
suffix = b .. suffix
end
if mw.ustring.match(s,'^(.-)(%[%[[Cc]ategory:.*)$') then
local a = mw.ustring.gsub(s, '^(.-)(%[%[[Cc]ategory:.*)$', '%1')
local b = mw.ustring.gsub(s, '^(.-)(%[%[[Cc]ategory:.*)$', '%2')
s = a
suffix = b .. suffix
end
return s, suffix
end
local function clean(s)
s = mw.ustring.gsub(s, '[Mm]etre', 'm')
s = mw.ustring.gsub(s, '([^a])meter', '%1m') -- prevents "parameter" from being changed to "param"
s = mw.ustring.gsub(s, '[Cc]enti', 'c') -- changes "centim" to "cm"
s = mw.ustring.gsub(s, 'ms', 'm')
s = mw.ustring.gsub(s, 'm[%.,]', 'm')
s = mw.ustring.gsub(s, '[Ff]eet', 'ft')
s = mw.ustring.gsub(s, 'foot', 'ft')
s = mw.ustring.gsub(s, 'ft[%.,]', 'ft')
s = mw.ustring.gsub(s, '[Ii]nches', 'in')
s = mw.ustring.gsub(s, '[Ii]nch', 'in')
s = mw.ustring.gsub(s, 'ins', 'in')
s = mw.ustring.gsub(s, 'in[%.,]', 'in')
s = mw.ustring.gsub(s, '%[%[[Mm]%]%]s', '[[Metre|m]]')
s = mw.ustring.gsub(s, '%[%[[Mm]|[Mm]%]%]', '[[Metre|m]]')
s = mw.ustring.gsub(s, '%[%[[Cc]m%]%]s', '[[Centimetre|cm]]')
s = mw.ustring.gsub(s, '%[%[[Cc]m|[Cc]m%]%]', '[[Centimetre|cm]]')
s = mw.ustring.gsub(s, '%[%[[Cc]entim|cm%]%]', '[[Centimetre|cm]]')
s = mw.ustring.gsub(s, '%[%[[Ii]n|in%]%]', '[[inch|in]]')
s = mw.ustring.gsub(s, '(%d)%s+[Cc][Mm]', '%1 cm')
s = mw.ustring.gsub(s, '(%d)%s+[Mm]', '%1 m')
s = mw.ustring.gsub(s, '(%d)%s+[Ff][Tt]', '%1 ft')
s = mw.ustring.gsub(s, '(%d)%s+[Ii][Nn]', '%1 in')
s = mw.ustring.gsub(s, '(%d&[Nn][Bb][Ss][Pp];)[Cc][Mm]', '%1cm')
s = mw.ustring.gsub(s, '(%d&[Nn][Bb][Ss][Pp];)[Mm]', '%1m')
s = mw.ustring.gsub(s, '(%d&[Nn][Bb][Ss][Pp];)[Ff][Tt]', '%1ft')
s = mw.ustring.gsub(s, '(%d&[Nn][Bb][Ss][Pp];)[Ii][Nn]', '%1in')
s = mw.ustring.gsub(s, '(%d)%s*[′\']%s*([%d]%d*)%s*[\"″]', '%1 ft %2 in')
return s
end
local function isnumber(s)
if s then
s = mw.ustring.gsub(s, '%+%s*%d+%s*/%s*%d+%s*$', '')
s = mw.ustring.gsub(s, '%s*1%s*/%s*2%s*$', '0.5')
return tonumber(s)
end
return nil
end
local function trimspace(s)
if s then
s = mw.ustring.gsub(s, '^%s*(.-)%s*$', '%1')
end
return s
end
local function force_unit(s, t)
s = mw.ustring.gsub(s, '&[Nn][Bb][Ss][Pp];', '★')
if (t == 'cm') then
s = mw.ustring.gsub(s, '(%d*)%.(%d%d)(%d+[★%s]+)m', '%1%2.%3cm')
s = mw.ustring.gsub(s, '(%d*)%.(%d%d)(%d+[★%s]+)%[%[[Mm]et[re][re]|m%]%]', '%1%2.%3[[centimetre|cm]]')
s = mw.ustring.gsub(s, '(%d*)%.(%d%d)([★%s]+)m', '%1%2%3cm')
s = mw.ustring.gsub(s, '(%d*)%.(%d%d)([★%s]+)%[%[[Mm]et[re][re]|m%]%]', '%1%2%3[[centimetre|cm]]')
s = mw.ustring.gsub(s, '(%d*)%.(%d)([★%s]+)m', '%1%20%3cm')
s = mw.ustring.gsub(s, '(%d*)%.(%d)([★%s]+)%[%[[Mm]et[re][re]|m%]%]', '%1%20%3[[centimetre|cm]]')
s = mw.ustring.gsub(s, '(%d*)%.([★%s]+)m', '%100.%2cm')
s = mw.ustring.gsub(s, '(%d*)%.([★%s]+)%[%[[Mm]et[re][re]|m%]%]', '%100.%2[[centimetre|cm]]')
s = mw.ustring.gsub(s, '^(%s*%d+)([★%s]+)m', '%100%2cm')
s = mw.ustring.gsub(s, '([%(★%s]%d+)([★%s]+)m', '%100%2cm')
s = mw.ustring.gsub(s, '^(%s*%d+)([★%s]+)%[%[[Mm]et[re][re]|m%]%]', '%100%2[[centimetre|cm]]')
s = mw.ustring.gsub(s, '([%(★%s]%d+)([★%s]+)%[%[[Mm]et[re][re]|m%]%]', '%100%2[[centimetre|cm]]')
s = mw.ustring.gsub(s, '0(%d+%.?%d*[★%s]+cm)', '%1')
s = mw.ustring.gsub(s, '0(%d+%.?%d*[★%s]+%[%[[Cc]entimet[re][re]|cm%]%])', '%1')
else
s = mw.ustring.gsub(s, '(%d)(%d%d)%.(%d*[★%s]+)cm', '%1.%2%3m')
s = mw.ustring.gsub(s, '(%d)(%d%d)%.(%d*[★%s]+)%[%[[Cc]entimet[re][re]|cm%]%]', '%1.%2%3[[metre|m]]')
s = mw.ustring.gsub(s, '(%d)(%d%d)([★%s]+)cm', '%1.%2%3m')
s = mw.ustring.gsub(s, '(%d)(%d%d)([★%s]+)%[%[[Cc]entimet[re][re]|cm%]%]', '%1.%2%3[[metre|m]]')
s = mw.ustring.gsub(s, '(%d%d)%.(%d*[★%s]+)cm', '0.%1%2m')
s = mw.ustring.gsub(s, '(%d%d)%.(%d*[★%s]+)%[%[[Cc]entimet[re][re]|cm%]%]', '0.%1%2[[metre|m]]')
s = mw.ustring.gsub(s, '(%d%d)([★%s]+)cm', '0.%1%2m')
s = mw.ustring.gsub(s, '(%d%d)([★%s]+)%[%[[Cc]entimet[re][re]|cm%]%]', '0.%1%2[[metre|m]]')
end
s = mw.ustring.gsub(s, '★', ' ')
return s
end
local function get_convert_args(s, prefer, enforce, ri)
local prefer_m = (prefer or '') == 'm'
local force_m = (enforce or '') == 'm'
local prefer_cm = (prefer or '') == 'cm'
local force_cm = (enforce or '') == 'cm'
ri = (ri or '') == 'cmin' and 'cmin' or ''
unconverted = clean(s or '') -- basic unit cleaning
s = mw.ustring.gsub(unconverted, '&[Nn][Bb][Ss][Pp];', ' ')
local m = mw.ustring.find(s, 'm')
local c = mw.ustring.find(s, 'cm')
local f = mw.ustring.find(s, 'ft')
local i = mw.ustring.find(s, 'in')
if m == nil and f == nil and i == nil then
return '', unconverted
end
local adj = nil
if c ~= nil and f == nil and i == nil then
local n = mw.ustring.sub(s, 1, c - 1)
if isnumber(n) then
if force_m then
local prec = require("Module:Math")._precision(trimspace(n))
adj = (prec == 1) and 'ri3' or 'ri2'
end
if ri ~= '' then
adj = force_m and 'ri2' or 'ri0'
end
return force_m
and {n/100,'m','ftin',0,['abbr']='on', ['adj']=adj}
or {n,'cm','ftin',0,['abbr']='on', ['adj']=adj}, mw.ustring.sub(s, c+2)
end
return '', unconverted
end
if m ~= nil and c == nil and f == nil and i == nil then
local n = mw.ustring.sub(s, 1, m - 1)
if ri ~= '' then
adj = force_cm and 'ri0' or 'ri2'
end
if isnumber(n) then
return force_cm
and {n*100,'cm','ftin',0,['abbr']='on',['adj']=adj}
or {n,'m','ftin',0,['abbr']='on',['adj']=adj}, mw.ustring.sub(s, m+1)
end
return '', unconverted
end
if f ~= nil and i ~=nil and m == nil then
local n1 = mw.ustring.sub(s, 1, f - 1)
local n2 = mw.ustring.sub(s, f+2, i - 1)
if isnumber(n1) and isnumber(n2) then
if ri ~= '' then
adj = 'ri0'
end
return (force_m or prefer_m)
and {n1,'ft',n2,'in', 'm',2,['abbr']='on',['adj']=adj}
or {n1,'ft',n2,'in', 'cm',0,['abbr']='on',['adj']=adj}, mw.ustring.sub(s, i+2)
end
return '', unconverted
end
if f ~= nil and i == nil and m == nil then
local n = mw.ustring.sub(s, 1, f - 1)
if isnumber(n) then
if ri ~= '' then
local n2 = 12*(n - math.floor(n))
adj = 'ri0'
return (force_m or prefer_m)
and {math.floor(n),'ft',n2, 'in','m',2,['abbr']='on',['adj']=adj}
or {math.floor(n),'ft',n2,'in','cm',0,['abbr']='on',['adj']=adj}, mw.ustring.sub(s, f+2)
end
return (force_m or prefer_m)
and {n,'ft','m',2,['abbr']='on'}
or {n,'ft','cm',0,['abbr']='on'}, mw.ustring.sub(s, f+2)
end
return '', unconverted
end
if i ~= nil and f == nil and m == nil then
local n = mw.ustring.sub(s, 1, i - 1)
if isnumber(n) then
if ri ~= '' then
adj = 'ri0'
end
return (force_m or prefer_m)
and {n,'in','m',2,['abbr']='on'}
or {n,'in','cm',0,['abbr']='on'}, mw.ustring.sub(s, i+2)
end
return '', unconverted
end
if force_cm and c == nil then
return '', force_unit(unconverted, 'cm')
end
if force_m and c ~= nil then
return '', force_unit(unconverted, 'm')
end
return '', unconverted
end
function convert(frame, args)
local str, suffix = splitsuffix(args[1] or '')
local targs, str = get_convert_args(str, args['prefer'] or '', args['enforce'] or '', args['ri'] or '')
str = str .. suffix
if type(targs) == 'table' then
return frame:expandTemplate{ title = 'convert', args = targs} .. str
else
return str
end
end
function p.main(frame)
return convert(frame, frame.args[1] and frame.args or frame:getParent().args)
end
return p
eae45d697c1881086eab11f622b4400e5c177c63
Template:Country2nationality
10
160
312
311
2023-12-24T02:08:52Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Country2nationality]]
wikitext
text/x-wiki
<includeonly>{{safesubst<noinclude/>:#ifeq:{{safesubst<noinclude/>:#invoke:String|len|s={{safesubst<noinclude/>:ISO 3166 code|{{{1}}}}}}}|2|{{safesubst<noinclude/>:Iso2nationality| {{safesubst<noinclude/>:ISO 3166 code|{{{1}}}}} }}| {{safesubst<noinclude/>:#if:{{{1|}}}| {{safesubst<noinclude/>:#switch: {{{1}}} | England = English | Scotland = Scottish | Wales = Welsh | Catalonia = Catalan | Kosovo = Kosovan }}}}}}</includeonly><noinclude>
{{documentation}}
</noinclude>
9c6b20fc59b2033477fb4dea0ffd1984bd673368
Template:ISO 3166 code
10
161
314
313
2023-12-24T02:08:53Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:ISO_3166_code]]
wikitext
text/x-wiki
{{safesubst<noinclude/>:#invoke:ISO 3166|code|{{{1}}}|{{{2|}}}}}<noinclude>
{{Documentation|content={{ISO 3166 conversion template doc}}}}
</noinclude>
06f8325798ef5cb3ed4eb035d562ab9f8656cc6c
Module:ISO 3166
828
162
316
315
2023-12-24T02:08:53Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:ISO_3166]]
Scribunto
text/plain
-- to enable us to replicate the current functioning of Country extract, we need to deal with:
-- 2 {{<name>}} DONE!
-- 3 [[<name>]] DONE!
-- 4 [[<name>|<junk>]] DONE!
-- 5 [[image:flag of <country>.[svg|gif|png|jpg]|\d+px]] DONE!
local p = {}
local getArgs = require("Module:Arguments").getArgs
local data = mw.loadData("Module:ISO 3166/data/National")
--[[----------F I N D N A M E----------]]-- -- Finds the name in the database
local function findname(code,cdata,qry)
local sqry = p.strip(qry)
if cdata["name"] and sqry==p.strip(cdata["name"])
or cdata["isoname"] and sqry==p.strip(cdata["isoname"])
or not cdata["nocode"] and sqry==code
or sqry==cdata["alpha3"] or sqry==cdata["numeric"]
then
return true
end
for _,tname in pairs(cdata["isonames"] or {}) do
if sqry==p.strip(tname) then
return true
end
end
for _,tname in pairs(cdata["altnames"] or {}) do
if sqry==p.strip(tname) then
return true
end
end
return false
end
--[[----------I S O N A M E----------]]-- -- Find the ISO name of a country/region
local function isoname(data,code,lang)
if data[code]["isonames"] then
local name = data[code]["isodisplaynames"] and data[code]["isodisplaynames"][lang]
or data[code]["isonames"][lang]
or data[code]["isodisplaynames"] and data[code]["isodisplaynames"][data[code]["defaultlang"] or data["defaultlang"]]
or data[code]["isonames"][data[code]["defaultlang"] or data["defaultlang"]]
or data[code]["isodisplaynames"] and data[code]["isodisplaynames"]["en"]
or data[code]["isonames"]["en"]
if name then return name end
for _,iname in pairs(data[code]["isonames"]) do return iname end
return data[code]["isodisplayname"] or data[code]["isoname"]
else
return data[code]["isodisplayname"] or data[code]["isoname"]
end
end
--[[----------S T R I P----------]]-- -- Removes junk from the input
function p.strip(text)
local accents = {["À"]="A",["Á"]="A",["Â"]="A",["Ã"]="A", -- accent list
["Ä"]="A",["Å"]="A",["Ç"]="C",["È"]="E",["É"]="E",
["Ê"]="E",["Ë"]="E",["Ì"]="I",["Í"]="I",["Î"]="I",
["Ï"]="I",["Ñ"]="N",["Ò"]="O",["Ó"]="O",["Ô"]="O",
["Õ"]="O",["Ö"]="O",["Ø"]="O",["Ù"]="U",["Ú"]="U",
["Û"]="U",["Ü"]="U",["Ý"]="Y"
}
local remove = {"NATION OF","COUNTRY OF","TERRITORY OF", -- text to be removed list
"FLAG OF","FLAG","KINGDOM OF","STATE OF"," STATE ",
"PROVINCE OF","PROVINCE","TERRITORY"
}
local patterns = {[".+:"]="",["|.+"]="",["%(.-%)"]="", -- patterns to follow (order may matter)
["%..*"]="",["^THE "]="",["%_"]=" ",["%-"]=" ",
["%d%d?%d?PX"]="",
}
text = mw.ustring.upper(text) -- Case insensitivity
text = mw.ustring.gsub(text,"[À-Ý]",accents) -- Deaccent
for pattern,value in pairs(patterns) do -- Follow patterns
text = mw.ustring.gsub(text,pattern,value)
end
for _,words in pairs(remove) do -- Remove unneeded words
text = mw.ustring.gsub(text,words,"")
end
text = mw.ustring.gsub(text,"%W","") -- Remove non alpha-numeric
return text
end
--[[----------P . C A L L S T R I P ---------]]-- -- Calls P.strip but using Module:Arguments
function p.callstrip(frame)
local args = getArgs(frame)
return p.strip(args[1]) or ""
end
--[[----------P . L U A C O D E---------]]-- -- Makes the ISO code of a country
function p.luacode(args)
if string.find(args[1] or '',"%-") then
args[1], args[2] = string.match(args[1] or '',"^([^%-]*)%-(.*)$")
end
if args[1] then args[1] = p.strip(args[1]) end
if args[2] then args[2] = p.strip(args[2]) end
if args["codetype"]=="3" then
args["codetype"]="alpha3"
end
local eot = args.error or ""
local catnocountry = (args.nocat and args.nocat == 'true') and ''
or '[[Category:Wikipedia page with obscure country]]'
local catnosubdivision = (args.nocat and args.nocat == 'true') and ''
or '[[Category:Wikipedia page with obscure subdivision]]'
if not args[1] then
if mw.title.getCurrentTitle().namespace ~= 0 then catnocountry = '' end
return catnocountry, '<span style="font-size:100%" class="error">"No parameter for the country given"</span>'
end
if not args[2] then --3166-1 code
for alpha2,cdata in pairs(data) do
if findname(alpha2,cdata,args[1]) then
if args["codetype"]=="numeric" or args["codetype"]=="alpha3" then
return cdata[args["codetype"]]
else
return alpha2
end
end
end
if mw.title.getCurrentTitle().namespace ~= 0 then catnocountry = '' end
return catnocountry
else --3166-2 code
for alpha2,cdata in pairs(data) do
if findname(alpha2,cdata,args[1]) then
if mw.ustring.match(alpha2,"GB") then -- For England, Wales etc.
alpha2 = "GB"
end
local sdata = mw.loadData("Module:ISO 3166/data/"..alpha2)
local empty = true
for scode,scdata in pairs(sdata) do
if type(scdata)=="table" then
empty = false
if findname(scode,scdata,args[2]) then
return alpha2.."-"..scode
end
end
end
if mw.title.getCurrentTitle().namespace ~= 0 then catnosubdivision = '' end
return catnosubdivision
end
end
if mw.title.getCurrentTitle().namespace ~= 0 then catnocountry = '' end
return catnocountry
end
end
--[[----------P . C O D E---------]]-- -- Calls P.Luacode but using Module:Arguments
function p.code(frame)
return p.luacode(getArgs(frame)) or ""
end
--[[----------P . N U M E R I C---------]]-- -- Calls P.Luacode but using Module:Arguments and setting it to output a numeric value
function p.numeric(frame)
local args = getArgs(frame)
args["codetype"]="numeric"
return p.luacode(args) or ""
end
--[[----------P . L U A N A M E---------]]-- -- Makes the ISO/common name of a country
function p.luaname(args)
local code1 = p.luacode(args)
local code2 = ''
if string.find(code1,"%-") then
code1, code2 = string.match(code1,"^([^%-]*)%-(.*)$")
end
if string.find(code1,"^%u%u$") then
if code2=="" then --3166-1 alpha-2 code
if data[code1] then
return (args.isoname or args.lang) and isoname(data,code1,args.lang)
or (data[code1]["displayname"] or data[code1]["name"])
else
return '[[Category:Wikipedia page with obscure country]]'
end
else --3166-2 code
local sdata
if data[code1] then
sdata = mw.loadData("Module:ISO 3166/data/"..code1)
else
return '[[Category:Wikipedia page with obscure country]]'
end
if sdata[code2] then
return (args.isoname or args.lang) and isoname(sdata,code2,args.lang)
or (sdata[code2]["displayname"] or sdata[code2]["name"])
else
return '[[Category:Wikipedia page with obscure country]]'
end
end
end
end
--[[----------P . N A M E---------]]-- -- Calls P.Luaname but using Module:Arguments
function p.name(frame)
return p.luaname(getArgs(frame)) or ""
end
--[[----------P . G E O C O O R D I N S E R T---------]]-- -- Wrapper for Module:Coordinates.coordinsert
function p.geocoordinsert(frame)
-- {{#invoke:ISO 3166|geocoordinsert|{{coord|...}}
-- |country=..|subdivision1=...|subdivision2=...
-- |type=...|scale=...|dim=...|source=...|globe=...
-- }}
local args = frame.args
local subdivisionqueried = false
local catnocountry = (args.nocat and args.nocat == 'true') and ''
or '[[Category:Wikipedia page with obscure country]]'
local catnosubdivision = (args.nocat and args.nocat == 'true') and ''
or '[[Category:Wikipedia page with obscure subdivision]]' or ''
local tracking = ''
local targs = {}
targs[1] = args[1] or ''
for i, v in pairs(args) do
if i == 'country' and not mw.ustring.find(targs[1], 'region:') then
local country = v
local k, region = 1, ''
-- look for a valid subdivision
while region == '' and k < 3 do
local subdivision = args['subdivision' .. k] or ''
if subdivision ~= '' then
region = p.luacode({country, subdivision, nocat = 'true'})
subdivisionqueried = true
end
k = k + 1
end
-- subdivision lookup failed or never attempted, try country only
if region == '' then
region = p.luacode({country, nocat = 'true'})
if mw.title.getCurrentTitle().namespace ~= 0 then catnocountry, catnosubdivision = '', '' end
if region == '' then
tracking = tracking .. catnocountry
elseif subdivisionqueried == true then
tracking = tracking .. catnosubdivision
end
end
-- something worked, add it to the targs
if region ~= '' then
targs[#targs + 1] = 'region:' .. region
end
elseif i == 'type' or i == 'scale' or i == 'dim'
or i == 'source' or i == 'globe' then
targs[#targs + 1] = i .. ':' .. v
end
end
-- call Module:Coordinates.coordinsert if there is something to insert
if #targs > 1 then
local coordinsert = require('Module:Coordinates').coordinsert
return coordinsert({args = targs}) .. tracking
end
-- otherwise, just return the coordinates
return targs[1] .. tracking
end
return p
6bc354f2610f29e712065cbe3ea814144fa3a600
Module:ISO 3166/data/National
828
163
318
317
2023-12-24T02:08:54Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:ISO_3166/data/National]]
Scribunto
text/plain
return {
["AD"] = {alpha3="AND",numeric="020",name="Andorra"},
["AE"] = {alpha3="ARE",numeric="784",name="United Arab Emirates",altnames={"UAE"}},
["AF"] = {alpha3="AFG",numeric="004",name="Afghanistan"},
["AG"] = {alpha3="ATG",numeric="028",name="Antigua and Barbuda"},
["AI"] = {alpha3="AIA",numeric="660",name="Anguilla"},
["AL"] = {alpha3="ALB",numeric="008",name="Albania"},
["AM"] = {alpha3="ARM",numeric="051",name="Armenia"},
["AO"] = {alpha3="AGO",numeric="024",name="Angola"},
["AQ"] = {alpha3="ATA",numeric="010",name="Antarctica"},
["AR"] = {alpha3="ARG",numeric="032",name="Argentina"},
["AS"] = {alpha3="ASM",numeric="016",name="American Samoa"},
["AT"] = {alpha3="AUT",numeric="040",name="Austria"},
["AU"] = {alpha3="AUS",numeric="036",name="Australia"},
["AW"] = {alpha3="ABW",numeric="533",name="Aruba"},
["AX"] = {alpha3="ALA",numeric="248",name="Åland Islands",altnames={"Aland Islands","Åland","Aland"}},
["AZ"] = {alpha3="AZE",numeric="031",name="Azerbaijan"},
["BA"] = {alpha3="BIH",numeric="070",name="Bosnia and Herzegovina",altnames={"Bosnia"}},
["BB"] = {alpha3="BRB",numeric="052",name="Barbados"},
["BD"] = {alpha3="BGD",numeric="050",name="Bangladesh"},
["BE"] = {alpha3="BEL",numeric="056",name="Belgium"},
["BF"] = {alpha3="BFA",numeric="854",name="Burkina Faso"},
["BG"] = {alpha3="BGR",numeric="100",name="Bulgaria"},
["BH"] = {alpha3="BHR",numeric="048",name="Bahrain"},
["BI"] = {alpha3="BDI",numeric="108",name="Burundi"},
["BJ"] = {alpha3="BEN",numeric="204",name="Benin"},
["BL"] = {alpha3="BLM",numeric="652",name="Saint Barthélemy",altnames={"St Barthelemy"}},
["BM"] = {alpha3="BMU",numeric="060",name="Bermuda"},
["BN"] = {alpha3="BRN",numeric="096",name="Brunei",isoname="Brunei Darussalam"},
["BO"] = {alpha3="BOL",numeric="068",name="Bolivia",isoname="Bolivia (Plurinational State of)"},
["BQ"] = {alpha3="BES",numeric="535",name="Caribbean Netherlands",isoname="Bonaire, Sint Eustatius and Saba"},
["BR"] = {alpha3="BRA",numeric="076",name="Brazil"},
["BS"] = {alpha3="BHS",numeric="044",name="Bahamas"},
["BT"] = {alpha3="BTN",numeric="064",name="Bhutan"},
["BV"] = {alpha3="BVT",numeric="074",name="Bouvet Island"},
["BW"] = {alpha3="BWA",numeric="072",name="Botswana"},
["BY"] = {alpha3="BLR",numeric="112",name="Belarus"},
["BZ"] = {alpha3="BLZ",numeric="084",name="Belize"},
["CA"] = {alpha3="CAN",numeric="124",name="Canada"},
["CC"] = {alpha3="CCK",numeric="166",name="Cocos (Keeling) Islands",altnames={"Cocos Islands","Keeling Islands"}},
["CD"] = {alpha3="COD",numeric="180",name="Democratic Republic of the Congo",isoname="Congo, Democratic Republic of the",altnames={"Congo-Kinshasa","DRC","DR Congo"}},
["CF"] = {alpha3="CAF",numeric="140",name="Central African Republic",altnames={"CAR"}},
["CG"] = {alpha3="COG",numeric="178",name="Republic of the Congo",isoname="Congo",altnames={"Congo-Brazzaville"}},
["CH"] = {alpha3="CHE",numeric="756",name="Switzerland"},
["CI"] = {alpha3="CIV",numeric="384",name="Côte d'Ivoire",altnames={"Ivory Coast"}},
["CK"] = {alpha3="COK",numeric="184",name="Cook Islands"},
["CL"] = {alpha3="CHL",numeric="152",name="Chile"},
["CM"] = {alpha3="CMR",numeric="120",name="Cameroon"},
["CN"] = {alpha3="CHN",numeric="156",name="China",altnames={"People's Republic of China","PRC"}},
["CO"] = {alpha3="COL",numeric="170",name="Colombia"},
["CR"] = {alpha3="CRI",numeric="188",name="Costa Rica"},
["CU"] = {alpha3="CUB",numeric="192",name="Cuba"},
["CV"] = {alpha3="CPV",numeric="132",name="Cabo Verde",altnames={"Cape Verde"}},
["CW"] = {alpha3="CUW",numeric="531",name="Curaçao",altnames={"Curacao"}},
["CX"] = {alpha3="CXR",numeric="162",name="Christmas Island"},
["CY"] = {alpha3="CYP",numeric="196",name="Cyprus"},
["CZ"] = {alpha3="CZE",numeric="203",name="Czech Republic",isoname="Czechia"},
["DE"] = {alpha3="DEU",numeric="276",name="Germany"},
["DJ"] = {alpha3="DJI",numeric="262",name="Djibouti"},
["DK"] = {alpha3="DNK",numeric="208",name="Denmark"},
["DM"] = {alpha3="DMA",numeric="212",name="Dominica"},
["DO"] = {alpha3="DOM",numeric="214",name="Dominican Republic"},
["DZ"] = {alpha3="DZA",numeric="012",name="Algeria"},
["EC"] = {alpha3="ECU",numeric="218",name="Ecuador"},
["EE"] = {alpha3="EST",numeric="233",name="Estonia"},
["EG"] = {alpha3="EGY",numeric="818",name="Egypt"},
["EH"] = {alpha3="ESH",numeric="732",name="Western Sahara"},
["ER"] = {alpha3="ERI",numeric="232",name="Eritrea"},
["ES"] = {alpha3="ESP",numeric="724",name="Spain"},
["ET"] = {alpha3="ETH",numeric="231",name="Ethiopia"},
["FI"] = {alpha3="FIN",numeric="246",name="Finland"},
["FJ"] = {alpha3="FJI",numeric="242",name="Fiji"},
["FK"] = {alpha3="FLK",numeric="238",name="Falkland Islands",isoname="Falkland Islands (Malvinas)",altnames={"Falklands","Islas Malvinas","Malvinas","Malvinas Islands"}},
["FM"] = {alpha3="FSM",numeric="583",name="Federated States of Micronesia",isoname="Micronesia (Federated States of)",altnames={"Micronesia"}},
["FO"] = {alpha3="FRO",numeric="234",name="Faroe Islands",altnames={"Faroer","Faeroer"}},
["FR"] = {alpha3="FRA",numeric="250",name="France"},
["GA"] = {alpha3="GAB",numeric="266",name="Gabon"},
["GB"] = {alpha3="GBR",numeric="826",name="United Kingdom",isoname="United Kingdom of Great Britain and Northern Ireland",altnames={"UK","Great Britain"}},
["GB-ENG"] = {alpha3="ENG",numeric="000",name="England"}, --Considered to be a country
["GB-NIR"] = {alpha3="NIR",numeric="000",name="Northern Ireland"}, --Considered to be a country
["GB-SCT"] = {alpha3="SCT",numeric="000",name="Scotland"}, --Considered to be a country
["GB-WLS"] = {alpha3="WLS",numeric="000",name="Wales"}, --Considered to be a country
["GB-EAW"] = {alpha3="EAW",numeric="000",name="England and Wales"}, --Considered to be a country
["GD"] = {alpha3="GRD",numeric="308",name="Grenada"},
["GE"] = {alpha3="GEO",numeric="268",name="Georgia"},
["GF"] = {alpha3="GUF",numeric="254",name="French Guiana"},
["GG"] = {alpha3="GGY",numeric="831",name="Guernsey"},
["GH"] = {alpha3="GHA",numeric="288",name="Ghana"},
["GI"] = {alpha3="GIB",numeric="292",name="Gibraltar"},
["GL"] = {alpha3="GRL",numeric="304",name="Greenland"},
["GM"] = {alpha3="GMB",numeric="270",name="Gambia"},
["GN"] = {alpha3="GIN",numeric="324",name="Guinea"},
["GP"] = {alpha3="GLP",numeric="312",name="Guadeloupe"},
["GQ"] = {alpha3="GNQ",numeric="226",name="Equatorial Guinea"},
["GR"] = {alpha3="GRC",numeric="300",name="Greece"},
["GS"] = {alpha3="SGS",numeric="239",name="South Georgia and the South Sandwich Islands"},
["GT"] = {alpha3="GTM",numeric="320",name="Guatemala"},
["GU"] = {alpha3="GUM",numeric="316",name="Guam"},
["GW"] = {alpha3="GNB",numeric="624",name="Guinea-Bissau"},
["GY"] = {alpha3="GUY",numeric="328",name="Guyana"},
["HK"] = {alpha3="HKG",numeric="344",name="Hong Kong",altnames={"Hong Kong SAR","HKSAR"}},
["HM"] = {alpha3="HMD",numeric="334",name="Heard Island and McDonald Islands",altnames={"Heard and McDonald Islands"}},
["HN"] = {alpha3="HND",numeric="340",name="Honduras"},
["HR"] = {alpha3="HRV",numeric="191",name="Croatia"},
["HT"] = {alpha3="HTI",numeric="332",name="Haiti"},
["HU"] = {alpha3="HUN",numeric="348",name="Hungary"},
["ID"] = {alpha3="IDN",numeric="360",name="Indonesia"},
["IE"] = {alpha3="IRL",numeric="372",name="Ireland",altnames={"Republic of Ireland"}},
["IL"] = {alpha3="ISR",numeric="376",name="Israel"},
["IM"] = {alpha3="IMN",numeric="833",name="Isle of Man"},
["IN"] = {alpha3="IND",numeric="356",name="India"},
["IO"] = {alpha3="IOT",numeric="086",name="British Indian Ocean Territory"},
["IQ"] = {alpha3="IRQ",numeric="368",name="Iraq"},
["IR"] = {alpha3="IRN",numeric="364",name="Iran",isoname="Iran (Islamic Republic of)"},
["IS"] = {alpha3="ISL",numeric="352",name="Iceland"},
["IT"] = {alpha3="ITA",numeric="380",name="Italy"},
["JE"] = {alpha3="JEY",numeric="832",name="Jersey"},
["JM"] = {alpha3="JAM",numeric="388",name="Jamaica"},
["JO"] = {alpha3="JOR",numeric="400",name="Jordan"},
["JP"] = {alpha3="JPN",numeric="392",name="Japan"},
["KE"] = {alpha3="KEN",numeric="404",name="Kenya"},
["KG"] = {alpha3="KGZ",numeric="417",name="Kyrgyzstan"},
["KH"] = {alpha3="KHM",numeric="116",name="Cambodia"},
["KI"] = {alpha3="KIR",numeric="296",name="Kiribati"},
["KM"] = {alpha3="COM",numeric="174",name="Comoros"},
["KN"] = {alpha3="KNA",numeric="659",name="Saint Kitts and Nevis",altnames={"St Kitts and Nevis"}},
["KP"] = {alpha3="PRK",numeric="408",name="North Korea",isoname="Korea (Democratic People's Republic of)",altnames={"Democratic People's Republic of Korea"}},
["KR"] = {alpha3="KOR",numeric="410",name="South Korea",isoname="Korea, Republic of",altnames={"Republic of Korea"}},
["KW"] = {alpha3="KWT",numeric="414",name="Kuwait"},
["KY"] = {alpha3="CYM",numeric="136",name="Cayman Islands"},
["KZ"] = {alpha3="KAZ",numeric="398",name="Kazakhstan"},
["LA"] = {alpha3="LAO",numeric="418",name="Laos",isoname="Lao People's Democratic Republic"},
["LB"] = {alpha3="LBN",numeric="422",name="Lebanon"},
["LC"] = {alpha3="LCA",numeric="662",name="Saint Lucia",altnames={"St Lucia"}},
["LI"] = {alpha3="LIE",numeric="438",name="Liechtenstein"},
["LK"] = {alpha3="LKA",numeric="144",name="Sri Lanka"},
["LR"] = {alpha3="LBR",numeric="430",name="Liberia"},
["LS"] = {alpha3="LSO",numeric="426",name="Lesotho"},
["LT"] = {alpha3="LTU",numeric="440",name="Lithuania"},
["LU"] = {alpha3="LUX",numeric="442",name="Luxembourg"},
["LV"] = {alpha3="LVA",numeric="428",name="Latvia"},
["LY"] = {alpha3="LBY",numeric="434",name="Libya"},
["MA"] = {alpha3="MAR",numeric="504",name="Morocco"},
["MC"] = {alpha3="MCO",numeric="492",name="Monaco"},
["MD"] = {alpha3="MDA",numeric="498",name="Moldova",isoname="Moldova, Republic of"},
["ME"] = {alpha3="MNE",numeric="499",name="Montenegro"},
["MF"] = {alpha3="MAF",numeric="663",name="Saint-Martin",isoname="Saint Martin (French part)",altnames={"St Martin","St Martin (French part)","Collectivity of Saint Martin","Collectivity of St Martin"}},
["MG"] = {alpha3="MDG",numeric="450",name="Madagascar"},
["MH"] = {alpha3="MHL",numeric="584",name="Marshall Islands"},
["MK"] = {alpha3="MKD",numeric="807",name="North Macedonia",altnames={"Republic of North Macedonia","Macedonia","Republic of Macedonia","Macedonia, the former Yugoslav Republic of"}},
["ML"] = {alpha3="MLI",numeric="466",name="Mali"},
["MM"] = {alpha3="MMR",numeric="104",name="Myanmar",altnames={"Burma"}},
["MN"] = {alpha3="MNG",numeric="496",name="Mongolia"},
["MO"] = {alpha3="MAC",numeric="446",name="Macau",isoname="Macao",altnames={"Macau SAR","Macao SAR"}},
["MP"] = {alpha3="MNP",numeric="580",name="Northern Mariana Islands"},
["MQ"] = {alpha3="MTQ",numeric="474",name="Martinique"},
["MR"] = {alpha3="MRT",numeric="478",name="Mauritania"},
["MS"] = {alpha3="MSR",numeric="500",name="Montserrat"},
["MT"] = {alpha3="MLT",numeric="470",name="Malta"},
["MU"] = {alpha3="MUS",numeric="480",name="Mauritius"},
["MV"] = {alpha3="MDV",numeric="462",name="Maldives"},
["MW"] = {alpha3="MWI",numeric="454",name="Malawi"},
["MX"] = {alpha3="MEX",numeric="484",name="Mexico"},
["MY"] = {alpha3="MYS",numeric="458",name="Malaysia"},
["MZ"] = {alpha3="MOZ",numeric="508",name="Mozambique"},
["NA"] = {alpha3="NAM",numeric="516",name="Namibia"},
["NC"] = {alpha3="NCL",numeric="540",name="New Caledonia"},
["NE"] = {alpha3="NER",numeric="562",name="Niger"},
["NF"] = {alpha3="NFK",numeric="574",name="Norfolk Island"},
["NG"] = {alpha3="NGA",numeric="566",name="Nigeria"},
["NI"] = {alpha3="NIC",numeric="558",name="Nicaragua"},
["NL"] = {alpha3="NLD",numeric="528",name="Netherlands"},
["NO"] = {alpha3="NOR",numeric="578",name="Norway"},
["NP"] = {alpha3="NPL",numeric="524",name="Nepal"},
["NR"] = {alpha3="NRU",numeric="520",name="Nauru"},
["NU"] = {alpha3="NIU",numeric="570",name="Niue"},
["NZ"] = {alpha3="NZL",numeric="554",name="New Zealand",altnames={"Aotearoa"}},
["OM"] = {alpha3="OMN",numeric="512",name="Oman"},
["PA"] = {alpha3="PAN",numeric="591",name="Panama"},
["PE"] = {alpha3="PER",numeric="604",name="Peru"},
["PF"] = {alpha3="PYF",numeric="258",name="French Polynesia"},
["PG"] = {alpha3="PNG",numeric="598",name="Papua New Guinea"},
["PH"] = {alpha3="PHL",numeric="608",name="Philippines"},
["PK"] = {alpha3="PAK",numeric="586",name="Pakistan"},
["PL"] = {alpha3="POL",numeric="616",name="Poland"},
["PM"] = {alpha3="SPM",numeric="666",name="Saint Pierre and Miquelon",altnames={"St Pierre and Miquelon"}},
["PN"] = {alpha3="PCN",numeric="612",name="Pitcairn"},
["PR"] = {alpha3="PRI",numeric="630",name="Puerto Rico"},
["PS"] = {alpha3="PSE",numeric="275",name="Palestine",isoname="Palestine, State of",altnames={"State of Palestine"}},
["PT"] = {alpha3="PRT",numeric="620",name="Portugal"},
["PW"] = {alpha3="PLW",numeric="585",name="Palau"},
["PY"] = {alpha3="PRY",numeric="600",name="Paraguay"},
["QA"] = {alpha3="QAT",numeric="634",name="Qatar"},
["RE"] = {alpha3="REU",numeric="638",name="Réunion"},
["RO"] = {alpha3="ROU",numeric="642",name="Romania"},
["RS"] = {alpha3="SRB",numeric="688",name="Serbia"},
["RU"] = {alpha3="RUS",numeric="643",name="Russia",isoname="Russian Federation"},
["RW"] = {alpha3="RWA",numeric="646",name="Rwanda"},
["SA"] = {alpha3="SAU",numeric="682",name="Saudi Arabia"},
["SB"] = {alpha3="SLB",numeric="090",name="Solomon Islands"},
["SC"] = {alpha3="SYC",numeric="690",name="Seychelles"},
["SD"] = {alpha3="SDN",numeric="729",name="Sudan"},
["SE"] = {alpha3="SWE",numeric="752",name="Sweden"},
["SG"] = {alpha3="SGP",numeric="702",name="Singapore"},
["SH"] = {alpha3="SHN",numeric="654",name="Saint Helena, Ascension and Tristan da Cunha"},
["SI"] = {alpha3="SVN",numeric="705",name="Slovenia"},
["SJ"] = {alpha3="SJM",numeric="744",name="Svalbard and Jan Mayen"},
["SK"] = {alpha3="SVK",numeric="703",name="Slovakia"},
["SL"] = {alpha3="SLE",numeric="694",name="Sierra Leone"},
["SM"] = {alpha3="SMR",numeric="674",name="San Marino"},
["SN"] = {alpha3="SEN",numeric="686",name="Senegal"},
["SO"] = {alpha3="SOM",numeric="706",name="Somalia"},
["SR"] = {alpha3="SUR",numeric="740",name="Suriname"},
["SS"] = {alpha3="SSD",numeric="728",name="South Sudan"},
["ST"] = {alpha3="STP",numeric="678",name="São Tomé and Príncipe",isoname="Sao Tome and Principe",altnames={"Democratic Republic of Sao Tome and Principe"}},
["SV"] = {alpha3="SLV",numeric="222",name="El Salvador"},
["SX"] = {alpha3="SXM",numeric="534",name="Sint Maarten",isoname="Sint Maarten (Dutch part)",altnames={"St Maarten","Saint Martin (Dutch part)","St Martin (Dutch part)"}},
["SY"] = {alpha3="SYR",numeric="760",name="Syria",isoname="Syrian Arab Republic"},
["SZ"] = {alpha3="SWZ",numeric="748",name="Eswatini",altnames={"Swaziland"}},
["TC"] = {alpha3="TCA",numeric="796",name="Turks and Caicos Islands"},
["TD"] = {alpha3="TCD",numeric="148",name="Chad"},
["TF"] = {alpha3="ATF",numeric="260",name="French Southern and Antarctic Lands",isoname="French Southern Territories"},
["TG"] = {alpha3="TGO",numeric="768",name="Togo"},
["TH"] = {alpha3="THA",numeric="764",name="Thailand"},
["TJ"] = {alpha3="TJK",numeric="762",name="Tajikistan"},
["TK"] = {alpha3="TKL",numeric="772",name="Tokelau"},
["TL"] = {alpha3="TLS",numeric="626",name="Timor-Leste",altnames={"East Timor"}},
["TM"] = {alpha3="TKM",numeric="795",name="Turkmenistan"},
["TN"] = {alpha3="TUN",numeric="788",name="Tunisia"},
["TO"] = {alpha3="TON",numeric="776",name="Tonga"},
["TR"] = {alpha3="TUR",numeric="792",name="Turkey",isoname="Türkiye"},
["TT"] = {alpha3="TTO",numeric="780",name="Trinidad and Tobago"},
["TV"] = {alpha3="TUV",numeric="798",name="Tuvalu"},
["TW"] = {alpha3="TWN",numeric="158",name="Taiwan",isoname="Taiwan, Province of China",altnames={"Republic of China"}},
["TZ"] = {alpha3="TZA",numeric="834",name="Tanzania",isoname="Tanzania, United Republic of"},
["UA"] = {alpha3="UKR",numeric="804",name="Ukraine"},
["UG"] = {alpha3="UGA",numeric="800",name="Uganda"},
["UM"] = {alpha3="UMI",numeric="581",name="United States Minor Outlying Islands"},
["US"] = {alpha3="USA",numeric="840",name="United States",isoname="United States of America",altnames={"US","USA","U.S."}},
["UY"] = {alpha3="URY",numeric="858",name="Uruguay"},
["UZ"] = {alpha3="UZB",numeric="860",name="Uzbekistan"},
["VA"] = {alpha3="VAT",numeric="336",name="Vatican City",isoname="Holy See",altnames={"Holy See (Vatican City State)","Vatican City State"}},
["VC"] = {alpha3="VCT",numeric="670",name="Saint Vincent and the Grenadines",altnames={"St Vincent and the Grenadines"}},
["VE"] = {alpha3="VEN",numeric="862",name="Venezuela",isoname="Venezuela (Bolivarian Republic of)"},
["VG"] = {alpha3="VGB",numeric="092",name="British Virgin Islands",isoname="Virgin Islands (British)",altnames={"UK Virgin Islands","BVI"}},
["VI"] = {alpha3="VIR",numeric="850",name="United States Virgin Islands",isoname="Virgin Islands (U.S.)",altnames={"US Virgin Islands","USVI"}},
["VN"] = {alpha3="VNM",numeric="704",name="Vietnam",isoname="Viet Nam"},
["VU"] = {alpha3="VUT",numeric="548",name="Vanuatu"},
["WF"] = {alpha3="WLF",numeric="876",name="Wallis and Futuna"},
["WS"] = {alpha3="WSM",numeric="882",name="Samoa"},
["YE"] = {alpha3="YEM",numeric="887",name="Yemen"},
["YT"] = {alpha3="MYT",numeric="175",name="Mayotte"},
["ZA"] = {alpha3="ZAF",numeric="710",name="South Africa"},
["ZM"] = {alpha3="ZMB",numeric="894",name="Zambia"},
["ZW"] = {alpha3="ZWE",numeric="716",name="Zimbabwe"}
}
1ae753fe1fa53ce062b0a008dbc9778d589666f0
Template:Collapse top
10
164
320
319
2023-12-24T02:08:55Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Collapse_top]]
wikitext
text/x-wiki
<div style="margin-left:{{{indent|0}}}"><!-- NOTE: width renders incorrectly if added to main STYLE section -->
{| <!-- Template:Collapse top --> class="mw-collapsible mw-archivedtalk {{<includeonly>safesubst:</includeonly>#if:{{{expand|{{{collapse|}}}}}}||mw-collapsed}} {{{class|}}}" style="background: {{{bg1|transparent}}}; text-align: left; border: {{{border|1px}}} solid {{{b-color|Silver}}}; margin: 0.2em auto auto; width:{{<includeonly>safesubst:</includeonly>#if:{{{width|}}}|{{{width}}}|100%}}; clear: {{{clear|both}}}; padding: 1px;"
|-
! style="background: {{{bg|#{{main other|F0F2F5|CCFFCC}}}}}; font-size:87%; padding:0.2em 0.3em; text-align:{{<includeonly>safesubst:</includeonly>#if:{{{left|}}}|left|{{<includeonly>safesubst:</includeonly>#if:{{{align|}}}|left|center}}}}; {{<includeonly>safesubst:</includeonly>#if:{{{fc|}}}|color: {{{fc}}};|}}" | <div style="font-size:115%;{{<includeonly>safesubst:</includeonly>#if:{{{left|}}}||margin:0 4em}}">{{{1|{{{title|{{{reason|{{{header|{{{heading|{{{result|Extended content}}}}}}}}}}}}}}}}}}</div>
{{<includeonly>safesubst:</includeonly>#if:{{{warning|{{{2|}}}}}}
|{{<includeonly>safesubst:</includeonly>!}}-
{{<includeonly>safesubst:</includeonly>!}} style="text-align:center; font-style:italic;" {{<includeonly>safesubst:</includeonly>!}} {{{2|The following is a closed discussion. {{strongbad|Please do not modify it.}} }}} }}
|-
| style="border: solid {{{border2|1px Silver}}}; padding: {{{padding|0.6em}}}; background: {{{bg2|White}}};" {{<includeonly>safesubst:</includeonly>!}}<noinclude>
{{lorem ipsum|3}}
{{Collapse bottom}}
{{Documentation}}
</noinclude>
247cc43d5198baf8804d0926529cbbdd7be91113
Template:Collapse bottom
10
165
322
321
2023-12-24T02:08:57Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Collapse_bottom]]
wikitext
text/x-wiki
<includeonly>|}</div></includeonly><noinclude>
{{Documentation|Template:Collapse top/doc}}
<!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS -->
</noinclude>
64b210e8ab0882b262da50e9fbccf2132bc34fab
Template:Linkless exists
10
166
324
323
2023-12-24T02:08:57Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Linkless_exists]]
wikitext
text/x-wiki
{{#if:{{PROTECTIONEXPIRY:edit|{{{1|}}}}}|{{{2|true}}}|{{{3|}}}}}<noinclude>{{documentation}}</noinclude>
1aa1e6e4f3589f452babd54a7c0bbc590dc2f96d
Template:Notice
10
167
326
325
2023-12-24T02:08:58Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Notice]]
wikitext
text/x-wiki
{{Mbox
| name = Notice
| demospace = {{{demospace|}}}
| style = {{#if:{{{style|}}} |{{{style}}} }}
| subst = <includeonly>{{subst:substcheck}}</includeonly>
| type = notice
| image = {{#if:{{{image|}}} |[[File:{{{image}}}|40px|Notice|alt={{{imagealt|}}}]]}}
| small = {{{small|}}}
| smallimage = {{#if:{{{image|}}} |[[File:{{{image}}}|30px|Notice|alt={{{imagealt|}}}]]}}
| imageright = {{#if:{{{imageright|}}} |{{{imageright}}} |{{#if:{{{shortcut|{{{shortcut1|}}}}}} |{{Ombox/shortcut|{{{shortcut|{{{shortcut1|}}}}}}|{{{shortcut2|}}}|{{{shortcut3|}}}|{{{shortcut4|}}}|{{{shortcut5|}}}}}}} }}
| textstyle = {{{textstyle|text-align: {{#if:{{{center|}}}|center|{{{align|left}}}}};}}}
| text = {{#if:{{{header|{{{heading|{{{title|}}}}}}}}} |<div style="{{{headstyle|text-align: {{#if:{{{center|}}}|center|left}};}}}">'''{{{header|{{{heading|{{{title|}}}}}}}}}'''</div>}}<!--
-->{{{text|{{{content|{{{reason|{{{1}}}}}}}}}}}}
}}<noinclude>
{{Documentation}}
</noinclude>
2cbdbb721ca517005f6827650eef5b0f17537a43
Module:ParameterCount
828
168
328
327
2023-12-24T02:08:58Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:ParameterCount]]
Scribunto
text/plain
-- This module produces a count of all the arguments passed to it.
local yesno = require('Module:Yesno')
-- Trim a string
local function trim(s)
return s:match('^%s*(.-)%s*$')
end
-- Test whether a string is blank
local function isBlank(s)
return not s:find('%S')
end
-- Tests whether a string is a valid positional key, and if so, returns it. If
-- the key is invalid, this returns nil.
local function isPositionalKey(s)
s = trim(s)
if s:find('^[1-9][0-9]*$') then
return tonumber(s)
end
end
-- Return the count of all arguments for which testFunc returns a truthy value.
local function count(args, testFunc)
local ret = 0
for key, val in pairs(args) do
if testFunc(key, val) then
ret = ret + 1
end
end
return ret
end
-- Check shared arguments and get the parent argument count.
local function main(frame, testFunc)
local blankifiedTestFunc
if yesno(frame.args.checkblanks) ~= false then
-- Extend the test function to check for blanks as well.
blankifiedTestFunc = function (key, val)
if not isBlank(val) then
return testFunc(key, val)
end
end
else
blankifiedTestFunc = testFunc
end
return count(frame:getParent().args, blankifiedTestFunc)
end
return {
-- Called with {{#invoke:ParameterCount|all}}
-- All specified parameters are counted, even those not supported by the
-- template.
all = function (frame)
return main(frame, function () return true end)
end,
-- Called with {{#invoke:ParameterCount|main}}
-- Users can specify a list of parameters to check, and a list of Lua
-- Ustring patterns to check each parameter against.
main = function (frame)
local args = frame.args
local keys, patterns = {}, {}
-- Get key list
for i, key in ipairs(args) do
local positionalKey = isPositionalKey(key)
if positionalKey then
keys[positionalKey] = true
else
keys[trim(key)] = true
end
end
-- Get patterns
do
local function getPattern(i)
local pattern = args['pattern' .. tostring(i)]
if pattern and pattern ~= '' then
return pattern
end
end
local i = 1
local pattern = getPattern(i)
while pattern do
patterns[i] = pattern
i = i + 1
pattern = getPattern(i)
end
end
-- Construct the test function
local testFunc = function (key, val)
if keys[key] then
return true
end
for i, pattern in ipairs(patterns) do
if mw.ustring.find(tostring(key), pattern) then
return true
end
end
return false
end
return main(frame, testFunc)
end
}
63e3811b7a17825c071b1920ce88af06bc1e778d
Template:Count
10
169
330
329
2023-12-24T02:09:00Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Count]]
wikitext
text/x-wiki
{{safesubst<noinclude/>:#ifexpr:{{safesubst<noinclude/>:#invoke:ParameterCount|main|pattern1=^[%d]+$}}>0|{{safesubst<noinclude/>:#invoke:ParameterCount|main|pattern1=^[%d]+$}}|{{{base|0}}}}}<noinclude>{{documentation}}</noinclude>
ccdb0aa784669ceae716044a9267ac7c4dea7283
Template:Template link code
10
170
332
331
2023-12-24T02:09:01Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Template_link_code]]
wikitext
text/x-wiki
<includeonly>{{#Invoke:Template link general|main|nolink=yes|code=yes|nowrap=yes}}</includeonly><noinclude>
{{Documentation|1=Template:Tlg/doc
|content = {{tlg/doc|tlc}}
}}
<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
044f00ca1bfc10cb967c32e893043ccc6f739764
Template:Tld
10
171
334
333
2023-12-24T02:09:02Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Tld]]
wikitext
text/x-wiki
#REDIRECT [[Template:Template link code]]
be5d6275ea41d83224503e05901f3405c82141f7
Template:CountryPrefixThe
10
172
336
335
2023-12-24T02:09:02Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:CountryPrefixThe]]
wikitext
text/x-wiki
<includeonly>{{{{{|safesubst:}}}#switch: {{{1|}}}
| Australian Capital Territory | Austrian Empire | Bahamas | Batavian Republic | Belgian Congo | British Antarctic Territory | British Empire | British Virgin Islands | Bukharan People's Soviet Republic | Cape Colony | Captaincy General of Chile | Caribbean | Cayman Islands | Central African Republic | Channel Islands | Collectivity of Saint Martin | Colony of Natal | Colony of Santiago | Comoros | Congo Free State | Cook Islands | Cossack Hetmanate | Crown Dependencies | Czech Republic | Danish colonial empire | Democratic Republic of the Congo | Dominican Republic | Dominion of Newfoundland | Donetsk People's Republic | Duchy of Nassau | Dutch Caribbean | Dutch East Indies | Dutch Empire | Dutch Republic | Empire of Brazil | Falkland Islands | Falkland Islands Dependencies | Faroe Islands | Federal District (Brazil) | Federal Republic of Central America | Federal Republic of Yugoslavia | Federated States of Micronesia | Federation of Rhodesia and Nyasaland | French Union | French colonial empire | Gambia | German Empire | German colonial empire | Greater Republic of Central America | Gilbert and Ellice Islands | Grand Duchy of Hesse | Grand Duchy of Tuscany | Habsburg monarchy | Habsburg Netherlands | Hawaiian Kingdom | Holy Roman Empire | Holy See | Inca civilization | Ionian Islands (region) | Irish Free State | Isle of Man | Italian Empire | Japanese colonial empire | Kazakh Autonomous Socialist Soviet Republic | Kazakh Soviet Socialist Republic | Kingdom of Hanover | Kingdom of Hawaii | Kingdom of Jerusalem | Kingdom of Naples | Kingdom of Sardinia | Kingdom of Sicily | Kingdom of the Two Sicilies | Kirghiz Soviet Socialist Republic | Luhansk People's Republic | Maldives | Mamluk Sultanate | Maratha Empire | Marshall Islands | Moldavian Autonomous Soviet Socialist Republic | Moldavian Soviet Socialist Republic | Mongol Empire | Mughal Empire | Nagorno-Karabakh Republic | Netherlands | Netherlands Antilles | New Hebrides | North Aegean | Northern Mariana Islands | Northern Territory | Orange Free State | Ottoman Empire | Palestinian territories | Papal States | Philippines | Pitcairn Islands | Polish–Lithuanian Commonwealth | Portuguese Empire | Province of Quebec (1763–1791) | Republic of Artsakh | Republic of Florence | Republic of Genoa | Republic of Ireland | Republic of Macedonia | Republic of New Granada | Republic of Texas | Republic of the Congo | Republic of Venice | Russian Empire | Sahrawi Arab Democratic Republic | Socialist Republic of Macedonia | Solomon Islands | South Aegean | South African Republic | Southern Nigeria Protectorate | Southwest Territory | Soviet Union | Spanish East Indies | Spanish Empire | Spanish West Indies | State of Mexico | State of Palestine | Straits Settlements | Swedish colonial empire | Territory of Papua | Thirteen Colonies | Trucial States | Trust Territory of the Pacific Islands | Turkmen Soviet Socialist Republic | Turks and Caicos Islands | United Arab Emirates | United Kingdom | United States | United States Virgin Islands | Vermont Republic | Viceroyalty of New Granada | Viceroyalty of Peru | Viceroyalty of the Río de la Plata | Zulu Kingdom =<!--
-->{{#ifeq: {{Yesno-no|{{{capitalised|{{{capitalized|}}}}}}}}|yes|The|the}} {{#ifeq: {{Yesno-no|{{{onlythe|}}}}}|yes||{{{1|}}}}}<!--
-->|#default={{#ifeq: {{Yesno-no|{{{onlythe|}}}}}|yes||{{{1|}}}}}<!--
-->}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
5453dc9520f098181447c2c5e3b518eda03d054c
Template:Strfind short
10
173
338
337
2023-12-24T02:09:03Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Strfind_short]]
wikitext
text/x-wiki
{{#Invoke:String|find|source={{{1|}}}|{{{2}}}}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
f5475bb1d4bf09dc8dea7613cd4bc79847dafcbc
Template:Find country
10
174
340
339
2023-12-24T02:09:03Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Find_country]]
wikitext
text/x-wiki
<includeonly>{{#if: {{{1|}}}
| {{#invoke:Find country|main|string={{{1|}}}|match={{{match|}}}|nomatch={{{nomatch|}}}}}
}}</includeonly><noinclude>{{Documentation}}</noinclude>
87d8d8e45c6295e043512958d665ffbdf7819cc1
Module:Find country
828
175
342
341
2023-12-24T02:09:05Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Find_country]]
Scribunto
text/plain
--[[ v1.00
Test the string against the list of countries/continents.
Return the first word which matches a country/continent name ...
unless the "match=" parameter specifies a different match.
If there is no match, then return an empty string ... unless
the "nomatch" parameter specifies something different
]]
local getArgs = require('Module:Arguments').getArgs
local p = {}
-- config
local nomatch = ""
local matchnum = 1
local countryList = {
'South Africa',
'the Central African Republic',
'Central African Republic',
'Africa',
'Antarctica',
'Central Asia',
'South Asia',
'South East Asia',
'Southeast Asia',
'Asia',
'the Caribbean',
'Caribbean',
'Eurasia',
'Europe',
'the Middle East',
'Middle East',
'Central America',
'North America',
'South America',
'Oceania',
'the Americas',
'Afghanistan',
'Albania',
'Algeria',
'American Samoa',
'Andorra',
'Angola',
'Anguilla',
'Antigua and Barbuda',
'Argentina',
'Armenia',
'Aruba',
'Australia',
'the Austrian Empire',
'Austrian Empire',
'Austria-Hungary',
'Austria',
'Azerbaijan',
'the Bahamas',
'Bahamas',
'Bahrain',
'Bangladesh',
'Barbados',
'Belarus',
'Belgium',
'Belize',
'Benin',
'Bermuda',
'Bhutan',
'Bolivia',
'Bosnia and Herzegovina',
'Botswana',
'Brazil',
'Brunei Darussalam',
'Brunei',
'Bulgaria',
'Burkina Faso',
'Burundi',
'Cambodia',
'Cameroon',
'Canada',
'Cape Verde',
'the Cayman Islands',
'Cayman Islands',
'Chad',
'Chile',
"the People's Republic of China",
"People's Republic of China",
'China PR',
'PR China',
'China',
'Colombia',
'Comoros',
'the Republic of the Congo',
'the Democratic Republic of the Congo',
'Democratic Republic of the Congo',
'Congo DR',
'DR Congo',
'DRC',
'the Congo',
'Congo',
'Cook Islands',
'Costa Rica',
'Croatia',
'Cuba',
'Curaçao',
'Curacao',
'Cyprus',
'the Czech Republic',
'Czech Republic',
'Czechia',
'Denmark',
'Djibouti',
'the Dominican Republic',
'Dominican Republic',
'Dominica',
'East Timor',
'Timor-Leste',
'Ecuador',
'Egypt',
'El Salvador',
'England',
'Eritrea',
'Estonia',
'Eswatini',
'Ethiopia',
'the Falkland Islands',
'Falkland Islands',
'the Faroe Islands',
'Faroe Islands',
'Fiji',
'Finland',
'France',
'Gabon',
'the Gambia',
'Gambia',
'Georgia',
'Germany',
'Ghana',
'Gibraltar',
'Great Britain',
'Britain',
'Greece',
'Grenada',
'Guam',
'Guatemala',
'Papua New Guinea',
'Equatorial Guinea',
'Guinea-Bissau',
'Guinea',
'Guyana',
'Haiti',
'Honduras',
'Hong Kong',
'Hungary',
'Iceland',
'India',
'Indonesia',
'Iran',
'Iraq',
'Northern Ireland',
'the Republic of Ireland',
'Republic of Ireland',
'Ireland',
'Israel',
'Italy',
'Ivory Coast',
"Côte d'Ivoire",
'Jamaica',
'Japan',
'Jordan',
'Kazakhstan',
'Kenya',
'Kiribati',
'Kosovo',
'the Republic of Kosovo',
'Republic of Kosovo',
'Kuwait',
'Kyrgyzstan',
'the Kyrgyz Republic',
'Kyrgyz Republic',
"the Lao People's Democratic Republic",
"Lao People's Democratic Republic",
'Laos',
'Latvia',
'Lebanon',
'Lesotho',
'Liberia',
'Libya',
'Liechtenstein',
'Lithuania',
'Luxembourg',
'Macau',
'the Republic of Macedonia',
'Republic of Macedonia',
'North Macedonia',
'Macedonia',
'Madagascar',
'Malawi',
'Malaysia',
'the Maldives',
'Maldives',
'Mali',
'Malta',
'the Marshall Islands',
'Marshall Islands',
'Mauritania',
'Mauritius',
'Mexico',
'the Federated States of Micronesia',
'Federated States of Micronesia',
'Micronesia',
'FSM',
'Moldova',
'Monaco',
'Mongolia',
'Montenegro',
'Montserrat',
'Morocco',
'Mozambique',
'Myanmar',
'Namibia',
'Nauru',
'Nepal',
'the Netherlands',
'Netherlands',
'New Caledonia',
'New Zealand',
'Nicaragua',
'Nigeria',
'Niger',
'North Korea',
"the People's Democratic Republic of Korea",
"the Democratic People's Republic of Korea",
"Democratic People's Republic of Korea",
"People's Democratic Republic of Korea",
'DPR Korea',
'Korea DPR',
'Norway',
'Oman',
'the Ottoman Empire',
'Ottoman Empire',
'Ottoman Egypt',
'Pakistan',
'Palau',
'Mandatory Palestine',
'Palestine',
'the Palestinian territories',
'Palestinian territories',
'Panama',
'Paraguay',
'Peru',
'the Philippines',
'Philippines',
'Poland',
'Portugal',
'Puerto Rico',
'the Spanish Virgin Islands',
'Spanish Virgin Islands',
'Qatar',
'Romania',
'the Russian Empire',
'Russian Empire',
'the Russian Federation',
'Russian Federation',
'Russia',
'Rwanda',
'Saint Kitts and Nevis',
'Saint Lucia',
'Saint Vincent and the Grenadines',
'Western Samoa',
'Samoa',
'San Marino',
'São Tomé and Príncipe',
'São Tomé and Príncipe',
'Sao Tome and Principe',
'Saudi Arabia',
'Scotland',
'Senegal',
'Serbia',
'Seychelles',
'Sierra Leone',
'Singapore',
'Slovakia',
'Slovenia',
'the Solomon Islands',
'Solomon Islands',
'Somalia',
'South Korea',
'the Republic of Korea',
'Korea Republic',
'South Sudan',
'Sudan',
'Spain',
'Sri Lanka',
'Suriname',
'Swaziland',
'Sweden',
'Switzerland',
'Syria',
'Tahiti',
'the Republic of China',
'Republic of China',
'Taiwan',
'Tajikistan',
'Tanzania',
'Thailand',
'Togo',
'Tonga',
'Trinidad and Tobago',
'Trinidad',
'Tobago',
'Tunisia',
'Turkey',
'Turkmenistan',
'Turks and Caicos Islands',
'Tuvalu',
'Uganda',
'Ukraine',
'the United Arab Emirates',
'the UAE',
'the U.A.E.',
'United Arab Emirates',
'UAE',
'U.A.E.',
'the United Kingdom',
'United Kingdom',
'the UK',
'the U.K.',
'UK',
'U.K.',
'the United States of America',
'the United States',
'the USA',
'the U.S.A.',
'United States of America',
'United States',
'US',
'U.S.',
'USA',
'U.S.A.',
'America',
'Uruguay',
'Uzbekistan',
'Vanuatu',
'Venezuela',
'Vietnam',
'the British Virgin Islands',
'British Virgin Islands',
'UK Virgin Islands',
'U.K. Virgin Islands',
'the United States Virgin Islands',
'the US Virgin Islands',
'the U.S. Virgin Islands',
'United States Virgin Islands',
'US Virgin Islands',
'U.S. Virgin Islands',
'the Virgin Islands',
'Virgin Islands',
'Wales',
'Yemen',
'Zambia',
'Zimbabwe',
'Find country/testcases'
}
-- returns the name of a country that is found in the string
-- ... or an empty string if there is no match
function findcountryinstring(str)
nMatches = 0
myMatches ={}
str=" " .. str:gsub("^%s*(.-)%s*$", "%1") .. " "
-- check agaist each country
-- if there is a match, then return that country
for i, thiscountry in ipairs(countryList) do
if mw.ustring.find(str, thiscountry) then
nMatches = nMatches + 1
myMatches[nMatches] = thiscountry
end
end
if (nMatches == 0) then
-- none of the title words matches a whole country
return nomatch
end
if ((matchnum >= 1) and (matchnum <= nMatches)) then
return myMatches[matchnum]
end
if (matchnum < 0) then
matchnum = matchnum + 1 -- so that -1 is the last match etc
if ((matchnum + nMatches) >= 1) then
return myMatches[matchnum + nMatches]
end
end
-- if we get here, we have not found a match at the position specified by "matchnum"
return nomatch
end
function p.main(frame)
local args = getArgs(frame)
return p._main(args)
end
function p._main(args)
if (args['nomatch'] ~= nil) then
nomatch = args['nomatch']
end
-- by default, we return the first match
-- but the optional "C" paarmeter sets the "matchnum" variable, which
-- * for a positive matchnum "n", returns the nth match if it exists
-- * for a positive matchnum "n", returns (if it exists) the nth match
-- counting backwards from the end.
-- So "match=-1" returns the last match
-- and "match=-3" returns the 3rd-last match
if (args['match'] ~= nil) then
matchnum = tonumber(args['match'])
if ((matchnum == nil) or (matchnum == 0)) then
matchnum = 1
end
end
-- by default, we use the current page
-- but if the "string=" parameters is supplied, we use that
-- so we try the parameter first
thispagename = nil
if ((args['string'] ~= nil) and (args['string'] ~= "")) then
-- we have a non-empty "string" parameter, so we use it
thisstring = args['string']
else
-- get the page title
thispage = mw.title.getCurrentTitle()
thisstring = thispage.text;
end
-- now check the pagename to try to find a country
result = findcountryinstring(thisstring)
if (result == "") then
return nomatch
end
return result
end
return p
c15468102dad4b0bd85392d3ecf49bcb6e12c324
Template:Detect singular
10
176
344
343
2023-12-24T02:09:08Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Detect_singular]]
wikitext
text/x-wiki
{{#invoke:Detect singular|main}}<noinclude>
{{documentation}}
</noinclude>
0dd1507d935296f20a354173ba876d010a9ed72b
Template:Clc
10
177
346
345
2023-12-24T02:09:10Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Clc]]
wikitext
text/x-wiki
#REDIRECT [[Template:Category link with count]]
02280e2ab57b544236e11f913e3759c5781ca9d5
Template:Generic template demo
10
178
348
347
2023-12-24T02:09:11Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Generic_template_demo]]
wikitext
text/x-wiki
#REDIRECT [[Template:Parameter names example]]
{{R semiprotected}}
[[Category:Wikipedia utility templates]]
[[Category:Template namespace templates]]
[[Category:Documentation assistance templates]]
22f645541f749cfd0eeffdee734b51b284103400
Template:UF-hcard-person
10
179
350
349
2023-12-24T02:09:11Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:UF-hcard-person]]
wikitext
text/x-wiki
The HTML markup produced by this template includes an [[HCard|hCard microformat]], which makes the person's details [[Parsing|parsable]] by computers, either acting automatically to catalogue articles across Wikipedia or via a browser tool operated by a reader, to (for example) add the subject to an address book or database. For more information about the use of [[microformat]]s on Wikipedia, please see [[Wikipedia:WikiProject Microformats|the microformat project]].
=== Sub-templates ===
Date-of-birth ("bday") information will only be included in the microformat if {{tl|birth date}}, or {{tl|birth date and age}} are used in the infobox. ([[Wikipedia:WikiProject Microformats/dates|Do not use these if the date is before 1583]]). Be cautious about using these if the person is still living, per [[WP:DOB]].
To include a URL, use {{Tl|URL}}.
'''Please do not remove instances of these sub-templates.'''
=== Classes ===
hCard uses HTML classes including:
{{Flatlist|
*adr
*agent
*bday
*birthplace
*category
*country-name
*deathdate
*deathplace
*extended-address
*family-name
*fn (required)
*given-name
*honorific-prefix
*honorific-suffix
*label
*locality
*n
*nickname
*note
*org
*role
*url
*vcard
}}
'''Please do not rename or remove these classes nor collapse nested elements which use them.'''<includeonly>{{#ifeq:{{SUBPAGENAME}}|doc | |{{#ifeq:{{SUBPAGENAME}}|sandbox | |[[Category:Templates generating hCards]]}} }}</includeonly><noinclude>
[[Category:Templates generating hCards]]
[[Category:Microformat (uF) message templates]]
</noinclude>
cf7d7c17b9e4a925f11599e609ceb43d23ba29ea
Template:Infobox officeholder/doc
10
180
352
351
2023-12-24T02:09:17Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Infobox_officeholder/doc]]
wikitext
text/x-wiki
{{Documentation subpage}}
{{Person infobox header}}
{{High-use}}
{{Notice|Please note that in June 2017, the {{para|religion}} parameter was removed from Infobox officeholder as a result of [[Template talk:Infobox officeholder/Archive 21#Religion in officeholder infoboxes|this discussion]].}}
{{tl|Infobox officeholder}} is incorporated into the following templates (i.e. all the templates listed <span class="plainlinks">[{{fullurl:Special:WhatLinksHere/Template:Infobox officeholder|namespace=10&limit=1000&hidetrans=1&hidelinks=1}} here]</span>). Please use the most appropriate name when placing this template on a page.
{{collapse top |title= List of templates}}
{{refbegin|colwidth=20em}}
* {{Tld|Infobox AM}}
* {{Tld|Infobox Canadian MP}}
* {{Tld|Infobox Canadian senator}}
* {{Tld|Infobox candidate}}
* {{Tld|Infobox civil servant}}
* {{Tld|Infobox chancellor}}
* {{Tld|Infobox congressional candidate}}
* {{Tld|Infobox congressman}}
* {{Tld|Infobox defense minister}}
* {{Tld|Infobox deputy first minister}}
* {{Tld|Infobox deputy prime minister}}
* {{Tld|Infobox doge}}
* {{Tld|Infobox Eritrea cabinet official}}
* {{Tld|Infobox first lady}}
* {{Tld|Infobox first minister}}
* {{Tld|Infobox governor}}
* {{Tld|Infobox governor-elect}}
* {{Tld|Infobox governor general}}
* {{Tld|Infobox governor-general}}
* {{Tld|Infobox Indian politician}}
* {{Tld|Infobox judge}}
* {{Tld|Infobox lt governor}}
* {{Tld|Infobox mayor}}
* {{Tld|Infobox MEP}}
* {{Tld|Infobox minister}}
* {{Tld|Infobox MLA}}
* {{Tld|Infobox MP}}
* {{Tld|Infobox MSP}}
* {{Tld|Infobox PM}}
* {{Tld|Infobox politician}}
* {{Tld|Infobox politician (general)}}
* {{Tld|Infobox premier}}
* {{Tld|Infobox president}}
* {{Tld|Infobox president-elect}}
* {{Tld|Infobox prime minister}}
* {{Tld|Infobox prime minister-elect}}
* {{Tld|Infobox representative-elect}}
* {{Tld|Infobox SCC chief justice}}
* {{Tld|Infobox SCC puisne justice}}
* {{Tld|Infobox secretary-general}}
* {{Tld|Infobox senator}}
* {{Tld|Infobox senator-elect}}
* {{Tld|Infobox speaker}}
* {{Tld|Infobox state representative}}
* {{Tld|Infobox state SC associate justice}}
* {{Tld|Infobox state SC justice}}
* {{Tld|Infobox state senator}}
* {{Tld|Infobox US ambassador}}
* {{Tld|Infobox US associate justice}}
* {{Tld|Infobox US cabinet official}}
* {{Tld|Infobox US chief justice}}
* {{Tld|Infobox US territorial governor}}
* {{Tld|Infobox vice president}}
{{refend}}
{{collapse bottom}}
{{Lua|Module:Infobox|Module:InfoboxImage|Module:Check for unknown parameters}}
==Usage==
{{hatnote|Note: This template is for use on articles about '''individual people'''. For the infobox for use on articles about offices/positions, see [[Template:Infobox official post]].}}
Paste the code for the relevant office and then add the [[#Personal data|personal data]] to the bottom. There are no required fields and some fields will not appear when others are in use. For instructions on how to implement multiple terms, see [[Template:Infobox officeholder/example#Multiple terms|this page]]. For advice on alt text, see ''[[Wikipedia:Alternative text for images]]''.
The parameter {{para|order}} is used in conjunction with {{para|office}} to state that the officeholder is the ''n''th holder of the office, for example "42nd President of the United States". This should only be used when there is a well-established use of such numbering in reliable sources. Do not add numbers simply based on a Wikipedia list of holders of the office, because (1) the list may not be accurate and (2) even with a definite list, different numbering systems could be applied (as to how various categories of "irregular" officeholders should be counted, and as to the counting of those serving for multiple non-consecutive periods) making the numbers arbitrary; and even where such issues are not yet present, they are bound to be in the future, making this unsustainable. Per [[WP:SEAOFBLUE]], it is not recommended to wikilink {{para|order}} to a list of officeholders, even if such a list exists.
If {{para|order}} is not specified, the value of {{para|office}} can be [[Help:Link#Wikilinks|wikilinked]] in the usual way, for example, "<code><nowiki>[[Ministry of Defence (Singapore)|Minister for Defence]]</nowiki></code>". However, if {{para|order}} is specified together with {{para|office}}, the value of {{para|office}} is automatically linked to a Wikipedia article of the same name, whether such an article exists or not. Wikilinking cannot be used to redirect the link elsewhere, but a [[Wikipedia:Piped link|piped link]] can be created like this: "<code><nowiki>Ministry of Defence (Singapore){{!}}Minister for Defence</nowiki></code>" (note that the double square brackets have been omitted).
When both a start and an end term are given, you can instead specify the complete term using the parameters {{para|term}}, {{para|term2}}, etc. This can be helpful for complicated terms that cannot be given as simple starting or ending dates, or if you prefer something other than the default term separator (an en dash, with spaces around it if the start or end is not a simple integer date).
Where a politician was redistricted into a new district, you can use {{para|prior_term}} to indicate which district(s) they were in before. This saves space in the infobox by not generating a completely new office each time redistricting happens. If you do this, it is recommended that you list the person who preceded the subject when the subject first took office and the person who succeeded the subject when the subject last left office. Where the use of "same district number" is used for determining "predecessor" and "successor" in any office, but where the area is so altered as to make such a "predecessor" or "successor" of little or no biographical value, the word "redistricted" should be used rather than using names of officeholders whose connection is accidental by virtue of district number, but unrelated to any election contests between officeholders.
Please do not re-purpose any fields to add decorative images, icons or flags. Template:Infobox viceroy styles or the like can be used for this. [[WP:INFOBOXFLAG]] applies here.
Per consensus in [[Wikipedia:Village pump (proposals)/Archive 175#RfC: Interim use of successor in Infobox officeholder|this RfC]], the infobox for an incumbent officeholder should not mention an [[-elect|elected or designated]] successor, or the end date of the term, until the successor takes office.
===General office===
{{For|examples of this code in use|Template:Infobox officeholder/example#General office}}
{{Generic template demo
| honorific_prefix
| name<!-- defaults to article title when left blank -->
| native_name
| native_name_lang
| honorific_suffix
| image
| image_size
| image_upright
| image name
| image_name_alt
| smallimage
| smallimage_alt
| alt
| caption
| order
| office
| status<!--If this is specified, overrides Incumbent.-->
| term_start
| term_end<!-- Add data only when the actual term has ended, not for terms which will end in the future. (Per usage guideline.) -->
| subterm
| suboffice
| alongside
| monarch
| president
| governor_general
| primeminister
| chancellor
| taoiseach
| governor
| co-leader
| vicepresident
| viceprimeminister
| deputy
| lieutenant
| parliamentarygroup
| constituency
| majority
| predecessor
| successor
| prior_term
| order2
| office2
| term_start2
| term_end2
| subterm2
| suboffice2
| alongside2
| monarch2
| president2
| governor_general2
| primeminister2
| chancellor2
| taoiseach2
| governor2
| co-leader2
| vicepresident2
| viceprimeminister2
| deputy2
| lieutenant2Z
| parliamentarygroup2
| constituency2
| predecessor2
| successor2
| majority2
| prior_term2
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox officeholder
| honorific_prefix =
| name = <!-- defaults to article title when left blank -->
| native_name = <!--The person's name in their own language, if different.-->
| native_name_lang = <!--ISO 639-1 code, e.g., "fr" for French. If more than one, use {{lang}} in |native_name= instead.-->
| honorific_suffix =
| image =
| image_size =
| image_upright =
| smallimage = <!--If this is specified, "image" should not be.-->
| smallimage_alt =
| alt =
| caption =
| order =
| office =
| status = <!--If this is specified, overrides Incumbent.-->
| term_start =
| term_end = <!-- Add data only when the actual term has ended, not for terms which will end in the future. (Per usage guideline.) -->
| subterm =
| suboffice =
| alongside = <!--For two or more people serving in the same position from the same district. (e.g. United States senators.)-->
| monarch =
| president =
| governor_general =
| primeminister =
| taoiseach =
| chancellor =
| governor =
| co-leader =
| vicepresident =
| viceprimeminister =
| deputy =
| lieutenant =
| succeeding = <!--For President-elect or equivalent-->
| parliamentarygroup =
| constituency =
| majority =
| predecessor =
| successor = <!-- should not be filled until the successor takes office-->
| prior_term =
| order2 = <!--Can be repeated up to 16 times by changing the number-->
| office2 = <!--Can be repeated up to 16 times by changing the number-->
| term_start2 = <!--Can be repeated up to 16 times by changing the number-->
| term_end2 = <!--Can be repeated up to 16 times by changing the number-->
| subterm2 = <!--Can be repeated up to 16 times by changing the number-->
| suboffice2 = <!--Can be repeated up to 16 times by changing the number-->
| alongside2 = <!--Can be repeated up to 16 times by changing the number-->
| monarch2 = <!--Can be repeated up to 16 times by changing the number-->
| president2 = <!--Can be repeated up to 16 times by changing the number-->
| governor_general2 = <!--Can be repeated up to 16 times by changing the number-->
| primeminister2 = <!--Can be repeated up to 16 times by changing the number-->
| chancellor2 = <!--Can be repeated up to 16 times by changing the number-->
| taoiseach2 = <!--Can be repeated up to 16 times by changing the number-->
| governor2 = <!--Can be repeated up to 16 times by changing the number-->
| co-leader2 = <!--Can be repeated up to 16 times by changing the number-->
| vicepresident2 = <!--Can be repeated up to 16 times by changing the number-->
| viceprimeminister2 = <!--Can be repeated up to 16 times by changing the number-->
| deputy2 = <!--Can be repeated up to 16 times by changing the number-->
| lieutenant2 = <!--Can be repeated up to 16 times by changing the number-->
| succeeding2 = <!--Can be repeated up to 16 times by changing the number-->
| predecessor2 = <!--Can be repeated up to 16 times by changing the number-->
| successor2 = <!--Can be repeated up to 16 times by changing the number-->
| parliamentarygroup2= <!--Can be repeated up to 16 times by changing the number-->
| constituency2 = <!--Can be repeated up to 16 times by changing the number-->
| majority2 = <!--Can be repeated up to 16 times by changing the number-->
| prior_term2 = <!--Can be repeated up to 16 times by changing the number-->
</syntaxhighlight>
''add [[#Personal data|personal data]]''
{{clear}}
===Ambassador===
{{For|examples of this code in use|Template:Infobox officeholder/example#Ambassador}}
{{Generic template demo
| honorific_prefix
| name
| honorific_suffix
| image
| alt
| order
| ambassador_from
| country
| term_start
| term_end
| predecessor
| successor
| president
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox ambassador
| honorific_prefix =
| name =
| honorific_suffix =
| image =
| alt =
| order = <!--Can be repeated up to 16 times by adding a number-->
| ambassador_from = <!--Can be repeated up to 16 times by adding a number-->
| country = <!--Can be repeated up to 16 times by adding a number-->
| term_start = <!--Can be repeated up to 16 times by adding a number-->
| term_end = <!--Can be repeated up to 16 times by adding a number-->
| predecessor = <!--Can be repeated up to 16 times by adding a number-->
| successor = <!--Can be repeated up to 16 times by adding a number-->
| president = <!--Can be repeated up to 16 times by adding a number-->
</syntaxhighlight>
''add [[#Personal data|personal data]]''
{{clear}}
===Assembly member===
{{For|examples of this code in use|Template:Infobox officeholder/example#Assembly Member}}
{{Generic template demo
| honorific_prefix
| name
| honorific_suffix
| image
| alt
| caption
| constituency_AM
| assembly
| majority
| term_start
| term_end
| predecessor
| successor
| prior_term
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox AM
| honorific_prefix =
| name =
| honorific_suffix =
| image =
| alt =
| caption =
| constituency_AM = <!--Can be repeated up to eight times by adding a number-->
| assembly = <!--Can be repeated up to 16 times by adding a number-->
| majority = <!--Can be repeated up to 16 times by adding a number-->
| term_start = <!--Can be repeated up to 16 times by adding a number-->
| term_end = <!--Can be repeated up to 16 times by adding a number-->
| predecessor = <!--Can be repeated up to 16 times by adding a number-->
| successor = <!--Can be repeated up to 16 times by adding a number-->
| prior_term =
</syntaxhighlight>
''add [[#Personal data|personal data]]''
{{clear}}
===Governor===
{{For|examples of this code in use|Template:Infobox officeholder/example#Governor}}
{{Generic template demo
| honorific_prefix
| name
| honorific_suffix
| image
| alt
| order
| office
| term_start
| term_end
| lieutenant
| predecessor
| successor
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox governor
| honorific_prefix =
| name =
| honorific_suffix =
| image =
| alt =
| order = <!--Can be repeated up to 16 times by adding a number-->
| office = <!--Can be repeated up to 16 times by adding a number-->
| term_start = <!--Can be repeated up to 16 times by adding a number-->
| term_end = <!--Can be repeated up to 16 times by adding a number-->
| lieutenant = <!--Can be repeated up to 16 times by adding a number-->
| predecessor = <!--Can be repeated up to 16 times by adding a number-->
| successor = <!--Can be repeated up to 16 times by adding a number-->
</syntaxhighlight>
''add [[#Personal data|personal data]]''
{{clear}}
If Governor was appointed by a President, add:
{{Generic template demo
| president
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| president = <!--name of president-->
</syntaxhighlight>
{{clear}}
If Governor appointed by other, add:
{{Generic template demo
| appointed
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| appointed = <!--name of appointer-->
</syntaxhighlight>
{{clear}}
===Judge===
{{For|examples of this code in use|Template:Infobox officeholder/example#Judge}}
{{Generic template demo
| honorific_prefix
| name
| honorific_suffix
| image
| alt
| caption
| office
| term_start
| term_end
| nominator
| appointer
| predecessor
| successor
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox judge
| honorific_prefix =
| name =
| honorific_suffix =
| image =
| alt =
| caption =
| office = <!--Can be repeated up to 16 times by changing the number-->
| term_start = <!--Can be repeated up to 16 times by changing the number-->
| term_end = <!--Can be repeated up to 16 times by changing the number-->
| nominator = <!--Can be repeated up to 16 times by changing the number-->
| appointer = <!--Can be repeated up to 16 times by changing the number-->
| predecessor = <!--Can be repeated up to 16 times by changing the number-->
| successor = <!--Can be repeated up to 16 times by changing the number-->
</syntaxhighlight>
''add [[#Personal data|personal data]]''
{{clear}}
===Member of Parliament===
{{For|examples of this code in use|Template:Infobox officeholder/example#Member of Parliament}}
{{Generic template demo
| honorific_prefix
| name
| honorific_suffix
| image
| alt
| caption
| constituency_MP
| parliament
| majority
| term_start
| term_end
| predecessor
| successor
| prior_term
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox MP
| honorific_prefix =
| name =
| honorific_suffix =
| image =
| alt =
| caption =
| constituency_MP = <!--Can be repeated up to eight times by adding a number-->
| parliament = <!--Can be repeated up to 16 times by adding a number-->
| majority = <!--Can be repeated up to 16 times by adding a number-->
| term_start = <!--Can be repeated up to 16 times by adding a number-->
| term_end = <!--Can be repeated up to 16 times by adding a number-->
| predecessor = <!--Can be repeated up to 16 times by adding a number-->
| successor = <!--Can be repeated up to 16 times by adding a number-->
| prior_term =
</syntaxhighlight>
''add [[#Personal data|personal data]]''
{{clear}}
===U.S. Representatives===
====U.S. Congressperson====
{{For|examples of this code in use|Template:Infobox officeholder/example#US Congressperson}}
{{Generic template demo
| honorific_prefix
| name
| honorific_suffix
| image
| alt
| state
| district
| term_start
| term_end
| predecessor
| successor
| prior_term
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox Congressman
| honorific_prefix =
| name =
| honorific_suffix =
| image =
| alt =
| state = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| district = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| term_start = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| term_end = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| predecessor = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| successor = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| prior_term =
</syntaxhighlight>
''add [[#Personal data|personal data]]''
{{clear}}
If Congressperson served as Speaker of the House add:
{{Generic template demo
| speaker
| term_start2
| term_end2
| predecessor2
| successor2
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| speaker = <!--number of office holder-->
| term_start2 =
| term_end2 =
| predecessor2 =
| successor2 =
</syntaxhighlight>
{{clear}}
If Congressman has been elected but not sworn in:
{{Generic template demo
| succeeding
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| succeeding = <!--the name of the incumbent congressman-->
</syntaxhighlight>
{{clear}}
====State Representative====
{{For|examples of this code in use|Template:Infobox officeholder/example#State Representative}}
{{Generic template demo
| honorific_prefix
| name
| honorific_suffix
| image
| alt
| state_house
| district
| term_start
| term_end
| predecessor
| successor
| prior_term
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox state representative
| honorific_prefix =
| name =
| honorific_suffix =
| image =
| alt =
| state_house = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| district = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| term_start = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| term_end = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| predecessor = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| successor = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| prior_term =
</syntaxhighlight>
''add [[#Personal data|personal data]]''
{{clear}}
For Representative from states that have an Assembly, instead of state_house use:
{{Generic template demo
| state_assembly
| district
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| state_assembly = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| district = <!--Can be repeated up to 16 times by adding a number, start at 3-->
</syntaxhighlight>
{{clear}}
For Representative from states that have a House of Delegates, instead of state_house use:
{{Generic template demo
| state_delegate
| district
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| state_delegate = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| district = <!--Can be repeated up to 16 times by adding a number, start at 3-->
</syntaxhighlight>
{{clear}}
For Representative from states that have a Legislature, instead of state_house use:
{{Generic template demo
| state_legislature
| district
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| state_legislature = <!--Can be repeated up to 16 times by adding a number, start at 3-->
| district = <!--Can be repeated up to 16 times by adding a number, start at 3-->
</syntaxhighlight>
{{clear}}
If Representative served as Speaker of the State House add:
{{Generic template demo
| speaker
| state_house
| term_start2
| term_end2
| predecessor2
| successor2
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| speaker = <!--number of office holder-->
| state_house =
| term_start2 =
| term_end2 =
| predecessor2 =
| successor2 =
</syntaxhighlight>
{{clear}}
===U.S. Senators===
====U.S. Senator====
{{For|examples of this code in use|Template:Infobox officeholder/example#US Senator}}
{{Generic template demo
| honorific_prefix
| name
| honorific_suffix
| image
| image_size
| image_upright
| alt
| jr/sr
| state
| term_start
| term_end
| predecessor
| successor
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox senator
| honorific_prefix =
| name =
| honorific_suffix =
| image =
| image_size =
| image_upright =
| alt =
| jr/sr = <!--Can be repeated up to eight times by appending 2, 3, etc--> Set to any value to display the "United States Senator from" header. If this parameter is missing or empty, "United States Senator from" will not be displayed.
| state = <!--Can be repeated up to eight times by appending 2, 3, etc-->
| term_start = <!--Can be repeated up to eight times by appending 2, 3, etc-->
| term_end = <!--Can be repeated up to eight times by appending 2, 3, etc-->
| predecessor = <!--Can be repeated up to eight times by appending 2, 3, etc-->
| successor = <!--Can be repeated up to eight times by appending 2, 3, etc-->
</syntaxhighlight>
''add [[#Personal data|personal data]]''
{{clear}}
{{Generic template demo
| term_start
| alongside
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| term_start =
| alongside = <!--the name of fellow senator-->
</syntaxhighlight>
{{clear}}
If Senator has just been elected and is a Senator-Elect:
{{Generic template demo
| succeeding
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| succeeding = <!--the name of the incumbent senator-->
</syntaxhighlight>
{{clear}}
If Senator served as Senate Majority Leader add:
{{Generic template demo
| majorityleader3
| term_start3
| term_end3
| predecessor3
| successor3
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| majorityleader3 = <!--number of office holder-->
| term_start3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| term_end3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| predecessor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| successor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
</syntaxhighlight>
{{clear}}
If Senator served as Congressman add:
{{Generic template demo
| state3
| district3
| term_start3
| term_end3
| predecessor3
| successor3
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| state3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| district3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| term_start3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| term_end3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| predecessor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| successor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
</syntaxhighlight>
{{clear}}
====State Senator====
{{For|examples of this code in use|Template:Infobox officeholder/example#State Senator}}
{{Generic template demo
| honorific_prefix
| name
| honorific_suffix
| image
| alt
| state_senate
| district
| term_start
| term_end
| predecessor
| successor
| prior_term
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox state senator
| honorific_prefix =
| name =
| honorific_suffix =
| image =
| alt =
| state_senate = <!--Can be repeated up to eight times by appending 2, 3, etc-->
| district = <!--Can be repeated up to eight times by appending 2, 3, etc-->
| term_start = <!--Can be repeated up to eight times by appending 2, 3, etc-->
| term_end = <!--Can be repeated up to eight times by appending 2, 3, etc-->
| predecessor = <!--Can be repeated up to eight times by appending 2, 3, etc-->
| successor = <!--Can be repeated up to eight times by appending 2, 3, etc-->
| prior_term =
</syntaxhighlight>
''add [[#Personal data|personal data]]''
{{clear}}
If State Senator served as Majority Leader of the State Senate add:
{{Generic template demo
| majority_leader3
| term_start3
| term_end3
| predecessor3
| successor3
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| majority_leader3 = <!--number of office holder-->
| term_start3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| term_end3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| predecessor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| successor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
</syntaxhighlight>
{{clear}}
If State Senator served as Minority Leader of the State Senate add:
{{Generic template demo
| minority_leader3
| term_start3
| term_end3
| predecessor3
| successor3
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| minority_leader3 = <!--number of office holder-->
| term_start3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| term_end3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| predecessor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| successor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
</syntaxhighlight>
{{clear}}
If State Senator served as Majority Floor Leader of the State Senate add:
{{Generic template demo
| majority_floor_leader3
| term_start3
| term_end3
| predecessor3
| successor3
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| majority_floor_leader3 = <!--number of office holder-->
| term_start3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| term_end3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| predecessor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| successor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
</syntaxhighlight>
{{clear}}
If State Senator served as Minority Floor Leader of the State Senate add:
{{Generic template demo
| minority_floor_leader3
| term_start3
| term_end3
| predecessor3
| successor3
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| minority_floor_leader3 = <!--number of office holder-->
| term_start3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| term_end3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| predecessor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
| successor3 = <!--Can be repeated up to seven times by adding a number, start at 3-->
</syntaxhighlight>
{{clear}}
===Ukrainian legislative office===
{{For|examples of this code in use|Template:Infobox officeholder/example#Ukrainian legislative office}}
{{Generic template demo
| name
| native_name
| native_name_lang
| image
| caption
| office1
| convocation1
| constituency1
| term_start1
| term_end1
| convocation2
| constituency2
| term_start2
| term_end2
| office3
| convocation3
| constituency3
| term_start3
| term_end3
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox Ukrainian legislative office
| name =
| native_name =
| native_name_lang =
| image =
| caption =
| office1 =
| convocation1 =
| constituency1 =
| term_start1 =
| term_end1 =
| convocation2 =
| constituency2 =
| term_start2 =
| term_end2 =
| office3 = <!--Can be repeated up to 16 times by adding a number-->
| convocation3 = <!--Can be repeated up to 16 times by adding a number-->
| constituency3 = <!--Can be repeated up to 16 times by adding a number-->
| term_start3 = <!--Can be repeated up to 16 times by adding a number-->
| term_end3 = <!--Can be repeated up to 16 times by adding a number-->
</syntaxhighlight>
==Personal data==
Place this underneath the template
{{Generic template demo
| pronunciation
| birth_name <!-- only use if different from name -->
| birth_date
| birth_place
| death_date
| death_place
| death_cause <!-- should only be included when the cause of death has significance for the subject's notability -->
| resting_place
| resting_place_coordinates
| citizenship <!-- use only when necessary per [[WP:INFONAT]] -->
| nationality <!-- use only when necessary per [[WP:INFONAT]] -->
| party
| otherparty
| height
| spouse <!--Fill only if notable (reference required) or there is a WP article on this person-->
| partner <!--Fill only if notable (reference required) or there is a WP article on this person-->
| relations <!--Fill only if notable (reference required) or there is a WP article on this person-->
| children <!--Fill only if notable (reference required) or there is a WP article on this person-->
| parents <!--Fill only if notable (reference required) or there is a WP article on this person-->
| mother <!--Fill only if notable (reference required) or there is a WP article on this person-->
| father <!--Fill only if notable (reference required) or there is a WP article on this person-->
| relatives <!--Fill only if notable (reference required) or there is a WP article on this person-->
| residence
| education
| alma_mater
| occupation
| profession
| salary
| known_for
| cabinet
| committees
| portfolio
| awards
| blank1
| data1
| blank2
| data2
| blank3
| data3
| blank4
| data4
| blank5
| data5
| signature
| signature_alt
| website
| nickname
| allegiance
| branch
| serviceyears
| rank
| unit
| commands
| battles
| mawards
| military_blank1
| military_data1
| military_blank2
| military_data2
| military_blank3
| military_data3
| military_blank4
| military_data4
| military_blank5
| military_data5
| module
| module2
| module3
| module4
| module5
| footnotes
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
| pronunciation =
| birth_name = <!-- only use if different from name -->
| birth_date = <!-- {{Birth date and age|YYYY|MM|DD}} -->
| birth_place =
| death_date = <!-- {{Death date and age|YYYY|MM|DD|YYYY|MM|DD}} -->
| death_place =
| death_cause = <!-- should only be included when the cause of death has significance for the subject's notability -->
| resting_place =
| resting_place_coordinates =
| citizenship = <!-- use only when necessary per [[WP:INFONAT]] -->
| nationality = <!-- use only when necessary per [[WP:INFONAT]] -->
| party =
| otherparty = <!--For additional political affiliations-->
| height = <!-- "X cm", "X m" or "X ft Y in" plus optional reference (conversions are automatic) -->
| spouse =
| partner = <!--For those with a domestic partner and not married-->
| relations =
| children =
| parents = <!-- overrides mother and father parameters -->
| mother = <!-- may be used (optionally with father parameter) in place of parents parameter (displays "Parent(s)" as label) -->
| father = <!-- may be used (optionally with mother parameter) in place of parents parameter (displays "Parent(s)" as label) -->
| relatives =
| residence =
| education =
| alma_mater =
| occupation =
| profession =
| known_for =
| salary =
| cabinet =
| committees =
| portfolio =
| awards = <!-- For civilian awards - appears as "Awards" if |mawards= is not set -->
| blank1 =
| data1 =
| blank2 =
| data2 =
| blank3 =
| data3 =
| blank4 =
| data4 =
| blank5 =
| data5 =
| signature =
| signature_alt =
| signature_size =
| website =
| nickname =
<!--Military service-->
| allegiance =
| branch =
| serviceyears =
| rank =
| unit =
| commands =
| battles =
| mawards = <!-- for military awards - appears as "Awards" if |awards= is not set -->
| military_blank1 =
| military_data1 =
| military_blank2 =
| military_data2 =
| military_blank3 =
| military_data3 =
| military_blank4 =
| military_data4 =
| military_blank5 =
| military_data5 =
<!--Embedded templates / Footnotes-->
| module =
| module2 =
| module3 =
| module4 =
| module5 =
| footnotes =
}}
</syntaxhighlight>
{{clear}}
<code>nationality</code> is [[Wikipedia:Manual of Style/Infoboxes#Nationality and citizenship|not displayed]] if the corresponding country is mentioned in <code>birth_place</code>, for example <code>|birth_place = Tokyo, Japan |nationality = Japanese</code>.
== Embedding other templates ==
The ''module'' parameters (module, module2, ... module5) may used to embed other templates into this infobox (see [[Wikipedia:Infobox modules]]).
<syntaxhighlight lang="wikitext" style="overflow: auto;">
{{Infobox officeholder
| name =
| <!-- etc. -->
| module =
{{Infobox football biography | embed = yes
| <!-- etc. -->
}}
}}
</syntaxhighlight>
== Embedding within a different infobox ==
Many officeholders are known for more than just their appointments (e.g., [[Clint Eastwood]]), and hence it may be desirable to merge this infobox with another one, like {{tl|Infobox person}}. By adding {{para|embed|yes}} to the first line of the infobox code, one can embed this infobox into another, creating the illusion of one continuous infobox. Though the process is a little complicated, it is possible to insert this infobox into most if not all other infoboxes. For {{tl|Infobox person}}, this infobox is passed as a "module" using the {{para|module}} syntax.
<syntaxhighlight lang="wikitext" style="overflow: auto">
{{Infobox person
| name = John Infobox
| image = Example.jpg
| caption = John Infobox in 2005
| birth_name = John Officeholder Person Infobox
| birth_date = {{Birth date|1950|5|25}}
| birth_place = Template City
| death_date = {{Death date and age|2010|10|22|1950|5|25}}
| occupation = Actor
| years_active = 1970–1990
| module =
{{Infobox officeholder | embed = yes
| office = Mayor of Wikipedia
| term_start = 1994
| term_end = 1998
}}
| website = {{URL|example.com}}
}}
</syntaxhighlight>
==Microformat==
{{UF-hcard-person}}
==TemplateData==
{{Collapse top|title=[[Wikipedia:TemplateData|TemplateData]] for this template used by [[mw:Extension:TemplateWizard|TemplateWizard]], [[Wikipedia:VisualEditor|VisualEditor]] and other tools}}
{{TemplateData header|noheader=1}}
<templatedata>
{
"description": "An infobox for office holders",
"format": "{{_\n| ___________________ = _\n}}\n",
"params": {
"name": {
"label": "Name",
"description": "Commonly-known name of person (defaults to article name, without disambiguation)",
"type": "line",
"default": "PAGENAME"
},
"office": {
"label": "office",
"description": "Office held",
"type": "string"
},
"order": {
"label": "order",
"description": "Used in conjunction with 'office' to state that the officeholder is the nth holder of the office",
"type": "string"
},
"bodyclass": {
"label": "bodyclass",
"type": "string"
},
"mainwidth": {
"label": "mainwidth",
"default": "22em",
"type": "string"
},
"native_name": {
"label": "Native name",
"type": "string",
"description": "Name in the person's native language",
"example": "Melquíades Rafael Martínez Ruiz"
},
"native_name_lang": {
"label": "Native name language",
"type": "string",
"description": "Language in which the person's native name is",
"example": "ca"
},
"image": {
"label": "Image",
"description": "Filename for the image (e.g. 'Example.jpg').",
"type": "wiki-file-name",
"required": false
},
"width": {
"label": "width",
"type": "string",
"aliases": [
"imagesize",
" image_size"
]
},
"alt": {
"label": "Alternative text",
"description": "Alternative text for the image.",
"type": "line"
},
"image name": {
"label": "image name",
"type": "string"
},
"smallimage": {
"label": "smallimage",
"type": "string"
},
"caption": {
"label": "Image caption",
"description": "Caption for the image.",
"type": "string",
"required": false
},
"alongside": {
"label": "alongside",
"description": "For two or more people serving in the same position from the same district. (e.g. United States senators.)",
"type": "string"
},
"ambassador_from": {
"label": "ambassador from",
"type": "string"
},
"appointer": {
"label": "appointer",
"type": "string"
},
"assembly": {
"label": "assembly",
"type": "string"
},
"chancellor": {
"label": "chancellor",
"type": "string"
},
"co-leader": {
"label": "co-leader",
"type": "string"
},
"constituency_AM": {
"label": "constituency AM",
"type": "string"
},
"constituency": {
"label": "constituency",
"type": "string"
},
"country": {
"label": "country",
"type": "string",
"example": "Israel"
},
"deputy": {
"label": "deputy",
"type": "string"
},
"district": {
"label": "district",
"type": "string"
},
"firstminister": {
"label": "first minister",
"type": "string"
},
"governor-general": {
"label": "governor-general",
"type": "string"
},
"leader": {
"label": "leader",
"type": "string"
},
"legislature": {
"label": "legislature",
"type": "wiki-page-name",
"example": "[[United States House of Representatives]]"
},
"lieutenant_governor": {
"label": "lieutenant governor",
"type": "string"
},
"lieutenant": {
"label": "lieutenant",
"type": "string"
},
"majorityleader": {
"label": "majority leader",
"type": "string"
},
"minister": {
"label": "minister",
"type": "string"
},
"minister_from": {
"label": "minister from",
"type": "string"
},
"minority_floor_leader": {
"label": "minority floor leader",
"type": "string"
},
"majority_floor_leader": {
"label": "majority floor leader",
"type": "string"
},
"minorityleader": {
"label": "minority leader",
"type": "string",
"example": "[[Chuck Shumer]]"
},
"monarch": {
"label": "monarch",
"type": "string"
},
"nominator": {
"label": "nominator",
"type": "string"
},
"parliament": {
"label": "parliament",
"type": "string"
},
"parliamentarygroup": {
"label": "parliamentary group",
"type": "string"
},
"predecessor": {
"label": "predecessor",
"type": "string"
},
"preceding": {
"label": "preceding",
"type": "string"
},
"preceded": {
"label": "preceded",
"type": "string"
},
"premier": {
"label": "premier",
"type": "string"
},
"president": {
"label": "president",
"type": "string"
},
"primeminister": {
"label": "primeminister",
"type": "string"
},
"riding": {
"label": "riding",
"type": "string"
},
"status": {
"label": "status",
"description": "If this is specified, overrides Incumbent.",
"type": "string"
},
"succeeded": {
"label": "succeeded",
"type": "string"
},
"succeeding": {
"label": "succeeding",
"description": "For President-elect or equivalent.",
"type": "string"
},
"successor": {
"label": "successor",
"type": "string"
},
"taoiseach": {
"label": "taoiseach",
"type": "string"
},
"term_start": {
"label": "term start",
"type": "string",
"description": "Date of the beginning of the person's term"
},
"term_end": {
"label": "term end",
"type": "string",
"description": "Date for the end of the person's term"
},
"title": {
"label": "title",
"type": "string"
},
"vicechair": {
"label": "vice chair",
"type": "string"
},
"vicegovernor": {
"label": "vice governor",
"type": "string"
},
"vicepresident": {
"label": "vice president",
"type": "string"
},
"vicepremier": {
"label": "vice premier",
"type": "string"
},
"viceprimeminister": {
"label": "vice prime minister",
"type": "string"
},
"speaker": {
"label": "speaker",
"type": "string"
},
"footnotes": {
"label": "footnotes",
"type": "string"
},
"date": {
"label": "date",
"type": "string"
},
"year": {
"label": "year",
"type": "string"
},
"source": {
"label": "source",
"type": "string"
},
"signature": {
"label": "signature",
"type": "wiki-file-name"
},
"signature_alt": {
"label": "signature alt text",
"type": "string"
},
"appointe": {
"label": "appointee",
"type": "string"
},
"alongside2": {
"label": "alongside 2",
"type": "string"
},
"peerage2": {
"label": "peerage 2",
"type": "string"
},
"ambassador_from2": {
"label": "ambassador from 2",
"type": "string"
},
"appointer2": {
"label": "appointer 2",
"type": "string"
},
"assembly2": {
"label": "assembly 2",
"type": "string"
},
"chancellor2": {
"label": "chancellor 2",
"type": "string"
},
"co-leader2": {
"label": "co-leader 2",
"type": "string"
},
"constituency_AM2": {
"label": "constituency AM 2",
"type": "string"
},
"country2": {
"label": "country 2",
"type": "string",
"example": "Malaya"
},
"deputy2": {
"label": "deputy 2",
"type": "string"
},
"district2": {
"label": "district 2",
"type": "string"
},
"firstminister2": {
"label": "first minister 2",
"type": "string"
},
"governor": {
"label": "governor",
"type": "string"
},
"governor-general2": {
"label": "governor-general 2",
"type": "string"
},
"governor2": {
"label": "governor 2",
"type": "string"
},
"leader2": {
"label": "leader 2",
"type": "string",
"example": "Donald Trump"
},
"legislature2": {
"label": "legislature 2",
"type": "wiki-page-name",
"example": "[[United States Senate]]"
},
"lieutenant_governor2": {
"label": "lieutenant governor 2",
"type": "string"
},
"lieutenant2": {
"label": "lieutenant2",
"type": "string"
},
"majority": {
"label": "majority",
"type": "string"
},
"majorityleader2": {
"label": "majority leader 2",
"type": "string",
"example": "Mitch McConnell"
},
"minister_from2": {
"label": "minister from 2",
"type": "string"
},
"minority_floor_leader2": {
"label": "minority floor leader 2",
"type": "string"
},
"majority_floor_leader2": {
"label": "majority floor leader 2",
"type": "string"
},
"majority2": {
"label": "majority 2",
"type": "string"
},
"minister2": {
"label": "minister 2",
"type": "string"
},
"minority": {
"label": "minority",
"type": "string"
},
"minorityleader2": {
"label": "minority leader 2",
"type": "string",
"example": "[[Chuck Shumer]]"
},
"monarch2": {
"label": "monarch 2",
"type": "string"
},
"nominator2": {
"label": "nominator 2",
"type": "string"
},
"office2": {
"label": "office 2",
"type": "string"
},
"order2": {
"label": "order 2",
"type": "string"
},
"parliament2": {
"label": "parliament2",
"type": "string"
},
"parliamentarygroup2": {
"label": "parliamentary group 2",
"type": "string"
},
"predecessor2": {
"label": "predecessor 2",
"type": "string"
},
"preceding2": {
"label": "preceding 2",
"type": "string"
},
"preceded2": {
"label": "preceded 2",
"type": "string"
},
"premier2": {
"label": "premier 2",
"type": "string"
},
"president2": {
"label": "president 2",
"type": "string"
},
"primeminister2": {
"label": "prime minister 2",
"type": "string"
},
"riding2": {
"label": "riding 2",
"type": "string"
},
"speaker_office": {
"label": "speaker office",
"type": "string"
},
"state_assembly": {
"label": "state assembly",
"type": "string"
},
"state_delegate": {
"label": "state delegate",
"type": "string"
},
"state_house": {
"label": "state house",
"type": "string"
},
"state_legislature": {
"label": "state legislature",
"type": "string"
},
"state_senate": {
"label": "state senate",
"type": "string"
},
"state": {
"label": "state",
"type": "string",
"description": "The state this officeholder represents or represented",
"example": "[[Alabama]]"
},
"term": {
"label": "term",
"type": "string"
},
"party": {
"label": "party",
"type": "string"
},
"prior_term": {
"label": "prior_term",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"1blankname": {
"label": "1blankname",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"1namedata": {
"label": "1namedata",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"2blankname": {
"label": "2blankname",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"2namedata": {
"label": "2namedata",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"3blankname": {
"label": "3blankname",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"3namedata": {
"label": "3namedata",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"4blankname": {
"label": "4blankname",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"4namedata": {
"label": "4namedata",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"5blankname": {
"label": "5blankname",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"5namedata": {
"label": "5namedata",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"1blankname1": {
"label": "1blankname1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"1namedata1": {
"label": "1namedata1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"2blankname1": {
"label": "2blankname1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"2namedata1": {
"label": "2namedata1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"3blankname1": {
"label": "3blankname1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"3namedata1": {
"label": "3namedata1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"4blankname1": {
"label": "4blankname1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"4namedata1": {
"label": "4namedata1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"5blankname1": {
"label": "5blankname1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"5namedata1": {
"label": "5namedata1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"alongside1": {
"label": "alongside1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"ambassador_from1": {
"label": "ambassador_from1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"appointer1": {
"label": "appointer1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"assembly1": {
"label": "assembly1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"chair1": {
"label": "chair1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"chancellor1": {
"label": "chancellor1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"co-leader1": {
"label": "co-leader1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"constituency_AM1": {
"label": "constituency_AM1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"constituency1": {
"label": "constituency1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"country1": {
"label": "country1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"deputy1": {
"label": "deputy1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"district1": {
"label": "district1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"firstminister1": {
"label": "firstminister1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"governor-general1": {
"label": "governor-general1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"governor1": {
"label": "governor1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"leader1": {
"label": "leader1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"legislature1": {
"label": "legislature1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"lieutenant_governor1": {
"label": "lieutenant governor 1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"lieutenant1": {
"label": "lieutenant 1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"minority_floor_leader1": {
"label": "minority floor leader 1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"minister_from1": {
"label": "minister from 1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"majority_floor_leader1": {
"label": "majority_floor_leader1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"majorityleader1": {
"label": "majorityleader1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"majority1": {
"label": "majority1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"minister1": {
"label": "minister1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"minorityleader1": {
"label": "minorityleader1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"monarch1": {
"label": "monarch1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"nominator1": {
"label": "nominator1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"office1": {
"label": "office1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"order1": {
"label": "order1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"parliament1": {
"label": "parliament1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"parliamentarygroup1": {
"label": "parliamentary group 1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"predecessor1": {
"label": "predecessor1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"preceding1": {
"label": "preceding1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"preceded1": {
"label": "preceded1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"premier1": {
"label": "premier1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"president1": {
"label": "president1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"primeminister1": {
"label": "primeminister1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"riding1": {
"label": "riding 1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state_assembly1": {
"label": "state_assembly1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state_delegate1": {
"label": "state_delegate1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state_house1": {
"label": "state_house1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state_legislature1": {
"label": "state_legislature1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state_senate1": {
"label": "state_senate1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state1": {
"label": "state1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"succeeded1": {
"label": "succeeded1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"succeeding1": {
"label": "succeeding1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"successor1": {
"label": "successor1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"taoiseach1": {
"label": "taoiseach1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"termend1": {
"label": "termend1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"termstart1": {
"label": "termstart1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"term1": {
"label": "term1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"title1": {
"label": "title1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"vicechair1": {
"label": "vicechair1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"vicegovernor1": {
"label": "vicegovernor1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"vicepresident1": {
"label": "vicepresident1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"vicepremier1": {
"label": "vicepremier1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"viceprimeminister1": {
"label": "viceprimeminister1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"prior_term1": {
"label": "prior term 1",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"termend2": {
"label": "term end 2",
"type": "string"
},
"termstart2": {
"label": "term start 2",
"type": "string"
},
"term2": {
"label": "term 2",
"type": "string"
},
"title2": {
"label": "title 2",
"type": "string"
},
"vicechair2": {
"label": "vice chair 2",
"type": "string"
},
"vicegovernor2": {
"label": "vice governor 2",
"type": "string"
},
"vicepresident2": {
"label": "vice president 2",
"type": "string"
},
"vicepremier2": {
"label": "vice premier 2",
"type": "string"
},
"viceprimeminister2": {
"label": "vice prime minister 2",
"type": "string"
},
"succeeded2": {
"label": "succeeded 2",
"type": "string"
},
"succeeding2": {
"label": "succeeding 2",
"type": "string"
},
"successor2": {
"label": "successor 2",
"type": "string"
},
"taoiseach2": {
"label": "taoiseach 2",
"type": "string"
},
"state_assembly2": {
"label": "state assembly2",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state_delegate2": {
"label": "state delegate2",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state_house2": {
"label": "state house 2",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state_legislature2": {
"label": "state legislature 2",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state_senate2": {
"label": "state senate2",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"state 2": {
"label": "state 2",
"description": "Additional fields numbered up to 14",
"type": "string",
"example": "[[Georgia (U.S. State)|Georgia]]"
},
"prior_term2": {
"label": "prior term 2",
"description": "Additional fields numbered up to 14",
"type": "string"
},
"birth_name": {
"label": "Birth name",
"description": "Name at birth, if different from 'name'.",
"type": "string",
"required": false,
"aliases": [
"birthname"
]
},
"birth_date": {
"label": "Birth date",
"description": "Date of birth. Use {{birth date and age}} (for living people) or {{birth date}} for the deceased.",
"type": "line",
"required": false
},
"birth_place": {
"label": "Birth place",
"description": "Place of birth.",
"type": "line"
},
"death_date": {
"label": "Death date",
"description": "Date of death. Use {{death date and age}}. Use {{death date}} if birth date unknown or incomplete.",
"type": "content"
},
"death_place": {
"label": "Death place",
"description": "The person's place of death, if deceased",
"type": "line",
"required": false,
"example": "[[Crown Heights]]"
},
"resting_place": {
"label": "Resting place",
"description": "Person's grave, etc.",
"type": "line",
"required": false
},
"resting_place_coordinates": {
"label": "Resting place",
"description": "Coordinates of grave, etc. Use {{Coord|LAT|LONG|type:landmark|display=inline}}",
"type": "line"
},
"citizenship": {
"label": "citizenship",
"type": "string",
"description": "The person's country of citizenship",
"example": "[[Germany]]"
},
"nationality": {
"label": "Nationality",
"description": "The person's nationality, use only when necessary per [[WP:INFONAT]]",
"type": "line",
"example": "Canadian"
},
"otherparty": {
"label": "other political party",
"type": "string"
},
"spouse": {
"label": "Spouse(s)",
"description": "Spouse(s), if notable",
"type": "line",
"required": false,
"aliases": [
"spouses"
]
},
"partner": {
"label": "Partner(s)",
"description": "Domestic partner(s), if notable",
"type": "line"
},
"relations": {
"label": "relations",
"type": "string"
},
"children": {
"label": "children",
"type": "string"
},
"parents": {
"label": "parents",
"type": "string"
},
"residence": {
"label": "Residence",
"description": "Where this person lives",
"type": "line"
},
"alma_mater": {
"label": "Alma mater",
"description": "The linked name of attended higher education institution(s).",
"type": "line"
},
"occupation": {
"label": "occupation",
"description": " Please observe sentence case and capitalise only the first letter of the first item: (i.e. Politician, entrepreneur, businessman)",
"type": "string"
},
"profession": {
"label": "profession",
"description": " Please observe sentence case and capitalise only the first letter of the first item: (i.e. Attorney, accountant)",
"type": "string"
},
"cabinet": {
"label": "cabinet",
"type": "string"
},
"committees": {
"label": "committees",
"type": "string"
},
"portfolio": {
"label": "portfolio",
"type": "string"
},
"blank1": {
"label": "blank1",
"description": "Also blank2 ... blank5",
"type": "string"
},
"data1": {
"label": "data1",
"description": "Also data2 ... data5",
"type": "string"
},
"website": {
"label": "Official website",
"description": "Office holder's official website, using {{URL}}.",
"type": "line"
},
"nickname": {
"label": "nickname",
"type": "string"
},
"allegiance": {
"label": "allegiance",
"type": "string"
},
"branch": {
"label": "branch",
"type": "string"
},
"serviceyears": {
"label": "serviceyears",
"type": "string"
},
"rank": {
"label": "rank",
"type": "string"
},
"unit": {
"label": "unit",
"type": "string"
},
"commands": {
"label": "commands",
"type": "string"
},
"battles": {
"label": "battles fought",
"type": "string"
},
"military_blank1": {
"label": "military blank 1",
"description": "Also military_blank2 ... military_blank5",
"type": "string"
},
"military_data1": {
"label": "military data 1",
"description": "Also military_data2 ... military_data5",
"type": "string"
},
"1blankname2": {
"label": "1blankname2",
"type": "string"
},
"1namedata2": {
"label": "1namedata2",
"type": "string"
},
"2blankname2": {
"label": "2blankname2",
"type": "string"
},
"2namedata2": {
"label": "2namedata2",
"type": "string"
},
"3blankname2": {
"label": "3blankname2",
"type": "string"
},
"3namedata2": {
"label": "3namedata2",
"type": "string"
},
"4blankname2": {
"label": "4blankname2",
"type": "string"
},
"4namedata2": {
"label": "4namedata2",
"type": "string"
},
"5blankname2": {
"label": "5blankname2",
"type": "string"
},
"5namedata2": {
"label": "5namedata2",
"type": "string"
},
"pronunciation": {
"label": "Name pronunciation",
"type": "string"
},
"honorific_prefix": {
"label": "Honorific prefix",
"description": "Title such as 'Sir', 'Lord'",
"type": "wiki-page-name",
"required": false,
"aliases": [
"honorific prefix"
]
},
"honorific_suffix": {
"label": "Honorific suffix",
"description": "Initials such as 'OBE', 'FRSA'",
"type": "wiki-page-name",
"required": false,
"aliases": [
"honorific suffix"
]
},
"image_size": {
"label": "Image size",
"description": "Size of the image (e.g. '220px').",
"type": "line",
"default": "varies",
"required": false,
"aliases": [
"imagesize"
]
},
"education": {
"label": "Education",
"description": "Where or with whom the officeholder trained.",
"type": "line",
"required": false
},
"awards": {
"label": "Awards",
"description": "Awards won by the officeholder. Consider using {{awd}}.",
"type": "line",
"required": false
},
"image_name_alt": {},
"smallname_alt": {},
"net_worth": {
"label": "DEPRECATED: Net worth",
"description": "Current estimated net worth, if relevant. Please be sure to support with a citation from a reliable source, in the article body.",
"deprecated": "DEPRECATED: Use of this parameter is discouraged. Delete it when encountered."
}
}
}
</templatedata>
{{Collapse bottom}}
== Tracking categories ==
'''Hidden tracking/maintenance categories (in main and supporting templates)'''
* {{clc|Biography template using pronunciation}}
* {{clc|Pages using infobox officeholder with ambassador from or minister from}}
* {{clc|Pages using infobox officeholder with both term and term_start or term_end}}
* {{clc|Pages using infobox officeholder with office0}}
* {{clc|Pages using infobox officeholder with speaker}}
* {{clc|Pages using infobox officeholder with succeeding and term or termend}}
* {{clc|Pages using infobox officeholder with unknown parameters}}
== See also ==
* [[Template:S-start]] ([[Wikipedia:WikiProject Succession Box Standardization|succession box standardization]])
'''Supporting templates'''
* [[Template:Infobox officeholder/office]]
* <!-- [[Template:Infobox officeholder/Personal data]] -->
<includeonly>{{Sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Infobox templates|Officeholder]]
[[Category:Politics and government infobox templates|Officeholder]]
[[Category:People and person infobox templates|Officeholder]]
[[Category:Infobox templates with module parameter|Officeholder]]
[[Category:Biographical templates usable as a module|Officeholder]]
[[Category:Templates that add a tracking category]]
}}</includeonly>
2172cd2acae07c73230ccb899ef236675cc4e2f7
Template:Person infobox header
10
181
354
353
2023-12-24T02:09:18Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Person_infobox_header]]
wikitext
text/x-wiki
{{ombox|type=content|text=The design and content of biographical infoboxes must follow Wikipedia's [[Wikipedia:Verifiability|verifiability policy]], as well as [[Wikipedia:Manual of Style/Infoboxes|infobox]] and [[Wikipedia:Manual of Style/Biography|biographical style guideline]].
All content displayed in this template must adhere to the '''[[Wikipedia:Biographies of living persons|biographies of living persons]]''' policy if applicable. [[Wikipedia:Citing sources|Unsourced or poorly sourced]] contentious material '''must be removed immediately''' from the article and its infobox, especially if potentially [[Wikipedia:Libel|libellous]].}}
<noinclude>
{{documentation
|content=
{{no documentation}}
{{Uncat}}
}}
</noinclude>
9f982493e161c304a75d9b6b06d5b730ee1bb282
Template:Plainlist/styles.css
10
182
356
355
2023-12-24T02:09:18Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Plainlist/styles.css]]
sanitized-css
text/css
/* {{pp-template|small=yes}} */
.plainlist ol,
.plainlist ul {
line-height: inherit;
list-style: none;
margin: 0;
padding: 0; /* Reset Minerva default */
}
.plainlist ol li,
.plainlist ul li {
margin-bottom: 0;
}
51706efa229ff8794c0d94f260a208e7c5e6ec30
Infobox
0
11
357
18
2023-12-24T02:10:17Z
Floopymichael
2
Did not mean to import this page. Meant to import the template. Oops!
wikitext
text/x-wiki
da39a3ee5e6b4b0d3255bfef95601890afd80709
Template:Infobox political party
10
183
359
358
2023-12-24T02:11:45Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Infobox_political_party]]
wikitext
text/x-wiki
<includeonly>{{#if:{{Has short description}} |<!--Do nothing--> |{{main other|{{Short description|Political party{{#if:{{{country|}}}| in {{Plain text|{{{country}}}}}}}|noreplace}}}} }}</includeonly>
{{Infobox
| bodyclass = vcard
| abovestyle = font-size: 125%;
| above = <div style="padding-top:0.3em; padding-bottom:0.3em; {{#if:{{{colorcode|}}}|border-top:2px solid {{{colorcode}}}; border-bottom:2px solid {{{colorcode}}};}} line-height: 1;"><div class="fn org">{{if empty|{{{name|}}}|{{PAGENAMEBASE}}}}</div> {{#if:{{{native_name|}}} |<div style="font-size: 0.8em; padding-top:0.3em;" class="nickname" {{#if:{{{native_name_lang|}}}|lang="{{{native_name_lang}}}"}}>{{{native_name}}}</div>}}</div>
| subheader = {{{_subheader|}}}
| imageclass = logo
| imagestyle = padding-top:.4em;padding-bottom:.3em;
| image = {{#invoke:InfoboxImage|InfoboxImage|image={{{logo|}}}|upright={{{logo_upright|0.8}}}|alt={{{logo_alt|}}}|size={{{logo_size|}}}}}
| caption = {{{caption|}}}
| headerstyle = line-height: 0.8em;
| labelstyle = line-height:1.3em;
| datastyle = line-height:1.3em;
| label1 = {{{lang1}}} name
| class1 = nickname
| data1 = {{{name_lang1|}}}
| label2 = {{{lang2}}} name
| class2 = nickname
| data2 = {{{name_lang2|}}}
| label3 = {{{lang3}}} name
| class3 = nickname
| data3 = {{{name_lang3|}}}
| label4 = {{{lang4}}} name
| class4 = nickname
| data4 = {{{name_lang4|}}}
| label5 = Abbreviation
| class5 = nickname
| data5 = {{if empty|{{{abbreviation|}}}|{{{abbr|}}}}}
| label6 = [[Party leader|Leader]]
| class6 = agent
| data6 = {{{leader|}}}
| label7 = President
| class7 = agent
| data7 = {{{president|}}}
| label8 = [[Party chair|Chair{{#if:{{{chairperson|}}}|person|{{#if:{{{chairman|}}}|man|woman}}}}]]
| class8 = agent
| data8 = {{if empty|{{{chairperson|}}}|{{{chairman|}}}|{{{chairwoman|}}}}}
| label9 = [[Party secretary|Secretary]]
| class9 = agent
| data9 = {{{secretary|}}}
| label10 = General Secretary
| class10 = agent
| data10 = {{{general_secretary|}}}
| label11 = First Secretary
| class11 = agent
| data11 = {{{first_secretary|}}}
| label12 = {{nowrap|Secretary-General}}
| class12 = agent
| data12 = {{{secretary_general|}}}
| label13 = [[Presidium]]
| class13 = agent
| data13 = {{{presidium|}}}
| label14 = Governing body
| class14 = agent
| data14 = {{{governing_body|}}}
| label15 = Standing Committee
| class15 = agent
| data15 = {{{standing_committee|}}}
| label16 = [[Party spokesperson|Spokes{{#if:{{{spokesperson|}}}|person|man}}]]
| class16 = agent
| data16 = {{if empty|{{{spokesperson|}}}|{{{spokesman|}}}}}
| label17 = {{{leader1_title|}}}
| class17 = agent
| data17 = {{{leader1_name|}}}
| label18 = {{{leader2_title|}}}
| class18 = agent
| data18 = {{{leader2_name|}}}
| label19 = {{{leader3_title|}}}
| class19 = agent
| data19 = {{{leader3_name|}}}
| label20 = {{{leader4_title|}}}
| class20 = agent
| data20 = {{{leader4_name|}}}
| label21 = {{{leader5_title|}}}
| class21 = agent
| data21 = {{{leader5_name|}}}
| label22 = {{#if:{{{founders|}}} |Founders |Founder}}
| class22 = agent
| data22 = {{if empty|{{{founders|}}}|{{{founder|}}}}}
| label23 = Founded
| data23 = {{if empty|{{{founded|}}}|{{{foundation|}}}}}
| label24 = Registered
| data24 = {{{registered|}}}
| label25 = Legali{{#if:{{{legalised|}}}|s|z}}ed
| data25 = {{if empty|{{{legalised|}}}|{{{legalized|}}}}}
| label26 = {{#if:{{{banned|}}} |Banned |Dissolved}}
| data26 = {{if empty|{{{banned|}}}|{{{dissolved|}}}|{{{dissolution|}}}}}
| label27 = Merger of
| data27 = {{{merger|}}}
| label28 = Split from
| data28 = {{{split|}}}
| label29 = Preceded by
| data29 = {{{predecessor|}}}
| label30 = Merged into
| data30 = {{{merged|}}}
| label31 = Succeeded by
| data31 = {{{successor|}}}
| label32 = Headquarters
| class32 = label
| data32 = {{{headquarters|}}}
| label33 = Newspaper
| data33 = {{{newspaper|}}}
| label34 = [[Think tank]]
| data34 = {{if empty|{{{think tank|}}}|{{{think_tank|}}}}}
| label35 = [[Student wing]]
| data35 = {{{student_wing|}}}
| label36 = [[Youth wing]]
| data36 = {{{youth_wing|}}}
| label37 = [[Women's wing]]
| data37 = {{{womens_wing|}}}
| label38 = {{{wing1_title}}}
| data38 = {{{wing1|}}}
| label39 = {{{wing2_title}}}
| data39 = {{{wing2|}}}
| label40 = {{{wing3_title}}}
| data40 = {{{wing3|}}}
| label41 = {{{wing4_title}}}
| data41 = {{{wing4|}}}
| label42 = Membership {{#if:{{{membership_year|}}} |{{nobold|({{{membership_year}}})}}}}
| data42 = {{{membership|}}}
| label43 = [[List of political ideologies|Ideology]]
| class43 = category
| data43 = {{{ideology|}}}
| label44 = [[Political spectrum|Political position]]
| class44 = category
| data44 = {{{position|}}}
| label45 = Religion
| class45 = category
| data45 = {{{religion|}}}
| label46 = National affiliation
| class46 = category
| data46 = {{{national|}}}
| label47 = Regional affiliation
| class47 = category
| data47 = {{if empty|{{{regional|}}}|{{{regional affiliation|}}}}}
| label48 = [[European political party|European affiliation]]
| class48 = category
| data48 = {{{european|}}}
| label49 = Continental affiliation
| class49 = category
| data49 = {{if empty|{{{continental|}}}|{{{continental affiliation|}}}}}
| label50 = International affiliation
| class50 = category
| data50 = {{{international|}}}
| label51 = [[Political groups of the European Parliament|European Parliament group]]
| class51 = category
| data51 = {{{europarl|}}}
| label52 = {{{affiliation1_title}}}
| class52 = category
| data52 = {{#if:{{{affiliation1_title|}}}|{{{affiliation1|}}}}}
| label53 = {{{affiliation2_title}}}
| class53 = category
| data53 = {{#if:{{{affiliation2_title|}}}|{{{affiliation2|}}}}}
| label54 = Colo{{#if:{{{colours|}}}|u|}}rs
| data54 = {{{colo{{#if:{{{colours|}}}|u|}}rs|}}}
| label55 = Slogan
| data55 = {{{slogan|}}}
| label56 = Anthem
| data56 = {{{anthem|}}}
| label57 = {{{blank1_title|}}}
| data57 = {{{blank1|}}}
| label58 = {{{blank2_title|}}}
| data58 = {{{blank2|}}}
| label59 = {{{blank3_title|}}}
| data59 = {{{blank3|}}}
| label60 = {{{blank4_title|}}}
| data60 = {{{blank4|}}}
| label61 = {{{seats1_title|}}}
| data61 = {{{seats1|}}}
| label62 = {{{seats2_title|}}}
| data62 = {{{seats2|}}}
| label63 = {{{seats3_title|}}}
| data63 = {{{seats3|}}}
| label64 = {{{seats4_title|}}}
| data64 = {{{seats4|}}}
| label65 = {{{seats5_title|}}}
| data65 = {{{seats5|}}}
| label66 = {{{seats6_title|}}}
| data66 = {{{seats6|}}}
| label67 = {{{seats7_title|}}}
| data67 = {{{seats7|}}}
| label68 = {{{seats8_title|}}}
| data68 = {{{seats8|}}}
| label69 = {{{seats9_title|}}}
| data69 = {{{seats9|}}}
| label70 = {{{seats10_title|}}}
| data70 = {{{seats10|}}}
| label71 = {{{seats11_title|}}}
| data71 = {{{seats11|}}}
| header72 = {{#if:{{{symbol|}}} |Election symbol}}
| data73 = {{{symbol|}}}
| header74 = {{#if:{{{flag|}}} |{{{flag_title|Party flag}}}}}
| data75 = {{#invoke:InfoboxImage|InfoboxImage|image={{{flag|}}}|upright=0.8|alt={{if empty|{{{flag_alt|}}}|{{{flag_title|}}}}}}}
| header76 = {{#if:{{{website|}}} |Website}}
| data77 = {{{website|}}}
| belowstyle = padding-top:0;
| below = {{#if:{{{state|}}}{{{country|}}}
| {{Hlist |style=line-height:1.3em; padding-top:0.3em; border-top:{{#if:{{{colorcode|}}}|2|1}}px solid {{{colorcode|#aaa}}};
| {{#if:{{{country_dab1|}}}
| {{#ifexist: {{{country_dab1|}}} | [[{{{country_dab1}}}|Politics of {{if empty|{{{state|}}}|{{{country}}}}}]] }}
| {{#ifexist: Politics of {{if empty|{{{state|}}}|{{{country}}}}} | [[Politics of {{if empty|{{{state|}}}|{{{country}}}}}]] }}
}}
| {{#if:{{{parties_dab1|}}}
| {{#ifexist: {{{parties_dab1|}}} | [[{{{parties_dab1}}}|Political parties]] }}
| {{#ifexist: List of political parties in {{if empty|{{{state|}}}|{{{country}}}}} | [[List of political parties in {{if empty|{{{state|}}}|{{{country}}}}}|Political parties]] }}
}}
| {{#if:{{{elections_dab1|}}}
| {{#ifexist: {{{elections_dab1}}} | [[{{{elections_dab1}}}|Elections]] }}
| {{#ifexist: Elections in {{if empty|{{{state|}}}|{{{country}}}}} | [[Elections in {{if empty|{{{state|}}}|{{{country}}}}}|Elections]]}}
}}
}}<!--
-->{{#if:{{{country2|}}}
| {{Hlist |style=line-height:1.3em; margin-top:0.2em; padding-top:0.2em; border-top: 1px solid #aaa;
| {{#if:{{{country_dab2|}}}
| {{#ifexist: {{{country_dab2|}}} | [[{{{country_dab2}}}|Politics of {{{country2}}}]] }}
| {{#ifexist: Politics of {{{country2}}} | [[Politics of {{{country2}}}]] }}
}}
| {{#if:{{{parties_dab1|}}}
| {{#ifexist: {{{parties_dab2|}}} | [[{{{parties_dab2}}}|Political parties]] }}
| {{#ifexist: List of political parties in {{{country2}}} | [[List of political parties in {{{country2}}}|Political parties]] }}
}}
| {{#if:{{{elections_dab1|}}}
| {{#ifexist: {{{elections_dab2}}} | [[{{{elections_dab2}}}|Elections]] }}
| {{#ifexist: Elections in {{{country2}}} | [[Elections in {{{country2}}}|Elections]]}}
}}
}} }} }}<!--
-->{{#if:{{{footnotes|}}} |<hr/>{{{footnotes}}} }}
}}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox political party with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox political party]] with unknown parameter "_VALUE_"|ignoreblank=y| _subheader | abbr | abbreviation | affiliation1 | affiliation1_title | affiliation2 | affiliation2_title | anthem | banned | blank1 | blank1_title | blank2 | blank2_title | blank3 | blank3_title | blank4 | blank4_title | caption | categories | chairman | chairperson | chairwoman | colorcode | colors | colours | continental | continental affiliation | country | country_dab1 | country_dab2 | country2 | demo | dissolution | dissolved | elections_dab1 | elections_dab2 | europarl | european | first_secretary | flag | flag_alt | flag_title | footnotes | foundation | founded | founder | founders | general_secretary | governing_body | headquarters | ideology | international | lang1 | lang2 | lang3 | lang4 | leader | leader1_name | leader1_title | leader2_name | leader2_title | leader3_name | leader3_title | leader4_name | leader4_title | leader5_name | leader5_title | legalised | legalized | logo | logo_alt | logo_size | logo_upright | membership | membership_year | merged | merger | name | name_lang1 | name_lang2 | name_lang3 | name_lang4 | national | native_name | native_name_lang | newspaper | nocat | parties_dab1 | parties_dab2 | position | predecessor | president | presidium | regional | regional affiliation | registered | religion | seats1 | seats1_title | seats10 | seats10_title | seats11 | seats11_title | seats2 | seats2_title | seats3 | seats3_title | seats4 | seats4_title | seats5 | seats5_title | seats6 | seats6_title | seats7 | seats7_title | seats8 | seats8_title | seats9 | seats9_title | secretary | secretary_general | slogan | split | spokesman | spokesperson | standing_committee | state | student_wing | successor | symbol | think tank | think_tank | website | wing1 | wing1_title | wing2 | wing2_title | wing3 | wing3_title | wing4 | wing4_title | womens_wing | youth_wing
}}<noinclude>
{{Documentation}}
</noinclude>
8b587d5ac78b0131b82ed669ff04f80ed06765f8
Template:Yesno-yes
10
184
361
360
2023-12-24T02:11:48Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Yesno-yes]]
wikitext
text/x-wiki
{{SAFESUBST:<noinclude />yesno|{{{1}}}|yes={{{yes|yes}}}|no={{{no|no}}}|blank={{{blank|yes}}}|¬={{{¬|yes}}}|def={{{def|yes}}}}}<noinclude>
{{Documentation|Template:Yesno/doc}}
<!--Categories go in the doc page referenced above; interwikis go in Wikidata.-->
</noinclude>
1644b79058ef2cece539a411edc164d98bb11ebe
Template:Hlist
10
185
363
362
2023-12-24T02:11:49Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Hlist]]
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:list|horizontal}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
9e3824c2e3c0e0dbef2f37556ac0b994987fecf9
Template:If empty
10
186
365
364
2023-12-24T02:11:54Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:If_empty]]
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:If empty|main}}<noinclude>{{Documentation}}</noinclude>
745940b7bdde8a1585c887ee4ee5ce81d98461a4
Module:If empty
828
187
367
366
2023-12-24T02:11:54Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:If_empty]]
Scribunto
text/plain
local p = {}
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:If empty', removeBlanks = false})
for k,v in ipairs(args) do
if v ~= '' then
return v
end
end
end
return p
4790391408957dea3ff9f453834c05f6b379a45c
Template:Has short description
10
188
369
368
2023-12-24T02:11:55Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Has_short_description]]
wikitext
text/x-wiki
{{#invoke:string2 |findpagetext |text={%{ *[Ss]hort description |plain=false |title={{{title|{{{1|}}} }}} }}<noinclude>
{{documentation}}
</noinclude>
87587209a436a4c02ef7564ffe868c4348cc6a3c
Module:String2
828
189
371
370
2023-12-24T02:11:55Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:String2]]
Scribunto
text/plain
local p = {}
p.trim = function(frame)
return mw.text.trim(frame.args[1] or "")
end
p.sentence = function (frame)
-- {{lc:}} is strip-marker safe, string.lower is not.
frame.args[1] = frame:callParserFunction('lc', frame.args[1])
return p.ucfirst(frame)
end
p.ucfirst = function (frame )
local s = mw.text.trim( frame.args[1] or "" )
local s1 = ""
-- if it's a list chop off and (store as s1) everything up to the first <li>
local lipos = mw.ustring.find(s, "<li>" )
if lipos then
s1 = mw.ustring.sub(s, 1, lipos + 3)
s = mw.ustring.sub(s, lipos + 4)
end
-- s1 is either "" or the first part of the list markup, so we can continue
-- and prepend s1 to the returned string
local letterpos
if mw.ustring.find(s, "^%[%[[^|]+|[^%]]+%]%]") then
-- this is a piped wikilink, so we capitalise the text, not the pipe
local _
_, letterpos = mw.ustring.find(s, "|%W*%w") -- find the first letter after the pipe
else
letterpos = mw.ustring.find(s, '%w')
end
if letterpos then
local first = mw.ustring.sub(s, 1, letterpos - 1)
local letter = mw.ustring.sub(s, letterpos, letterpos)
local rest = mw.ustring.sub(s, letterpos + 1)
return s1 .. first .. mw.ustring.upper(letter) .. rest
else
return s1 .. s
end
end
p.title = function (frame )
-- http://grammar.yourdictionary.com/capitalization/rules-for-capitalization-in-titles.html
-- recommended by The U.S. Government Printing Office Style Manual:
-- "Capitalize all words in titles of publications and documents,
-- except a, an, the, at, by, for, in, of, on, to, up, and, as, but, or, and nor."
local alwayslower = {['a'] = 1, ['an'] = 1, ['the'] = 1,
['and'] = 1, ['but'] = 1, ['or'] = 1, ['for'] = 1,
['nor'] = 1, ['on'] = 1, ['in'] = 1, ['at'] = 1, ['to'] = 1,
['from'] = 1, ['by'] = 1, ['of'] = 1, ['up'] = 1 }
local res = ''
local s = mw.text.trim( frame.args[1] or "" )
local words = mw.text.split( s, " ")
for i, s in ipairs(words) do
-- {{lc:}} is strip-marker safe, string.lower is not.
s = frame:callParserFunction('lc', s)
if i == 1 or alwayslower[s] ~= 1 then
s = mw.getContentLanguage():ucfirst(s)
end
words[i] = s
end
return table.concat(words, " ")
end
-- findlast finds the last item in a list
-- the first unnamed parameter is the list
-- the second, optional unnamed parameter is the list separator (default = comma space)
-- returns the whole list if separator not found
p.findlast = function(frame)
local s = mw.text.trim( frame.args[1] or "" )
local sep = frame.args[2] or ""
if sep == "" then sep = ", " end
local pattern = ".*" .. sep .. "(.*)"
local a, b, last = s:find(pattern)
if a then
return last
else
return s
end
end
-- stripZeros finds the first number and strips leading zeros (apart from units)
-- e.g "0940" -> "940"; "Year: 0023" -> "Year: 23"; "00.12" -> "0.12"
p.stripZeros = function(frame)
local s = mw.text.trim(frame.args[1] or "")
local n = tonumber( string.match( s, "%d+" ) ) or ""
s = string.gsub( s, "%d+", n, 1 )
return s
end
-- nowiki ensures that a string of text is treated by the MediaWiki software as just a string
-- it takes an unnamed parameter and trims whitespace, then removes any wikicode
p.nowiki = function(frame)
local str = mw.text.trim(frame.args[1] or "")
return mw.text.nowiki(str)
end
-- split splits text at boundaries specified by separator
-- and returns the chunk for the index idx (starting at 1)
-- #invoke:String2 |split |text |separator |index |true/false
-- #invoke:String2 |split |txt=text |sep=separator |idx=index |plain=true/false
-- if plain is false/no/0 then separator is treated as a Lua pattern - defaults to plain=true
p.split = function(frame)
local args = frame.args
if not(args[1] or args.txt) then args = frame:getParent().args end
local txt = args[1] or args.txt or ""
if txt == "" then return nil end
local sep = (args[2] or args.sep or ""):gsub('"', '')
local idx = tonumber(args[3] or args.idx) or 1
local plain = (args[4] or args.plain or "true"):sub(1,1)
plain = (plain ~= "f" and plain ~= "n" and plain ~= "0")
local splittbl = mw.text.split( txt, sep, plain )
if idx < 0 then idx = #splittbl + idx + 1 end
return splittbl[idx]
end
-- val2percent scans through a string, passed as either the first unnamed parameter or |txt=
-- it converts each number it finds into a percentage and returns the resultant string.
p.val2percent = function(frame)
local args = frame.args
if not(args[1] or args.txt) then args = frame:getParent().args end
local txt = mw.text.trim(args[1] or args.txt or "")
if txt == "" then return nil end
local function v2p (x)
x = (tonumber(x) or 0) * 100
if x == math.floor(x) then x = math.floor(x) end
return x .. "%"
end
txt = txt:gsub("%d[%d%.]*", v2p) -- store just the string
return txt
end
-- one2a scans through a string, passed as either the first unnamed parameter or |txt=
-- it converts each occurrence of 'one ' into either 'a ' or 'an ' and returns the resultant string.
p.one2a = function(frame)
local args = frame.args
if not(args[1] or args.txt) then args = frame:getParent().args end
local txt = mw.text.trim(args[1] or args.txt or "")
if txt == "" then return nil end
txt = txt:gsub(" one ", " a "):gsub("^one", "a"):gsub("One ", "A "):gsub("a ([aeiou])", "an %1"):gsub("A ([aeiou])", "An %1")
return txt
end
-- findpagetext returns the position of a piece of text in a page
-- First positional parameter or |text is the search text
-- Optional parameter |title is the page title, defaults to current page
-- Optional parameter |plain is either true for plain search (default) or false for Lua pattern search
-- Optional parameter |nomatch is the return value when no match is found; default is nil
p._findpagetext = function(args)
-- process parameters
local nomatch = args.nomatch or ""
if nomatch == "" then nomatch = nil end
--
local text = mw.text.trim(args[1] or args.text or "")
if text == "" then return nil end
--
local title = args.title or ""
local titleobj
if title == "" then
titleobj = mw.title.getCurrentTitle()
else
titleobj = mw.title.new(title)
end
--
local plain = args.plain or ""
if plain:sub(1, 1) == "f" then plain = false else plain = true end
-- get the page content and look for 'text' - return position or nomatch
local content = titleobj and titleobj:getContent()
return content and mw.ustring.find(content, text, 1, plain) or nomatch
end
p.findpagetext = function(frame)
local args = frame.args
local pargs = frame:getParent().args
for k, v in pairs(pargs) do
args[k] = v
end
if not (args[1] or args.text) then return nil end
-- just the first value
return (p._findpagetext(args))
end
-- returns the decoded url. Inverse of parser function {{urlencode:val|TYPE}}
-- Type is:
-- QUERY decodes + to space (default)
-- PATH does no extra decoding
-- WIKI decodes _ to space
p._urldecode = function(url, type)
url = url or ""
type = (type == "PATH" or type == "WIKI") and type
return mw.uri.decode( url, type )
end
-- {{#invoke:String2|urldecode|url=url|type=type}}
p.urldecode = function(frame)
return mw.uri.decode( frame.args.url, frame.args.type )
end
-- what follows was merged from Module:StringFunc
-- helper functions
p._GetParameters = require('Module:GetParameters')
-- Argument list helper function, as per Module:String
p._getParameters = p._GetParameters.getParameters
-- Escape Pattern helper function so that all characters are treated as plain text, as per Module:String
function p._escapePattern( pattern_str)
return mw.ustring.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" )
end
-- Helper Function to interpret boolean strings, as per Module:String
p._getBoolean = p._GetParameters.getBoolean
--[[
Strip
This function Strips characters from string
Usage:
{{#invoke:String2|strip|source_string|characters_to_strip|plain_flag}}
Parameters
source: The string to strip
chars: The pattern or list of characters to strip from string, replaced with ''
plain: A flag indicating that the chars should be understood as plain text. defaults to true.
Leading and trailing whitespace is also automatically stripped from the string.
]]
function p.strip( frame )
local new_args = p._getParameters( frame.args, {'source', 'chars', 'plain'} )
local source_str = new_args['source'] or ''
local chars = new_args['chars'] or '' or 'characters'
source_str = mw.text.trim(source_str)
if source_str == '' or chars == '' then
return source_str
end
local l_plain = p._getBoolean( new_args['plain'] or true )
if l_plain then
chars = p._escapePattern( chars )
end
local result
result = mw.ustring.gsub(source_str, "["..chars.."]", '')
return result
end
--[[
Match any
Returns the index of the first given pattern to match the input. Patterns must be consecutively numbered.
Returns the empty string if nothing matches for use in {{#if:}}
Usage:
{{#invoke:String2|matchAll|source=123 abc|456|abc}} returns '2'.
Parameters:
source: the string to search
plain: A flag indicating that the patterns should be understood as plain text. defaults to true.
1, 2, 3, ...: the patterns to search for
]]
function p.matchAny(frame)
local source_str = frame.args['source'] or error('The source parameter is mandatory.')
local l_plain = p._getBoolean( frame.args['plain'] or true )
for i = 1, math.huge do
local pattern = frame.args[i]
if not pattern then return '' end
if mw.ustring.find(source_str, pattern, 1, l_plain) then
return tostring(i)
end
end
end
--[[--------------------------< H Y P H E N _ T O _ D A S H >--------------------------------------------------
Converts a hyphen to a dash under certain conditions. The hyphen must separate
like items; unlike items are returned unmodified. These forms are modified:
letter - letter (A - B)
digit - digit (4-5)
digit separator digit - digit separator digit (4.1-4.5 or 4-1-4-5)
letterdigit - letterdigit (A1-A5) (an optional separator between letter and
digit is supported – a.1-a.5 or a-1-a-5)
digitletter - digitletter (5a - 5d) (an optional separator between letter and
digit is supported – 5.a-5.d or 5-a-5-d)
any other forms are returned unmodified.
str may be a comma- or semicolon-separated list
]]
function p.hyphen_to_dash( str, spacing )
if (str == nil or str == '') then
return str
end
local accept
str = mw.text.decode(str, true ) -- replace html entities with their characters; semicolon mucks up the text.split
local out = {}
local list = mw.text.split (str, '%s*[,;]%s*') -- split str at comma or semicolon separators if there are any
for _, item in ipairs (list) do -- for each item in the list
item = mw.text.trim(item) -- trim whitespace
item, accept = item:gsub ('^%(%((.+)%)%)$', '%1')
if accept == 0 and mw.ustring.match (item, '^%w*[%.%-]?%w+%s*[%-–—]%s*%w*[%.%-]?%w+$') then -- if a hyphenated range or has endash or emdash separators
if item:match ('^%a+[%.%-]?%d+%s*%-%s*%a+[%.%-]?%d+$') or -- letterdigit hyphen letterdigit (optional separator between letter and digit)
item:match ('^%d+[%.%-]?%a+%s*%-%s*%d+[%.%-]?%a+$') or -- digitletter hyphen digitletter (optional separator between digit and letter)
item:match ('^%d+[%.%-]%d+%s*%-%s*%d+[%.%-]%d+$') or -- digit separator digit hyphen digit separator digit
item:match ('^%d+%s*%-%s*%d+$') or -- digit hyphen digit
item:match ('^%a+%s*%-%s*%a+$') then -- letter hyphen letter
item = item:gsub ('(%w*[%.%-]?%w+)%s*%-%s*(%w*[%.%-]?%w+)', '%1–%2') -- replace hyphen, remove extraneous space characters
else
item = mw.ustring.gsub (item, '%s*[–—]%s*', '–') -- for endash or emdash separated ranges, replace em with en, remove extraneous whitespace
end
end
table.insert (out, item) -- add the (possibly modified) item to the output table
end
local temp_str = table.concat (out, ',' .. spacing) -- concatenate the output table into a comma separated string
temp_str, accept = temp_str:gsub ('^%(%((.+)%)%)$', '%1') -- remove accept-this-as-written markup when it wraps all of concatenated out
if accept ~= 0 then
temp_str = str:gsub ('^%(%((.+)%)%)$', '%1') -- when global markup removed, return original str; do it this way to suppress boolean second return value
end
return temp_str
end
function p.hyphen2dash( frame )
local str = frame.args[1] or ''
local spacing = frame.args[2] or ' ' -- space is part of the standard separator for normal spacing (but in conjunction with templates r/rp/ran we may need a narrower spacing
return p.hyphen_to_dash(str, spacing)
end
-- Similar to [[Module:String#endswith]]
function p.startswith(frame)
return (frame.args[1]:sub(1, frame.args[2]:len()) == frame.args[2]) and 'yes' or ''
end
return p
418f407ee2454811910e333a13523afc975fa40c
Module:GetParameters
828
190
373
372
2023-12-24T02:11:56Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:GetParameters]]
Scribunto
text/plain
local p = {}
--[[
Helper function that populates the argument list given that user may need to use a mix of
named and unnamed parameters. This is relevant because named parameters are not
identical to unnamed parameters due to string trimming, and when dealing with strings
we sometimes want to either preserve or remove that whitespace depending on the application.
]]
function p.getParameters( frame_args, arg_list )
local new_args = {};
local index = 1;
local value;
for i,arg in ipairs( arg_list ) do
value = frame_args[arg]
if value == nil then
value = frame_args[index];
index = index + 1;
end
new_args[arg] = value;
end
return new_args;
end
--[[
Helper Function to interpret boolean strings
]]
function p.getBoolean( boolean_str )
local boolean_value;
if type( boolean_str ) == 'string' then
boolean_str = boolean_str:lower();
if boolean_str == 'false' or boolean_str == 'no' or boolean_str == '0'
or boolean_str == '' then
boolean_value = false;
else
boolean_value = true;
end
elseif type( boolean_str ) == 'boolean' then
boolean_value = boolean_str;
else
error( 'No boolean value found' );
end
return boolean_value
end
function p.defined(frame)
local arg = mw.text.trim(frame.args[1])
--if arg == tostring(tonumber(arg)) then -- undesired result for '-0'
-- arg = tonumber(arg)
--end
--if mw.ustring.find(arg, '^%s*-?[1-9][0-9]*%s*$') ~= nil or arg == '0' then
-- arg = tonumber(arg)
--end
if mw.ustring.find(arg, '^-?[1-9][0-9]*$') ~= nil then
arg = tonumber(arg)
elseif arg == '0' then
arg = 0
end
return frame:getParent().args[arg] ~= nil
end
return p
00e952f0ee8f6ea68e990d589dfb15e7d4036623
Template:Longitem
10
191
375
374
2023-12-24T02:11:56Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Longitem]]
wikitext
text/x-wiki
<noinclude>{{#tag: code|
</noinclude>{{#ifeq: {{{1|+}}} | {{{1|-}}} | <div style="}}display: inline-block; line-height: 1.2em; padding: .1em 0; {{#ifeq: {{{1|+}}} | {{{1|-}}} | {{{style|}}}">{{{1|}}}</div> | <includeonly>width: 100%;</includeonly> }}<includeonly>{{#if:{{{2|}}}|[[Category:Pages using Template:Longitem with unnamed style parameter]]}}</includeonly><noinclude>
|lang=wikitext}}
{{documentation}}
</noinclude>
2919b818deb36b243e9f9517917cbcfaa2c8d4ec
Template:Navbox
10
192
377
376
2023-12-24T02:11:57Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Navbox]]
wikitext
text/x-wiki
<includeonly>{{#invoke:Navbox|navbox}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
fe9b964401f895918ee4fe078678f1722a3c41ec
Module:Navbox
828
193
379
378
2023-12-24T02:11:59Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Navbox]]
Scribunto
text/plain
require('strict')
local p = {}
local navbar = require('Module:Navbar')._navbar
local cfg = mw.loadData('Module:Navbox/configuration')
local getArgs -- lazily initialized
local args
local format = string.format
local function striped(wikitext, border)
-- Return wikitext with markers replaced for odd/even striping.
-- Child (subgroup) navboxes are flagged with a category that is removed
-- by parent navboxes. The result is that the category shows all pages
-- where a child navbox is not contained in a parent navbox.
local orphanCat = cfg.category.orphan
if border == cfg.keyword.border_subgroup and args[cfg.arg.orphan] ~= cfg.keyword.orphan_yes then
-- No change; striping occurs in outermost navbox.
return wikitext .. orphanCat
end
local first, second = cfg.class.navbox_odd_part, cfg.class.navbox_even_part
if args[cfg.arg.evenodd] then
if args[cfg.arg.evenodd] == cfg.keyword.evenodd_swap then
first, second = second, first
else
first = args[cfg.arg.evenodd]
second = first
end
end
local changer
if first == second then
changer = first
else
local index = 0
changer = function (code)
if code == '0' then
-- Current occurrence is for a group before a nested table.
-- Set it to first as a valid although pointless class.
-- The next occurrence will be the first row after a title
-- in a subgroup and will also be first.
index = 0
return first
end
index = index + 1
return index % 2 == 1 and first or second
end
end
local regex = orphanCat:gsub('([%[%]])', '%%%1')
return (wikitext:gsub(regex, ''):gsub(cfg.marker.regex, changer)) -- () omits gsub count
end
local function processItem(item, nowrapitems)
if item:sub(1, 2) == '{|' then
-- Applying nowrap to lines in a table does not make sense.
-- Add newlines to compensate for trim of x in |parm=x in a template.
return '\n' .. item ..'\n'
end
if nowrapitems == cfg.keyword.nowrapitems_yes then
local lines = {}
for line in (item .. '\n'):gmatch('([^\n]*)\n') do
local prefix, content = line:match('^([*:;#]+)%s*(.*)')
if prefix and not content:match(cfg.pattern.nowrap) then
line = format(cfg.nowrap_item, prefix, content)
end
table.insert(lines, line)
end
item = table.concat(lines, '\n')
end
if item:match('^[*:;#]') then
return '\n' .. item ..'\n'
end
return item
end
local function has_navbar()
return args[cfg.arg.navbar] ~= cfg.keyword.navbar_off
and args[cfg.arg.navbar] ~= cfg.keyword.navbar_plain
and (
args[cfg.arg.name]
or mw.getCurrentFrame():getParent():getTitle():gsub(cfg.pattern.sandbox, '')
~= cfg.pattern.navbox
)
end
local function renderNavBar(titleCell)
if has_navbar() then
titleCell:wikitext(navbar{
[cfg.navbar.name] = args[cfg.arg.name],
[cfg.navbar.mini] = 1,
[cfg.navbar.fontstyle] = (args[cfg.arg.basestyle] or '') .. ';' ..
(args[cfg.arg.titlestyle] or '') ..
';background:none transparent;border:none;box-shadow:none;padding:0;'
})
end
end
local function renderTitleRow(tbl)
if not args[cfg.arg.title] then return end
local titleRow = tbl:tag('tr')
local titleCell = titleRow:tag('th'):attr('scope', 'col')
local titleColspan = 2
if args[cfg.arg.imageleft] then titleColspan = titleColspan + 1 end
if args[cfg.arg.image] then titleColspan = titleColspan + 1 end
titleCell
:cssText(args[cfg.arg.basestyle])
:cssText(args[cfg.arg.titlestyle])
:addClass(cfg.class.navbox_title)
:attr('colspan', titleColspan)
renderNavBar(titleCell)
titleCell
:tag('div')
-- id for aria-labelledby attribute
:attr('id', mw.uri.anchorEncode(args[cfg.arg.title]))
:addClass(args[cfg.arg.titleclass])
:css('font-size', '114%')
:css('margin', '0 4em')
:wikitext(processItem(args[cfg.arg.title]))
end
local function getAboveBelowColspan()
local ret = 2
if args[cfg.arg.imageleft] then ret = ret + 1 end
if args[cfg.arg.image] then ret = ret + 1 end
return ret
end
local function renderAboveRow(tbl)
if not args[cfg.arg.above] then return end
tbl:tag('tr')
:tag('td')
:addClass(cfg.class.navbox_abovebelow)
:addClass(args[cfg.arg.aboveclass])
:cssText(args[cfg.arg.basestyle])
:cssText(args[cfg.arg.abovestyle])
:attr('colspan', getAboveBelowColspan())
:tag('div')
-- id for aria-labelledby attribute, if no title
:attr('id', (not args[cfg.arg.title]) and mw.uri.anchorEncode(args[cfg.arg.above]) or nil)
:wikitext(processItem(args[cfg.arg.above], args[cfg.arg.nowrapitems]))
end
local function renderBelowRow(tbl)
if not args[cfg.arg.below] then return end
tbl:tag('tr')
:tag('td')
:addClass(cfg.class.navbox_abovebelow)
:addClass(args[cfg.arg.belowclass])
:cssText(args[cfg.arg.basestyle])
:cssText(args[cfg.arg.belowstyle])
:attr('colspan', getAboveBelowColspan())
:tag('div')
:wikitext(processItem(args[cfg.arg.below], args[cfg.arg.nowrapitems]))
end
local function renderListRow(tbl, index, listnum, listnums_size)
local row = tbl:tag('tr')
if index == 1 and args[cfg.arg.imageleft] then
row
:tag('td')
:addClass(cfg.class.noviewer)
:addClass(cfg.class.navbox_image)
:addClass(args[cfg.arg.imageclass])
:css('width', '1px') -- Minimize width
:css('padding', '0 2px 0 0')
:cssText(args[cfg.arg.imageleftstyle])
:attr('rowspan', listnums_size)
:tag('div')
:wikitext(processItem(args[cfg.arg.imageleft]))
end
local group_and_num = format(cfg.arg.group_and_num, listnum)
local groupstyle_and_num = format(cfg.arg.groupstyle_and_num, listnum)
if args[group_and_num] then
local groupCell = row:tag('th')
-- id for aria-labelledby attribute, if lone group with no title or above
if listnum == 1 and not (args[cfg.arg.title] or args[cfg.arg.above] or args[cfg.arg.group2]) then
groupCell
:attr('id', mw.uri.anchorEncode(args[cfg.arg.group1]))
end
groupCell
:attr('scope', 'row')
:addClass(cfg.class.navbox_group)
:addClass(args[cfg.arg.groupclass])
:cssText(args[cfg.arg.basestyle])
-- If groupwidth not specified, minimize width
:css('width', args[cfg.arg.groupwidth] or '1%')
groupCell
:cssText(args[cfg.arg.groupstyle])
:cssText(args[groupstyle_and_num])
:wikitext(args[group_and_num])
end
local listCell = row:tag('td')
if args[group_and_num] then
listCell
:addClass(cfg.class.navbox_list_with_group)
else
listCell:attr('colspan', 2)
end
if not args[cfg.arg.groupwidth] then
listCell:css('width', '100%')
end
local rowstyle -- usually nil so cssText(rowstyle) usually adds nothing
if index % 2 == 1 then
rowstyle = args[cfg.arg.oddstyle]
else
rowstyle = args[cfg.arg.evenstyle]
end
local list_and_num = format(cfg.arg.list_and_num, listnum)
local listText = args[list_and_num]
local oddEven = cfg.marker.oddeven
if listText:sub(1, 12) == '</div><table' then
-- Assume list text is for a subgroup navbox so no automatic striping for this row.
oddEven = listText:find(cfg.pattern.navbox_title) and cfg.marker.restart or cfg.class.navbox_odd_part
end
local liststyle_and_num = format(cfg.arg.liststyle_and_num, listnum)
local listclass_and_num = format(cfg.arg.listclass_and_num, listnum)
listCell
:css('padding', '0')
:cssText(args[cfg.arg.liststyle])
:cssText(rowstyle)
:cssText(args[liststyle_and_num])
:addClass(cfg.class.navbox_list)
:addClass(cfg.class.navbox_part .. oddEven)
:addClass(args[cfg.arg.listclass])
:addClass(args[listclass_and_num])
:tag('div')
:css('padding',
(index == 1 and args[cfg.arg.list1padding]) or args[cfg.arg.listpadding] or '0 0.25em'
)
:wikitext(processItem(listText, args[cfg.arg.nowrapitems]))
if index == 1 and args[cfg.arg.image] then
row
:tag('td')
:addClass(cfg.class.noviewer)
:addClass(cfg.class.navbox_image)
:addClass(args[cfg.arg.imageclass])
:css('width', '1px') -- Minimize width
:css('padding', '0 0 0 2px')
:cssText(args[cfg.arg.imagestyle])
:attr('rowspan', listnums_size)
:tag('div')
:wikitext(processItem(args[cfg.arg.image]))
end
end
local function has_list_class(htmlclass)
local patterns = {
'^' .. htmlclass .. '$',
'%s' .. htmlclass .. '$',
'^' .. htmlclass .. '%s',
'%s' .. htmlclass .. '%s'
}
for arg, _ in pairs(args) do
if type(arg) == 'string' and mw.ustring.find(arg, cfg.pattern.class) then
for _, pattern in ipairs(patterns) do
if mw.ustring.find(args[arg] or '', pattern) then
return true
end
end
end
end
return false
end
-- there are a lot of list classes in the wild, so we add their TemplateStyles
local function add_list_styles()
local frame = mw.getCurrentFrame()
local function add_list_templatestyles(htmlclass, templatestyles)
if has_list_class(htmlclass) then
return frame:extensionTag{
name = 'templatestyles', args = { src = templatestyles }
}
else
return ''
end
end
local hlist_styles = add_list_templatestyles('hlist', cfg.hlist_templatestyles)
local plainlist_styles = add_list_templatestyles('plainlist', cfg.plainlist_templatestyles)
-- a second workaround for [[phab:T303378]]
-- when that issue is fixed, we can actually use has_navbar not to emit the
-- tag here if we want
if has_navbar() and hlist_styles == '' then
hlist_styles = frame:extensionTag{
name = 'templatestyles', args = { src = cfg.hlist_templatestyles }
}
end
-- hlist -> plainlist is best-effort to preserve old Common.css ordering.
-- this ordering is not a guarantee because most navboxes will emit only
-- one of these classes [hlist_note]
return hlist_styles .. plainlist_styles
end
local function needsHorizontalLists(border)
if border == cfg.keyword.border_subgroup or args[cfg.arg.tracking] == cfg.keyword.tracking_no then
return false
end
return not has_list_class(cfg.pattern.hlist) and not has_list_class(cfg.pattern.plainlist)
end
local function hasBackgroundColors()
for _, key in ipairs({cfg.arg.titlestyle, cfg.arg.groupstyle,
cfg.arg.basestyle, cfg.arg.abovestyle, cfg.arg.belowstyle}) do
if tostring(args[key]):find('background', 1, true) then
return true
end
end
return false
end
local function hasBorders()
for _, key in ipairs({cfg.arg.groupstyle, cfg.arg.basestyle,
cfg.arg.abovestyle, cfg.arg.belowstyle}) do
if tostring(args[key]):find('border', 1, true) then
return true
end
end
return false
end
local function isIllegible()
local styleratio = require('Module:Color contrast')._styleratio
for key, style in pairs(args) do
if tostring(key):match(cfg.pattern.style) then
if styleratio{mw.text.unstripNoWiki(style)} < 4.5 then
return true
end
end
end
return false
end
local function getTrackingCategories(border)
local cats = {}
if needsHorizontalLists(border) then table.insert(cats, cfg.category.horizontal_lists) end
if hasBackgroundColors() then table.insert(cats, cfg.category.background_colors) end
if isIllegible() then table.insert(cats, cfg.category.illegible) end
if hasBorders() then table.insert(cats, cfg.category.borders) end
return cats
end
local function renderTrackingCategories(builder, border)
local title = mw.title.getCurrentTitle()
if title.namespace ~= 10 then return end -- not in template space
local subpage = title.subpageText
if subpage == cfg.keyword.subpage_doc or subpage == cfg.keyword.subpage_sandbox
or subpage == cfg.keyword.subpage_testcases then return end
for _, cat in ipairs(getTrackingCategories(border)) do
builder:wikitext('[[Category:' .. cat .. ']]')
end
end
local function renderMainTable(border, listnums)
local tbl = mw.html.create('table')
:addClass(cfg.class.nowraplinks)
:addClass(args[cfg.arg.bodyclass])
local state = args[cfg.arg.state]
if args[cfg.arg.title] and state ~= cfg.keyword.state_plain and state ~= cfg.keyword.state_off then
if state == cfg.keyword.state_collapsed then
state = cfg.class.collapsed
end
tbl
:addClass(cfg.class.collapsible)
:addClass(state or cfg.class.autocollapse)
end
tbl:css('border-spacing', 0)
if border == cfg.keyword.border_subgroup or border == cfg.keyword.border_none then
tbl
:addClass(cfg.class.navbox_subgroup)
:cssText(args[cfg.arg.bodystyle])
:cssText(args[cfg.arg.style])
else -- regular navbox - bodystyle and style will be applied to the wrapper table
tbl
:addClass(cfg.class.navbox_inner)
:css('background', 'transparent')
:css('color', 'inherit')
end
tbl:cssText(args[cfg.arg.innerstyle])
renderTitleRow(tbl)
renderAboveRow(tbl)
local listnums_size = #listnums
for i, listnum in ipairs(listnums) do
renderListRow(tbl, i, listnum, listnums_size)
end
renderBelowRow(tbl)
return tbl
end
local function add_navbox_styles(hiding_templatestyles)
local frame = mw.getCurrentFrame()
-- This is a lambda so that it doesn't need the frame as a parameter
local function add_user_styles(templatestyles)
if templatestyles and templatestyles ~= '' then
return frame:extensionTag{
name = 'templatestyles', args = { src = templatestyles }
}
end
return ''
end
-- get templatestyles. load base from config so that Lua only needs to do
-- the work once of parser tag expansion
local base_templatestyles = cfg.templatestyles
local templatestyles = add_user_styles(args[cfg.arg.templatestyles])
local child_templatestyles = add_user_styles(args[cfg.arg.child_templatestyles])
-- The 'navbox-styles' div exists to wrap the styles to work around T200206
-- more elegantly. Instead of combinatorial rules, this ends up being linear
-- number of CSS rules.
return mw.html.create('div')
:addClass(cfg.class.navbox_styles)
:wikitext(
add_list_styles() .. -- see [hlist_note] applied to 'before base_templatestyles'
base_templatestyles ..
templatestyles ..
child_templatestyles ..
table.concat(hiding_templatestyles)
)
:done()
end
-- work around [[phab:T303378]]
-- for each arg: find all the templatestyles strip markers, insert them into a
-- table. then remove all templatestyles markers from the arg
local function move_hiding_templatestyles(args)
local gfind = string.gfind
local gsub = string.gsub
local templatestyles_markers = {}
local strip_marker_pattern = '(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)'
for k, arg in pairs(args) do
for marker in gfind(arg, strip_marker_pattern) do
table.insert(templatestyles_markers, marker)
end
args[k] = gsub(arg, strip_marker_pattern, '')
end
return templatestyles_markers
end
function p._navbox(navboxArgs)
args = navboxArgs
local hiding_templatestyles = move_hiding_templatestyles(args)
local listnums = {}
for k, _ in pairs(args) do
if type(k) == 'string' then
local listnum = k:match(cfg.pattern.listnum)
if listnum then table.insert(listnums, tonumber(listnum)) end
end
end
table.sort(listnums)
local border = mw.text.trim(args[cfg.arg.border] or args[1] or '')
if border == cfg.keyword.border_child then
border = cfg.keyword.border_subgroup
end
-- render the main body of the navbox
local tbl = renderMainTable(border, listnums)
local res = mw.html.create()
-- render the appropriate wrapper for the navbox, based on the border param
if border == cfg.keyword.border_none then
res:node(add_navbox_styles(hiding_templatestyles))
local nav = res:tag('div')
:attr('role', 'navigation')
:node(tbl)
-- aria-labelledby title, otherwise above, otherwise lone group
if args[cfg.arg.title] or args[cfg.arg.above] or (args[cfg.arg.group1]
and not args[cfg.arg.group2]) then
nav:attr(
'aria-labelledby',
mw.uri.anchorEncode(
args[cfg.arg.title] or args[cfg.arg.above] or args[cfg.arg.group1]
)
)
else
nav:attr('aria-label', cfg.aria_label)
end
elseif border == cfg.keyword.border_subgroup then
-- We assume that this navbox is being rendered in a list cell of a
-- parent navbox, and is therefore inside a div with padding:0em 0.25em.
-- We start with a </div> to avoid the padding being applied, and at the
-- end add a <div> to balance out the parent's </div>
res
:wikitext('</div>')
:node(tbl)
:wikitext('<div>')
else
res:node(add_navbox_styles(hiding_templatestyles))
local nav = res:tag('div')
:attr('role', 'navigation')
:addClass(cfg.class.navbox)
:addClass(args[cfg.arg.navboxclass])
:cssText(args[cfg.arg.bodystyle])
:cssText(args[cfg.arg.style])
:css('padding', '3px')
:node(tbl)
-- aria-labelledby title, otherwise above, otherwise lone group
if args[cfg.arg.title] or args[cfg.arg.above]
or (args[cfg.arg.group1] and not args[cfg.arg.group2]) then
nav:attr(
'aria-labelledby',
mw.uri.anchorEncode(args[cfg.arg.title] or args[cfg.arg.above] or args[cfg.arg.group1])
)
else
nav:attr('aria-label', cfg.aria_label)
end
end
if (args[cfg.arg.nocat] or cfg.keyword.nocat_false):lower() == cfg.keyword.nocat_false then
renderTrackingCategories(res, border)
end
return striped(tostring(res), border)
end
function p.navbox(frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
args = getArgs(frame, {wrappers = {cfg.pattern.navbox}})
-- Read the arguments in the order they'll be output in, to make references
-- number in the right order.
local _
_ = args[cfg.arg.title]
_ = args[cfg.arg.above]
-- Limit this to 20 as covering 'most' cases (that's a SWAG) and because
-- iterator approach won't work here
for i = 1, 20 do
_ = args[format(cfg.arg.group_and_num, i)]
_ = args[format(cfg.arg.list_and_num, i)]
end
_ = args[cfg.arg.below]
return p._navbox(args)
end
return p
05be9a97c035ab3f0fac69423779e261949d473c
Module:Navbox/configuration
828
194
381
380
2023-12-24T02:11:59Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Navbox/configuration]]
Scribunto
text/plain
return {
aria_label = 'Navbox',
nowrap_item = '%s<span class="nowrap">%s</span>',
templatestyles = mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Module:Navbox/styles.css' }
},
hlist_templatestyles = 'Hlist/styles.css',
plainlist_templatestyles = 'Plainlist/styles.css',
-- do not localize marker table
marker = {
oddeven = '\127_ODDEVEN_\127',
restart = '\127_ODDEVEN0_\127',
regex = '\127_ODDEVEN(%d?)_\127'
},
category = {
orphan = '[[Category:Navbox orphans]]',
horizontal_lists = 'Navigational boxes without horizontal lists',
background_colors = 'Navboxes using background colours',
illegible = 'Potentially illegible navboxes',
borders = 'Navboxes using borders',
},
keyword = {
border_subgroup = 'subgroup',
border_child = 'child',
border_none = 'none',
evenodd_swap = 'swap',
navbar_off = 'off',
navbar_plain = 'plain',
nocat_false = 'false',
nowrapitems_yes = 'yes',
orphan_yes = 'yes',
state_collapsed = 'collapsed',
state_off = 'off',
state_plain = 'plain',
subpage_doc = 'doc',
subpage_sandbox = 'sandbox',
subpage_testcases = 'testcases',
tracking_no = 'no'
},
class = {
autocollapse = 'autocollapse',
collapsible = 'mw-collapsible',
collapsed = 'mw-collapsed',
-- Warning
navbox = 'navbox', -- WMF currently hides 'navbox' from mobile,
-- so you probably shouldn't change the navbox class.
navbox_abovebelow = 'navbox-abovebelow',
navbox_group = 'navbox-group',
navbox_image = 'navbox-image',
navbox_inner = 'navbox-inner',
navbox_list = 'navbox-list',
navbox_list_with_group = 'navbox-list-with-group',
navbox_part = 'navbox-', -- do not l10n
navbox_styles = 'navbox-styles',
navbox_subgroup = 'navbox-subgroup',
navbox_title = 'navbox-title', -- l10n only if you change pattern.navbox_title below
navbox_odd_part = 'odd', -- do not l10n
navbox_even_part = 'even', -- do not l10n
nomobile = 'nomobile',
nowraplinks = 'nowraplinks',
noviewer = 'noviewer' -- used to remove images from MediaViewer
},
pattern = {
listnum = '^list(%d+)$',
class = 'class',
sandbox = '/sandbox$',
navbox = 'Template:Navbox',
nowrap = '^<span class="nowrap">',
style = 'style$',
navbox_title = '<th[^>]*"navbox%-title"',
hlist = 'hlist',
plainlist = 'plainlist',
},
arg = {
above = 'above',
aboveclass = 'aboveclass',
abovestyle = 'abovestyle',
basestyle = 'basestyle',
bodyclass = 'bodyclass',
bodystyle = 'bodystyle',
border = 'border',
below = 'below',
belowclass = 'belowclass',
belowstyle = 'belowstyle',
evenodd = 'evenodd',
evenstyle = 'evenstyle',
group1 = 'group1',
group2 = 'group2',
group_and_num = 'group%d',
groupstyle_and_num = 'group%dstyle',
groupclass = 'groupclass',
groupstyle = 'groupstyle',
groupwidth = 'groupwidth',
innerstyle = 'innerstyle',
image = 'image',
imageclass = 'imageclass',
imageleft = 'imageleft',
imageleftstyle = 'imageleftstyle',
imagesetyle = 'imagestyle',
list_and_num = 'list%d',
listclass_and_num = 'list%dclass',
liststyle_and_num = 'list%dstyle',
list1padding = 'list1padding',
listclass = 'listclass',
listpadding = 'listpadding',
liststyle = 'liststyle',
name = 'name',
navbar = 'navbar',
navboxclass = 'navboxclass',
nocat = 'nocat',
nowrapitems = 'nowrapitems',
oddstyle = 'oddstyle',
orphan = 'orphan',
state = 'state',
style = 'style',
templatestyles = 'templatestyles',
child_templatestyles = 'child templatestyles',
title = 'title',
titleclass = 'titleclass',
titlestyle = 'titlestyle',
tracking = 'tracking'
},
-- names of navbar arguments
navbar = {
name = 1,
fontstyle = 'fontstyle',
mini = 'mini'
}
}
4148736fd32a93636c0413e73ed38afaef065ec9
Module:Navbox/styles.css
828
195
383
382
2023-12-24T02:12:00Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Navbox/styles.css]]
sanitized-css
text/css
/* {{pp|small=y}} */
.navbox {
box-sizing: border-box;
border: 1px solid #a2a9b1;
width: 100%;
clear: both;
font-size: 88%;
text-align: center;
padding: 1px;
margin: 1em auto 0; /* Prevent preceding content from clinging to navboxes */
}
.navbox .navbox {
margin-top: 0; /* No top margin for nested navboxes */
}
.navbox + .navbox, /* TODO: remove first line after transclusions have updated */
.navbox + .navbox-styles + .navbox {
margin-top: -1px; /* Single pixel border between adjacent navboxes */
}
.navbox-inner,
.navbox-subgroup {
width: 100%;
}
.navbox-group,
.navbox-title,
.navbox-abovebelow {
padding: 0.25em 1em;
line-height: 1.5em;
text-align: center;
}
.navbox-group {
white-space: nowrap;
/* @noflip */
text-align: right;
}
.navbox,
.navbox-subgroup {
background-color: #fdfdfd;
}
.navbox-list {
line-height: 1.5em;
border-color: #fdfdfd; /* Must match background color */
}
.navbox-list-with-group {
text-align: left;
border-left-width: 2px;
border-left-style: solid;
}
/* cell spacing for navbox cells */
/* Borders above 2nd, 3rd, etc. rows */
/* TODO: figure out how to replace tr as structure;
* with div structure it should be just a matter of first-child */
tr + tr > .navbox-abovebelow,
tr + tr > .navbox-group,
tr + tr > .navbox-image,
tr + tr > .navbox-list {
border-top: 2px solid #fdfdfd; /* Must match background color */
}
.navbox-title {
background-color: #ccf; /* Level 1 color */
}
.navbox-abovebelow,
.navbox-group,
.navbox-subgroup .navbox-title {
background-color: #ddf; /* Level 2 color */
}
.navbox-subgroup .navbox-group,
.navbox-subgroup .navbox-abovebelow {
background-color: #e6e6ff; /* Level 3 color */
}
.navbox-even {
background-color: #f7f7f7;
}
.navbox-odd {
background-color: transparent;
}
/* TODO: figure out how to remove reliance on td as structure */
.navbox .hlist td dl,
.navbox .hlist td ol,
.navbox .hlist td ul,
.navbox td.hlist dl,
.navbox td.hlist ol,
.navbox td.hlist ul {
padding: 0.125em 0;
}
.navbox .navbar {
display: block;
font-size: 100%;
}
.navbox-title .navbar {
/* @noflip */
float: left;
/* @noflip */
text-align: left;
/* @noflip */
margin-right: 0.5em;
}
e80b0d7a5770e6e105dab832deb6c37a5245ebc6
Template:Smallsup
10
196
385
384
2023-12-24T02:12:02Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Smallsup]]
wikitext
text/x-wiki
<includeonly><sup><small>{{{1}}}</small></sup></includeonly><noinclude>
{{Documentation}}
</noinclude>
c174fb3247218273210500118556feb9f3c76d5a
Module:Color contrast
828
197
387
386
2023-12-24T02:12:03Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Color_contrast]]
Scribunto
text/plain
--
-- This module implements
-- {{Color contrast ratio}}
-- {{Greater color contrast ratio}}
-- {{ColorToLum}}
-- {{RGBColorToLum}}
--
local p = {}
local HTMLcolor = mw.loadData( 'Module:Color contrast/colors' )
local function sRGB (v)
if (v <= 0.03928) then
v = v / 12.92
else
v = math.pow((v+0.055)/1.055, 2.4)
end
return v
end
local function rgbdec2lum(R, G, B)
if ( 0 <= R and R < 256 and 0 <= G and G < 256 and 0 <= B and B < 256 ) then
return 0.2126 * sRGB(R/255) + 0.7152 * sRGB(G/255) + 0.0722 * sRGB(B/255)
else
return ''
end
end
local function hsl2lum(h, s, l)
if ( 0 <= h and h < 360 and 0 <= s and s <= 1 and 0 <= l and l <= 1 ) then
local c = (1 - math.abs(2*l - 1))*s
local x = c*(1 - math.abs( math.fmod(h/60, 2) - 1) )
local m = l - c/2
local r, g, b = m, m, m
if( 0 <= h and h < 60 ) then
r = r + c
g = g + x
elseif( 60 <= h and h < 120 ) then
r = r + x
g = g + c
elseif( 120 <= h and h < 180 ) then
g = g + c
b = b + x
elseif( 180 <= h and h < 240 ) then
g = g + x
b = b + c
elseif( 240 <= h and h < 300 ) then
r = r + x
b = b + c
elseif( 300 <= h and h < 360 ) then
r = r + c
b = b + x
end
return rgbdec2lum(255*r, 255*g, 255*b)
else
return ''
end
end
local function color2lum(c)
if (c == nil) then
return ''
end
-- html '#' entity
c = c:gsub("#", "#")
-- whitespace
c = c:match( '^%s*(.-)[%s;]*$' )
-- unstrip nowiki strip markers
c = mw.text.unstripNoWiki(c)
-- lowercase
c = c:lower()
-- first try to look it up
local L = HTMLcolor[c]
if (L ~= nil) then
return L
end
-- convert from hsl
if mw.ustring.match(c,'^hsl%([%s]*[0-9][0-9%.]*[%s]*,[%s]*[0-9][0-9%.]*%%[%s]*,[%s]*[0-9][0-9%.]*%%[%s]*%)$') then
local h, s, l = mw.ustring.match(c,'^hsl%([%s]*([0-9][0-9%.]*)[%s]*,[%s]*([0-9][0-9%.]*)%%[%s]*,[%s]*([0-9][0-9%.]*)%%[%s]*%)$')
return hsl2lum(tonumber(h), tonumber(s)/100, tonumber(l)/100)
end
-- convert from rgb
if mw.ustring.match(c,'^rgb%([%s]*[0-9][0-9]*[%s]*,[%s]*[0-9][0-9]*[%s]*,[%s]*[0-9][0-9]*[%s]*%)$') then
local R, G, B = mw.ustring.match(c,'^rgb%([%s]*([0-9][0-9]*)[%s]*,[%s]*([0-9][0-9]*)[%s]*,[%s]*([0-9][0-9]*)[%s]*%)$')
return rgbdec2lum(tonumber(R), tonumber(G), tonumber(B))
end
-- convert from rgb percent
if mw.ustring.match(c,'^rgb%([%s]*[0-9][0-9%.]*%%[%s]*,[%s]*[0-9][0-9%.]*%%[%s]*,[%s]*[0-9][0-9%.]*%%[%s]*%)$') then
local R, G, B = mw.ustring.match(c,'^rgb%([%s]*([0-9][0-9%.]*)%%[%s]*,[%s]*([0-9][0-9%.]*)%%[%s]*,[%s]*([0-9][0-9%.]*)%%[%s]*%)$')
return rgbdec2lum(255*tonumber(R)/100, 255*tonumber(G)/100, 255*tonumber(B)/100)
end
-- remove leading # (if there is one) and whitespace
c = mw.ustring.match(c, '^[%s#]*([a-f0-9]*)[%s]*$')
-- split into rgb
local cs = mw.text.split(c or '', '')
if( #cs == 6 ) then
local R = 16*tonumber('0x' .. cs[1]) + tonumber('0x' .. cs[2])
local G = 16*tonumber('0x' .. cs[3]) + tonumber('0x' .. cs[4])
local B = 16*tonumber('0x' .. cs[5]) + tonumber('0x' .. cs[6])
return rgbdec2lum(R, G, B)
elseif ( #cs == 3 ) then
local R = 16*tonumber('0x' .. cs[1]) + tonumber('0x' .. cs[1])
local G = 16*tonumber('0x' .. cs[2]) + tonumber('0x' .. cs[2])
local B = 16*tonumber('0x' .. cs[3]) + tonumber('0x' .. cs[3])
return rgbdec2lum(R, G, B)
end
-- failure, return blank
return ''
end
-- This exports the function for use in other modules.
-- The colour is passed as a string.
function p._lum(color)
return color2lum(color)
end
function p._greatercontrast(args)
local bias = tonumber(args['bias'] or '0') or 0
local css = (args['css'] and args['css'] ~= '') and true or false
local v1 = color2lum(args[1] or '')
local c2 = args[2] or '#FFFFFF'
local v2 = color2lum(c2)
local c3 = args[3] or '#000000'
local v3 = color2lum(c3)
local ratio1 = -1;
local ratio2 = -1;
if (type(v1) == 'number' and type(v2) == 'number') then
ratio1 = (v2 + 0.05)/(v1 + 0.05)
ratio1 = (ratio1 < 1) and 1/ratio1 or ratio1
end
if (type(v1) == 'number' and type(v3) == 'number') then
ratio2 = (v3 + 0.05)/(v1 + 0.05)
ratio2 = (ratio2 < 1) and 1/ratio2 or ratio2
end
if css then
local c1 = args[1] or ''
if mw.ustring.match(c1, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') or
mw.ustring.match(c1, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') then
c1 = '#' .. c1
end
if mw.ustring.match(c2, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') or
mw.ustring.match(c2, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') then
c2 = '#' .. c2
end
if mw.ustring.match(v3, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') or
mw.ustring.match(v3, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') then
c3 = '#' .. c3
end
return 'background-color:' .. c1 .. '; color:' .. ((ratio1 > 0) and (ratio2 > 0) and ((ratio1 + bias > ratio2) and c2 or c3) or '') .. ';'
end
return (ratio1 > 0) and (ratio2 > 0) and ((ratio1 + bias > ratio2) and c2 or c3) or ''
end
function p._ratio(args)
local v1 = color2lum(args[1])
local v2 = color2lum(args[2])
if (type(v1) == 'number' and type(v2) == 'number') then
-- v1 should be the brighter of the two.
if v2 > v1 then
v1, v2 = v2, v1
end
return (v1 + 0.05)/(v2 + 0.05)
else
return args['error'] or '?'
end
end
function p._styleratio(args)
local style = (args[1] or ''):lower()
local bg, fg = 'white', 'black'
local lum_bg, lum_fg = 1, 0
if args[2] then
local lum = color2lum(args[2])
if lum ~= '' then bg, lum_bg = args[2], lum end
end
if args[3] then
local lum = color2lum(args[3])
if lum ~= '' then fg, lum_fg = args[3], lum end
end
local slist = mw.text.split(mw.ustring.gsub(mw.ustring.gsub(style or '', '&#[Xx]23;', '#'), '#', '#'), ';')
for k = 1,#slist do
local s = slist[k]
local k,v = s:match( '^[%s]*([^:]-):([^:]-)[%s;]*$' )
k = k or ''
v = v or ''
if (k:match('^[%s]*(background)[%s]*$') or k:match('^[%s]*(background%-color)[%s]*$')) then
local lum = color2lum(v)
if( lum ~= '' ) then bg, lum_bg = v, lum end
elseif (k:match('^[%s]*(color)[%s]*$')) then
local lum = color2lum(v)
if( lum ~= '' ) then bg, lum_fg = v, lum end
end
end
if lum_bg > lum_fg then
return (lum_bg + 0.05)/(lum_fg + 0.05)
else
return (lum_fg + 0.05)/(lum_bg + 0.05)
end
end
--[[
Use {{#invoke:Color contrast|somecolor}} directly or
{{#invoke:Color contrast}} from a wrapper template.
Parameters:
-- |1= — required; A color to check.
--]]
function p.lum(frame)
local color = frame.args[1] or frame:getParent().args[1]
return p._lum(color)
end
function p.ratio(frame)
local args = frame.args[1] and frame.args or frame:getParent().args
return p._ratio(args)
end
function p.styleratio(frame)
local args = frame.args[1] and frame.args or frame:getParent().args
return p._styleratio(args)
end
function p.greatercontrast(frame)
local args = frame.args[1] and frame.args or frame:getParent().args
return p._greatercontrast(args)
end
return p
1e399769117591366a63f62996c9a407077cc711
Module:Color contrast/colors
828
198
389
388
2023-12-24T02:12:03Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Color_contrast/colors]]
Scribunto
text/plain
return {
aliceblue = 0.92880068253475,
antiquewhite = 0.84646951707754,
aqua = 0.7874,
aquamarine = 0.8078549208338,
azure = 0.97265264954166,
beige = 0.8988459998705,
bisque = 0.80732327372979,
black = 0,
blanchedalmond = 0.85084439608156,
blue = 0.0722,
blueviolet = 0.12622014321946,
brown = 0.098224287876511,
burlywood = 0.51559844533893,
cadetblue = 0.29424681085422,
chartreuse = 0.76032025902623,
chocolate = 0.23898526114557,
coral = 0.37017930872924,
cornflowerblue = 0.30318641994179,
cornsilk = 0.93562110372965,
crimson = 0.16042199953026,
cyan = 0.7874,
darkblue = 0.018640801980939,
darkcyan = 0.20329317839046,
darkgoldenrod = 0.27264703559993,
darkgray = 0.39675523072563,
darkgreen = 0.091143429047575,
darkgrey = 0.39675523072563,
darkkhaki = 0.45747326349994,
darkmagenta = 0.07353047651207,
darkolivegreen = 0.12651920884889,
darkorange = 0.40016167026524,
darkorchid = 0.13413142174857,
darkred = 0.054889674531132,
darksalmon = 0.40541471563381,
darkseagreen = 0.43789249325969,
darkslateblue = 0.065792846227988,
darkslategray = 0.067608151928044,
darkslategrey = 0.067608151928044,
darkturquoise = 0.4874606277449,
darkviolet = 0.10999048339343,
deeppink = 0.23866895828276,
deepskyblue = 0.44481603395575,
dimgray = 0.14126329114027,
dimgrey = 0.14126329114027,
dodgerblue = 0.27442536991456,
firebrick = 0.10724525535015,
floralwhite = 0.95922484825004,
forestgreen = 0.18920812076002,
fuchsia = 0.2848,
gainsboro = 0.71569350050648,
ghostwhite = 0.94311261886323,
gold = 0.69860877428159,
goldenrod = 0.41919977809569,
gray = 0.2158605001139,
green = 0.15438342968146,
greenyellow = 0.80609472611453,
grey = 0.2158605001139,
honeydew = 0.96336535554782,
hotpink = 0.34658438169715,
indianred = 0.21406134963884,
indigo = 0.03107561486337,
ivory = 0.99071270600615,
khaki = 0.77012343394121,
lavender = 0.80318750514521,
lavenderblush = 0.90172748631046,
lawngreen = 0.73905893124963,
lemonchiffon = 0.94038992245622,
lightblue = 0.63709141280807,
lightcoral = 0.35522120733135,
lightcyan = 0.94587293494829,
lightgoldenrodyellow = 0.93348351018297,
lightgray = 0.65140563741982,
lightgreen = 0.69091979956865,
lightgrey = 0.65140563741982,
lightpink = 0.58566152734898,
lightsalmon = 0.4780675225206,
lightseagreen = 0.35050145117042,
lightskyblue = 0.56195637618331,
lightslategray = 0.23830165007287,
lightslategrey = 0.23830165007287,
lightsteelblue = 0.53983888284666,
lightyellow = 0.98161818392882,
lime = 0.7152,
limegreen = 0.44571042246098,
linen = 0.88357340984379,
magenta = 0.2848,
maroon = 0.045891942324215,
mediumaquamarine = 0.49389703310801,
mediumblue = 0.044077780212328,
mediumorchid = 0.21639251153773,
mediumpurple = 0.22905858091648,
mediumseagreen = 0.34393112338131,
mediumslateblue = 0.20284629471622,
mediumspringgreen = 0.70704308194184,
mediumturquoise = 0.5133827926448,
mediumvioletred = 0.14371899849357,
midnightblue = 0.02071786635086,
mintcream = 0.97834604947588,
mistyrose = 0.82183047859185,
moccasin = 0.80083000991567,
navajowhite = 0.76519682342785,
navy = 0.015585128108224,
oldlace = 0.91900633405549,
olive = 0.20027537200568,
olivedrab = 0.22593150951929,
orange = 0.4817026703631,
orangered = 0.25516243753416,
orchid = 0.31348806761439,
palegoldenrod = 0.78792647887614,
palegreen = 0.77936759006353,
paleturquoise = 0.76436077921714,
palevioletred = 0.28754994117889,
papayawhip = 0.87797100199835,
peachpuff = 0.74905589878251,
peru = 0.30113074877936,
pink = 0.63271070702466,
plum = 0.45734221587969,
powderblue = 0.68254586500605,
purple = 0.061477070432439,
rebeccapurple = 0.07492341159447,
red = 0.2126,
rosybrown = 0.32319457649407,
royalblue = 0.16663210743188,
saddlebrown = 0.097922285020521,
salmon = 0.36977241527596,
sandybrown = 0.46628543696283,
seagreen = 0.19734199706275,
seashell = 0.92737862206922,
sienna = 0.13697631337098,
silver = 0.52711512570581,
skyblue = 0.55291668518184,
slateblue = 0.14784278062136,
slategray = 0.20896704076536,
slategrey = 0.20896704076536,
snow = 0.96533341834849,
springgreen = 0.73052306068529,
steelblue = 0.20562642207625,
tan = 0.48237604163921,
teal = 0.16996855778968,
thistle = 0.56818401093733,
tomato = 0.30638612719415,
turquoise = 0.5895536427578,
violet = 0.40315452986676,
wheat = 0.74909702820482,
white = 1,
whitesmoke = 0.91309865179342,
yellow = 0.9278,
yellowgreen = 0.50762957208707,
}
6ae47fdb24de4eed5ec26d203faf5341a388987b
Template:Str left
10
199
391
390
2023-12-24T02:12:04Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Str_left]]
wikitext
text/x-wiki
<includeonly>{{safesubst:padleft:|{{{2|1}}}|{{{1}}}}}</includeonly><noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
2048b0d7b35e156528655b1d090e8b5ffab3f400
Template:Remove first word
10
200
393
392
2023-12-24T02:12:04Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Remove_first_word]]
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:String|replace|source={{{1}}}|pattern=^[^{{{sep|%s}}}]*{{{sep|%s}}}*|replace=|plain=false}}<noinclude>{{Documentation}}</noinclude>
df7a9e692f68be1581be06af5f51eaed5483b4c8
Template:Large
10
201
395
394
2023-12-24T02:12:04Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Large]]
wikitext
text/x-wiki
<span style="font-size:120%">{{{1}}}</span><noinclude>
{{Documentation}}
</noinclude>
8ba6ec8c3178e22dc1f05aa239df8a2b052be668
Template:Clear right
10
202
397
396
2023-12-24T02:12:07Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Clear_right]]
wikitext
text/x-wiki
{{Clear|right}}<noinclude>
{{Documentation|Template:Clear/doc}}
</noinclude>
12b36d3e1933e27905b1549e2e69366dc1c3c7b2
Template:Subpage other
10
203
399
398
2023-12-24T02:12:07Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Subpage_other]]
wikitext
text/x-wiki
{{#ifeq:{{SUBPAGENAME}}|{{ROOTPAGENAME}}|{{{2|}}}|{{{1|}}}}}<!--
--><noinclude>{{documentation}}</noinclude>
ebcb508ec39c25594f4151c4e32c01eeb5732f3d
Template:Infobox political party/doc
10
204
401
400
2023-12-24T02:12:15Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Infobox_political_party/doc]]
wikitext
text/x-wiki
{{Documentation subpage}}
<!--Categories where indicated at the bottom of this page, please; interwikis at Wikidata (see [[Wikipedia:Wikidata]])-->
{{#ifeq:{{SUBPAGENAME}}|sandbox||{{High-use}}}}
{{Auto short description}}
{{lua|Module:Infobox|Module:InfoboxImage|Module:Check for unknown parameters}}
==Usage==
===Basic===
{{Parameter names example
|name
|logo
|logo_alt
|colorcode=red
|leader
|president
|chairperson
|secretary
|general_secretary
|first_secretary
|secretary_general
|presidium
|governing_body
|standing_committee
|spokesperson
|founder
|founded
|headquarters
|ideology
|international
|website
|country
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox political party
| name =
| logo =
| logo_alt =
| colorcode = <!-- HTML color code (e.g. "red", "#FF0000" or Party metadata color template) otherwise "transparent" -->
| leader =
| president =
| chairperson =
| secretary =
| general_secretary =
| first_secretary =
| secretary_general =
| presidium =
| governing_body =
| standing_committee =
| spokesperson =
| founder =
| founded = <!-- {{start date|YYYY|MM|DD}} -->
| headquarters =
| ideology =
| international =
| website =
| country =
}}
</syntaxhighlight>
{{clear right}}
===Full===
{{Parameter names example
|name |native_name
|native_name_lang |lang1 |name_lang1 |lang2 |name_lang2 |lang3 |name_lang3 |lang4 |name_lang4 |logo |logo_size |logo_upright |logo_alt |caption |colorcode=red |abbreviation={{{abbreviation}}} or {{{abbr}}} |leader |president |chairperson={{{chairperson}}} or {{{chairman}}} |general_secretary |first_secretary |secretary_general |presidium |governing_body |standing_committee |secretary |spokesperson={{{spokesperson}}} or {{{spokesman}}}
|leader1_title |leader1_name |leader2_title |leader2_name |leader3_title |leader3_name |leader4_title |leader4_name |leader5_title |leader5_name
|founder={{{founder}}} or {{{founders}}} |founded={{{founded}}} or {{{foundation}}} |registered |legalised={{{legalised}}} or {{{legalized}}} |dissolved={{{dissolved}}} or {{{banned}}} or {{{dissolution}}} |merger |split |predecessor |merged |successor |headquarters |newspaper |think_tank |student_wing |youth_wing |womens_wing |lgbt_wing |wing1_title |wing1 |wing2_title |wing2 |wing3_title |wing3 |wing4_title |wing4
|membership_year=[''year''] |membership |ideology |position |religion |national |regional |european |continental |international |europarl |affiliation1_title |affiliation1 |affiliation2_title |affiliation2 |colors={{{colors}}} or {{{colours}}} |slogan |anthem
|blank1_title |blank1 |blank2_title |blank2 |blank3_title |blank3 |blank4_title |blank4
|seats1_title |seats1 |seats2_title |seats2 |seats3_title |seats3 |seats4_title |seats4
|symbol |flag |flag_title |flag_alt |website |country |country2 |footnotes
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox political party
| name =
| native_name =
| native_name_lang =
| lang1 =
| name_lang1 =
| lang2 =
| name_lang2 =
| lang3 =
| name_lang3 =
| lang4 =
| name_lang4 =
| logo =
| logo_size =
| logo_upright =
| logo_alt =
| caption =
| colorcode = <!-- HTML color code (e.g. "red", "#FF0000" or Party metadata color template) otherwise "transparent" -->
| abbreviation = <!-- official abbreviation or | abbr = -->
| leader =
| president =
| chairperson = <!-- or | chairman = -->
| secretary =
| general_secretary =
| first_secretary =
| secretary_general =
| presidium =
| governing_body =
| standing_committee =
| spokesperson = <!-- or | spokesman = -->
| leader1_title =
| leader1_name =
| leader2_title =
| leader2_name =
| leader3_title =
| leader3_name =
| leader4_title =
| leader4_name =
| leader5_title =
| leader5_name =
| founder = <!-- or | founders = -->
| founded = <!-- or | foundation = use {{start date|YYYY|MM|DD}} -->
| registered =
| legalised = <!-- or | legalized = -->
| dissolved = <!-- or | banned = or | dissolution = use {{end date|YYYY|MM|DD}} -->
| merger =
| split =
| predecessor =
| merged =
| successor =
| headquarters =
| newspaper =
| think_tank =
| student_wing =
| youth_wing =
| womens_wing =
| wing1_title =
| wing1 =
| wing2_title =
| wing2 =
| wing3_title =
| wing3 =
| wing4_title =
| wing4 =
| membership_year =
| membership =
| ideology =
| position =
| religion =
| national =
| regional = <!-- or | regional affiliation = -->
| european =
| continental = <!-- or | continental affiliation = -->
| international =
| europarl =
| affiliation1_title =
| affiliation1 =
| affiliation2_title =
| affiliation2 =
| colors = <!-- or | colours = ; use based on [[WP:ENGVAR]]-->
| slogan =
| anthem =
| blank1_title =
| blank1 =
| blank2_title =
| blank2 =
| blank3_title =
| blank3 =
| blank4_title =
| blank4 =
| seats1_title =
| seats1 = <!-- {{Infobox political party/seats|50|100|hex=#ff0000}} -->
| seats2_title =
| seats2 =
| seats3_title =
| seats3 =
| seats4_title = <!-- up to | seats11_title = -->
| seats4 = <!-- up to | seats11 = -->
| symbol =
| flag =
| flag_title =
| flag_alt =
| website =
| state = <!-- or | country = -->
| country = <!-- or | state = -->
| country_dab1 =
| parties_dab1 =
| elections_dab1 =
| country2 =
| country_dab2 =
| parties_dab2 =
| elections_dab2 =
| footnotes =
}}
</syntaxhighlight>
{{clear right}}
==Microformat==
{{UF-hcard-org}}
== TemplateData ==
{{TemplateData header}}
<templatedata>
{
"description": "An infobox for a political party. Used to briefly summarize information about a party at the top of the article. ",
"format": "{{_\n| ________________ = _\n}}\n",
"params": {
"name": {
"label": "Name",
"description": "The name of the party",
"type": "string"
},
"logo": {
"label": "Logo",
"description": "The logo of the party",
"type": "string"
},
"logo_size": {
"label": "Logo size",
"description": "Size of logo image",
"type": "string"
},
"colorcode": {
"label": "Color code",
"description": "The color to be used for infobox accents. HTML color code (e.g. red, #FF0000 or Party metadata color template) or transparent for no coloring.",
"type": "string"
},
"leader": {
"label": "Leader",
"description": "The leader of the party",
"type": "string"
},
"president": {
"label": "President",
"description": "The president of the party",
"type": "string"
},
"chairperson": {
"label": "Chairperson",
"description": "The chairperson of the party",
"type": "string",
"aliases": [
"chairman"
]
},
"secretary": {
"label": "Secretary",
"description": "The secretary of the party",
"type": "string"
},
"general_secretary": {
"label": "General secretary",
"description": "The general secretary of the party",
"type": "string"
},
"first_secretary": {
"label": "First secretary",
"description": "The first secretary of the party",
"type": "string"
},
"secretary_general": {
"label": "Secretary-general",
"description": "The secretary-general of the party",
"type": "string"
},
"presidium": {
"label": "Presidium",
"description": "The presidium of the party",
"type": "string"
},
"spokesperson": {
"label": "Spokesperson",
"description": "The spokesperson of the party",
"type": "string",
"aliases": [
"spokesman"
]
},
"foundation": {
"label": "Foundation",
"description": "The foundation date of the party. Insert as {{Start date|YYYY|MM|DD}}.",
"type": "string",
"aliases": [
"founded"
]
},
"ideology": {
"label": "Ideology",
"description": "The ideology of the party",
"type": "string"
},
"headquarters": {
"label": "Headquarters",
"description": "The headquarters of the party",
"type": "string"
},
"international": {
"label": "International",
"description": "The party’s international affiliation(s)",
"type": "string"
},
"website": {
"label": "Website",
"description": "The website of the party",
"type": "string"
},
"registered": {
"label": "Registered",
"description": "The registration number of party; if unregistered, then write NO.",
"type": "string"
},
"country": {
"label": "Country",
"description": "The country of the party",
"type": "string",
"aliases": [
"state"
]
},
"abbreviation": {
"aliases": [
"abbr"
]
},
"founder": {
"aliases": [
"founders"
]
},
"legalised": {
"aliases": [
"legalized"
]
},
"dissolved": {
"aliases": [
"banned",
"dissolution"
]
},
"colors": {
"description": "The official colors of the party, independent of infobox usage",
"aliases": [
"colours"
]
},
"native_name": {
"label": "Native name",
"description": "The native name of the party",
"type": "string"
},
"native_name_lang": {
"label": "Native name language code",
"description": "The ISO-639 language code of the native name of the party",
"example": "fr",
"type": "string"
},
"governing_body": {},
"standing_committee": {},
"merger": {},
"split": {
"label": "Split from",
"description": "Party or organisation the party was split from",
"type": "string"
},
"predecessor": {},
"merged": {},
"successor": {},
"newspaper": {},
"think_tank": {
"aliases": [
"think tank"
]
},
"student_wing": {},
"youth_wing": {},
"womens_wing": {},
"membership": {},
"membership_year": {},
"position": {},
"religion": {},
"national": {},
"regional": {
"aliases": [
"regional affiliation"
]
},
"european": {},
"continental": {
"aliases": [
"continental affiliation"
]
},
"europarl": {},
"slogan": {},
"anthem": {},
"symbol": {},
"flag": {
"aliases": [
"flag_title"
]
},
"flag_alt": {},
"country2": {},
"footnotes": {},
"logo_upright": {},
"logo_alt": {}
},
"paramOrder": [
"name",
"native_name",
"logo",
"logo_size",
"colorcode",
"leader",
"president",
"chairperson",
"secretary",
"general_secretary",
"first_secretary",
"secretary_general",
"presidium",
"spokesperson",
"foundation",
"ideology",
"headquarters",
"international",
"website",
"registered",
"country",
"abbreviation",
"founder",
"legalised",
"dissolved",
"colors",
"native_name_lang",
"governing_body",
"standing_committee",
"merger",
"split",
"predecessor",
"merged",
"successor",
"newspaper",
"think_tank",
"student_wing",
"youth_wing",
"womens_wing",
"membership",
"membership_year",
"position",
"religion",
"national",
"regional",
"european",
"continental",
"europarl",
"slogan",
"anthem",
"symbol",
"flag",
"flag_alt",
"country2",
"footnotes",
"logo_upright",
"logo_alt"
]
}
</templatedata>
== Tracking categories ==
* {{clc|Pages using infobox political party with unknown parameters}}
== See also ==
* {{tl|Composition bar}}, used to display a statistic, such as the number of seats held by a political party.
{{Organization infoboxes}}
<includeonly>{{sandbox other||
<!-- Categories below this line; interwikis at Wikidata -->
[[Category:Organization infobox templates|Political Party]]
[[Category:Political party infobox templates| ]]
[[Category:Templates that add a tracking category]]
}}</includeonly>
b246a618822a8e4debea143592790494f2f156b3
Template:Organization infoboxes
10
205
403
402
2023-12-24T02:12:16Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Organization_infoboxes]]
wikitext
text/x-wiki
{{Navbox
| name = Organization infoboxes
| state = {{{state<includeonly>|expanded</includeonly>}}}
| bodyclass = hlist
| title = [[Wikipedia:Template index|Wikipedia templates]]: [[organization]] [[Template:Infobox|infoboxes]]
| above = [[Wikipedia:Manual of Style/Infoboxes]]
| group1 = General
| list1 =
* {{Tl|Infobox organization}}
* {{Tl|Infobox official post}}
* {{tl|Infobox criminal organization}}
* {{tl|Infobox fictional organisation}}
| group2 = {{longitem|Government<br/>and politics}}
| list2 =
* {{Tl|Infobox government}}
* {{Tl|Infobox government agency}}
* {{Tl|Infobox legislature}}
* {{Tl|Infobox political party}}
* {{Tl|Infobox court}}
* {{Tl|Infobox detention facility}}
* {{tl|Infobox fire department}}
* {{Tl|Infobox law enforcement agency}}
* {{Tl|Infobox space agency}}
| group3 = Military
| list3 =
* {{Tl|Infobox national military}}
* {{Tl|Infobox military unit}}
* {{tl|Infobox military rank}}
* {{Tl|Infobox military gear}}
| group4 = Religion
| list4 =
* {{Tl|Infobox religious group}}
* {{Tl|Infobox religion}}
* {{Tl|Infobox diocese}}
* {{Tl|Infobox church}}
* {{Tl|Infobox monastery}}
| group5 = People
| list5 =
* {{Tl|Infobox ethnic group}}
* {{Tl|Infobox caste}}
* {{Tl|Infobox clan}}
* {{Tl|Infobox family}}
* {{Tl|Infobox iwi}}
* {{Tl|Infobox hereditary title}}
* {{Tl|Infobox monarchy}}
* {{Tl|Infobox officeholder}}
* {{Tl|Infobox tribe}}
| group6 = {{longitem|Typically<br/>non-profit}}
| list6 =
* {{tl|Infobox hospital}}
* {{Tl|Infobox institute}}
* {{Tl|Infobox laboratory}}{{smallsup|1}}
* {{tl|Infobox museum}}
* {{Tl|Infobox observatory}}
* {{Tl|Infobox school}}
* {{tl|Infobox school district}}
* {{Tl|Infobox university}}{{smallsup|2}}
| group7 = Publications
| list7 =
* {{Tl|Infobox journal}}
* {{Tl|Infobox magazine}}
* {{Tl|Infobox newspaper}}
* {{Tl|Infobox publisher}}
| group8 = Business
| list8 =
* {{Tl|Infobox company}}
* {{tl|Infobox brewery}}
* {{Tl|Infobox law firm}}
* {{tl|Infobox restaurant}}
* {{tl|Infobox website}} – ''type of business or publication''
| group9 = Distinctions
| list9 =
* {{Tl|Infobox order}}
* {{Tl|Infobox fraternity}}
* {{Tl|Infobox Grand Lodge}}
| group10 = Subtemplates
| list10 =
* '''Coordinates''' {{Tl|coord}}
* '''Dates'''
** {{Tl|start date}}}—for {{para|established}}, {{para|founded}}, {{para|opened}} etc.
** {{Tl|end date}}}—for {{para|dissolved}}, {{para|defunct}}
* '''Lists'''
**{{tl|plainlist}}
** {{tl|flatlist}}
** {{tl|unbulleted list}}
* '''Non-English text''' {{Tl|lang}}
* '''Website'''
** {{tl|URL}}
** {{tl|Official URL}}
** {{tl|Official website}}
* '''Documentation'''
** {{Tl|mf-adr}}}—Address
** {{Tl|UF-hcard-org}}—[[Microformat]]/metadata
| below =
* {{smallsup|1}} or research institution
* {{smallsup|2}} or college
* [[:Category:Infobox templates|Category]]
* [[Help:Infobox|Help]]
* [[Wikipedia:List of infoboxes|List of infoboxes]]
}}<noinclude>{{documentation}}</noinclude>
8e81fe7179216c1823e098fa600be889f26cbeba
Template:Microformat message
10
206
405
404
2023-12-24T02:12:17Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Microformat_message]]
wikitext
text/x-wiki
The [[Help:HTML in wikitext|HTML mark-up]] produced by this template includes {{#if:{{{type|}}} |{{{type}}} |an [[{{{format}}} microformat]]}} that makes {{{data}}} readily [[Parsing|parsable]] by computer programs. This aids tasks such as the cataloguing of articles and maintenance of databases. For more information about the use of microformats on Wikipedia, please visit [[Wikipedia:WikiProject Microformats|the Microformat WikiProject]].<!--
-->{{#if:{{{subtemplates<includeonly>|</includeonly>}}}
| <div style="margin-top:0.5em;margin-bottom:0.65em;">
; {{large|Subtemplates}}
{{{subtemplates}}}
'''''Please do not remove instances of these subtemplates.'''''
</div>}}<!--
-->{{#if:{{{subsection1|}}}
| <div style="margin-top:0.5em;margin-bottom:0.65em;"><!--(newline in case subsection begins with heading:)-->
{{{subsection1}}}
</div>}}<!--
-->{{#if:{{{1<includeonly>|</includeonly>}}} <!--(i.e. if at least one unnamed parameter supplied:)-->
| <div style="margin-top:0.5em;margin-bottom:0.65em;">
; {{large|Classes used}}
The [[HTML attribute|HTML class]]es of this microformat include:
: {{hlist
|item_style=font-size:110%;{{{itemstyle|}}}
|{{{1}}} |{{{2<includeonly>|</includeonly>}}} |{{{3|<noinclude>{{nobold|……}}</noinclude>}}}
|{{{4|}}} |{{{5|}}} |{{{6|}}} |{{{7|}}} |{{{8|}}} |{{{9|}}} |{{{10|}}} |{{{11|}}} |{{{12|}}} |{{{13|}}} |{{{14|}}} |{{{15|}}} |{{{16|}}} |{{{17|}}} |{{{18|}}} |{{{19|}}} |{{{20|}}}
}} </div>
{{longitem|style=line-height:1.3em|'''''Please do not rename or remove these classes{{#if:{{{nocollapse<includeonly>|</includeonly>}}} |<br/>nor collapse nested elements which use them}}.'''''}}<!--
-->}}<!--(end #if:[1])--><noinclude>
{{Documentation}}
</noinclude>
25d8c54d56c1c64f1b98e6c8b2a50054e6a9deb5
Template:Auto short description
10
207
407
406
2023-12-24T02:12:17Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Auto_short_description]]
wikitext
text/x-wiki
{{Ombox
| type = notice
| text = This template {{#if:{{{sometimes|}}}|sometimes{{sp}}}}adds an automatically generated '''[[Wikipedia:Short description|short description]]'''{{#if:{{{category|}}}|{{sp}}({{{category}}})|}}{{#if:{{{indirect|}}}|{{sp}}via an embedded template}}{{#if:{{{conditions|}}}|{{space}}{{{conditions}}}}}. If the automatic short description is not optimal, replace it by adding {{tl|Short description}} at the top of the article.
}}<includeonly>{{Subpage other|<!-- do not categorise -->|[[Category:Templates that generate short descriptions{{#if:{{{category|}}}|{{sp}}for {{{category}}}|}}]]}}</includeonly><noinclude>
{{Documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
e05ca99e1d986f5fcc83593ae854151d2a7dcea0
Template:UF-hcard-org
10
208
409
408
2023-12-24T02:12:18Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:UF-hcard-org]]
wikitext
text/x-wiki
{{Microformat message
| format = hCard
| data = an organization's details
| subtemplates =
* Use {{#ifeq:{{yesno-yes|{{{age|}}}}}|yes|{{tl|Start date and age}}|{{tl|Start date}}}} for the date on which an organisation was "established", "founded", "opened" or otherwise started, [[Wikipedia:WikiProject Microformats/dates|unless that date is before 1583 CE]].
* Use {{tl|URL}} for an organisation's URL.
|adr |agent |category |country-name |extended-address |fn |geo |label |latitude |locality |longitude |nickname |note |org |region |street-address |url |vcard
| nocollapse = on
}}<includeonly>{{sandbox other||
[[Category:Templates generating hCards]]
}}</includeonly><noinclude>
{{Documentation |content={{Microformat message templates}}}}
[[Category:Microformat (uF) message templates]]
[[Category:Templates generating hCards| ]]
</noinclude>
631bc99cd046167681b6eb518559d92fc65a4920
Template:Infobox election
10
209
411
410
2023-12-24T02:13:12Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Infobox_election]]
wikitext
text/x-wiki
<includeonly>{{#invoke:infobox|infoboxTemplate
| child = {{{child|{{{embed|}}}}}}
| bodyclass = {{#if:{{{election_date|}}}|vevent|}}
| bodystyle = line-height: 1.5em; {{#if:<!--
-->{{{map_image|}}}{{{map|}}}{{{map2_image|}}}{{{map2|}}}{{{map3_image|}}}{{{map3|}}}{{{map4_image|}}}{{{map4|}}}<!--
-->|width:{{max
| 1 = {{#if:{{{map_image|}}}{{{map|}}}|{{#invoke:string|replace|{{if empty|{{{map_size|}}}|300px}}|px%s*$||plain=false}}}}
| 2 = {{#if:{{{map2_image|}}}{{{map2|}}}|{{#invoke:string|replace|{{if empty|{{{map2_size|}}}|300px}}|px%s*$||plain=false}}}}
| 3 = {{#if:{{{map3_image|}}}{{{map3|}}}|{{#invoke:string|replace|{{if empty|{{{map3_size|}}}|300px}}|px%s*$||plain=false}}}}
| 4 = {{#if:{{{map4_image|}}}{{{map4|}}}|{{#invoke:string|replace|{{if empty|{{{map4_size|}}}|300px}}|px%s*$||plain=false}}}}
}}px}}
| titleclass = summary
| titlestyle = font-size: 125%;
| title = {{#ifeq:{{{child|{{{embed|}}}}}}|yes|{{#if:{{{election_name|}}}|<div style="background-color:#ddd; font-size:120%; font-weight:bold">{{{election_name}}}</div>}}|{{{election_name|{{PAGENAME}}}}}}}
| datastyle = text-align:center;
| labelstyle = width:5em;white-space:nowrap;
| subheaderstyle = line-height:130%;
| subheader1 = {{#if:{{{flag_image|}}}
|{{#invoke:InfoboxImage|InfoboxImage|image={{{flag_image|}}}|size=50px|alt=|link=}}<hr />
|{{#if:{{{country|}}}
|{{#ifexist:Template:Country data {{{country}}}|{{flagdeco|{{{country}}}|variant={{{flag_year|}}}|size=50px|noredlink={{main other||yes}}}}<hr />}}
}}
}}
| subheader2 = {{#if:{{{previous_year|}}}{{{election_date|}}}{{{next_year|}}}|
{{succession links|leftstyle=width:20%;|centerstyle = width:60%;|rightstyle=width:20%;
| left ={{#if:{{{previous_year|}}}|{{#ifexist:{{{previous_election|}}}|[[{{{previous_election}}}|{{{previous_year}}}]]|{{{previous_year}}}}}}}
| center = {{#if:{{{election_date|}}}|'''{{{election_date}}}'''}}
| right = {{#if:{{{next_year|}}}|{{#ifexist:{{{next_election|}}}|[[{{{next_election}}}|{{{next_year}}}]]|{{{next_year}}}}}}}
}}
}}
| subheader3 =
{{#if:{{{outgoing_members|{{{previous_mps|}}}}}}{{{elected_members|{{{elected_mps|}}}}}}|
{{succession links|leftstyle=width:40%; text-align:center;|rightstyle=width:40%; text-align:center;
| left = {{#if:{{{outgoing_members|{{{previous_mps|}}}}}}|{{#ifexist:{{{outgoing_members|{{{previous_mps|}}}}}}|[[{{{outgoing_members|{{{previous_mps|}}}}}}|outgoing members]]|{{{outgoing_members|{{{previous_mps|}}}}}}}}}}
| right = {{#if:{{{elected_members|{{{elected_mps|}}}}}}|{{#ifexist:{{{elected_members|{{{elected_mps|}}}}}}|[[{{{elected_members|{{{elected_mps|}}}}}}|elected members]]|{{{elected_members|{{{elected_mps|}}}}}}}}|}}
}}
}}
| headerstyle = font-weight:normal;
| header1 =
{{#switch:{{{type|}}}
| primary
| Primary
| presidential
| Presidential = {{#if:{{{votes_for_election|}}}|<hr />{{{votes_for_election}}}{{#if:{{{needed_votes|}}}|<br />{{{needed_votes}}} votes needed to win}}
}}
| parliamentary
| Parliamentary
| legislative
| Legislative
| by-election
| By-election = {{#if:{{{seats_for_election|}}}|<hr />{{{seats_for_election}}}{{#if:{{{majority_seats|}}}|<br />{{{majority_seats}}} seats needed for a majority}}
}}
| #default =
}}
| data2 = {{#if:{{{opinion_polls|}}}| [[{{{opinion_polls}}}|Opinion polls]] }}
| label3 = Registered
| data3 = {{{registered|}}}
| label4 = Turnout
| data4 = {{{turnout|}}}
| label5 = Votes counted
| data5 = {{#if:{{{votes_counted|}}}|{{center|{{Percentage bar|{{{votes_counted}}}|{{{votes_counted}}}%|1BCE0E}}}}as of '''{{{last_update}}} {{{time_zone}}}''' }}
| label6 = Reporting
| data6 = {{#if:{{{reporting|}}}|{{center|{{Percentage bar|{{{reporting}}}|{{{reporting}}}%|1BCE0E}}}}as of '''{{{last_update}}} {{{time_zone}}}''' }}
| label7 = Declared
| data7 = {{#if:{{{declared|}}}|{{center|{{Percentage bar|{{{declared}}}|{{{declared}}}%|1BCE0E}}}}as of '''{{{last_update}}} {{{time_zone}}}''' }}
| data10 = <nowiki />
{{(!}} style="background:transparent; width:100%;"
{{!}}-
{{Infobox election/row
| type = {{{type|}}}
| divider = <!-- none -->
| filler = {{{filler|}}}
| col3 = {{#if:{{{color3|}}}{{{colour3|}}}{{{image3|}}}{{{nominee3|}}}{{{candidate3|}}}{{{leader3|}}}{{{party3|}}}{{{alliance3|}}}{{{home_state3|}}}{{{running_mate3|}}}{{{electoral_vote3|}}}{{{delegate_count3|}}}{{{states_carried3|}}}{{{leader_since3|}}}{{{leaders_seat3|}}}{{{last_election3|}}}{{{seats_before3|}}}{{{seats_needed3|}}}{{{seats3|}}}{{{seats_after3|}}}{{{seat_change3|}}}{{{popular_vote3|}}}{{{percentage3|}}}{{{swing3|}}}{{{poll1_nominee3|}}}{{{poll1_candidate3|}}}{{{poll2_nominee3|}}}{{{poll2_candidate3|}}}{{{poll3_nominee3|}}}{{{poll3_candidate3|}}}{{{poll4_nominee3|}}}{{{poll4_candidate3|}}}{{{poll5_nominee3|}}}{{{poll5_candidate3|}}}{{{poll1_party3|}}}{{{poll2_party3|}}}{{{poll3_party3|}}}{{{poll4_party3|}}}{{{poll5_party3|}}}{{{1data3|}}}{{{2data3|}}}{{{3data3|}}}{{{4data3|}}}{{{5data3|}}}{{{6data3|}}}|yes}}
| ongoing = {{{ongoing|no}}}
| header1 = {{#switch:{{{type|}}}|parliamentary|Parliamentary=First party|#default=Majority party}}
| header2 = {{#switch:{{{type|}}}|parliamentary|Parliamentary=Second party|#default=Minority party}}
| header3 = {{#switch:{{{type|}}}|parliamentary|Parliamentary=Third party|#default=Third party}}
| party_color = {{if empty| {{{party_colour|}}} | {{{party_color|}}} | yes }}
| color1 = {{if empty| {{{color1|}}} | {{{colour1|}}} }}
| color2 = {{if empty| {{{color2|}}} | {{{colour2|}}} }}
| color3 = {{if empty| {{{color3|}}} | {{{colour3|}}} }}
| image_size = {{{image_size|150x150px}}}
| image_upright = {{{image_upright|}}}
| image1 = {{{image1|}}}
| image1_size = {{{image1_size|}}}
| image1_upright = {{{image1_upright|}}}
| image2 = {{{image2|}}}
| image2_size = {{{image2_size|}}}
| image2_upright = {{{image2_upright|}}}
| image3 = {{{image3|}}}
| image3_size = {{{image3_size|}}}
| image3_upright = {{{image3_upright|}}}
| pageimage1 = {{{pageimage1|}}}
| pageimage2 = {{{pageimage2|}}}
| pageimage3 = {{{pageimage3|}}}
| nominee1 = {{{nominee1|}}}
| nominee2 = {{{nominee2|}}}
| nominee3 = {{{nominee3|}}}
| candidate1 = {{{candidate1|}}}
| candidate2 = {{{candidate2|}}}
| candidate3 = {{{candidate3|}}}
| leader1 = {{{leader1|}}}
| leader2 = {{{leader2|}}}
| leader3 = {{{leader3|}}}
| party1_name = {{{party1_name|{{{party_name|}}}}}}
| party2_name = {{{party2_name|{{{party_name|}}}}}}
| party3_name = {{{party3_name|{{{party_name|}}}}}}
| party1 = {{{party1|}}}
| party2 = {{{party2|}}}
| party3 = {{{party3|}}}
| alliance1_name = {{{alliance1_name|{{{alliance_name|}}}}}}
| alliance2_name = {{{alliance2_name|{{{alliance_name|}}}}}}
| alliance3_name = {{{alliance3_name|{{{alliance_name|}}}}}}
| alliance1 = {{{alliance1|}}}
| alliance2 = {{{alliance2|}}}
| alliance3 = {{{alliance3|}}}
| home_state1 = {{{home_state1|}}}
| home_state2 = {{{home_state2|}}}
| home_state3 = {{{home_state3|}}}
| running_mate1 = {{{running_mate1|}}}
| running_mate2 = {{{running_mate2|}}}
| running_mate3 = {{{running_mate3|}}}
| college_voted = {{{college_voted|}}}
| electoral_vote1 = {{{electoral_vote1|}}}
| electoral_vote2 = {{{electoral_vote2|}}}
| electoral_vote3 = {{{electoral_vote3|}}}
| delegate_count1 = {{{delegate_count1|}}}
| delegate_count2 = {{{delegate_count2|}}}
| delegate_count3 = {{{delegate_count3|}}}
| states_carried1 = {{{states_carried1|}}}
| states_carried2 = {{{states_carried2|}}}
| states_carried3 = {{{states_carried3|}}}
| leader_since1 = {{{leader_since1|}}}
| leader_since2 = {{{leader_since2|}}}
| leader_since3 = {{{leader_since3|}}}
| leaders_seat1 = {{{leaders_seat1|}}}
| leaders_seat2 = {{{leaders_seat2|}}}
| leaders_seat3 = {{{leaders_seat3|}}}
| last_election1 = {{{last_election1|}}}
| last_election2 = {{{last_election2|}}}
| last_election3 = {{{last_election3|}}}
| seats_before1 = {{{seats_before1|}}}
| seats_before2 = {{{seats_before2|}}}
| seats_before3 = {{{seats_before3|}}}
| seats_needed1 = {{{seats_needed1|}}}
| seats_needed2 = {{{seats_needed2|}}}
| seats_needed3 = {{{seats_needed3|}}}
| seats1 = {{{seats1|}}}
| seats2 = {{{seats2|}}}
| seats3 = {{{seats3|}}}
| seats_after1 = {{{seats_after1|}}}
| seats_after2 = {{{seats_after2|}}}
| seats_after3 = {{{seats_after3|}}}
| seat_change1 = {{{seat_change1|}}}
| seat_change2 = {{{seat_change2|}}}
| seat_change3 = {{{seat_change3|}}}
| vote_type = {{{vote_type|Popular}}}
| popular_vote1 = {{{popular_vote1|}}}
| popular_vote2 = {{{popular_vote2|}}}
| popular_vote3 = {{{popular_vote3|}}}
| percentage1 = {{{percentage1|}}}
| percentage2 = {{{percentage2|}}}
| percentage3 = {{{percentage3|}}}
| counties_won1 = {{{counties_won1|}}}
| counties_won2 = {{{counties_won2|}}}
| counties_won3 = {{{counties_won3|}}}
| counties_threshold1 = {{{counties_threshold1|}}}
| counties_threshold2 = {{{counties_threshold2|}}}
| counties_threshold3 = {{{counties_threshold3|}}}
| swing1 = {{{swing1|}}}
| swing2 = {{{swing2|}}}
| swing3 = {{{swing3|}}}
| opinion_polls = {{{opinion_polls|}}}
| poll1_date = {{if empty|{{{poll1_date1|}}}|{{{poll1_date|}}}}}
| poll1_source = {{if empty|{{{poll1_source1|}}}|{{{poll1_source|}}}}}
| poll1_person1 = {{if empty|{{{poll1_nominee1|}}}|{{{poll1_candidate1|}}}}}
| poll1_person2 = {{if empty|{{{poll1_nominee2|}}}|{{{poll1_candidate2|}}}}}
| poll1_person3 = {{if empty|{{{poll1_nominee3|}}}|{{{poll1_candidate3|}}}}}
| poll2_date = {{if empty|{{{poll2_date1|}}}|{{{poll2_date|}}}}}
| poll2_source = {{if empty|{{{poll2_source1|}}}|{{{poll2_source|}}}}}
| poll2_person1 = {{if empty|{{{poll2_nominee1|}}}|{{{poll2_candidate1|}}}}}
| poll2_person2 = {{if empty|{{{poll2_nominee2|}}}|{{{poll2_candidate2|}}}}}
| poll2_person3 = {{if empty|{{{poll2_nominee3|}}}|{{{poll2_candidate3|}}}}}
| poll3_date = {{if empty|{{{poll3_date1|}}}|{{{poll3_date|}}}}}
| poll3_source = {{if empty|{{{poll3_source1|}}}|{{{poll3_source|}}}}}
| poll3_person1 = {{if empty|{{{poll3_nominee1|}}}|{{{poll3_candidate1|}}}}}
| poll3_person2 = {{if empty|{{{poll3_nominee2|}}}|{{{poll3_candidate2|}}}}}
| poll3_person3 = {{if empty|{{{poll3_nominee3|}}}|{{{poll3_candidate3|}}}}}
| poll4_date = {{if empty|{{{poll4_date1|}}}|{{{poll4_date|}}}}}
| poll4_source = {{if empty|{{{poll4_source1|}}}|{{{poll4_source|}}}}}
| poll4_person1 = {{if empty|{{{poll4_nominee1|}}}|{{{poll4_candidate1|}}}}}
| poll4_person2 = {{if empty|{{{poll4_nominee2|}}}|{{{poll4_candidate2|}}}}}
| poll4_person3 = {{if empty|{{{poll4_nominee3|}}}|{{{poll4_candidate3|}}}}}
| poll5_date = {{if empty|{{{poll5_date1|}}}|{{{poll5_date|}}}}}
| poll5_source = {{if empty|{{{poll5_source1|}}}|{{{poll5_source|}}}}}
| poll5_person1 = {{if empty|{{{poll5_nominee1|}}}|{{{poll5_candidate1|}}}}}
| poll5_person2 = {{if empty|{{{poll5_nominee2|}}}|{{{poll5_candidate2|}}}}}
| poll5_person3 = {{if empty|{{{poll5_nominee3|}}}|{{{poll5_candidate3|}}}}}
| poll1_party1 = {{{poll1_party1|}}}| poll1_party2 = {{{poll1_party2|}}}| poll1_party3 = {{{poll1_party3|}}}
| poll2_party1 = {{{poll2_party1|}}}| poll2_party2 = {{{poll2_party2|}}}| poll2_party3 = {{{poll2_party3|}}}
| poll3_party1 = {{{poll3_party1|}}}| poll3_party2 = {{{poll3_party2|}}}| poll3_party3 = {{{poll3_party3|}}}
| poll4_party1 = {{{poll4_party1|}}}| poll4_party2 = {{{poll4_party2|}}}| poll4_party3 = {{{poll4_party3|}}}
| poll5_party1 = {{{poll5_party1|}}}| poll5_party2 = {{{poll5_party2|}}}| poll5_party3 = {{{poll5_party3|}}}
| 1blank = {{{1blank|}}}| 1data1 = {{{1data1|}}}| 1data2 = {{{1data2|}}}| 1data3 = {{{1data3|}}}
| 2blank = {{{2blank|}}}| 2data1 = {{{2data1|}}}| 2data2 = {{{2data2|}}}| 2data3 = {{{2data3|}}}
| 3blank = {{{3blank|}}}| 3data1 = {{{3data1|}}}| 3data2 = {{{3data2|}}}| 3data3 = {{{3data3|}}}
| 4blank = {{{4blank|}}}| 4data1 = {{{4data1|}}}| 4data2 = {{{4data2|}}}| 4data3 = {{{4data3|}}}
| 5blank = {{{5blank|}}}| 5data1 = {{{5data1|}}}| 5data2 = {{{5data2|}}}| 5data3 = {{{5data3|}}}
| 6blank = {{{6blank|}}}| 6data1 = {{{6data1|}}}| 6data2 = {{{6data2|}}}| 6data3 = {{{6data3|}}}
}}
{{!}}-
{{Infobox election/row
| type = {{{type|}}}
| divider = <hr />
| col3 = {{#if:{{{color6|}}}{{{colour6|}}}{{{image6|}}}{{{nominee6|}}}{{{candidate6|}}}{{{leader6|}}}{{{party6|}}}{{{alliance6|}}}{{{home_state6|}}}{{{running_mate6|}}}{{{electoral_vote6|}}}{{{delegate_count6|}}}{{{states_carried6|}}}{{{leader_since6|}}}{{{leaders_seat6|}}}{{{last_election6|}}}{{{seats_before6|}}}{{{seats_needed6|}}}{{{seats6|}}}{{{seats_after6|}}}{{{seat_change6|}}}{{{popular_vote6|}}}{{{percentage6|}}}{{{swing6|}}}{{{poll1_nominee6|}}}{{{poll1_candidate6|}}}{{{poll2_nominee6|}}}{{{poll2_candidate6|}}}{{{poll3_nominee6|}}}{{{poll3_candidate6|}}}{{{poll4_nominee6|}}}{{{poll4_candidate6|}}}{{{poll5_nominee6|}}}{{{poll5_candidate6|}}}{{{poll1_party6|}}}{{{poll2_party6|}}}{{{poll3_party6|}}}{{{poll4_party6|}}}{{{poll5_party6|}}}{{{1data6|}}}{{{2data6|}}}{{{3data6|}}}{{{4data6|}}}{{{5data6|}}}{{{6data6|}}}|yes}}
| ongoing = {{{ongoing|no}}}
| header1 = {{#if:{{{party3|}}}|Fourth party|Third party}}
| header2 = {{#if:{{{party3|}}}|Fifth party|Fourth party}}
| header3 = {{#if:{{{party3|}}}|Sixth party|Fifth party}}
| party_color = {{if empty| {{{party_colour|}}} | {{{party_color|}}} | yes }}
| color1 = {{if empty| {{{color4|}}} | {{{colour4|}}} }}
| color2 = {{if empty| {{{color5|}}} | {{{colour5|}}} }}
| color3 = {{if empty| {{{color6|}}} | {{{colour6|}}} }}
| image_size = {{{image_size|150x150px}}}
| image_upright = {{{image_upright|}}}
| image1 = {{{image4|}}}
| image1_size = {{{image4_size|}}}
| image1_upright = {{{image4_upright|}}}
| image2 = {{{image5|}}}
| image2_size = {{{image5_size|}}}
| image2_upright = {{{image5_upright|}}}
| image3 = {{{image6|}}}
| image3_size = {{{image6_size|}}}
| image3_upright = {{{image6_upright|}}}
| pageimage1 = {{{pageimage4|}}}
| pageimage2 = {{{pageimage5|}}}
| pageimage3 = {{{pageimage6|}}}
| nominee1 = {{{nominee4|}}}
| nominee2 = {{{nominee5|}}}
| nominee3 = {{{nominee6|}}}
| candidate1 = {{{candidate4|}}}
| candidate2 = {{{candidate5|}}}
| candidate3 = {{{candidate6|}}}
| leader1 = {{{leader4|}}}
| leader2 = {{{leader5|}}}
| leader3 = {{{leader6|}}}
| party1_name = {{{party4_name|{{{party_name|}}}}}}
| party2_name = {{{party5_name|{{{party_name|}}}}}}
| party3_name = {{{party6_name|{{{party_name|}}}}}}
| party1 = {{{party4|}}}
| party2 = {{{party5|}}}
| party3 = {{{party6|}}}
| alliance1_name = {{{alliance4_name|{{{alliance_name|}}}}}}
| alliance2_name = {{{alliance5_name|{{{alliance_name|}}}}}}
| alliance3_name = {{{alliance6_name|{{{alliance_name|}}}}}}
| alliance1 = {{{alliance4|}}}
| alliance2 = {{{alliance5|}}}
| alliance3 = {{{alliance6|}}}
| home_state1 = {{{home_state4|}}}
| home_state2 = {{{home_state5|}}}
| home_state3 = {{{home_state6|}}}
| running_mate1 = {{{running_mate4|}}}
| running_mate2 = {{{running_mate5|}}}
| running_mate3 = {{{running_mate6|}}}
| college_voted = {{{college_voted|}}}
| electoral_vote1 = {{{electoral_vote4|}}}
| electoral_vote2 = {{{electoral_vote5|}}}
| electoral_vote3 = {{{electoral_vote6|}}}
| delegate_count1 = {{{delegate_count4|}}}
| delegate_count2 = {{{delegate_count5|}}}
| delegate_count3 = {{{delegate_count6|}}}
| states_carried1 = {{{states_carried4|}}}
| states_carried2 = {{{states_carried5|}}}
| states_carried3 = {{{states_carried6|}}}
| leader_since1 = {{{leader_since4|}}}
| leader_since2 = {{{leader_since5|}}}
| leader_since3 = {{{leader_since6|}}}
| leaders_seat1 = {{{leaders_seat4|}}}
| leaders_seat2 = {{{leaders_seat5|}}}
| leaders_seat3 = {{{leaders_seat6|}}}
| last_election1 = {{{last_election4|}}}
| last_election2 = {{{last_election5|}}}
| last_election3 = {{{last_election6|}}}
| seats_before1 = {{{seats_before4|}}}
| seats_before2 = {{{seats_before5|}}}
| seats_before3 = {{{seats_before6|}}}
| seats_needed1 = {{{seats_needed4|}}}
| seats_needed2 = {{{seats_needed5|}}}
| seats_needed3 = {{{seats_needed6|}}}
| seats1 = {{{seats4|}}}
| seats2 = {{{seats5|}}}
| seats3 = {{{seats6|}}}
| seats_after1 = {{{seats_after4|}}}
| seats_after2 = {{{seats_after5|}}}
| seats_after3 = {{{seats_after6|}}}
| seat_change1 = {{{seat_change4|}}}
| seat_change2 = {{{seat_change5|}}}
| seat_change3 = {{{seat_change6|}}}
| vote_type = {{{vote_type|Popular}}}
| popular_vote1 = {{{popular_vote4|}}}
| popular_vote2 = {{{popular_vote5|}}}
| popular_vote3 = {{{popular_vote6|}}}
| percentage1 = {{{percentage4|}}}
| percentage2 = {{{percentage5|}}}
| percentage3 = {{{percentage6|}}}
| swing1 = {{{swing4|}}}
| swing2 = {{{swing5|}}}
| swing3 = {{{swing6|}}}
| opinion_polls = {{{opinion_polls|}}}
| poll1_date = {{if empty|{{{poll1_date2|}}}|{{{poll1_date|}}}}}
| poll1_source = {{if empty|{{{poll1_source2|}}}|{{{poll1_source|}}}}}
| poll1_person1 = {{if empty|{{{poll1_nominee4|}}}|{{{poll1_candidate4|}}}}}
| poll1_person2 = {{if empty|{{{poll1_nominee5|}}}|{{{poll1_candidate5|}}}}}
| poll1_person3 = {{if empty|{{{poll1_nominee6|}}}|{{{poll1_candidate6|}}}}}
| poll2_date = {{if empty|{{{poll2_date2|}}}|{{{poll2_date|}}}}}
| poll2_source = {{if empty|{{{poll2_source2|}}}|{{{poll2_source|}}}}}
| poll2_person1 = {{if empty|{{{poll2_nominee4|}}}|{{{poll2_candidate4|}}}}}
| poll2_person2 = {{if empty|{{{poll2_nominee5|}}}|{{{poll2_candidate5|}}}}}
| poll2_person3 = {{if empty|{{{poll2_nominee6|}}}|{{{poll2_candidate6|}}}}}
| poll3_date = {{if empty|{{{poll3_date2|}}}|{{{poll3_date|}}}}}
| poll3_source = {{if empty|{{{poll3_source2|}}}|{{{poll3_source|}}}}}
| poll3_person1 = {{if empty|{{{poll3_nominee4|}}}|{{{poll3_candidate4|}}}}}
| poll3_person2 = {{if empty|{{{poll3_nominee5|}}}|{{{poll3_candidate5|}}}}}
| poll3_person3 = {{if empty|{{{poll3_nominee6|}}}|{{{poll3_candidate6|}}}}}
| poll4_date = {{if empty|{{{poll4_date2|}}}|{{{poll4_date|}}}}}
| poll4_source = {{if empty|{{{poll4_source2|}}}|{{{poll4_source|}}}}}
| poll4_person1 = {{if empty|{{{poll4_nominee4|}}}|{{{poll4_candidate4|}}}}}
| poll4_person2 = {{if empty|{{{poll4_nominee5|}}}|{{{poll4_candidate5|}}}}}
| poll4_person3 = {{if empty|{{{poll4_nominee6|}}}|{{{poll4_candidate6|}}}}}
| poll5_date = {{if empty|{{{poll5_date2|}}}|{{{poll5_date|}}}}}
| poll5_source = {{if empty|{{{poll5_source2|}}}|{{{poll5_source|}}}}}
| poll5_person1 = {{if empty|{{{poll5_nominee4|}}}|{{{poll5_candidate4|}}}}}
| poll5_person2 = {{if empty|{{{poll5_nominee5|}}}|{{{poll5_candidate5|}}}}}
| poll5_person3 = {{if empty|{{{poll5_nominee6|}}}|{{{poll5_candidate6|}}}}}
| poll1_party1 = {{{poll1_party4|}}}| poll1_party2 = {{{poll1_party5|}}}| poll1_party3 = {{{poll1_party6|}}}
| poll2_party1 = {{{poll2_party4|}}}| poll2_party2 = {{{poll2_party5|}}}| poll2_party3 = {{{poll2_party6|}}}
| poll3_party1 = {{{poll3_party4|}}}| poll3_party2 = {{{poll3_party5|}}}| poll3_party3 = {{{poll3_party6|}}}
| poll4_party1 = {{{poll4_party4|}}}| poll4_party2 = {{{poll4_party5|}}}| poll4_party3 = {{{poll4_party6|}}}
| poll5_party1 = {{{poll5_party4|}}}| poll5_party2 = {{{poll5_party5|}}}| poll5_party3 = {{{poll5_party6|}}}
| 1blank = {{{1blank|}}}| 1data1 = {{{1data4|}}}| 1data2 = {{{1data5|}}}| 1data3 = {{{1data6|}}}
| 2blank = {{{2blank|}}}| 2data1 = {{{2data4|}}}| 2data2 = {{{2data5|}}}| 2data3 = {{{2data6|}}}
| 3blank = {{{3blank|}}}| 3data1 = {{{3data4|}}}| 3data2 = {{{3data5|}}}| 3data3 = {{{3data6|}}}
| 4blank = {{{4blank|}}}| 4data1 = {{{4data4|}}}| 4data2 = {{{4data5|}}}| 4data3 = {{{4data6|}}}
| 5blank = {{{5blank|}}}| 5data1 = {{{5data4|}}}| 5data2 = {{{5data5|}}}| 5data3 = {{{5data6|}}}
| 6blank = {{{6blank|}}}| 6data1 = {{{6data4|}}}| 6data2 = {{{6data5|}}}| 6data3 = {{{6data6|}}}
}}
{{!}}-
{{Infobox election/row
| type = {{{type|}}}
| divider = <hr />
| ongoing = {{{ongoing|no}}}
| col3 = {{#if:{{{color9|}}}{{{colour9|}}}{{{image9|}}}{{{nominee9|}}}{{{candidate9|}}}{{{leader9|}}}{{{party9|}}}{{{alliance9|}}}{{{home_state9|}}}{{{running_mate9|}}}{{{electoral_vote9|}}}{{{delegate_count9|}}}{{{states_carried9|}}}{{{leader_since9|}}}{{{leaders_seat9|}}}{{{last_election9|}}}{{{seats_before9|}}}{{{seats_needed9|}}}{{{seats9|}}}{{{seats_after9|}}}{{{seat_change9|}}}{{{popular_vote9|}}}{{{percentage9|}}}{{{counties_won9|}}}{{{counties_threshold9|}}}{{{swing9|}}}{{{poll1_nominee9|}}}{{{poll1_candidate9|}}}{{{poll2_nominee9|}}}{{{poll2_candidate9|}}}{{{poll3_nominee9|}}}{{{poll3_candidate9|}}}{{{poll4_nominee9|}}}{{{poll4_candidate9|}}}{{{poll5_nominee9|}}}{{{poll5_candidate9|}}}{{{poll1_party9|}}}{{{poll2_party9|}}}{{{poll3_party9|}}}{{{poll4_party9|}}}{{{poll5_party9|}}}{{{1data9|}}}{{{2data9|}}}{{{3data9|}}}{{{4data9|}}}{{{5data9|}}}{{{6data9|}}}|yes}}
| header1 = {{#switch:{{#expr:{{#if:{{{party3|}}}|1|0}}+{{#if:{{{party6|}}}|1|0}}}}|0=Fifth party|1=Sixth party|2=Seventh party}}
| header2 = {{#switch:{{#expr:{{#if:{{{party3|}}}|1|0}}+{{#if:{{{party6|}}}|1|0}}}}|0=Sixth party|1=Seventh party|2=Eighth party}}
| header3 = {{#switch:{{#expr:{{#if:{{{party3|}}}|1|0}}+{{#if:{{{party6|}}}|1|0}}}}|0=Seventh party|1=Eighth party|2=Ninth party}}
| party_color = {{if empty| {{{party_colour|}}} | {{{party_color|}}} | yes }}
| color1 = {{if empty| {{{color7|}}} | {{{colour7|}}} }}
| color2 = {{if empty| {{{color8|}}} | {{{colour8|}}} }}
| color3 = {{if empty| {{{color9|}}} | {{{colour9|}}} }}
| image_size = {{{image_size|150x150px}}}
| image_upright = {{{image_upright|}}}
| image1 = {{{image7|}}}
| image1_size = {{{image7_size|}}}
| image1_upright = {{{image7_upright|}}}
| image2 = {{{image8|}}}
| image2_size = {{{image8_size|}}}
| image2_upright = {{{image8_upright|}}}
| image3 = {{{image9|}}}
| image3_size = {{{image9_size|}}}
| image3_upright = {{{image9_upright|}}}
| pageimage1 = {{{pageimage7|}}}
| pageimage2 = {{{pageimage8|}}}
| pageimage3 = {{{pageimage9|}}}
| nominee1 = {{{nominee7|}}}
| nominee2 = {{{nominee8|}}}
| nominee3 = {{{nominee9|}}}
| candidate1 = {{{candidate7|}}}
| candidate2 = {{{candidate8|}}}
| candidate3 = {{{candidate9|}}}
| leader1 = {{{leader7|}}}
| leader2 = {{{leader8|}}}
| leader3 = {{{leader9|}}}
| party1_name = {{{party7_name|{{{party_name|}}}}}}
| party2_name = {{{party8_name|{{{party_name|}}}}}}
| party3_name = {{{party9_name|{{{party_name|}}}}}}
| party1 = {{{party7|}}}
| party2 = {{{party8|}}}
| party3 = {{{party9|}}}
| alliance1_name = {{{alliance7_name|{{{alliance_name|}}}}}}
| alliance2_name = {{{alliance8_name|{{{alliance_name|}}}}}}
| alliance3_name = {{{alliance9_name|{{{alliance_name|}}}}}}
| alliance1 = {{{alliance7|}}}
| alliance2 = {{{alliance8|}}}
| alliance3 = {{{alliance9|}}}
| home_state1 = {{{home_state7|}}}
| home_state2 = {{{home_state8|}}}
| home_state3 = {{{home_state9|}}}
| running_mate1 = {{{running_mate7|}}}
| running_mate2 = {{{running_mate8|}}}
| running_mate3 = {{{running_mate9|}}}
| college_voted = {{{college_voted|}}}
| electoral_vote1 = {{{electoral_vote7|}}}
| electoral_vote2 = {{{electoral_vote8|}}}
| electoral_vote3 = {{{electoral_vote9|}}}
| delegate_count1 = {{{delegate_count7|}}}
| delegate_count2 = {{{delegate_count8|}}}
| delegate_count3 = {{{delegate_count9|}}}
| states_carried1 = {{{states_carried7|}}}
| states_carried2 = {{{states_carried8|}}}
| states_carried3 = {{{states_carried9|}}}
| leader_since1 = {{{leader_since7|}}}
| leader_since2 = {{{leader_since8|}}}
| leader_since3 = {{{leader_since9|}}}
| leaders_seat1 = {{{leaders_seat7|}}}
| leaders_seat2 = {{{leaders_seat8|}}}
| leaders_seat3 = {{{leaders_seat9|}}}
| last_election1 = {{{last_election7|}}}
| last_election2 = {{{last_election8|}}}
| last_election3 = {{{last_election9|}}}
| seats_before1 = {{{seats_before7|}}}
| seats_before2 = {{{seats_before8|}}}
| seats_before3 = {{{seats_before9|}}}
| seats_needed1 = {{{seats_needed7|}}}
| seats_needed2 = {{{seats_needed8|}}}
| seats_needed3 = {{{seats_needed9|}}}
| seats1 = {{{seats7|}}}
| seats2 = {{{seats8|}}}
| seats3 = {{{seats9|}}}
| seats_after1 = {{{seats_after7|}}}
| seats_after2 = {{{seats_after8|}}}
| seats_after3 = {{{seats_after9|}}}
| seat_change1 = {{{seat_change7|}}}
| seat_change2 = {{{seat_change8|}}}
| seat_change3 = {{{seat_change9|}}}
| vote_type = {{{vote_type|Popular}}}
| popular_vote1 = {{{popular_vote7|}}}
| popular_vote2 = {{{popular_vote8|}}}
| popular_vote3 = {{{popular_vote9|}}}
| percentage1 = {{{percentage7|}}}
| percentage2 = {{{percentage8|}}}
| percentage3 = {{{percentage9|}}}
| swing1 = {{{swing7|}}}
| swing2 = {{{swing8|}}}
| swing3 = {{{swing9|}}}
| opinion_polls = {{{opinion_polls|}}}
| poll1_date = {{if empty|{{{poll1_date3|}}}|{{{poll1_date|}}}}}
| poll1_source = {{if empty|{{{poll1_source3|}}}|{{{poll1_source|}}}}}
| poll1_person1 = {{if empty|{{{poll1_nominee7|}}}|{{{poll1_candidate7|}}}}}
| poll1_person2 = {{if empty|{{{poll1_nominee8|}}}|{{{poll1_candidate8|}}}}}
| poll1_person3 = {{if empty|{{{poll1_nominee9|}}}|{{{poll1_candidate9|}}}}}
| poll2_date = {{if empty|{{{poll2_date3|}}}|{{{poll2_date|}}}}}
| poll2_source = {{if empty|{{{poll2_source3|}}}|{{{poll2_source|}}}}}
| poll2_person1 = {{if empty|{{{poll2_nominee7|}}}|{{{poll2_candidate7|}}}}}
| poll2_person2 = {{if empty|{{{poll2_nominee8|}}}|{{{poll2_candidate8|}}}}}
| poll2_person3 = {{if empty|{{{poll2_nominee9|}}}|{{{poll2_candidate9|}}}}}
| poll3_date = {{if empty|{{{poll3_date3|}}}|{{{poll3_date|}}}}}
| poll3_source = {{if empty|{{{poll3_source3|}}}|{{{poll3_source|}}}}}
| poll3_person1 = {{if empty|{{{poll3_nominee7|}}}|{{{poll3_candidate7|}}}}}
| poll3_person2 = {{if empty|{{{poll3_nominee8|}}}|{{{poll3_candidate8|}}}}}
| poll3_person3 = {{if empty|{{{poll3_nominee9|}}}|{{{poll3_candidate9|}}}}}
| poll4_date = {{if empty|{{{poll4_date3|}}}|{{{poll4_date|}}}}}
| poll4_source = {{if empty|{{{poll4_source3|}}}|{{{poll4_source|}}}}}
| poll4_person1 = {{if empty|{{{poll4_nominee7|}}}|{{{poll4_candidate7|}}}}}
| poll4_person2 = {{if empty|{{{poll4_nominee8|}}}|{{{poll4_candidate8|}}}}}
| poll4_person3 = {{if empty|{{{poll4_nominee9|}}}|{{{poll4_candidate9|}}}}}
| poll5_date = {{if empty|{{{poll5_date3|}}}|{{{poll5_date|}}}}}
| poll5_source = {{if empty|{{{poll5_source3|}}}|{{{poll5_source|}}}}}
| poll5_person1 = {{if empty|{{{poll5_nominee7|}}}|{{{poll5_candidate7|}}}}}
| poll5_person2 = {{if empty|{{{poll5_nominee8|}}}|{{{poll5_candidate8|}}}}}
| poll5_person3 = {{if empty|{{{poll5_nominee9|}}}|{{{poll5_candidate9|}}}}}
| poll1_party1 = {{{poll1_party7|}}}| poll1_party2 = {{{poll1_party8|}}}| poll1_party3 = {{{poll1_party9|}}}
| poll2_party1 = {{{poll2_party7|}}}| poll2_party2 = {{{poll2_party8|}}}| poll2_party3 = {{{poll2_party9|}}}
| poll3_party1 = {{{poll3_party7|}}}| poll3_party2 = {{{poll3_party8|}}}| poll3_party3 = {{{poll3_party9|}}}
| poll4_party1 = {{{poll4_party7|}}}| poll4_party2 = {{{poll4_party8|}}}| poll4_party3 = {{{poll4_party9|}}}
| poll5_party1 = {{{poll5_party7|}}}| poll5_party2 = {{{poll5_party8|}}}| poll5_party3 = {{{poll5_party9|}}}
| 1blank = {{{1blank|}}}| 1data1 = {{{1data7|}}}| 1data2 = {{{1data8|}}}| 1data3 = {{{1data9|}}}
| 2blank = {{{2blank|}}}| 2data1 = {{{2data7|}}}| 2data2 = {{{2data8|}}}| 2data3 = {{{2data9|}}}
| 3blank = {{{3blank|}}}| 3data1 = {{{3data7|}}}| 3data2 = {{{3data8|}}}| 3data3 = {{{3data9|}}}
| 4blank = {{{4blank|}}}| 4data1 = {{{4data7|}}}| 4data2 = {{{4data8|}}}| 4data3 = {{{4data9|}}}
| 5blank = {{{5blank|}}}| 5data1 = {{{5data7|}}}| 5data2 = {{{5data8|}}}| 5data3 = {{{5data9|}}}
| 6blank = {{{6blank|}}}| 6data1 = {{{6data7|}}}| 6data2 = {{{6data8|}}}| 6data3 = {{{6data9|}}}
}}
{{!)}}
| data11 =
{{#if:{{{map_image|}}}{{{map|}}}|<hr />{{#if:{{{map_image|}}}
|{{#invoke:InfoboxImage|InfoboxImage|image={{{map_image}}}|size={{{map_size|}}}|sizedefault=300px|alt={{{map_alt|}}}}}
|{{{map}}}
}}{{#if:{{{map_caption|}}}|<div>{{{map_caption|}}}</div>}}
}}
| data12 =
{{#if:{{{map2_image|}}}{{{map2|}}}|<hr />{{#if:{{{map2_image|}}}
|{{#invoke:InfoboxImage|InfoboxImage|image={{{map2_image}}}|size={{{map2_size|}}}|sizedefault=300px|alt={{{map2_alt|}}}}}
|{{{map2}}}
}}{{#if:{{{map2_caption|}}}|<div>{{{map2_caption|}}}</div>}}
}}
|data13 =
{{#if:{{{map3_image|}}}{{{map3|}}}|<hr />{{#if:{{{map3_image|}}}
|{{#invoke:InfoboxImage|InfoboxImage|image={{{map3_image}}}|size={{{map3_size|}}}|sizedefault=300px|alt={{{map3_alt|}}}}}
|{{{map3}}}
}}{{#if:{{{map3_caption|}}}|<div>{{{map3_caption|}}}</div>}}
}}
|data14 =
{{#if:{{{map4_image|}}}{{{map4|}}}|<hr />{{#if:{{{map4_image|}}}
|{{#invoke:InfoboxImage|InfoboxImage|image={{{map4_image}}}|size={{{map4_size|}}}|sizedefault=300px|alt={{{map4_alt|}}}}}
|{{{map4}}}
}}{{#if:{{{map4_caption|}}}|<div>{{{map4_caption|}}}</div>}}
}}
| data15 = {{#if:{{{title|}}}|<hr />
{{{!}} cellspacing="0" cellpadding="0" style="background:transparent; width:100%;"
{{!}} style="width:50%; text-align:left;" {{!}}{{#if:{{{before_election|}}}{{{before_party|}}}|'''{{#ifeq:{{{type}}}|primary|Previous {{{title}}}|{{#ifeq:{{{ongoing|no}}}|yes|Incumbent {{#ifeq:{{lc:{{{title}}}}}|u.s. senator|[[List of United States senators from {{#ifeq:{{{country}}}|Georgia (U.S. state)|Georgia|{{{country}}}}}|U.S. senator]]|{{{title}}}}}|{{#ifeq:{{lc:{{{title}}}}}|u.s. senator|[[List of United States senators from {{#ifeq:{{{country}}}|Georgia (U.S. state)|Georgia|{{{country}}}}}|U.S. senator]]|{{{title}}}}} before election}}}}'''<br />
{{{before_election}}}<br />
{{#if:{{{before_party|}}}|{{Infobox election/shortname|link={{{before_party_link|{{{party_name}}}}}}|name={{{before_party}}}}} }} }}
{{!}} style="width:50%; text-align:right;" {{!}} {{#ifeq:{{{ongoing|no}}}|yes|{{#ifeq:{{{type}}}|primary|{{#if:{{{after_election|}}}|'''Presumptive {{#if:{{{posttitle|}}}|{{{posttitle}}}|{{{title}}}}}'''|}}|}} |'''{{#if:{{{posttitle|}}}|{{{posttitle}}}|{{#ifeq:{{{type}}}|primary||Elected}} {{{title}}}}}'''}} <br />
{{#ifeq:{{{ongoing|no}}}|yes|{{#ifeq:{{{type}}}|primary|{{#if:{{{after_election|}}}|{{{after_election}}}|}}}}}}
{{#ifeq:{{{ongoing|no}}}|yes||{{#if:{{{after_election|}}}|{{{after_election}}}|}}{{#if:{{{after_election|}}}{{{after_party|}}}||TBD}}<br />
{{#if:{{{after_party|}}}|{{Infobox election/shortname|link={{{after_party_link|{{{party_name|}}}}}}|name={{{after_party}}}}}}} }}
{{!}}} }}
{{#if:{{{template_name|}}}|{{align|right|{{navbar|{{{template_name}}}|mini=2}}}} }}
| data16 = {{{module|}}}
}}</includeonly><noinclude>{{documentation}}<!-- Add categories to the /doc subpage, not here! --></noinclude>{{#if:{{{electoral_vote1|}}}|{{Main other|[[Category:Elections using electoral votes]]}}}}<!-- temporary tracking of elections using an electoral college -->{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox election with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox election]] with unknown parameter "_VALUE_"|ignoreblank=y| regexp1 = [%d]blank | regexp2 = [%d]data[%d] | after_election | after_party | after_party_link | regexp3 = alliance[%d]_name | alliance_name | regexp4 = alliance[%d] | before_election | before_party | before_party_link | regexp5 = candidate[%d] | child | college_voted | regexp6 = colou?r[%d] | counties_threshold1 | counties_threshold2 | counties_threshold3 | counties_threshold9 | counties_won1 | counties_won2 | counties_won3 | counties_won9 | country | declared | regexp7 = delegate_count[%d] | elected_members | elected_mps | election_date | election_name | regexp8 = electoral_vote[%d] | embed | filler | flag_image | flag_year | regexp9 = home_state[%d] | image_size | image_upright | regexp10 = image[%d] | regexp11 = image[%d]_size | regexp12 = image[%d]_upright | regexp13 = last_election[%d] | last_update | regexp14 = leader_since[%d] | regexp15 = leader[%d] | regexp16 = leaders_seat[%d] | majority_seats | map | map_alt | map_caption | map_image | map_size | map2 | map2_alt | map2_caption | map2_image | map2_size | map3 | map3_alt | map3_caption | map3_image | map3_size | map4 | map4_alt | map4_caption | map4_image | map4_size | module | needed_votes | next_election | next_year | regexp17 = nominee[%d] | ongoing | opinion_polls | outgoing_members | party_color | party_colour | regexp18 = party[%d]_name | party_name | regexp19 = party[%d] | regexp20 = percentage[%d] | regexp21 = poll[%d]_candidate[%d] | regexp22 = poll[%d]_date[%d]? | regexp23 = poll[%d]_nominee[%d] | regexp24 = poll[%d]_party[%d] | regexp25 = poll[%d]_source[%d]? | regexp26 = popular_vote[%d] | posttitle | previous_election | previous_mps | previous_year | registered | reporting | regexp27 = running_mate[%d] | regexp28 = seat_change[%d] | regexp29 = seats_after[%d] | regexp30 = seats_before[%d] | seats_for_election | regexp31 = seats_needed[%d] | regexp32 = seats[%d] | regexp33 = states_carried[%d] | regexp34 = swing[%d] | template_name | time_zone | title | turnout | type | vote_type | votes_counted | votes_for_election }}
df420508fd5c0716ddbc0c7e9b78e637a11151d3
Module:MultiReplace
828
210
413
412
2023-12-24T02:13:18Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:MultiReplace]]
Scribunto
text/plain
local p = {}
local function MultiReplace(args)
local input = args[1] or "{{{1}}}"
local plain = args.plain == "yes"
local i = 1
local changeList = {}
while args[i * 2] do
local change = {pattern = args[i * 2], repl = args[i * 2 + 1]}
if not change.repl then
return require('Module:Error').error{
'MultiReplace: Unpaired argument: <code>' .. (i * 2) .. ' = ' .. mw.text.nowiki(change.pattern) .. '</code>'
}
end
changeList[i] = change
i = i + 1
end
local matchList = {}
local pos = 1
local len = mw.ustring.len(input)
local result = ""
while pos <= len do
local bestStart = len + 1
local bestStop = len
local bestChange
for _, change in ipairs(changeList) do
local start, stop = mw.ustring.find(input, change.pattern, pos, plain)
if start and (start < bestStart) then
bestStart = start
bestStop = stop
bestChange = change
end
end
result = result .. mw.ustring.sub(input, pos, bestStart - 1)
if bestChange then
local fragment = mw.ustring.sub(input, bestStart, bestStop)
result = result .. (plain and bestChange.repl or
mw.ustring.gsub(fragment, bestChange.pattern, bestChange.repl, 1))
end
pos = bestStop + 1
end
return result
end
function p.main(frame, ...)
local args =
type(frame) ~= 'table' and {frame, ...} or
type(frame.args) ~= 'table' and frame or
frame.args[1] and frame.args or
frame:getParent().args
return MultiReplace(args)
end
return p
3bd8e7e4debe76a2cd5ce5587b1629efc3e6d1f2
Template:-
10
211
415
414
2023-12-24T02:13:20Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:-]]
wikitext
text/x-wiki
#REDIRECT [[Template:Clear]]
{{Redirect category shell|
{{R from modification}}
{{R from template shortcut}}
}}
3fb0b377ebee11659e4a3ba0034f60898dbc473f
Template:MONTHNUMBER
10
212
417
416
2023-12-24T02:13:23Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:MONTHNUMBER]]
wikitext
text/x-wiki
<includeonly>{{#if:{{{1|}}}
|{{#switch:{{lc:{{{1}}}}}
|january|jan=1
|february|feb=2
|march|mar=3
|apr|april=4
|may=5
|june|jun=6
|july|jul=7
|august|aug=8
|september|sep|sept=9
|october|oct=10
|november|nov=11
|december|dec=12
|{{#ifexpr:{{{1}}}<0
|{{#ifexpr:(({{{1}}})round 0)!=({{{1}}})
|{{#expr:12-(((0.5-({{{1}}}))round 0)mod 12)}}
|{{#expr:12-(((11.5-({{{1}}}))round 0)mod 12)}}
}}
|{{#expr:(((10.5+{{{1}}})round 0)mod 12)+1}}
}}
}}
|Missing required parameter 1=''month''!
}}</includeonly><noinclude>
{{Documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
c2ade663b96231e493986cd17b454923da290098
Template:MONTHNAME
10
213
419
418
2023-12-24T02:13:23Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:MONTHNAME]]
wikitext
text/x-wiki
<includeonly>{{#if:{{{1|}}}|{{#switch:{{MONTHNUMBER|{{{1}}}}}|1=January|2=February|3=March|4=April|5=May|6=June|7=July|8=August|9=September|10=October|11=November|12=December|Incorrect required parameter 1=''month''!}}|Missing required parameter 1=''month''!}}</includeonly><noinclude>
{{Documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
25327282f70efd1189b70245a0e23509f3bb65e6
Template:!)
10
214
421
420
2023-12-24T02:13:26Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:!)]]
wikitext
text/x-wiki
|}<noinclude>
{{Documentation}}
</noinclude>
4708392952b330b1c5bf605bc6fc76222b1609d2
Template:(!
10
215
423
422
2023-12-24T02:13:26Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:(!]]
wikitext
text/x-wiki
<includeonly>{|</includeonly><noinclude><nowiki>{|</nowiki>{{Documentation}}
</noinclude>
f709d1f206330f000c28ae20e722426c750f9bd5
Template:Country data United States
10
216
425
424
2023-12-24T02:13:28Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Country_data_United_States]]
wikitext
text/x-wiki
{{safesubst<noinclude />: {{{1<noinclude>|country showdata</noinclude>}}}
| alias = United States
| flag alias = Flag of the United States.svg
| flag alias-1776 = Flag of the United States (1776–1777).svg
| flag alias-1777 = Flag of the United States (1777–1795).svg
| flag alias-1777-Ross = Betsy Ross flag.svg
| flag alias-1795 = Flag of the United States (1795-1818).svg
| flag alias-1795FM = Flag of the United States (1795–1818).svg
| flag alias-1818 = Flag of the United States (1818-1819).svg
| flag alias-1819 = Flag of the United States (1819-1820).svg
| flag alias-1820 = Flag of the United States (1820-1822).svg
| flag alias-1822 = Flag of the United States (1822-1836).svg
| flag alias-1836 = Flag of the United States (1836-1837).svg
| flag alias-1837 = Flag of the United States (1837-1845).svg
| flag alias-1845 = Flag of the United States (1845-1846).svg
| flag alias-1846 = Flag of the United States (1846-1847).svg
| flag alias-1847 = Flag of the United States (1847-1848).svg
| flag alias-1848 = Flag of the United States (1848-1851).svg
| flag alias-1851 = Flag of the United States (1851-1858).svg
| flag alias-1858 = Flag of the United States (1858-1859).svg
| flag alias-1859 = Flag of the United States (1859-1861).svg
| flag alias-1861 = Flag of the United States (1861-1863).svg
| flag alias-1863 = Flag of the United States (1863-1865).svg
| flag alias-1865 = Flag of the United States (1865-1867).svg
| flag alias-1867 = Flag of the United States (1867-1877).svg
| flag alias-1877 = Flag of the United States (1877-1890).svg
| flag alias-1890 = Flag of the United States (1890-1891).svg
| flag alias-1891 = Flag of the United States (1891-1896).svg
| flag alias-1896 = Flag of the United States (1896-1908).svg
| flag alias-1908 = Flag of the United States (1908-1912).svg
| flag alias-1912 = Flag of the United States (1912-1959).svg
| flag alias-1959 = Flag of the United States (1959-1960).svg
| flag alias-1960 = Flag of the United States (Pantone).svg
| flag alias-yacht = United States yacht flag.svg
| flag alias-air force = Flag of the United States Air Force.svg
| flag alias-coast guard-1799 = Ensign of the United States Revenue-Marine (1799).png
| flag alias-coast guard-1815 = Ensign of the United States Revenue-Marine (1815).png
| flag alias-coast guard-1836 = Ensign of the United States Revenue-Marine (1836).png
| flag alias-coast guard-1841 = Ensign of the United States Revenue-Marine (1841).png
| flag alias-coast guard-1867 = Ensign of the United States Revenue-Marine (1867).png
| flag alias-coast guard-1868 = Ensign of the United States Revenue-Marine (1868).png
| flag alias-coast guard-1915 = Ensign of the United States Coast Guard (1915-1953).png
| flag alias-coast guard-1953 = Ensign of the United States Coast Guard.svg
| flag alias-coast guard = Flag of the United States Coast Guard.svg
| link alias-coast guard = {{#switch:{{{variant|}}}|coast guard|coast guard-1915=United States Coast Guard|coast guard-1894=United States Revenue Cutter Service|coast guard-1799|coast guard-1815|coast guard-1836|coast guard-1841|coast guard-1867|coast guard-1868=United States Revenue-Marine|United States Coast Guard}}
| flag alias-army = Flag of the United States Army.svg
| link alias-naval = {{#switch:{{{variant|}}}|navy|coast guard-1915=United States Coast Guard|United States Coast Guard|United States Navy}}
| flag alias-navy-1864 = Flag of the United States Navy (1864-1959).svg
| flag alias-navy = Flag of the United States Navy (official).svg
| link alias-navy = United States Navy
| link alias-marines = {{#switch:{{{variant|}}}|marines|marines-1914=United States Marine Corps|United States Marine Corps}}
| flag alias-marines-1914 = Flag of the United States Marine Corps (1914-1939).png
| flag alias-marines = Flag of the United States Marine Corps.svg
| link alias-merchant marine = United States Merchant Marine
| flag alias-merchant marine = Flag of the United States Merchant Marine Higher Resolution.jpg
| flag alias-space force = Flag of the United States Space Force.svg
| link alias-military = United States Armed Forces
| link alias-football = United States {{{mw|men's}}} national {{{age|}}} soccer team
| link alias-Australian rules football = United States {{{mw|men's}}} national Australian rules football team
| {{#ifeq:{{{altlink}}}|A national rugby union team|link alias-rugby union|empty}} = USA Selects
| size = {{{size|}}}
| name = {{{name|}}}
| altlink = {{{altlink|}}}
| altvar = {{{altvar|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = 1776
| var2 = 1777
| var3 = 1777-Ross
| var4 = 1795
| var5 = 1795FM
| var6 = 1818
| var7 = 1819
| var8 = 1820
| var9 = 1822
| var10 = 1836
| var11 = 1837
| var12 = 1845
| var13 = 1846
| var14 = 1847
| var15 = 1848
| var16 = 1851
| var17 = 1858
| var18 = 1859
| var19 = 1861
| var20 = 1863
| var21 = 1865
| var22 = 1867
| var23 = 1877
| var24 = 1890
| var25 = 1891
| var26 = 1896
| var27 = 1908
| var28 = 1912
| var29 = 1959
| var30 = 1960
| var31 = yacht
| var32 = coast guard-1915
| var33 = coast guard-1953
| var34 = marines-1914
| redir1 = USA
| redir2 = US
| redir3 = United States of America
| redir4 = U.S.
</noinclude>
}}
14b1f0dfe034ac279f6c3e9c246fa120c6431cda
Template:Delink question hyphen-minus
10
217
427
426
2023-12-24T02:13:28Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Delink_question_hyphen-minus]]
wikitext
text/x-wiki
{{{{{|safesubst:}}}#invoke:MultiReplace|main|{{{1|}}}|%[%[ *([%?-]) *%]%]|%1|%[%[ *[%?-] *{{{{{|safesubst:}}}!}} *(.-) *%]%]|%1}}<noinclude>
{{documentation}}
</noinclude>
f342bb1e299a3bd5e482defa9cde3dd36ccf210e
Template:Flagdeco
10
218
429
428
2023-12-24T02:13:29Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Flagdeco]]
wikitext
text/x-wiki
<includeonly>{{#ifeq: {{Yesno-no|{{{noredlink|}}}}}|yes<!--
-->|<!--
#Check for existence of Template: Country data foo before invoking it
-->{{#ifexist: Template: Country data {{{1|}}}<!--
-->|<!--
# It exists, so proceed
-->{{country data {{{1|}}}|flagdeco/core|variant={{{variant|{{{2|}}}}}}|size={{{size|}}}}}<!--
-->|<!--
# It doesn't exist, so do nothing
-->}}<!--
-->|<!--
# DEFAULT call Template: Country data {{{1|}}}
# with no prior checks
-->{{country data {{{1|}}}|flagdeco/core|variant={{{variant|{{{2|}}}}}}|size={{{size|}}}}}<!--
# Track use where "Template:Country data Foo" does not exist
-->{{#ifexist: Template:Country data {{{1|}}}||{{namespace detect showall
| 1 =
| 2 = [[Category:Flagdeco with missing country data templates]]
| user = 1
| talk = 1
| other = 2
}}}}<!--
-->}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
2cd50bb91e18505de93484a7348c92b68745dbf9
Template:Flagdeco/core
10
219
431
430
2023-12-24T02:13:29Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Flagdeco/core]]
wikitext
text/x-wiki
<span class="flagicon">[[File:{{{flag alias-{{{variant}}}|{{{flag alias}}}}}}|{{#if:{{{size|}}}|{{{size}}}|{{{size flag alias-{{{variant}}}|{{#if:{{{variant|}}}|23x15px|{{{size flag alias|23x15px}}}}}}}}}}|{{{border-{{{variant}}}|{{{border|border}}}}}} |alt=|link=]]</span><noinclude>{{documentation}}</noinclude>
42dea5caf343aa87e6e075eb1bec3aebe1f396b1
Module:Math
828
220
433
432
2023-12-24T02:13:29Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Math]]
Scribunto
text/plain
--[[
This module provides a number of basic mathematical operations.
]]
local yesno, getArgs -- lazily initialized
local p = {} -- Holds functions to be returned from #invoke, and functions to make available to other Lua modules.
local wrap = {} -- Holds wrapper functions that process arguments from #invoke. These act as intemediary between functions meant for #invoke and functions meant for Lua.
--[[
Helper functions used to avoid redundant code.
]]
local function err(msg)
-- Generates wikitext error messages.
return mw.ustring.format('<strong class="error">Formatting error: %s</strong>', msg)
end
local function unpackNumberArgs(args)
-- Returns an unpacked list of arguments specified with numerical keys.
local ret = {}
for k, v in pairs(args) do
if type(k) == 'number' then
table.insert(ret, v)
end
end
return unpack(ret)
end
local function makeArgArray(...)
-- Makes an array of arguments from a list of arguments that might include nils.
local args = {...} -- Table of arguments. It might contain nils or non-number values, so we can't use ipairs.
local nums = {} -- Stores the numbers of valid numerical arguments.
local ret = {}
for k, v in pairs(args) do
v = p._cleanNumber(v)
if v then
nums[#nums + 1] = k
args[k] = v
end
end
table.sort(nums)
for i, num in ipairs(nums) do
ret[#ret + 1] = args[num]
end
return ret
end
local function fold(func, ...)
-- Use a function on all supplied arguments, and return the result. The function must accept two numbers as parameters,
-- and must return a number as an output. This number is then supplied as input to the next function call.
local vals = makeArgArray(...)
local count = #vals -- The number of valid arguments
if count == 0 then return
-- Exit if we have no valid args, otherwise removing the first arg would cause an error.
nil, 0
end
local ret = table.remove(vals, 1)
for _, val in ipairs(vals) do
ret = func(ret, val)
end
return ret, count
end
--[[
Fold arguments by selectively choosing values (func should return when to choose the current "dominant" value).
]]
local function binary_fold(func, ...)
local value = fold((function(a, b) if func(a, b) then return a else return b end end), ...)
return value
end
--[[
random
Generate a random number
Usage:
{{#invoke: Math | random }}
{{#invoke: Math | random | maximum value }}
{{#invoke: Math | random | minimum value | maximum value }}
]]
function wrap.random(args)
local first = p._cleanNumber(args[1])
local second = p._cleanNumber(args[2])
return p._random(first, second)
end
function p._random(first, second)
math.randomseed(mw.site.stats.edits + mw.site.stats.pages + os.time() + math.floor(os.clock() * 1000000000))
-- math.random will throw an error if given an explicit nil parameter, so we need to use if statements to check the params.
if first and second then
if first <= second then -- math.random doesn't allow the first number to be greater than the second.
return math.random(first, second)
end
elseif first then
return math.random(first)
else
return math.random()
end
end
--[[
order
Determine order of magnitude of a number
Usage:
{{#invoke: Math | order | value }}
]]
function wrap.order(args)
local input_string = (args[1] or args.x or '0');
local input_number = p._cleanNumber(input_string);
if input_number == nil then
return err('order of magnitude input appears non-numeric')
else
return p._order(input_number)
end
end
function p._order(x)
if x == 0 then return 0 end
return math.floor(math.log10(math.abs(x)))
end
--[[
precision
Detemines the precision of a number using the string representation
Usage:
{{ #invoke: Math | precision | value }}
]]
function wrap.precision(args)
local input_string = (args[1] or args.x or '0');
local trap_fraction = args.check_fraction;
local input_number;
if not yesno then
yesno = require('Module:Yesno')
end
if yesno(trap_fraction, true) then -- Returns true for all input except nil, false, "no", "n", "0" and a few others. See [[Module:Yesno]].
local pos = string.find(input_string, '/', 1, true);
if pos ~= nil then
if string.find(input_string, '/', pos + 1, true) == nil then
local denominator = string.sub(input_string, pos+1, -1);
local denom_value = tonumber(denominator);
if denom_value ~= nil then
return math.log10(denom_value);
end
end
end
end
input_number, input_string = p._cleanNumber(input_string);
if input_string == nil then
return err('precision input appears non-numeric')
else
return p._precision(input_string)
end
end
function p._precision(x)
if type(x) == 'number' then
x = tostring(x)
end
x = string.upper(x)
local decimal = x:find('%.')
local exponent_pos = x:find('E')
local result = 0;
if exponent_pos ~= nil then
local exponent = string.sub(x, exponent_pos + 1)
x = string.sub(x, 1, exponent_pos - 1)
result = result - tonumber(exponent)
end
if decimal ~= nil then
result = result + string.len(x) - decimal
return result
end
local pos = string.len(x);
while x:byte(pos) == string.byte('0') do
pos = pos - 1
result = result - 1
if pos <= 0 then
return 0
end
end
return result
end
--[[
max
Finds the maximum argument
Usage:
{{#invoke:Math| max | value1 | value2 | ... }}
Note, any values that do not evaluate to numbers are ignored.
]]
function wrap.max(args)
return p._max(unpackNumberArgs(args))
end
function p._max(...)
local max_value = binary_fold((function(a, b) return a > b end), ...)
if max_value then
return max_value
end
end
--[[
median
Find the median of set of numbers
Usage:
{{#invoke:Math | median | number1 | number2 | ...}}
OR
{{#invoke:Math | median }}
]]
function wrap.median(args)
return p._median(unpackNumberArgs(args))
end
function p._median(...)
local vals = makeArgArray(...)
local count = #vals
table.sort(vals)
if count == 0 then
return 0
end
if p._mod(count, 2) == 0 then
return (vals[count/2] + vals[count/2+1])/2
else
return vals[math.ceil(count/2)]
end
end
--[[
min
Finds the minimum argument
Usage:
{{#invoke:Math| min | value1 | value2 | ... }}
OR
{{#invoke:Math| min }}
When used with no arguments, it takes its input from the parent
frame. Note, any values that do not evaluate to numbers are ignored.
]]
function wrap.min(args)
return p._min(unpackNumberArgs(args))
end
function p._min(...)
local min_value = binary_fold((function(a, b) return a < b end), ...)
if min_value then
return min_value
end
end
--[[
sum
Finds the sum
Usage:
{{#invoke:Math| sum | value1 | value2 | ... }}
OR
{{#invoke:Math| sum }}
Note, any values that do not evaluate to numbers are ignored.
]]
function wrap.sum(args)
return p._sum(unpackNumberArgs(args))
end
function p._sum(...)
local sums, count = fold((function(a, b) return a + b end), ...)
if not sums then
return 0
else
return sums
end
end
--[[
average
Finds the average
Usage:
{{#invoke:Math| average | value1 | value2 | ... }}
OR
{{#invoke:Math| average }}
Note, any values that do not evaluate to numbers are ignored.
]]
function wrap.average(args)
return p._average(unpackNumberArgs(args))
end
function p._average(...)
local sum, count = fold((function(a, b) return a + b end), ...)
if not sum then
return 0
else
return sum / count
end
end
--[[
round
Rounds a number to specified precision
Usage:
{{#invoke:Math | round | value | precision }}
--]]
function wrap.round(args)
local value = p._cleanNumber(args[1] or args.value or 0)
local precision = p._cleanNumber(args[2] or args.precision or 0)
if value == nil or precision == nil then
return err('round input appears non-numeric')
else
return p._round(value, precision)
end
end
function p._round(value, precision)
local rescale = math.pow(10, precision or 0);
return math.floor(value * rescale + 0.5) / rescale;
end
--[[
log10
returns the log (base 10) of a number
Usage:
{{#invoke:Math | log10 | x }}
]]
function wrap.log10(args)
return math.log10(args[1])
end
--[[
mod
Implements the modulo operator
Usage:
{{#invoke:Math | mod | x | y }}
--]]
function wrap.mod(args)
local x = p._cleanNumber(args[1])
local y = p._cleanNumber(args[2])
if not x then
return err('first argument to mod appears non-numeric')
elseif not y then
return err('second argument to mod appears non-numeric')
else
return p._mod(x, y)
end
end
function p._mod(x, y)
local ret = x % y
if not (0 <= ret and ret < y) then
ret = 0
end
return ret
end
--[[
gcd
Calculates the greatest common divisor of multiple numbers
Usage:
{{#invoke:Math | gcd | value 1 | value 2 | value 3 | ... }}
--]]
function wrap.gcd(args)
return p._gcd(unpackNumberArgs(args))
end
function p._gcd(...)
local function findGcd(a, b)
local r = b
local oldr = a
while r ~= 0 do
local quotient = math.floor(oldr / r)
oldr, r = r, oldr - quotient * r
end
if oldr < 0 then
oldr = oldr * -1
end
return oldr
end
local result, count = fold(findGcd, ...)
return result
end
--[[
precision_format
Rounds a number to the specified precision and formats according to rules
originally used for {{template:Rnd}}. Output is a string.
Usage:
{{#invoke: Math | precision_format | number | precision }}
]]
function wrap.precision_format(args)
local value_string = args[1] or 0
local precision = args[2] or 0
return p._precision_format(value_string, precision)
end
function p._precision_format(value_string, precision)
-- For access to Mediawiki built-in formatter.
local lang = mw.getContentLanguage();
local value
value, value_string = p._cleanNumber(value_string)
precision = p._cleanNumber(precision)
-- Check for non-numeric input
if value == nil or precision == nil then
return err('invalid input when rounding')
end
local current_precision = p._precision(value)
local order = p._order(value)
-- Due to round-off effects it is neccesary to limit the returned precision under
-- some circumstances because the terminal digits will be inaccurately reported.
if order + precision >= 14 then
if order + p._precision(value_string) >= 14 then
precision = 13 - order;
end
end
-- If rounding off, truncate extra digits
if precision < current_precision then
value = p._round(value, precision)
current_precision = p._precision(value)
end
local formatted_num = lang:formatNum(math.abs(value))
local sign
-- Use proper unary minus sign rather than ASCII default
if value < 0 then
sign = '−'
else
sign = ''
end
-- Handle cases requiring scientific notation
if string.find(formatted_num, 'E', 1, true) ~= nil or math.abs(order) >= 9 then
value = value * math.pow(10, -order)
current_precision = current_precision + order
precision = precision + order
formatted_num = lang:formatNum(math.abs(value))
else
order = 0;
end
formatted_num = sign .. formatted_num
-- Pad with zeros, if needed
if current_precision < precision then
local padding
if current_precision <= 0 then
if precision > 0 then
local zero_sep = lang:formatNum(1.1)
formatted_num = formatted_num .. zero_sep:sub(2,2)
padding = precision
if padding > 20 then
padding = 20
end
formatted_num = formatted_num .. string.rep('0', padding)
end
else
padding = precision - current_precision
if padding > 20 then
padding = 20
end
formatted_num = formatted_num .. string.rep('0', padding)
end
end
-- Add exponential notation, if necessary.
if order ~= 0 then
-- Use proper unary minus sign rather than ASCII default
if order < 0 then
order = '−' .. lang:formatNum(math.abs(order))
else
order = lang:formatNum(order)
end
formatted_num = formatted_num .. '<span style="margin:0 .15em 0 .25em">×</span>10<sup>' .. order .. '</sup>'
end
return formatted_num
end
--[[
divide
Implements the division operator
Usage:
{{#invoke:Math | divide | x | y | round= | precision= }}
--]]
function wrap.divide(args)
local x = args[1]
local y = args[2]
local round = args.round
local precision = args.precision
if not yesno then
yesno = require('Module:Yesno')
end
return p._divide(x, y, yesno(round), precision)
end
function p._divide(x, y, round, precision)
if y == nil or y == "" then
return err("Empty divisor")
elseif not tonumber(y) then
if type(y) == 'string' and string.sub(y, 1, 1) == '<' then
return y
else
return err("Not a number: " .. y)
end
elseif x == nil or x == "" then
return err("Empty dividend")
elseif not tonumber(x) then
if type(x) == 'string' and string.sub(x, 1, 1) == '<' then
return x
else
return err("Not a number: " .. x)
end
else
local z = x / y
if round then
return p._round(z, 0)
elseif precision then
return p._round(z, precision)
else
return z
end
end
end
--[[
Helper function that interprets the input numerically. If the
input does not appear to be a number, attempts evaluating it as
a parser functions expression.
]]
function p._cleanNumber(number_string)
if type(number_string) == 'number' then
-- We were passed a number, so we don't need to do any processing.
return number_string, tostring(number_string)
elseif type(number_string) ~= 'string' or not number_string:find('%S') then
-- We were passed a non-string or a blank string, so exit.
return nil, nil;
end
-- Attempt basic conversion
local number = tonumber(number_string)
-- If failed, attempt to evaluate input as an expression
if number == nil then
local success, result = pcall(mw.ext.ParserFunctions.expr, number_string)
if success then
number = tonumber(result)
number_string = tostring(number)
else
number = nil
number_string = nil
end
else
number_string = number_string:match("^%s*(.-)%s*$") -- String is valid but may contain padding, clean it.
number_string = number_string:match("^%+(.*)$") or number_string -- Trim any leading + signs.
if number_string:find('^%-?0[xX]') then
-- Number is using 0xnnn notation to indicate base 16; use the number that Lua detected instead.
number_string = tostring(number)
end
end
return number, number_string
end
--[[
Wrapper function that does basic argument processing. This ensures that all functions from #invoke can use either the current
frame or the parent frame, and it also trims whitespace for all arguments and removes blank arguments.
]]
local mt = { __index = function(t, k)
return function(frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
return wrap[k](getArgs(frame)) -- Argument processing is left to Module:Arguments. Whitespace is trimmed and blank arguments are removed.
end
end }
return setmetatable(p, mt)
2bbe734d898299f65412963a3c1782e9fcc4d9ca
Template:Succession links
10
221
435
434
2023-12-24T02:13:30Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Succession_links]]
wikitext
text/x-wiki
{{#if:{{{above|}}}
|<div class="{{{aboveclass|}}}" style="width:100%; text-align:center; {{{abovestyle|}}}">{{{above}}}</div>
}}{{#if:{{{center|}}}
|<!-- then
--><table style="width:100%; margin:1px; display:inline-table;"><tr>
<td style="text-align:left; vertical-align:{{{vertical-align|middle}}}; padding:0 0.5em 0 0;{{#if:{{{wide|}}}|width:45%;}}{{{leftstyle|}}}" class="noprint">{{#if:{{{left|}}}|{{#if:{{{noarrows|}}}||← }}{{Delink question hyphen-minus|{{{left|}}}}}{{#if:{{{bullets|}}}| '''·'''}}}}</td>
{{#if:{{{center|}}}|
<td style="text-align:center; vertical-align:{{{vertical-align|middle}}};; padding:0 1px;{{{centerstyle|}}}" class="{{{centerclass|}}}">{{{center|}}}</td>
}}
<td style="text-align:right; vertical-align:{{{vertical-align|middle}}};; padding:0 0 0 0.5em;{{#if:{{{wide|}}}|width:45%;}}{{{rightstyle|}}}" class="noprint">{{#if:{{{right|}}}|{{#if:{{{bullets|}}}|'''·''' }}{{Delink question hyphen-minus|{{{right|}}}}}{{#if:{{{noarrows|}}}|| →}}}}</td>
</tr></table>
|<!-- else
-->{{#if:{{{left|}}}{{{right|}}}|<div style="width:100%">{{#if:{{{left|}}}|
<div style="float: left; text-align:left;padding-right:0.5em;{{{leftstyle|}}}" class="noprint">{{#if:{{{noarrows|}}}||← }}{{{left|}}}</div>
}}{{#if:{{{right|}}}|
<div style="float: right; text-align:right;padding-left:0.5em;{{{rightstyle|}}}" class="noprint">{{{right|}}}{{#if:{{{noarrows|}}}|| →}}</div>
}}</div>}}
}}<noinclude>{{documentation}}</noinclude>
69440132c87bdda8349cd83cd55b1db88112e68f
Template:Infobox election/row
10
222
437
436
2023-12-24T02:13:30Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Infobox_election/row]]
wikitext
text/x-wiki
<includeonly>|-
{{#if:{{{divider|}}}|{{#if:{{{party1|}}}{{{color1|}}}{{{leader1|}}}{{{party2|}}}{{{color2|}}}{{{leader2|}}}{{{party3|}}}{{{color3|}}}{{{leader3|}}}|{{!}} colspan=4 {{!}} {{{divider}}} }} }}
|- style="display:none"
{{#ifeq:{{{ongoing|}}}|yes||{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative = {{#if:{{{party1|}}}{{{party2|}}}{{{party3|}}}|
! style="text-align:left;" {{!}}
! style="text-align:center" {{!}} {{#if:{{{party1|}}}| {{{header1|}}} }}
! style="text-align:center" {{!}} {{#if:{{{party2|}}}| {{{header2|}}} }}
{{#if:{{{col3|}}}|! style="text-align:center" {{!}} {{#if:{{{party3|}}}| {{{header3|}}} }}}}
}}
| #default =
}}}}
|-
{{#if:{{{party1|}}}{{{color1|}}}{{{image1|}}}{{{party2|}}}{{{color2|}}}{{{image2|}}}{{{party3|}}}{{{color3|}}}{{{image3|}}}|<!-- Images -->
{{#if:{{{filler|}}}|
! <br />{{{filler}}}
|
{{!}}
}}
{{!}} style="text-align:center;{{#if:{{{party1|}}}{{{color1|}}}||width:0;}}{{#if:{{{color1|}}}|border-bottom: 6px solid #{{#invoke:Ustring|gsub|s1={{{color1}}}|#|}}|{{#ifeq: {{{party_color}}}|no||{{#if:{{{party1|}}}|{{#ifeq: {{#invoke:Political party|fetch|{{#invoke:delink|delink|wikilinks=target|1={{#invoke:string|replace|source={{{party1}}}|pattern=^(%[%[%s*[^%]%[]*%]%]).*$|replace=%1|plain=false}}}}|color|error=NOTHERE}} | NOTHERE || border-bottom: 6px solid {{#invoke:Political party|fetch|{{#invoke:delink|delink|wikilinks=target|1={{#invoke:string|replace|source={{{party1}}}|pattern=^(%[%[%s*[^%]%[]*%]%]).*$|replace=%1|plain=false}}}}|color}};}}}}}}}}" {{!}} {{#invoke:InfoboxImage|InfoboxImage|image={{{image1|}}}|size={{if empty|{{{image1_size|}}}|{{{image_size|}}}}}|alt={{{alt1|}}}|upright={{if empty|{{{image1_upright|}}}|{{{image_upright|}}}|{{#if:{{both|{{{col3|}}}|{{{image3|}}}}}|0.5|0.75}}}}|suppressplaceholder=yes|class={{#if:{{{pageimage1|}}}||notpageimage}}}}
{{!}} style="text-align:center;{{#if:{{{party2|}}}{{{color2|}}}||width:0;}}{{#if:{{{color2|}}}|border-bottom: 6px solid #{{#invoke:Ustring|gsub|s1={{{color2}}}|#|}}|{{#ifeq: {{{party_color}}}|no||{{#if:{{{party2|}}}|{{#ifeq: {{#invoke:Political party|fetch|{{#invoke:delink|delink|wikilinks=target|1={{#invoke:string|replace|source={{{party2}}}|pattern=^(%[%[%s*[^%]%[]*%]%]).*$|replace=%1|plain=false}}}}|color|error=NOTHERE}} | NOTHERE || border-bottom: 6px solid {{#invoke:Political party|fetch|{{#invoke:delink|delink|wikilinks=target|1={{#invoke:string|replace|source={{{party2}}}|pattern=^(%[%[%s*[^%]%[]*%]%]).*$|replace=%1|plain=false}}}}|color}};}}}}}}}}"{{!}} {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{if empty|{{{image2_size|}}}|alt={{{alt2|}}}|{{{image_size|}}}}}|upright={{if empty|{{{image2_upright|}}}|{{{image_upright|}}}|{{#if:{{both|{{{col3|}}}|{{{image3|}}}}}|0.5|0.75}}}}|suppressplaceholder=yes|class={{#if:{{{pageimage2|}}}||notpageimage}}}}
{{#if:{{{col3|}}}|{{!}} style="text-align:center;{{#if:{{{party3|}}}{{{color3|}}}||width:0;}}{{#if:{{{color3|}}}|border-bottom: 6px solid #{{#invoke:Ustring|gsub|s1={{{color3}}}|#|}}|{{#ifeq: {{{party_color}}}|no||{{#if:{{{party3|}}}|{{#ifeq: {{#invoke:Political party|fetch|{{#invoke:delink|delink|wikilinks=target|1={{#invoke:string|replace|source={{{party3}}}|pattern=^(%[%[%s*[^%]%[]*%]%]).*$|replace=%1|plain=false}}}}|color|error=NOTHERE}} | NOTHERE || border-bottom: 6px solid {{#invoke:Political party|fetch|{{#invoke:delink|delink|wikilinks=target|1={{#invoke:string|replace|source={{{party3}}}|pattern=^(%[%[%s*[^%]%[]*%]%]).*$|replace=%1|plain=false}}}}|color}};}}}}}}}}"{{!}} {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|alt={{{alt3|}}}|size={{if empty|{{{image3_size|}}}|{{{image_size|}}}}}|upright={{if empty|{{{image3_upright|}}}|{{{image_upright|}}}|0.5}}|suppressplaceholder=yes|class={{#if:{{{pageimage3|}}}||notpageimage}}}}}}
}}
|-
{{#if:{{{nominee1|}}}{{{nominee2|}}}{{{nominee3|}}}|<!-- Presidential & by-election nominee -->
{{#switch:{{{type|}}}
| primary
| Primary
| presidential
| Presidential
| by-election
| By-election =
! style="width:75px;text-align:left" {{!}}Nominee
{{!}} style="{{#if:{{{nominee1|}}}|width:75px;}}text-align:center" {{!}} {{{nominee1|}}}
{{!}} style="{{#if:{{{nominee2|}}}|width:75px;}}text-align:center" {{!}} {{{nominee2|}}}
{{!}} style="{{#if:{{{nominee3|}}}|width:75px;}}text-align:center" {{!}} {{{nominee3|}}}
| #default =
}}|{{#if:{{{candidate1|}}}{{{candidate2|}}}{{{candidate3|}}}|<!-- Candidate -->
! style="width:75px;text-align:left" {{!}}Candidate
{{!}} style="{{#if:{{{candidate1|}}}|width:75px;}}text-align:center" {{!}} {{{candidate1|}}}
{{!}} style="{{#if:{{{candidate2|}}}|width:75px;}}text-align:center" {{!}} {{{candidate2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{candidate3|}}}|width:75px;}}text-align:center" {{!}} {{{candidate3|}}}}}
}}
}}
|-<!-- Party leader -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#if:{{{leader1|}}}{{{leader2|}}}{{{leader3|}}}|
! style="text-align:left" {{!}} Leader
{{!}} style="{{#if:{{{leader1|}}}|width:75px;}}text-align:center" {{!}} {{{leader1|}}}
{{!}} style="{{#if:{{{leader2|}}}|width:75px;}}text-align:center" {{!}} {{{leader2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{leader3|}}}|width:75px;}}text-align:center" {{!}} {{{leader3|}}}}}
}}
| #default =
}}
|-
{{#if:{{{party1|}}}{{{party2|}}}{{{party3|}}}|<!-- Party name -->
! style="width:75px;text-align:left" {{!}} Party
{{!}} style="{{#if:{{{party1|}}}|width:75px;}}text-align:center" {{!}} {{Infobox election/shortname|link={{{party1_name}}}|name={{{party1|}}}}}
{{!}} style="{{#if:{{{party2|}}}|width:75px;}}text-align:center" {{!}} {{Infobox election/shortname|link={{{party2_name}}}|name={{{party2|}}}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{party3|}}}|width:75px;}}text-align:center" {{!}} {{Infobox election/shortname|link={{{party3_name}}}|name={{{party3|}}}}}}}
}}
|-
{{#if:{{{alliance1|}}}{{{alliance2|}}}{{{alliance3|}}}|<!-- Alliance name -->
! style="text-align:left" {{!}} Alliance
{{!}} style="{{#if:{{{alliance1|}}}|width:75px;}}text-align:center" {{!}} {{Infobox election/shortname|link={{{alliance1_name}}}|name={{{alliance1|}}}}}
{{!}} style="{{#if:{{{alliance2|}}}|width:75px;}}text-align:center" {{!}} {{Infobox election/shortname|link={{{alliance2_name}}}|name={{{alliance2|}}}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{alliance3|}}}|width:75px;}}text-align:center" {{!}} {{Infobox election/shortname|link={{{alliance3_name}}}|name={{{alliance3|}}}}}}}
}}
|-<!-- Home state -->
{{#if:{{{home_state1|}}}{{{home_state2|}}}{{{home_state3|}}}|
{{#switch:{{{type|}}}
| primary
| Primary
| presidential
| Presidential =
! style="text-align:left" {{!}} Home state
{{!}} style="{{#if:{{{home_state1|}}}|width:75px;}}text-align:center" {{!}} {{{home_state1|}}}
{{!}} style="{{#if:{{{home_state2|}}}|width:75px;}}text-align:center" {{!}} {{{home_state2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{home_state3|}}}|width:75px;}}text-align:center" {{!}} {{{home_state3|}}}}}
| #default =
}}
}}
|-<!-- Running mate -->
{{#switch:{{{type|}}}
| presidential
| Presidential =
{{#if:{{{running_mate1|}}}{{{running_mate2|}}}{{{running_mate3|}}}|
! style="text-align:left" {{!}} Running mate
{{!}} style="{{#if:{{{running_mate1|}}}|width:75px;}}text-align:center" {{!}} {{{running_mate1|}}}
{{!}} style="{{#if:{{{running_mate2|}}}|width:75px;}}text-align:center" {{!}} {{{running_mate2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{running_mate3|}}}|width:75px;}}text-align:center" {{!}} {{{running_mate3|}}}}}
}}
| #default =
}}
|-<!-- Electoral vote -->
{{#switch:{{{type|}}}
| presidential
| Presidential =
{{#ifeq:{{{ongoing|}}}|yes||
{{#if:{{{electoral_vote1|}}}{{{electoral_vote2|}}}{{{electoral_vote3|}}}|
! style="text-align:left" {{!}} {{#ifeq:{{{college_voted|}}}|no|Projected e|E}}lectoral vote
{{!}} style="{{#if:{{{electoral_vote1|}}}|width:75px;}}text-align:center" {{!}} {{{electoral_vote1|}}}
{{!}} style="{{#if:{{{electoral_vote2|}}}|width:75px;}}text-align:center" {{!}} {{{electoral_vote2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{electoral_vote3|}}}|width:75px;}}text-align:center" {{!}} {{{electoral_vote3|}}}}}
}}
}}
| #default =
}}
|-<!-- Delegate count -->
{{#switch:{{{type|}}}
| primary
| Primary
| presidential
| Presidential =
{{#if:{{{delegate_count1|}}}{{{delegate_count2|}}}{{{delegate_count3|}}}|
! style="text-align:left" {{!}} {{#ifeq:{{{ongoing|}}}|yes|Estimated delegate|Delegate}} count
{{!}} style="{{#if:{{{delegate_count2|}}}|width:75px;}}text-align:center" {{!}} {{{delegate_count1|}}}
{{!}} style="{{#if:{{{delegate_count2|}}}|width:75px;}}text-align:center" {{!}} {{{delegate_count2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{delegate_count3|}}}|width:75px;}}text-align:center" {{!}} {{{delegate_count3|}}}}}
}}
| #default =
}}
|-<!-- States carried -->
{{#switch:{{{type|}}}
| primary
| Primary =
{{#if:{{{states_carried1|}}}{{{states_carried2|}}}{{{states_carried3|}}}|
! style="text-align:left" {{!}} Contests won
{{!}} style="{{#if:{{{states_carried2|}}}|width:75px;}}text-align:center" {{!}} {{{states_carried1|}}}
{{!}} style="{{#if:{{{states_carried2|}}}|width:75px;}}text-align:center" {{!}} {{{states_carried2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{states_carried2|}}}|width:75px;}}text-align:center" {{!}} {{{states_carried3|}}}}}
}}
| presidential
| Presidential =
{{#ifeq:{{{ongoing|}}}|yes||
{{#if:{{{states_carried1|}}}{{{states_carried2|}}}{{{states_carried3|}}}|
! style="text-align:left" {{!}} States carried
{{!}} style="{{#if:{{{states_carried2|}}}|width:75px;}}text-align:center" {{!}} {{{states_carried1|}}}
{{!}} style="{{#if:{{{states_carried2|}}}|width:75px;}}text-align:center" {{!}} {{{states_carried2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{states_carried3|}}}|width:75px;}}text-align:center" {{!}} {{{states_carried3|}}}}}
}}
}}
| #default =
}}
|-<!-- Leader since -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#if:{{{leader_since1|}}}{{{leader_since2|}}}{{{leader_since3|}}}|
! style="text-align:left" {{!}} Leader since
{{!}} style="{{#if:{{{leader_since1|}}}|width:75px;}}text-align:center" {{!}} {{{leader_since1|}}}
{{!}} style="{{#if:{{{leader_since2|}}}|width:75px;}}text-align:center" {{!}} {{{leader_since2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{leader_since3|}}}|width:75px;}}text-align:center" {{!}} {{{leader_since3|}}}}}
}}
| #default =
}}
|-<!-- Leader seat -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#if:{{{leaders_seat1|}}}{{{leaders_seat2|}}}{{{leaders_seat3|}}}|
! style="text-align:left" {{!}} Leader's seat
{{!}} style="{{#if:{{{leaders_seat2|}}}|width:75px;}}text-align:center" {{!}} {{{leaders_seat1|}}}
{{!}} style="{{#if:{{{leaders_seat2|}}}|width:75px;}}text-align:center" {{!}} {{{leaders_seat2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{leaders_seat3|}}}|width:75px;}}text-align:center" {{!}} {{{leaders_seat3|}}}}}
}}
| #default =
}}
|-<!-- last election -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#if:{{{last_election1|}}}{{{last_election2|}}}{{{last_election3|}}}|
! style="text-align:left" {{!}} Last election
{{!}} style="{{#if:{{{last_election1|}}}|width:75px;}}text-align:center" {{!}} {{{last_election1|}}}
{{!}} style="{{#if:{{{last_election2|}}}|width:75px;}}text-align:center" {{!}} {{{last_election2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{last_election3|}}}|width:75px;}}text-align:center" {{!}} {{{last_election3|}}}}}
}}
| #default =
}}
|-<!-- seats before -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#if:{{{seats_before1|}}}{{{seats_before2|}}}{{{seats_before3|}}}|
! style="text-align:left" {{!}} {{#ifeq:{{{ongoing|}}}|yes|Current seats|Seats before}}
{{!}} style="{{#if:{{{seats_before1|}}}|width:75px;}}text-align:center" {{!}} {{{seats_before1|}}}
{{!}} style="{{#if:{{{seats_before2|}}}|width:75px;}}text-align:center" {{!}} {{{seats_before2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{seats_before3|}}}|width:75px;}}text-align:center" {{!}} {{{seats_before3|}}}}}
}}
| #default =
}}
|-<!-- seats needed -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{seats_needed1|}}}{{{seats_needed2|}}}{{{seats_needed3|}}}|
! style="text-align:left" {{!}} Seats needed
{{!}} style="{{#if:{{{seats_needed1|}}}|width:75px;}}text-align:center" {{!}} {{{seats_needed1|}}}
{{!}} style="{{#if:{{{seats_needed2|}}}|width:75px;}}text-align:center" {{!}} {{{seats_needed2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{seats_needed3|}}}|width:75px;}}text-align:center" {{!}} {{{seats_needed3|}}}}}
}}
}}
| #default =
}}
|-<!-- seats -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes||
{{#if:{{{seats1|}}}{{{seats2|}}}{{{seats3|}}}|
! style="text-align:left" {{!}} Seats won
{{!}} style="{{#if:{{{seats1|}}}|width:75px;}}text-align:center" {{!}} {{{seats1|}}}
{{!}} style="{{#if:{{{seats2|}}}|width:75px;}}text-align:center" {{!}} {{{seats2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{seats3|}}}|width:75px;}}text-align:center" {{!}} {{{seats3|}}}}}
}}
}}
| #default =
}}
|-<!-- seats after -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes||
{{#if:{{{seats_after1|}}}{{{seats_after2|}}}{{{seats_after3|}}}|
! style="text-align:left" {{!}} Seats after
{{!}} style="{{#if:{{{seats_after1|}}}|width:75px;}}text-align:center" {{!}} {{{seats_after1|}}}
{{!}} style="{{#if:{{{seats_after2|}}}|width:75px;}}text-align:center" {{!}} {{{seats_after2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{seats_after3|}}}|width:75px;}}text-align:center" {{!}} {{{seats_after3|}}}}}
}}
}}
| #default =
}}
|-<!-- seat change -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes||
{{#if:{{{seat_change1|}}}{{{seat_change2|}}}{{{seat_change3|}}}|
! style="text-align:left" {{!}} Seat change
{{!}} style="{{#if:{{{seat_change1|}}}|width:75px;}}text-align:center" {{!}} {{{seat_change1|}}}
{{!}} style="{{#if:{{{seat_change2|}}}|width:75px;}}text-align:center" {{!}} {{{seat_change2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{seat_change3|}}}|width:75px;}}text-align:center" {{!}} {{{seat_change3|}}}}}
}}
}}
| #default =
}}
|-<!-- popular vote -->
{{#ifexpr:not {{#ifeq:{{{ongoing|}}}|yes|1|0}} or {{#ifeq:{{{type|}}}|primary|1|0}}|
{{#if:{{{popular_vote1|}}}{{{popular_vote2|}}}{{{popular_vote3|}}}|
! style="text-align:left" {{!}} {{{vote_type|Popular}}} vote
{{!}} style="{{#if:{{{popular_vote1|}}}|width:75px;}}text-align:center" {{!}} {{{popular_vote1|}}}
{{!}} style="{{#if:{{{popular_vote2|}}}|width:75px;}}text-align:center" {{!}} {{{popular_vote2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{popular_vote3|}}}|width:75px;}}text-align:center" {{!}} {{{popular_vote3|}}}}}
}}
}}
|-<!-- percentage -->
{{#ifexpr:not {{#ifeq:{{{ongoing|}}}|yes|1|0}} or {{#ifeq:{{{type|}}}|primary|1|0}}|
{{#if:{{{percentage1|}}}{{{percentage2|}}}{{{percentage3|}}}|
! style="text-align:left" {{!}} Percentage
{{!}} style="{{#if:{{{percentage1|}}}|width:75px;}}text-align:center" {{!}} {{{percentage1|}}}
{{!}} style="{{#if:{{{percentage2|}}}|width:75px;}}text-align:center" {{!}} {{{percentage2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{percentage3|}}}|width:75px;}}text-align:center" {{!}} {{{percentage3|}}}}}
}}
}}
|-<!-- Counties won -->
{{#switch:{{{type|}}}
| primary
| Primary
| presidential
| Presidential =
{{#ifexpr:not {{#ifeq:{{{ongoing|}}}|yes|1|0}} or {{#ifeq:{{{type|}}}|primary|1|0}}|
{{#if:{{{counties_won1|}}}{{{counties_won2|}}}{{{counties_won3|}}}|
! style="text-align:left" {{!}} Counties won
{{!}} style="{{#if:{{{counties_won1|}}}|width:75px;}}text-align:center" {{!}} {{{counties_won1|}}}
{{!}} style="{{#if:{{{counties_won2|}}}|width:75px;}}text-align:center" {{!}} {{{counties_won2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{counties_won3|}}}|width:75px;}}text-align:center" {{!}} {{{counties_won3|}}}}}
}}
}}
| #default =
}}
|-<!-- Counties 25% threshold -->
{{#switch:{{{type|}}}
| primary
| Primary
| presidential
| Presidential =
{{#ifexpr:not {{#ifeq:{{{ongoing|}}}|yes|1|0}} or {{#ifeq:{{{type|}}}|primary|1|0}}|
{{#if:{{{counties_threshold1|}}}{{{counties_threshold2|}}}{{{counties_threshold3|}}}|
! style="text-align:left" {{!}} Counties with 25% vote
{{!}} style="{{#if:{{{counties_threshold1|}}}|width:75px;}}text-align:center" {{!}} {{{counties_threshold1|}}}
{{!}} style="{{#if:{{{counties_threshold2|}}}|width:75px;}}text-align:center" {{!}} {{{counties_threshold2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{counties_threshold3|}}}|width:75px;}}text-align:center" {{!}} {{{counties_threshold3|}}}}}
}}
}}
| #default =
}}
|-<!-- swing -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes||
{{#if:{{{swing1|}}}|
! style="text-align:left" {{!}} Swing
{{!}} style="width:75px;text-align:center" {{!}} {{{swing1}}}
{{!}} style="{{#if:{{{swing2|}}}|width:75px;}}text-align:center" {{!}} {{{swing2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{swing3|}}}|width:75px;}}text-align:center" {{!}} {{{swing3|}}}}}
}}
}}
| #default =
}}
{{#if:{{{opinion_polls|}}}||
{{!-}}<!-- Presidential poll nominee -->
{{#switch:{{{type|}}}
| presidential
| Presidential =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll1_person1|}}}{{{poll1_person2|}}}{{{poll1_person3|}}}|
! colspan=4 {{!}} Opinion polls
}}
}}
| #default =
}}
{{!-}}
{{#switch:{{{type|}}}
| presidential
| Presidential =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll1_person1|}}}{{{poll1_person2|}}}{{{poll1_person3|}}}|
! style="text-align:left; white-space: nowrap" {{!}} {{{poll1_date|}}}{{#if:{{{poll1_source|}}}| [{{{poll1_source|}}}]}}
{{!}} style="{{#if:{{{poll1_person1|}}}|width:75px;}}text-align:center" {{!}} {{{poll1_person1|}}}
{{!}} style="{{#if:{{{poll1_person2|}}}|width:75px;}}text-align:center" {{!}} {{{poll1_person2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{poll1_person3|}}}|width:75px;}}text-align:center" {{!}} {{{poll1_person3|}}}}}
}}}}
| #default =
}}
{{!-}}
{{#switch:{{{type|}}}
| presidential
| Presidential =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll2_person1|}}}{{{poll2_person2|}}}{{{poll2_person3|}}}|
! style="text-align:left; white-space: nowrap" {{!}} {{{poll2_date|}}}{{#if:{{{poll2_source|}}}| [{{{poll2_source|}}}]}}
{{!}} style="{{#if:{{{poll2_person1|}}}|width:75px;}}text-align:center" {{!}} {{{poll2_person1|}}}
{{!}} style="{{#if:{{{poll2_person2|}}}|width:75px;}}text-align:center" {{!}} {{{poll2_person2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{poll2_person3|}}}|width:75px;}}text-align:center" {{!}} {{{poll2_person3|}}}}}
}}}}
| #default =
}}
{{!-}}
{{#switch:{{{type|}}}
| presidential
| Presidential =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll3_person1|}}}{{{poll3_person2|}}}{{{poll3_person3|}}}|
! style="text-align:left; white-space: nowrap" {{!}} {{{poll3_date|}}}{{#if:{{{poll3_source|}}}| [{{{poll3_source|}}}]}}
{{!}} style="{{#if:{{{poll3_person1|}}}|width:75px;}}text-align:center" {{!}} {{{poll3_person1|}}}
{{!}} style="{{#if:{{{poll3_person2|}}}|width:75px;}}text-align:center" {{!}} {{{poll3_person2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{poll3_person3|}}}|width:75px;}}text-align:center" {{!}} {{{poll3_person3|}}}}}
}}}}
| #default =
}}
{{!-}}
{{#switch:{{{type|}}}
| presidential
| Presidential =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll4_person1|}}}{{{poll4_person2|}}}{{{poll4_person3|}}}|
! style="text-align:left; white-space: nowrap" {{!}} {{{poll4_date|}}}{{#if:{{{poll4_source|}}}| [{{{poll4_source|}}}]}}
{{!}} style="{{#if:{{{poll4_person1|}}}|width:75px;}}text-align:center" {{!}} {{{poll4_person1|}}}
{{!}} style="{{#if:{{{poll4_person2|}}}|width:75px;}}text-align:center" {{!}} {{{poll4_person2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{poll4_person3|}}}|width:75px;}}text-align:center" {{!}} {{{poll4_person3|}}}}}
}}}}
| #default =
}}
{{!-}}
{{#switch:{{{type|}}}
| presidential
| Presidential =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll5_person1|}}}{{{poll5_person2|}}}{{{poll5_person3|}}}|
! style="text-align:left; white-space: nowrap" {{!}} {{{poll5_date|}}}{{#if:{{{poll5_source|}}}| [{{{poll5_source|}}}]}}
{{!}} style="{{#if:{{{poll5_person1|}}}|width:75px;}}text-align:center" {{!}} {{{poll5_person1|}}}
{{!}} style="{{#if:{{{poll5_person2|}}}|width:75px;}}text-align:center" {{!}} {{{poll5_person2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{poll5_person3|}}}|width:75px;}}text-align:center" {{!}} {{{poll5_person3|}}}}}
}}}}
| #default =
}}
{{!-}}<!-- Legislative poll nominee -->
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll1_party1|}}}{{{poll1_party2|}}}{{{poll1_party3|}}}|
! colspan=4 {{!}} Opinion polls
}}
}}
| #default =
}}
{{!-}}
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll1_party1|}}}{{{poll1_party2|}}}{{{poll1_party3|}}}|
! style="text-align:left; white-space: nowrap" {{!}} {{{poll1_date|}}}{{#if:{{{poll1_source|}}}| [{{{poll1_source|}}}]}}
{{!}} style="{{#if:{{{poll1_party1|}}}|width:75px;}}text-align:center" {{!}} {{{poll1_party1|}}}
{{!}} style="{{#if:{{{poll1_party2|}}}|width:75px;}}text-align:center" {{!}} {{{poll1_party2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{poll1_party3|}}}|width:75px;}}text-align:center" {{!}} {{{poll1_party3|}}}}}
}}
}}
| #default =
}}
{{!-}}
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll2_party1|}}}{{{poll2_party2|}}}{{{poll2_party3|}}}|
! style="text-align:left; white-space: nowrap" {{!}} {{{poll2_date|}}}{{#if:{{{poll2_source|}}}| [{{{poll2_source|}}}]}}
{{!}} style="{{#if:{{{poll2_party1|}}}|width:75px;}}text-align:center" {{!}} {{{poll2_party1|}}}
{{!}} style="{{#if:{{{poll2_party2|}}}|width:75px;}}text-align:center" {{!}} {{{poll2_party2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{poll2_party3|}}}|width:75px;}}text-align:center" {{!}} {{{poll2_party3|}}}}}
}}
}}
| #default =
}}
{{!-}}
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll3_party1|}}}{{{poll3_party2|}}}{{{poll3_party3|}}}|
! style="text-align:left; white-space: nowrap" {{!}} {{{poll3_date|}}}{{#if:{{{poll3_source|}}}| [{{{poll3_source|}}}]}}
{{!}} style="{{#if:{{{poll3_party1|}}}|width:75px;}}text-align:center" {{!}} {{{poll3_party1|}}}
{{!}} style="{{#if:{{{poll3_party2|}}}|width:75px;}}text-align:center" {{!}} {{{poll3_party2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{poll3_party3|}}}|width:75px;}}text-align:center" {{!}} {{{poll3_party3|}}}}}
}}
}}
| #default =
}}
{{!-}}
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll4_party1|}}}{{{poll4_party2|}}}{{{poll4_party3|}}}|
! style="text-align:left; white-space: nowrap" {{!}} {{{poll4_date|}}}{{#if:{{{poll4_source|}}}| [{{{poll4_source|}}}]}}
{{!}} style="{{#if:{{{poll4_party1|}}}|width:75px;}}text-align:center" {{!}} {{{poll4_party1|}}}
{{!}} style="{{#if:{{{poll4_party2|}}}|width:75px;}}text-align:center" {{!}} {{{poll4_party2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{poll4_party3|}}}|width:75px;}}text-align:center" {{!}} {{{poll4_party3|}}}}}
}}
}}
| #default =
}}
{{!-}}
{{#switch:{{{type|}}}
| parliamentary
| Parliamentary
| legislative
| Legislative =
{{#ifeq:{{{ongoing|}}}|yes|
{{#if:{{{poll5_party1|}}}{{{poll5_party2|}}}{{{poll5_party3|}}}|
! style="text-align:left; white-space: nowrap" {{!}} {{{poll5_date|}}}{{#if:{{{poll5_source|}}}| [{{{poll5_source|}}}]}}
{{!}} style="{{#if:{{{poll5_party1|}}}|width:75px;}}text-align:center" {{!}} {{{poll5_party1|}}}
{{!}} style="{{#if:{{{poll5_party2|}}}|width:75px;}}text-align:center" {{!}} {{{poll5_party2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{poll5_party3|}}}|width:75px;}}text-align:center" {{!}} {{{poll5_party3|}}}}}
}}
}}
| #default =
}}}}
|-<!-- Blank field -->
{{#if:{{#if:{{{1blank|}}}|{{{1data1|}}}{{{1data2|}}}{{{1data3|}}}}}|
! style="text-align:left" {{!}} {{{1blank}}}
{{!}} style="{{#if:{{{1data1|}}}|width:75px;}}text-align:center" {{!}} {{{1data1|}}}
{{!}} style="{{#if:{{{1data2|}}}|width:75px;}}text-align:center" {{!}} {{{1data2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{1data3|}}}|width:75px;}}text-align:center" {{!}} {{{1data3|}}}}}
}}
|-
{{#if:{{#if:{{{2blank|}}}|{{{2data1|}}}{{{2data2|}}}{{{2data3|}}}}}|
! style="text-align:left" {{!}} {{{2blank}}}
{{!}} style="{{#if:{{{2data1|}}}|width:75px;}}text-align:center" {{!}} {{{2data1|}}}
{{!}} style="{{#if:{{{2data2|}}}|width:75px;}}text-align:center" {{!}} {{{2data2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{2data3|}}}|width:75px;}}text-align:center" {{!}} {{{2data3|}}}}}
}}
|-
{{#if:{{#if:{{{3blank|}}}|{{{3data1|}}}{{{3data2|}}}{{{3data3|}}}}}|
! style="text-align:left" {{!}} {{{3blank}}}
{{!}} style="{{#if:{{{3data1|}}}|width:75px;}}text-align:center" {{!}} {{{3data1|}}}
{{!}} style="{{#if:{{{3data2|}}}|width:75px;}}text-align:center" {{!}} {{{3data2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{3data3|}}}|width:75px;}}text-align:center" {{!}} {{{3data3|}}}}}
}}
|-
{{#if:{{#if:{{{4blank|}}}|{{{4data1|}}}{{{4data2|}}}{{{4data3|}}}}}|
! style="text-align:left" {{!}} {{{4blank}}}
{{!}} style="{{#if:{{{4data1|}}}|width:75px;}}text-align:center" {{!}} {{{4data1|}}}
{{!}} style="{{#if:{{{4data2|}}}|width:75px;}}text-align:center" {{!}} {{{4data2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{4data3|}}}|width:75px;}}text-align:center" {{!}} {{{4data3|}}}}}
}}
|-
{{#if:{{#if:{{{5blank|}}}|{{{5data1|}}}{{{5data2|}}}{{{5data3|}}}}}|
! style="text-align:left" {{!}} {{{5blank}}}
{{!}} style="{{#if:{{{5data1|}}}|width:75px;}}text-align:center" {{!}} {{{5data1|}}}
{{!}} style="{{#if:{{{5data2|}}}|width:75px;}}text-align:center" {{!}} {{{5data2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{5data3|}}}|width:75px;}}text-align:center" {{!}} {{{5data3|}}}}}
}}
|-
{{#if:{{#if:{{{6blank|}}}|{{{6data1|}}}{{{6data2|}}}{{{6data3|}}}}}|
! style="text-align:left" {{!}} {{{6blank}}}
{{!}} style="{{#if:{{{6data1|}}}|width:75px;}}text-align:center" {{!}} {{{6data1|}}}
{{!}} style="{{#if:{{{6data2|}}}|width:75px;}}text-align:center" {{!}} {{{6data2|}}}
{{#if:{{{col3|}}}|{{!}} style="{{#if:{{{6data3|}}}|width:75px;}}text-align:center" {{!}} {{{6data3|}}}}}
}}</includeonly><noinclude>
{{Documentation}}</noinclude>
378d817ebb08432f35bc744f7606f7bddcc99d6a
Template:Infobox election/shortname
10
223
439
438
2023-12-24T02:13:31Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Infobox_election/shortname]]
wikitext
text/x-wiki
{{#if:{{{name|}}}
|{{#ifeq:{{{link}}}|no
|{{{name}}}
|{{#ifeq:{{delink|{{{name}}}|wikilinks=target}}|{{{name}}}
|{{#switch:{{{name}}}
| Independent | Independents = [[Independent politician|{{{name}}}]]
| Miscellaneous = [[Independent politician|DIV]]
| Other | Others = Others
| Regionalists = [[Regionalism (politics)|Regionalists]]
| Vacant = [[Casual vacancy|Vacant]]
| [[{{{name}}}|{{#invoke:Political party|fetch|{{{name}}}|shortname}}]]
}}
|{{{name}}}
}}
}}
}}<noinclude>
{{documentation}}</noinclude>
f658604d53e60703b125cff21f46afbfd71c8969
Template:Increase
10
224
441
440
2023-12-24T02:13:31Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Increase]]
wikitext
text/x-wiki
[[File:Increase2.svg|{{{size|11px}}}|alt={{{1|Increase}}}|link=|{{{1|Increase}}}]]<noinclude>
{{documentation}}
</noinclude>
dac0cb099f2bf8616e0649249f7e4593a2bf54bd
Template:!-
10
225
443
442
2023-12-24T02:13:32Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:!-]]
wikitext
text/x-wiki
|-<noinclude>
{{documentation}}
</noinclude>
19a1b27b5273caa6fd83a1208fb704afa9ee7c04
Module:Political party
828
226
445
444
2023-12-24T02:13:32Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Political_party]]
Scribunto
text/plain
local p = {}
local default_color = '#F8F9FA'
local categories = {
party_not_in_list = '[[Category:Pages using Political party with unknown party]]',
shortname_not_in_list = '[[Category:Pages using Political party with missing shortname]]',
color_not_in_list = '[[Category:Pages using Political party with missing color]]',
}
local function create_error(error_message)
return string.format('<strong class="error">%s</strong>', error_message)
end
local function getFirstLetter(party)
local index = mw.ustring.sub(party, 1, 1)
-- Set index for non-A-Z starts
if string.match(index, '%A') then
return '1'
end
return string.upper(index)
end
local function stripToNil(text)
-- If text is a string, return its trimmed content, or nil if empty.
-- Otherwise return text (which may, for example, be nil).
if type(text) == 'string' then
text = text:match('(%S.-)%s*$')
local delink = require('Module:Delink')._delink
text = delink({text, wikilinks = "target"})
end
return text
end
-- Example of having all the data - color and names - in one table. Requires one page to be edited instead of two when adding a new party.
function p._fetch(args)
if not args[1] then
return create_error("parameter 1 should be a party name.")
end
if not args[2] then
return create_error("parameter 2 should be the output type.")
end
local party = stripToNil(args[1])
local out_type = stripToNil(args[2])
if out_type == 'colour' then
out_type = 'color'
end
local index = getFirstLetter(party)
-- Load data from submodule
local data = mw.loadData('Module:Political party/' .. index)
local data_all = data.full
local party_alt = data.alternate[party]
local party_info
if party_alt then
if data_all[party_alt] then
party_info = data_all[party_alt]
else
index = getFirstLetter(party_alt)
data = mw.loadData('Module:Political party/' .. index)
party_info = data.full[party_alt]
end
else
party_info = data_all[party]
end
-- Check if database value exists
-- * Not even in database - return given error or input
-- * No color - return error
-- * No shortname/abbrev - return first non-blank of abbrev->shortname->input
if not party_info then
if out_type == 'color' then
return args.error or default_color
else
return args.error or party
end
end
local return_value = party_info[out_type]
if return_value == "" then
if out_type == 'color' then
return args.error or create_error("Value not in template. Please request that it be added.")
elseif out_type == 'abbrev' then
if party_info.shortname ~= "" then
return party_info.shortname
else
return party
end
elseif out_type == 'shortname' then
if party_info.abbrev ~= "" then
return party_info.abbrev
else
return party
end
else
return party
end
end
if out_type == 'color' and string.find(return_value, '#') then
return_value = string.gsub(return_value, '#', '#')
end
return return_value
end
function p.fetch(frame)
-- Initialise and populate variables
local getArgs = require("Module:Arguments").getArgs
local args = getArgs(frame)
return p._fetch(args)
end
return p
5619f7c33e00168878164325d0fcb8600faa2446
Module:Political party/C
828
227
447
446
2023-12-24T02:13:32Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Political_party/C]]
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["California Democratic Party"] = "Democratic Party (United States)",
["California Progressive Party"] = "Progressive Party (US)",
["California Republican Party"] = "Republican Party (United States)",
["Cambiamo"] = "Cambiamo!",
["Cambodian National Rescue Party"] = "Cambodia National Rescue Party",
["Canarian Nationalist Assembly"] = "Nationalist Canarian Assembly",
["Canarian United Left"] = "United Left (Spain)",
["Cap 21"] = "Cap21",
["Carlist Party"] = "Carlist Party (1970)",
["Carlist Party of Euskal Herria"] = "Carlist Party (1970)",
["Cartel (Luxembourg)"] = "Party of Independents of the East",
["Catalan Democratic Party"] = "Catalan European Democratic Party",
["Catalan Federation of the PSOE"] = "Spanish Socialist Workers' Party",
["Catalan Socialist Federation"] = "Spanish Socialist Workers' Party",
["Catalunya en Comú–Podem"] = "Catalunya en Comú",
["Catholic Democrats (The National Party)"] = "Catholic Democrats (Ireland)",
["Catholic Democrats"] = "Catholic Democrats (Ireland)",
["CCM"] = "Chama Cha Mapinduzi",
["CD&V"] = "Christen-Democratisch en Vlaams",
["CdH"] = "Humanist Democratic Centre",
["CDS - People's Party"] = "CDS – People's Party",
["CDU"] = "Christian Democratic Union of Germany",
["CDU/CSU"] = "Christian Democratic Union of Germany",
["CDU (2023)"] = "Christian Democratic Union of Germany (2023)",
["Centre Agreement"] = "Centre Alliance",
["Centre Democratic Action of Galicia"] = "Citizens of Galicia Democratic Action",
["Centre démocrate humaniste"] = "Humanist Democratic Centre",
["Centre Independent Aragonese Candidacy"] = "Aragonese Party",
["Centre Party (Israel)"] = "Center Party (Israel)",
["Centre Party"] = "Centre Party (Sweden)",
["Centre Union (Greece)"] = "Centre Union",
["Centre Union – New Forces"] = "Centre Union",
["Centre-left coalition"] = "Centre-left coalition (Italy)",
["Centre-right coalition"] = "Centre-right coalition (Italy)",
["Centre-right Coalition"] = "Centre-right coalition (Italy)",
["Centrist Party (United States)"] = "Centrist Party (US)",
["Centrists of Catalonia"] = "Union of the Democratic Centre (Spain)",
["Ceylon Indian Congress"] = "Ceylon Workers' Congress",
["Chama cha Mapinduzi"] = "Chama Cha Mapinduzi",
["Cambio 90 – New Majority"] = "Cambio 90",
["Chart Thai Pattana Party"] = "Chartthaipattana Party",
["Change UK – The Independent Group"] = "The Independent Group for Change",
["Change UK"] = "The Independent Group for Change",
["Chilean Socialist Party (1987-1990)"] = "Chilean Socialist Party",
["Chilean Socialist Party (1987–1990)"] = "Chilean Socialist Party", -- dash differences
["China Democratic National Construction Association"] = "China National Democratic Construction Association",
["Chinese Youth Party"] = "Young China Party",
["Chrisitan Democracy for the Autonomies"] = "Christian Democracy for the Autonomies",
["Christian and Democratic Union - Czechoslovak People's Party"] = "KDU-ČSL",
["Christian and Democratic Union – Czechoslovak People's Party"] = "KDU-ČSL", -- dash difference
["Christian Democracy"] = "Christian Democracy (Italy)",
["Christian Democrat Party of Chile"] = "Christian Democratic Party (Chile)",
["Christian Democratic and Flemish"] = "Christen-Democratisch en Vlaams",
["Christian Democratic Party (France)"] = "VIA, the Way of the People",
["Christian Democratic Team of the Spanish State"] = "Christian Democracy Federation–Christian Democracy Team",
["Christian Democratic Union (Germany)"] = "Christian Democratic Union of Germany",
["Christian Democratic Union (Germany, 2023)"] = "Christian Democratic Union of Germany (2023)",
["Christian Democratic Unity"] = "Christian Democrats (Sweden)",
["Christian Heritage New Zealand"] = "Christian Heritage Party of New Zealand",
["Christian Liberal Party"] = "Christian Liberty Unification Party",
["Christian Liberty Party"] = "Christian Liberty Unification Party",
["Christian Nationalist Party (US)"] = "Constitution Party (US, 1952)",
["Christian People's Party (Latvia)"] = "Popular Front of Latvia",
["Christian Social Party (Belgium, defunct)"] = "Christian Social Party (Belgium, 1945)",
["Christian Social Party (Wallonia)"] = "Humanist Democratic Centre",
["Christian Social Party"] = "Christian Social Party (Germany)",
["Christian Social Union of Bavaria"] = "Christian Social Union in Bavaria",
["Christian Workers' Union (Finland)"] = "Christian Workers' Union of Finland",
["Christian-Democratic National Peasants' Party (Romania)"] = "Christian Democratic National Peasants' Party",
["ChristianUnion"] = "Christian Union (Netherlands)",
["CIBAC"] = "Citizens' Battle Against Corruption",
["CISTA"] = "Cannabis Is Safer Than Alcohol",
["Citizen Europe"] = "Cap21",
["Citizen’s Coalition for Justice Party (Mongolia)"] = "Citizen's Coalition for Justice Party (Mongolia)",
["Citizens Coalition For Change"] = "Citizens Coalition for Change",
["Citizens of Democratic Centre"] = "Democratic Centre Coalition",
["Citizens Party (United States)"] = "Citizens Party (US)",
["Citizens' Liberation Party"] = "Nagrik Unmukti Party",
["Citizens' Movement (France)"] = "Citizen and Republican Movement",
["Citizens' Movement for Change"] = "Mouvement des Citoyens pour le Changement",
["Citizens' Party (Philippines)"] = "Nationalist Citizens' Party",
["Citizenship, Action, Participation for the 21st Century"] = "Cap21",
["Civic Centre Alliance"] = "Centre Civic Alliance",
["Civic-Liberal Alliance"] = "Civic Liberal Alliance",
["Civil Congress of Ukraine"] = "Slavic Party (Ukraine)",
["Civil Contract"] = "Civil Contract (Armenia)",
["Civil Initiative"] = "Civic Initiative",
["Civil Will-Green Party"] = "Civil Will–Green Party",
["Club 2002"] = "Club 2002 – Party for the Unity and the Republic",
["Coalition for Bulgaria"] = "BSP for Bulgaria",
["Coalition for Democratic Unity"] = "Democratic Unity Roundtable",
["Coalition for Europe (2009)"] = "Coalition for Europe",
["Coalition for Europe (2014)"] = "Coalition for Europe",
["Coalition for Republic – Republican Party of Czechoslovakia"] = "Rally for the Republic – Republican Party of Czechoslovakia",
["Coalition for the Europe of the Peoples"] = "Europe of the Peoples",
["Coalition Liberal"] = "National Liberal Party (UK, 1922)",
["Coalition New Zealand"] = "Vision NZ",
["Coalition of the Radical Left"] = "Syriza",
["Coalition Party and Rural People's Association"] = "Estonian Coalition Party",
["Coalition Unionist"] = "Coalition Conservative",
["Collective Action Party — Civic Congress"] = "Common Action Political Party — Civil Congress",
["Collective Action Party – Civic Congress"] = "Common Action Political Party — Civil Congress",
["Colorado Democratic Party"] = "Democratic Party (United States)",
["Colorado Republican Party"] = "Republican Party (United States)",
["Colombia Coalition"] = "Citizens' Compromise",
["Common Peoples' Party"] = "Other parties",
["Commonwealth Land Party (United States)"] = "Commonwealth Land Party (US)",
["Commonwealth Liberal"] = "Commonwealth Liberal Party",
["Communist League Marxist–Leninists (the revolutionaries)"] = "Communist Party (Sweden)",
["Communist Movement of Aragon"] = "Communist Movement (Spain)",
["Communist Movement of Asturias"] = "Communist Movement (Spain)",
["Communist Movement of Catalonia"] = "Communist Movement (Spain)",
["Communist Movement of Euskadi"] = "Communist Movement (Spain)",
["Communist Movement of Galicia"] = "Communist Movement (Spain)",
["Communist Movement of the Valencian Country"] = "Communist Movement (Spain)",
["Communist Party (Sweden, 2018)"] = "Party of Labour of Albania",
["Communist Party (United States)"] = "Communist Party (US)",
["Communist Party of Andalusia"] = "Communist Party of Spain",
["Communist Party of Aragon"] = "Communist Party of Spain",
["Communist Party of Armenia (Soviet Union)"] = "Communist Party of the Soviet Union",
["Communist Party of Asturias"] = "Communist Party of Spain",
["Communist Party of Belgium"] = "Workers' Party of Belgium",
["Communist Party of Britain (Marxist-Leninist)"] = "Communist Party of Britain (Marxist–Leninist)",
["Communist Party of Cantabria"] = "Communist Party of Spain",
["Communist Party of Castile and León"] = "Communist Party of Spain",
["Communist Party of Castilla–La Mancha"] = "Communist Party of Spain",
["Communist Party of Ceylon"] = "Communist Party of Sri Lanka",
["Communist Party of China"] = "Chinese Communist Party",
["Communist Party of Estonia"] = "Communist Party of the Soviet Union",
["Communist Party of Extremadura"] = "Communist Party of Spain",
["Communist Party of Finland (1997)"] = "Communist Party of Finland (1994)",
["Communist Party of Galicia (Revolutionary Marxist)"] = "Workers' Party of Spain–Communist Unity",
["Communist Party of Galicia"] = "Communist Party of Spain",
["Communist Party of Germany (Opposition)"] = "Communist Party of Germany",
["Communist Party of Great Britain (Marxist-Leninist)"] = "Communist Party of Great Britain (Marxist–Leninist)",
["Communist Party of India (Marxist-Leninist) (Liberation)"] = "Communist Party of India (Marxist–Leninist) Liberation",
["Communist Party of India (Marxist-Leninist) Liberation"] = "Communist Party of India (Marxist–Leninist) Liberation",
["Communist Party of India (Marxist-Leninist) Red Star"] = "Communist Party of India (Marxist–Leninist) Red Star",
["Communist Party of India (Marxist–Leninist)"] = "Provisional Central Committee, Communist Party of India (Marxist–Leninist)",
["Communist Party of Ireland (Marxist-Leninist)"] = "Communist Party of Ireland (Marxist–Leninist)",
["Communist Party of La Rioja"] = "Communist Party of Spain",
["Communist Party of Madrid"] = "Communist Party of Spain",
["Communist Party of Nepal (Marxist-Leninist) (1998)"] = "Communist Party of Nepal (Marxist–Leninist) (2002)",
["Communist Party of Nepal (Marxist-Leninist) (2002)"] = "Communist Party of Nepal (Marxist–Leninist) (2002)",
["Communist Party of Nepal (Unified Marxist-Leninist)"] = "Communist Party of Nepal (Unified Marxist–Leninist)",
["Communist Party of the Balearic Islands"] = "Communist Party of Spain",
["Communist Party of the Basque Country"] = "Communist Party of Spain",
["Communist Party of the Canaries"] = "Communist Party of Spain",
["Communist Party of the Catalan People"] = "Communist Party of the Peoples of Spain",
["Communist Party of the Galician People"] = "Communist Party of the Peoples of Spain",
["Communist Party of the Portuguese Workers / Reorganizative Movement of the Party of the Proletariat"] = "Portuguese Workers' Communist Party",
["Communist Party of the Region of Murcia"] = "Communist Party of Spain",
["Communist Party of the Valencian Country"] = "Communist Party of Spain",
["Communist Party of Turkey (current)"] = "Communist Party of Turkey (modern)",
["Communist Party of Turkey (today)"] = "Communist Party of Turkey (modern)",
["Communist Party of Yugoslavia"] = "League of Communists of Yugoslavia",
["Communist Workers' Party of Catalonia"] = "Spanish Communist Workers' Party",
["Communists' Unity Board"] = "Workers' Party of Spain–Communist Unity",
["Community of the People"] = "Inuit Ataqatigiit",
["Concert of Parties for Democracy"] = "Concertación",
["Concertación de Partidos por la Democracia"] = "Concertación",
["Confederation for an Independent Poland"] = "Confederation of Independent Poland",
["Connecticut Democratic Party"] = "Democratic Party (United States)",
["Connecticut for Lieberman"] = "Independent (US)",
["Connecticut Republican Party"] = "Republican Party (United States)",
["Connecticut Green Party"] = "Green Party (US)",
["Connecticut Working Families Party"] = "Working Families Party",
["Conservatism"] = "Conservatism sidebar",
["Conservative and National Liberal"] = "National Liberal Party (UK, 1931)",
["Conservative and Unionist"] = "Scottish Conservatives",
["Conservative Party (New York)"] = "Conservative Party (US)",
["Conservative Party (UK)"] = "Conservative and Unionist Party (UK)",
["Conservative Party (United States)"] = "Conservative Party (US)",
["Conservative Party of Canada (historical)"] = "Conservative Party of Canada (1867–1942)",
["Conservative Party (Virginia, 1867)"] = "Conservative Party (US)",
["Conservative Party of Cuba"] = "National Conservative Party (Cuba)",
["Conservative Party of New York State"] = "Conservative Party (US)",
["Conservative Party of New York"] = "Conservative Party (US)",
["Conservative Party of New Zealand"] = "New Conservative Party of New Zealand",
["Conservative Party of Norway"] = "Conservative Party (Norway)",
["Conservative Party of Virginia (1965)"] = "Conservative Party (Virginia, 1965)",
["Conservative Party"] = "Conservative and Unionist Party (UK)",
["Conservatives in Northern Ireland"] = "Northern Ireland Conservatives",
["Constituent Unity"] = "New Social Pact",
["Constitution Party (Oregon)"] = "Constitution Party (US)",
["Constitution Party (United States)"] = "Constitution Party (US)",
["Constitution Party (Utah)"] = "Constitution Party (US)",
["Constitution Party of Minnesota"] = "Constitution Party (US)",
["Constitution Party of Oregon"] = "Constitution Party (US)",
["Constitution Party of Washington"] = "Constitution Party (US)",
["Constitutional Democratic Rally"] = "Democratic Constitutional Rally",
["Constitutional People's Party (Finland)"] = "Constitutional Right Party",
["Constitutional Union Party (United States)"] = "Constitutional Union Party (US)",
["Constructive Ecological Party \"KEDR\""] = "Russian Ecological Party \"The Greens\"",
["Cook Islands Party Tumu"] = "Party Tumu",
["COPEI"] = "Copei",
["Costa Rican Renovation Party"] = "Costa Rican Renewal Party",
["Country Party of Australia – Tasmania"] = "National Party of Australia – Tasmania",
["Country Party of Western Australia"] = "National Party of Australia",
["Country Party"] = "National Party of Australia",
["Country–Liberal Coalition"] = "Country/Liberal Coalition",
["Country"] = "National Party of Australia",
["Country/National coalition"] = "National Party of Australia",
["Country/Nationalist coalition"] = "National Party of Australia",
["Country/QPP coalition"] = "National Party of Australia",
["Country/UAP coalition"] = "National Party of Australia",
["Country/United coalition"] = "National Party of Australia",
["Courage Italy"] = "Coraggio Italia",
["CPI(M)"] = "Communist Party of India (Marxist)",
["CREO Movement"] = "Creating Opportunities",
["Crescent Star Party"] = "Crescent Star Party (Indonesia)",
["Croatian Citizen Party"] = "Croatian Civic Party",
["Croatian Labourists - Labour Party"] = "Croatian Labourists – Labour Party",
["Croatian People's Party - Liberal Democrats"] = "Croatian People's Party – Liberal Democrats",
["Croatian Sustainable Development"] = "Green Alternative - Sustainable Development of Croatia",
["Crossbench"] = "Crossbencher",
["CSSD"] = "Czech Social Democratic Party",
["CSSD (2021)"] = "Czech Social Democratic Party (2021)",
["Cuban Popular Party-National League"] = "Cuban Popular Party",
["Cumann na nGaedhael"] = "Cumann na nGaedheal",
["CumbriaFirst"] = "Putting Cumbria First",
["Cumbria First"] = "Putting Cumbria First",
["CVP"] = "Christen-Democratisch en Vlaams",
}
local full = {
["Caballas Coalition"] = {abbrev = "", color = "#C9601C", shortname = "Caballas",},
["Cabal (political party)"] = {abbrev = "", color = "#1642fd", shortname = "Cabal",},
["Cáceres Eres Tú"] = {abbrev = "", color = "#5A1E5A", shortname = "",},
["Cáceres Viva"] = {abbrev = "", color = "#008B15", shortname = "",},
["Caledonia Together"] = {abbrev = "", color = "#00CCCC", shortname = "",},
["Caledonian Union"] = {abbrev = "", color = "#008000", shortname = "",},
["California National Party"] = {abbrev = "", color = "#FFD700", shortname = "California National",},
["Caló Nationalist Party"] = {abbrev = "", color = "#008284", shortname = "",},
["Cambia Avilés"] = {abbrev = "", color = "#19905A", shortname = "",},
["Cambia Logroño"] = {abbrev = "", color = "#A30052", shortname = "",},
["Cámbialo Municipalistas"] = {abbrev = "", color = "#AD0B5A", shortname = "",},
["Cambiamo!"] = {abbrev = "", color = "#E58321", shortname = "",},
["Cambiando Burlada"] = {abbrev = "", color = "#9F82A1", shortname = "",},
["Cambiar Huesca"] = {abbrev = "", color = "#27933E", shortname = "",},
["Cambiar la Región de Murcia"] = {abbrev = "", color = "#80B620", shortname = "",},
["Cambiemos Murcia"] = {abbrev = "", color = "#C0CD37", shortname = "",},
["Cambiemos Orihuela"] = {abbrev = "", color = "#009A97", shortname = "",},
["Cambiemos Parla"] = {abbrev = "", color = "#BF469A", shortname = "",},
["Cambiemos Villalba"] = {abbrev = "", color = "#B00868", shortname = "",},
["Cambiemos"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Cambio (political party)"] = {abbrev = "", color = "#fbd504", shortname = "Change",},
["Cambio 90"] = {abbrev = "", color = "#D45500", shortname = "",},
["Cambio-Aldaketa"] = {abbrev = "", color = "#A2AA00", shortname = "",},
["Cambodia Indigenous Peoples Democracy Party"] = {abbrev = "", color = "#522315", shortname = "",},
["Cambodia National Rescue Party"] = {abbrev = "CNRP", color = "#0047AB", shortname = "",},
["Cambodian Nationality Party"] = {abbrev = "", color = "#FDEB04", shortname = "",},
["Cambodian People's Party"] = {abbrev = "CPP", color = "#1E90FF", shortname = "",},
["Cambodian Youth Party"] = {abbrev = "CYP", color = "#0045BC", shortname = "",},
["Cambridge Socialists"] = {abbrev = "", color = "red", shortname = "",},
["Camden Charter"] = {abbrev = "", color = "white", shortname = "",},
["Cameroon Democratic Union"] = {abbrev = "UDC", color = "#2B3781", shortname = "",},
["Cameroon People's Democratic Movement"] = {abbrev = "RDPC", color = "#73C2FB", shortname = "",},
["Cameroon Renaissance Movement"] = {abbrev = "MRC", color = "#9BC8E9", shortname = "",},
["Cameroonian National Union"] = {abbrev = "UNC", color = "#00CD12", shortname = "",},
["Cameroonian Union"] = {abbrev = "", color = "#007F00", shortname = "",},
["Caminando Juntos"] = {abbrev = "CJ", color = "#203C90", shortname = "",},
["Camp of National Unity"] = {abbrev = "OZN", color = "#00177C", shortname = "",},
["Campaign for a More Prosperous Britain"] = {abbrev = "", color = "grey", shortname = "More Prosperous Britain",},
["Can Lao Party"] = {abbrev = "", color = "#39944A", shortname = "",},
["Canadian Alliance"] = {abbrev = "", color = "#5F9EA0", shortname = "Alliance",},
["Canarian Assembly"] = {abbrev = "", color = "#C62821", shortname = "",},
["Canarian Centrist Group"] = {abbrev = "", color = "#0D601C", shortname = "",},
["Canarian Coalition–New Canaries"] = {abbrev = "", color = "#BAF73E", shortname = "",},
["Canarian Coalition"] = {abbrev = "CC", color = "#FFD700", shortname = "",},
["Canarian Green Party"] = {abbrev = "", color = "#85C026", shortname = "",},
["Canarian Greens"] = {abbrev = "", color = "#008000", shortname = "",},
["Canarian Independent Groups"] = {abbrev = "AIC", color = "#000088", shortname = "",},
["Canarian Nationalist Alternative"] = {abbrev = "", color = "#AD221B", shortname = "",},
["Canarian Nationalist Convergence"] = {abbrev = "", color = "#65BFE3", shortname = "",},
["Canarian Nationalist Federation"] = {abbrev = "FNC", color = "#823D8F", shortname = "",},
["Canarian Nationalist Party"] = {abbrev = "", color = "#495087", shortname = "",},
["Canarian People's Union"] = {abbrev = "", color = "#BA0033", shortname = "",},
["Canarian Popular Alternative"] = {abbrev = "", color = "#009642", shortname = "",},
["Canarian Social Democratic Centre"] = {abbrev = "", color = "#FF7F02", shortname = "",},
["Canarian Union"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Canaries Decides"] = {abbrev = "", color = "#9B0024", shortname = "",},
["Canaries for Progress"] = {abbrev = "", color = "#3485BD", shortname = "",},
["Candidacy for the Neighbors' Participation in the City Council"] = {abbrev = "", color = "#DEC939", shortname = "",},
["Candidatura de Unidad Popular"] = {abbrev = "", color = "#A0866E", shortname = "",},
["Candlelight Party"] = {abbrev = "", color = "#020878", shortname = "Candlelight",},
["Cangas Left Alternative"] = {abbrev = "", color = "#6F956C", shortname = "",},
["Cannabis Is Safer Than Alcohol"] = {abbrev = "CISTA", color = "#D2B48C", shortname = "",},
["Cannabis Law Reform"] = {abbrev = "", color = "#556B2F", shortname = "",},
["Cannabis Party (Spain)"] = {abbrev = "", color = "#428600", shortname = "",},
["Cannabis Party–Green Light"] = {abbrev = "", color = "#3AAA35", shortname = "",},
["Cantabrian Nationalist Council"] = {abbrev = "", color = "#973D3C", shortname = "",},
["Cantabrian Unity"] = {abbrev = "", color = "#08C853", shortname = "",},
["Cantabristas"] = {abbrev = "", color = "#7D002E", shortname = "",},
["Cantonal Party"] = {abbrev = "", color = "#8F3F42", shortname = "",},
["Canvey Island Independent Party"] = {abbrev = "CIIP", color = "#000000", shortname = "",},
["Canviem entre Tots"] = {abbrev = "", color = "#5B244B", shortname = "",},
["Canviem Mollet"] = {abbrev = "", color = "#631F5E", shortname = "",},
["Cap Ecology"] = {abbrev = "", color = "#509A32", shortname = "",},
["Cap21"] = {abbrev = "", color = "#9db55c", shortname = "",},
["Cape Coloured Congress"] = {abbrev = "", color = "#000000", shortname = "",},
["Cape Party"] = {abbrev = "", color = "#000076", shortname = "",},
["Capitalist Party of South Africa"] = {abbrev = "", color = "#693C97", shortname = "",},
["Capitalist Party"] = {abbrev = "", color = "#4A104A", shortname = "",},
["Caribbean Socialist Party"] = {abbrev = "", color = "#be1918", shortname = "",},
["Caring for Macau"] = {abbrev = "", color = "#1034A6", shortname = "",},
["Carlist Party (1970)"] = {abbrev = "", color = "#FF454F", shortname = "",},
["Carlist Traditionalist Communion"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Carpatho-Russian Labour Party of Small Peasants and Landless"] = {abbrev = "KTPMB", color = "orange", shortname = "",},
["Cartagena Sí Se Puede"] = {abbrev = "", color = "#572458", shortname = "",},
["Cartagenerist Party"] = {abbrev = "", color = "#BE2F33", shortname = "",},
["Cartago Agrarian Force Party"] = {abbrev = "FAC", color = "#87CEEB", shortname = "",},
["Cartago Agrarian Union Party"] = {abbrev = "PUAC", color = "#BA55D3", shortname = "",},
["Cartago Green Party"] = {abbrev = "PVC", color = "green", shortname = "",},
["Carthaginense Citizens' Initiative"] = {abbrev = "", color = "#820004", shortname = "",},
["Cartista"] = {abbrev = "", color = "#002395", shortname = "",},
["CASA–CE"] = {abbrev = "", color = "#52a8ff", shortname = "",},
["CasaPound"] = {abbrev = "", color = "#000000", shortname = "",},
["Cascadia Bioregional Party"] = {abbrev = "", color = "#067DC4", shortname = "",},
["Cassolists"] = {abbrev = "", color = "#2EA5A5", shortname = "",},
["Castelló en Moviment"] = {abbrev = "", color = "#35A299", shortname = "",},
["Castellón Democracy"] = {abbrev = "", color = "#0D9F4E", shortname = "",},
["Castilian Left"] = {abbrev = "", color = "#C5496F", shortname = "",},
["Castilian Party"] = {abbrev = "", color = "#551D79", shortname = "",},
["Castilian Regionalist Party"] = {abbrev = "", color = "#F0DD07", shortname = "",},
["Castilian Unity"] = {abbrev = "", color = "#313494", shortname = "",},
["Castilianist Union"] = {abbrev = "", color = "#DC143C", shortname = "",},
["CastroVerde (political party)"] = {abbrev = "", color = "#06BC58", shortname = "",},
["Casual vacancy"] = {abbrev = "", color = "#FFFFFF", shortname = "Vacant",},
["Catalan Action"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Catalan Agreement of Progress"] = {abbrev = "", color = "#FA8005", shortname = "",},
["Catalan Centre"] = {abbrev = "", color = "#6D1402", shortname = "",},
["Catalan Civil Support"] = {abbrev = "", color = "#A11C26", shortname = "",},
["Catalan Coexistence"] = {abbrev = "", color = "#0E2D87", shortname = "",},
["Catalan European Democratic Party"] = {abbrev = "PDeCAT", color = "#0263AC", shortname = "",},
["Catalan Left"] = {abbrev = "", color = "#D6B800", shortname = "",},
["Catalan Nationalist Republican"] = {abbrev = "", color = "#FACF9A", shortname = "",},
["Catalan Republican Party (1917)"] = {abbrev = "", color = "#B35359", shortname = "",},
["Catalan Republican Party"] = {abbrev = "", color = "#EB5604", shortname = "",},
["Catalan Solidarity (1906)"] = {abbrev = "SC", color = "#FFBC3D", shortname = "",},
["Catalan Solidarity (1980)"] = {abbrev = "", color = "#FFA07A", shortname = "",},
["Catalan Solidarity for Independence"] = {abbrev = "SI", color = "#CA0405", shortname = "",},
["Catalan Sovereigntist Bloc"] = {abbrev = "", color = "#C1001F", shortname = "",},
["Catalonia Among Neighbors"] = {abbrev = "", color = "#914B1E", shortname = "",},
["Catalonia in the Senate"] = {abbrev = "", color = "#FFD74D", shortname = "",},
["Catalonia Yes"] = {abbrev = "", color = "#1E242E", shortname = "",},
["Catalunya en Comú"] = {abbrev = "", color = "#912C45", shortname = "",},
["Catalunya Lliure"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Catalunya Sí que es Pot"] = {abbrev = "", color = "#C4375B", shortname = "CatSíqueesPot",},
["Catamarca People's Movement"] = {abbrev = "", color = "#0052CE", shortname = "",},
["Catarinense Republican Party"] = {abbrev = "PRC", color = "#FA8072", shortname = "",},
["Catholic-National Conservative Party in Bohemia"] = {abbrev = "KNKSČ", color = "#004F50", shortname = "",},
["Catholic Centre Party (Portugal)"] = {abbrev = "CCP", color = "#00BFFF", shortname = "Catholic Centre",},
["Catholic Church footer"] = {abbrev = "", color = "#FFD700", shortname = "Catholic",},
["Catholic Democrats (Ireland)"] = {abbrev = "", color = "#8A8AE0", shortname = "Catholic Democrats",},
["Catholic Election Action"] = {abbrev = "WAK", color = "#3F82C6", shortname = "",},
["Catholic League"] = {abbrev = "LC", color = "#2D2D2D", shortname = "",},
["Catholic National Party"] = {abbrev = "KNP", color = "#47B26B", shortname = "",},
["Catholic Party (Belgium)"] = {abbrev = "", color = "#FFD700", shortname = "Catholic",},
["Catholic Party (Indonesia)"] = {abbrev = "", color = "#800000", shortname = "Catholic",},
["Catholic Party (Liverpool)"] = {abbrev = "", color = "#99FF66", shortname = "Catholic",},
["Catholic People's Party (Poland)"] = {abbrev = "SKL", color = "#335B5B", shortname = "",},
["Catholic People's Party"] = {abbrev = "KVP", color = "#004F50", shortname = "",},
["Catholic Union (Spain)"] = {abbrev = "", color = "#1D5D96", shortname = "",},
["Catholic Workers' Party"] = {abbrev = "PCO", color = "#800000", shortname = "",},
["Cavalier"] = {abbrev = "", color = "white", shortname = "",},
["Cayman Democratic Party"] = {abbrev = "CDP", color = "#345284", shortname = "",},
["Cayman Islands People's Party"] = {abbrev = "", color = "#FFC30D", shortname = "",},
["CDS – People's Party"] = {abbrev = "CDS–PP", color = "#0093DD", shortname = "",},
["CEDA"] = {abbrev = "", color = "#303180", shortname = "",},
["Ceann Comhairle"] = {abbrev = "", color = "#000000", shortname = "",},
["Ceire Cion"] = {abbrev = "", color = "salmon", shortname = "",},
["Célbakísér Civil Szövetség"] = {abbrev = "", color = "#95C241", shortname = "",},
["Center for Islamic Iran Academics"] = {abbrev = "CIIA", color = "#03babe", shortname = "",},
["Center for the Study of Natural Resources"] = {abbrev = "", color = "#17AA5C", shortname = "",},
["Center Party (Israel)"] = {abbrev = "", color = "#1935D0", shortname = "",},
["Center Party (Norway)"] = {abbrev = "", color = "#D63D2D", shortname = "",},
["Center Union-New Forces"] = {abbrev = "EK-ND", color = "#FF7F50", shortname = "",},
["Centered for Tarragona"] = {abbrev = "", color = "#00436E", shortname = "",},
["Centered Progressives Coalition"] = {abbrev = "", color = "#C60079", shortname = "",},
["Centrados"] = {abbrev = "", color = "#D9007F", shortname = "",},
["Central African Democratic Rally"] = {abbrev = "RDC", color = "#FFE339", shortname = "",},
["Central African Democratic Union"] = {abbrev = "UDC", color = "#B1CF70", shortname = "",},
["Central African Republican Party"] = {abbrev = "", color = "#4682B4", shortname = "",},
["Central and Western Democratic Power"] = {abbrev = "CWDP", color = "#d75453", shortname = "",},
["Central and Western District Coalition"] = {abbrev = "", color = "#3FA900", shortname = "",},
["Central Committee of Tallinn Trade Unions"] = {abbrev = "TAK", color = "#FF0000", shortname = "",},
["Central Polish Electoral Committee"] = {abbrev = "LCRK", color = "#F200CB", shortname = "",},
["Centralist Republican Party"] = {abbrev = "", color = "#B82761", shortname = "",},
["Centrats"] = {abbrev = "", color = "#16946F", shortname = "",},
["Centre (Croatian political party)"] = {abbrev = "", color = "#2D7AB0", shortname = "",},
["Centre Alliance (Argentina)"] = {abbrev = "", color = "#0087D1", shortname = "Centre Alliance",},
["Centre Alliance"] = {abbrev = "", color = "#ff6300", shortname = "",},
["Centre and Democracy Forum"] = {abbrev = "", color = "#009E31", shortname = "",},
["Centre Civic Alliance"] = {abbrev = "POC", color = "#FFD054", shortname = "",},
["Centre Democracy and Progress"] = {abbrev = "", color = "#00CCCC", shortname = "",},
["Centre Democrats (Denmark)"] = {abbrev = "", color = "#800080", shortname = "Centre Democrats",},
["Centre Democrats (Netherlands)"] = {abbrev = "CD", color = "#7F663D", shortname = "",},
["Centre for Poland"] = {abbrev = "CdP", color = "#0D3570", shortname = "",},
["Centre Group"] = {abbrev = "", color = "#F47F31", shortname = "",},
["Centre of Arona"] = {abbrev = "", color = "#70B72B", shortname = "",},
["Centre of Social Democrats"] = {abbrev = "", color = "#4B0082", shortname = "",},
["Centre Party '86"] = {abbrev = "", color = "red", shortname = "",},
["Centre Party (Denmark)"] = {abbrev = "", color = "#39944A", shortname = "Centre",},
["Centre Party (Faroe Islands)"] = {abbrev = "", color = "#0A4168", shortname = "Centre",},
["Centre Party (Finland)"] = {abbrev = "Kesk.", color = "#3AAD2E", shortname = "Centre",},
["Centre Party (Germany)"] = {abbrev = "", color = "#000000", shortname = "Centre",},
["Centre Party (Germany, 1945)"] = {abbrev = "", color = "#004C90", shortname = "Centre",},
["Centre Party (Greenland)"] = {abbrev = "", color = "#FFCC00", shortname = "Akulliit",},
["Centre Party (Hungary)"] = {abbrev = "", color = "#FFB900", shortname = "Centre",},
["Centre Party (Iceland)"] = {abbrev = "", color = "#002169", shortname = "Centre",},
["Centre Party (Jersey)"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Centre Party (Latvia)"] = {abbrev = "", color = "#8D2421", shortname = "",},
["Centre Party (Nauru)"] = {abbrev = "", color = "#FFC718", shortname = "",},
["Centre Party (Netherlands)"] = {abbrev = "CP", color = "red", shortname = "",},
["Centre Party (Norway)"] = {abbrev = "", color = "#00843D", shortname = "Centre",},
["Centre Party (Rhodesia)"] = {abbrev = "", color = "#0088ff", shortname = "Centre Party",},
["Centre Party (Sweden)"] = {abbrev = "C", color = "#124838", shortname = "Centre",},
["Centre Party (Sweden, 1873)"] = {abbrev = "", color = "#6BB7EC", shortname = "Centre",},
["Centre Party (Tasmania)"] = {abbrev = "", color = "#3E933E", shortname = "Centre",},
["Centre Party (Turkey)"] = {abbrev = "", color = "#12A19A", shortname = "Centre",},
["Centre Party of Ireland"] = {abbrev = "Cen", color = "#0000A5", shortname = "Centre Party",},
["Centre Republican Party"] = {abbrev = "", color = "#00984B", shortname = "",},
["Centre through Action for Progress"] = {abbrev = "CAP", color = "#0EF70E", shortname = "",},
["Centre Union"] = {abbrev = "ΕΚ", color = "#FCB825", shortname = "",},
["Centre Union for Terrassa"] = {abbrev = "", color = "#C7DB08", shortname = "",},
["Centre Unity"] = {abbrev = "", color = "#881A2D", shortname = "",},
["Centre-left coalition (Italy)"] = {abbrev = "", color = "#EF3E3E", shortname = "Centre-left",},
["Centre-Left of Albacete"] = {abbrev = "", color = "#F4644A", shortname = "",},
["Centre-left politics"] = {abbrev = "", color = "#464646", shortname = "Centre-left",},
["Centre-right coalition (Italy)"] = {abbrev = "", color = "#0A6BE1", shortname = "Centre-right",},
["Centre-right politics"] = {abbrev = "", color = "#ADC1FD", shortname = "Centre-right",},
["Centrem"] = {abbrev = "", color = "#0B5663", shortname = "",},
["Centrism (Italy)"] = {abbrev = "", color = "lightblue", shortname = "Centrismo",},
["Centrist Alliance"] = {abbrev = "AC", color = "#473B84", shortname = "",},
["Centrist Convergence–Democratic and Social Centre"] = {abbrev = "", color = "#FF9900", shortname = "",},
["Centrist Democratic Party (Rwanda)"] = {abbrev = "", color = "#F0E68C", shortname = "",},
["Centrist Democratic Party of the Philippines"] = {abbrev = "CDP", color = "#0067B4", shortname = "",},
["Centrist Party (Spain)"] = {abbrev = "", color = "#08D152", shortname = "",},
["Centrist Party (US)"] = {abbrev = "", color = "#3333FF", shortname = "",},
["Centrist Republican Stable Movement"] = {abbrev = "MECR", color = "purple", shortname = "",},
["Centrist Union group"] = {abbrev = "UC", color = "#0073c3", shortname = "",},
["Centrist Union of Moldova"] = {abbrev = "", color = "#062A78", shortname = "",},
["Centrists for Europe"] = {abbrev = "", color = "#A6DBEC", shortname = "",},
["Centrists of Galicia"] = {abbrev = "", color = "#0EB2D5", shortname = "",},
["Centrists of the Valencian Community"] = {abbrev = "", color = "#39B639", shortname = "",},
["Centrolew"] = {abbrev = "", color = "#BC235B", shortname = "",},
["Centrum"] = {abbrev = "", color = "#5F9F3F", shortname = "",},
["Cerna (political organization)"] = {abbrev = "", color = "#00A3E0", shortname = "",},
["Ceuta Ya!"] = {abbrev = "", color = "#F6CC46", shortname = "",},
["Ceutan Democratic Union"] = {abbrev = "", color = "#AD2916", shortname = "",},
["Ceutan Party"] = {abbrev = "", color = "#2F4378", shortname = "",},
["Ceylon Communist Party (Maoist)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Ceylon Labour Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Ceylon Workers' Congress"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Chadema"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Chadian Action for Unity and Socialism"] = {abbrev = "", color = "red", shortname = "",},
["Chadian Progressive Party"] = {abbrev = "", color = "#2D2A3B", shortname = "",},
["Chadian Social Action"] = {abbrev = "", color = "#F08080", shortname = "",},
["Chaldean Syriac Assyrian Popular Council"] = {abbrev = "", color = "saddlebrown", shortname = "",},
["Chama Cha Kijamii"] = {abbrev = "", color = "navy", shortname = "",},
["Chama Cha Mapinduzi"] = {abbrev = "CCM", color = "#228B22", shortname = "",},
["Chama Cha Mashinani"] = {abbrev = "", color = "#ffff00", shortname = "",},
["Chama cha Ukombozi wa Umma"] = {abbrev = "", color = "red", shortname = "",},
["Chama Cha Uzalendo"] = {abbrev = "", color = "#51B757", shortname = "",},
["Chance (Moldova)"] = {abbrev = "", color = "#FF412C", shortname = "Chance",},
["Chance. Duties. Realization."] = {abbrev = "ȘOR", color = "#4CA355", shortname = "",},
["Change 2011"] = {abbrev = "M11", color = "#01414D", shortname = "",},
["Change It (Spain)"] = {abbrev = "", color = "#739C29", shortname = "",},
["Change Party (Thailand)"] = {abbrev = "", color = "#BD1F2E", shortname = "Change",},
["Chart Pattana Kla Party"] = {abbrev = "", color = "#FF4919", shortname = "Chart Pattana Kla",},
["Chart Pattana Party (2007)"] = {abbrev = "", color = "#F69520", shortname = "",},
["Chart Pattana Party"] = {abbrev = "", color = "#fe980d", shortname = "",},
["Charter Party"] = {abbrev = "", color = "#C0C0C0", shortname = "Charter",},
["Chartism"] = {abbrev = "", color = "#FF3333", shortname = "Chartist",},
["Chartthaipattana Party"] = {abbrev = "", color = "#E20884", shortname = "Chart Thai Pattana",},
["Chase Community Independents Group"] = {abbrev = "", color = "#065E5E", shortname = "Chase Indies",},
["Chat Rung Rueang Party"] = {abbrev = "", color = "#E7B138", shortname = "",},
["Chehabist"] = {abbrev = "", color = "#808080", shortname = "",},
["Chega (political party)"] = {abbrev = "", color = "#222256", shortname = "CHEGA",},
["Cheung Sha Wan Community Establishment Power"] = {abbrev = "CSWCEP", color = "#F48326", shortname = "",},
["Chez Nous (Belgian political party)"] = {abbrev = "", color = "#002D61", shortname = "Chez Nous",},
["Cheung Sha Wan West Front"] = {abbrev = "CSWWF", color = "#53bfa7", shortname = "",},
["Chile Digno"] = {abbrev = "", color = "#EE113A", shortname = "",},
["Chile Podemos Más"] = {abbrev = "", color = "#ffd700", shortname = "",},
["Chile Vamos"] = {abbrev = "", color = "#006BB0", shortname = "",},
["Chilean Renovating Action"] = {abbrev = "", color = "black", shortname = "",},
["Chilean Social Democracy Party"] = {abbrev = "", color = "#FF6347", shortname = "",},
["Chilean Socialist Party"] = {abbrev = "", color = "#ED1624", shortname = "",},
["ChileFirst"] = {abbrev = "", color = "#D1FF00", shortname = "",},
["Chin National League for Democracy"] = {abbrev = "CNLD", color = "#01AEF2", shortname = "",},
["Chin National Party"] = {abbrev = "CNP", color = "#006600", shortname = "",},
["Chin Progressive Party"] = {abbrev = "CPP", color = "#FFFFFF", shortname = "",},
["China Association for Promoting Democracy"] = {abbrev = "CAPD", color = "#FFF500", shortname = "",},
["China Democratic League"] = {abbrev = "CDL", color = "#cb7e1f", shortname = "",},
["China Democratic Socialist Party"] = {abbrev = "CDSP", color = "#008000", shortname = "Democratic Socialist",},
["China National Democratic Construction Association"] = {abbrev = "CNDCA", color = "Orangered", shortname = "",},
["China Youth Service & Recreation Centre"] = {abbrev = "CYSRC", color = "#4ED052", shortname = "",},
["China Zhi Gong Party"] = {abbrev = "CZGP", color = "Red", shortname = "",},
["Chinbak Yeondae"] = {abbrev = "", color = "#0a50a1", shortname = "",},
["Chinese Communist Party"] = {abbrev = "CCP", color = "#DD0000", shortname = "Communist",},
["Chinese Empire Reform Association"] = {abbrev = "CERA", color = "navy", shortname = "",},
["Chinese Peasants' and Workers' Democratic Party"] = {abbrev = "CPWDP", color = "#189df0", shortname = "",},
["Chinese People's Party"] = {abbrev = "", color = "green", shortname = "",},
["Chinese Production Party"] = {abbrev = "", color = "#21358F", shortname = "",},
["Chinese Social Democratic Party"] = {abbrev = "CSDP", color = "#FFD900", shortname = "",},
["Chinese Unification Promotion Party"] = {abbrev = "", color = "#253686", shortname = "",},
["Ching Fat Living Concern Group"] = {abbrev = "CFLCG", color = "#10791D", shortname = "",},
["Chipani cha Pfuko"] = {abbrev = "CCP", color = "#9F622B", shortname = "",},
["Choi Hung Estate Social Service Association"] = {abbrev = "CHESSA", color = "#468CA8", shortname = "",},
["Choice of Russia (electoral bloc)"] = {abbrev = "VR", color = "#29166F", shortname = "",},
["Chondoist Chongu Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Christchurch 2021"] = {abbrev = "", color = "#AB0616", shortname = "",},
["Christchurch Independents"] = {abbrev = "CI", color = "#999999", shortname = "",},
["Christen-Democratisch en Vlaams"] = {abbrev = "CD&V", color = "#FF6200", shortname = "",},
["Christene Volkspartij"] = {abbrev = "CVP", color = "#FFA500", shortname = "",},
["Christian and Democratic Union"] = {abbrev = "KDU", color = "#FFCB03", shortname = "",},
["Christian Centre"] = {abbrev = "", color = "#00BFFF", shortname = "",},
["Christian Centrist Party"] = {abbrev = "", color = "#8032CC", shortname = "Christian Centrist",},
["Christian Citizens"] = {abbrev = "", color = "darkblue", shortname = "",},
["Christian Coalition (New Zealand)"] = {abbrev = "", color = "#878FB8", shortname = "Christian Coalition",},
["Christian Conservative Party (Chile)"] = {abbrev = "", color = "#000080", shortname = "",},
["Christian Conservative Party"] = {abbrev = "", color = "yellow", shortname = "",},
["Christian Conservative Social Union"] = {abbrev = "", color = "#332F83", shortname = "",},
["Christian Democracy (Brazil)"] = {abbrev = "DC", color = "#015F9D", shortname = "",},
["Christian Democracy (Greece)"] = {abbrev = "ChD", color = "#013220", shortname = "",},
["Christian Democracy (Italy, 2002)"] = {abbrev = "DC", color = "#1560BD", shortname = "Christian Democracy",},
["Christian Democracy (Italy)"] = {abbrev = "DC", color = "#87CEFA", shortname = "",},
["Christian Democracy (Poland)"] = {abbrev = "ChD", color = "#5C3FB5", shortname = "",},
["Christian Democracy Federation–Christian Democracy Team"] = {abbrev = "", color = "#E94E1B", shortname = "",},
["Christian Democracy for the Autonomies"] = {abbrev = "", color = "#ADD8E6", shortname = "Christian Democracy",},
["Christian Democrat Party (New Zealand)"] = {abbrev = "", color = "#800080", shortname = "Christian Democrats",},
["Christian Democrat Party (Peru)"] = {abbrev = "", color = "#00008B", shortname = "",},
["Christian Democratic Alliance (Costa Rica)"] = {abbrev = "ADC", color = "#483D8B", shortname = "",},
["Christian Democratic Alliance (Fiji)"] = {abbrev = "VLV", color = "orange", shortname = "",},
["Christian Democratic Alliance (South Africa)"] = {abbrev = "", color = "#300064", shortname = "Christian Democratic Alliance",},
["Christian Democratic Appeal (2021)"] = {abbrev = "", color = "#2CC84D", shortname = "",},
["Christian Democratic Appeal"] = {abbrev = "CDA", color = "#007C5E", shortname = "",},
["Christian Democratic Centre"] = {abbrev = "CCD", color = "#A6DBEC", shortname = "",},
["Christian Democratic Front"] = {abbrev = "", color = "orange", shortname = "",},
["Christian Democratic Movement (2021)"] = {abbrev = "KDH", color = "#173a70", shortname = "",},
["Christian Democratic Movement"] = {abbrev = "KDH", color = "#FFE17D", shortname = "",},
["Christian Democratic Movement (Montenegro)"] = {abbrev = "DP", color = "#0172BB", shortname = "",},
["Christian Democratic National Peasants' Party"] = {abbrev = "PNȚCD", color = "#004A92", shortname = "",},
["Christian Democratic Party (Argentina)"] = {abbrev = "PDC", color = "#00008B", shortname = "Christian Democratic Party",},
["Christian Democratic Party (Australia)"] = {abbrev = "", color = "#7F007F", shortname = "Christian Democrats",},
["Christian Democratic Party (Belgium)"] = {abbrev = "CDP", color = "#FFA500", shortname = "",},
["Christian Democratic Party (Belize)"] = {abbrev = "CDP", color = "#FF7F00", shortname = "",},
["Christian Democratic Party (Bolivia)"] = {abbrev = "PDC", color = "#016167", shortname = "",},
["Christian Democratic Party (Brazil)"] = {abbrev = "PDC", color = "#FF7700", shortname = "",},
["Christian Democratic Party (Chile)"] = {abbrev = "PDC", color = "#0061A7", shortname = "",},
["Christian Democratic Party (Costa Rica)"] = {abbrev = "PDC", color = "#CC1B56", shortname = "",},
["Christian Democratic Party (Democratic Republic of the Congo)"] = {abbrev = "", color = "orange", shortname = "Christian Democratic Party",},
["Christian Democratic Party (East Timor)"] = {abbrev = "", color = "#3F5EBE", shortname = "Christian Democratic Party",},
["Christian Democratic Party (El Salvador)"] = {abbrev = "PDC", color = "#00732E", shortname = "",},
["Christian Democratic Party (Norway)"] = {abbrev = "", color = "#ffd959", shortname = "Christian Democratic",},
["Christian Democratic Party (Papua New Guinea)"] = {abbrev = "CDP", color = "#FF0000", shortname = "Christian Democratic Party",},
["Christian Democratic Party (Paraguay)"] = {abbrev = "", color = "#11a018", shortname = "Christian Democratic Party",},
["Christian Democratic Party (Samoa)"] = {abbrev = "CDP", color = "#FF00FF", shortname = "Christian Democratic Party",},
["Christian Democratic Party (South Africa)"] = {abbrev = "", color = "#662D91", shortname = "Christian Democratic Party",},
["Christian Democratic Party (Spain)"] = {abbrev = "", color = "#068B1C", shortname = "Christian Democratic Party",},
["Christian Democratic Party of Albania"] = {abbrev = "PKDSH", color = "#0080FF", shortname = "",},
["Christian Democratic Party of Cuba"] = {abbrev = "", color = "#3EB489", shortname = "Christian Democratic Party",},
["Christian Democratic Party of Honduras"] = {abbrev = "CD", color = "#11992B", shortname = "",},
["Christian Democratic Party of Russia"] = {abbrev = "", color = "#9999FF", shortname = "Christian Democratic Party",},
["Christian Democratic Party of Serbia"] = {abbrev = "DHSS", color = "#964B00", shortname = "",},
["Christian Democratic Party of Ukraine"] = {abbrev = "CDPU", color = "#222629", shortname = "",},
["Christian Democratic Party of Uruguay"] = {abbrev = "PDCU", color = "#FFA500", shortname = "",},
["Christian Democratic People's Party (Hungary)"] = {abbrev = "KDNP", color = "#938862", shortname = "",},
["Christian Democratic People's Party of Switzerland"] = {abbrev = "", color = "#EF7D00", shortname = "Christian Democrats",},
["Christian Democratic Union (Bolivia)"] = {abbrev = "CDU", color = "#0047AB", shortname = "",},
["Christian Democratic Union (Dominican Republic)"] = {abbrev = "", color = "#ffd300", shortname = "",},
["Christian Democratic Union (East Germany)"] = {abbrev = "CDU", color = "#237CDB", shortname = "",},
["Christian Democratic Union (Ecuador)"] = {abbrev = "", color = "#008F4C", shortname = "",},
["Christian Democratic Union (Latvia)"] = {abbrev = "", color = "#F3AE12", shortname = "",},
["Christian Democratic Union (Lithuania)"] = {abbrev = "KDS", color = "#5DA782", shortname = "",},
["Christian Democratic Union (Netherlands)"] = {abbrev = "CDU", color = "#E50066", shortname = "",},
["Christian Democratic Union (Ukraine)"] = {abbrev = "CDU", color = "#F39518", shortname = "",},
["Christian Democratic Union of Timor"] = {abbrev = "UDC", color = "#2FAAD6", shortname = "",},
["Christian Democratic Union of Germany"] = {abbrev = "CDU", color = "#151518", shortname = "",},
["Christian Democratic Union of Germany (2023)"] = {abbrev = "CDU", color = "#51B8C2", shortname = "",},
["Christian Democratic Voice"] = {abbrev = "CDV", color = "#24B87A", shortname = "",},
["Christian Democrats (Denmark)"] = {abbrev = "", color = "#53619B", shortname = "Christian Democrats",},
["Christian Democrats (Denmark, 2022)"] = {abbrev = "", color = "#53619B", shortname = "Christian Democrats",},
["Christian Democrats (Finland)"] = {abbrev = "KD", color = "#2B67C9", shortname = "",},
["Christian Democrats (Sweden)"] = {abbrev = "KD", color = "#005EA1", shortname = "Christian Democrats",},
["Christian Economic and Social Party"] = {abbrev = "KGSZP", color = "#006447", shortname = "",},
["Christian Flemish People's Union"] = {abbrev = "CVV", color = "black", shortname = "",},
["Christian Heritage Party of Canada"] = {abbrev = "", color = "#800020", shortname = "Christian Heritage",},
["Christian Heritage Party of New Zealand"] = {abbrev = "", color = "#878FB8", shortname = "Christian Heritage",},
["Christian Historical Party"] = {abbrev = "CHP", color = "#008080", shortname = "",},
["Christian Historical Union"] = {abbrev = "CHU", color = "#006F70", shortname = "",},
["Christian Independent Alliance"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Christian Labour Party"] = {abbrev = "PTC", color = "#009966", shortname = "",},
["Christian Liberty Unification Party"] = {abbrev = "", color = "#0095DA", shortname = "",},
["Christian Movement for a New Haiti"] = {abbrev = "", color = "#00923F", shortname = "",},
["Christian National Alliance Party"] = {abbrev = "PANC", color = "saddlebrown", shortname = "",},
["Christian National Party (Chile)"] = {abbrev = "", color = "turquoise", shortname = "",},
["Christian National Party (Hungary)"] = {abbrev = "KNP", color = "#6091ba", shortname = "",},
["Christian National Union for the Reconstruction of Haiti"] = {abbrev = "UNCRH", color = "#FFFF00", shortname = "",},
["Christian National Union Party"] = {abbrev = "KNEP", color = "#43884A", shortname = "",},
["Christian National Union"] = {abbrev = "", color = "#007FFF", shortname = "",},
["Christian Party (Samoa)"] = {abbrev = "SCP", color = "#FFFFDD", shortname = "",},
["Christian Party (UK)"] = {abbrev = "", color = "#9966CC", shortname = "Christian",},
["Christian Party of Austria"] = {abbrev = "", color = "#FAD41B", shortname = "Christian Party",},
["Christian People's Alliance"] = {abbrev = "", color = "#FF00FF", shortname = "",},
["Christian People's Party (Belgium)"] = {abbrev = "CVP", color = "#EEAA00", shortname = "",},
["Christian People's Party (Dominican Republic)"] = {abbrev = "", color = "#ff7900", shortname = "",},
["Christian People's Party (Estonia)"] = {abbrev = "KRE", color = "#000000", shortname = "",},
["Christian People's Party (Faroe Islands)"] = {abbrev = "", color = "#FF6600", shortname = "Christian People's",},
["Christian People's Party (Germany)"] = {abbrev = "CVP", color = "#8DCEE7", shortname = "",},
["Christian People's Party (Peru)"] = {abbrev = "", color = "#14953B", shortname = "",},
["Christian Peoples Alliance"] = {abbrev = "CPA", color = "#813887", shortname = "",},
["Christian Political Movement"] = {abbrev = "", color = "#E8AE0B", shortname = "",},
["Christian Positivist Party (Spain)"] = {abbrev = "", color = "#8B898B", shortname = "",},
["Christian Principles Party"] = {abbrev = "", color = "#8032CC", shortname = "Christian Principles",},
["Christian Social Democratic Party"] = {abbrev = "PSDC", color = "#7797E0", shortname = "",},
["Christian Social Front"] = {abbrev = "", color = "#2A58A6", shortname = "",},
["Christian Social Party (Austria)"] = {abbrev = "CS", color = "#000000", shortname = "",},
["Christian Social Party (Belgium, 1945)"] = {abbrev = "", color = "orange", shortname = "Christian Social",},
["Christian Social Party (Belgium)"] = {abbrev = "", color = "#FFCC99", shortname = "",},
["Christian Social Party (Chile)"] = {abbrev = "", color = "#26348D", shortname = "",},
["Christian Social Party (German-speaking Community)"] = {abbrev = "CSP", color = "orange", shortname = "",},
["Christian Social Party (Germany)"] = {abbrev = "", color = "#008080", shortname = "",},
["Christian Social Party (Liechtenstein)"] = {abbrev = "", color = "#80FFFF", shortname = "",},
["Christian Social Party (Netherlands)"] = {abbrev = "", color = "#D2691E", shortname = "",},
["Christian Social Party (Switzerland)"] = {abbrev = "", color = "#0F95A7", shortname = "Christian Social",},
["Christian Social Party of Obwalden"] = {abbrev = "", color = "#BF3235", shortname = "CSP Obwalden",},
["Christian Social People's Party"] = {abbrev = "CSV", color = "#FFC300", shortname = "",},
["Christian Social People's Service"] = {abbrev = "", color = "#1DB4E1", shortname = "",},
["Christian Social Rally of Liberty"] = {abbrev = "RSCL", color = "#FF4500", shortname = "",},
["Christian Social Union in Bavaria"] = {abbrev = "CSU", color = "#008AC5", shortname = "",},
["Christian Solidarity Party"] = {abbrev = "", color = "#FFFF99", shortname = "Christian Solidarity",},
["Christian Spanish Party"] = {abbrev = "", color = "#AAAAFF", shortname = "",},
["Christian Union – Reformed Political Party"] = {abbrev = "CU–SGP", color = "#00a7eb", shortname = "",},
["Christian Union (Lithuania)"] = {abbrev = "", color = "#445C64", shortname = "",},
["Christian Union (Netherlands)"] = {abbrev = "CU", color = "#00A7EB", shortname = "",},
["Christian Union (Slovakia)"] = {abbrev = "KÚ", color = "#04B2E8", shortname = "",},
["Christian Union Movement"] = {abbrev = "", color = "#6ca860", shortname = "",},
["Christian Union of National Unity"] = {abbrev = "ChZJN", color = "#2B3F3D", shortname = "",},
["Christian Unity Party"] = {abbrev = "", color = "#143d8d", shortname = "",},
["Christian Workers' Alliance"] = {abbrev = "", color = "#8B0000", shortname = "Christian Workers",},
["Christian Workers' Union of Finland"] = {abbrev = "SKrTL", color = "#FF5050", shortname = "",},
["Christian-Democratic Movement (Georgia)"] = {abbrev = "KDM", color = "#881532", shortname = "",},
["Christian-Democratic People's Party (Moldova)"] = {abbrev = "PPCD", color = "#8D8E56", shortname = "",},
["Christian-National Peasants' and Farmers' Party"] = {abbrev = "CNBL", color = "#7FCEB1", shortname = "",},
["Christian-Social People's Party (Liechtenstein)"] = {abbrev = "CSVP", color = "red", shortname = "",},
["Christians Against Abortion"] = {abbrev = "", color = "#000080", shortname = "",},
["Christians to the World"] = {abbrev = "", color = "#F2EA35", shortname = "",},
["Christlich Soziale Partei (Belgium)"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Chubut Action Party"] = {abbrev = "", color = "#0A1172", shortname = "",},
["Chubut Somos Todos"] = {abbrev = "", color = "#008E6F", shortname = "",},
["Chunta Aragonesista"] = {abbrev = "CHA", color = "#008A21", shortname = "",},
["Chuquisaca We Are All"] = {abbrev = "", color = "#ED8603", shortname = "",},
["Church of the Militant Elvis Party"] = {abbrev = "", color = "#FF00FF", shortname = "Church of the Militant Elvis",},
["Chure Bhawar Rastriya Ekta Party Nepal"] = {abbrev = "", color = "#F0FFF0", shortname = "Churebhawar Rastriya Ekta Party",},
["Cidadania"] = {abbrev = "", color = "#EC008C", shortname = "",},
["Ciervists"] = {abbrev = "", color = "#314F9D", shortname = "",},
["Circle of Liberal Reformers"] = {abbrev = "CLR", color = "#FE492E", shortname = "",},
["Circle of Rhine Party"] = {abbrev = "", color = "#4287f5", shortname = "",},
["Ciskei National Independence Party"] = {abbrev = "CNIP", color = "#0070BB", shortname = "",},
["Citizen Action of Ferrol"] = {abbrev = "", color = "#D9017A", shortname = "",},
["Citizen Alternative of Ponteareas"] = {abbrev = "", color = "#005747", shortname = "",},
["Citizen Alternative of Rubí"] = {abbrev = "", color = "#97C00E", shortname = "",},
["Citizen and Republican Movement"] = {abbrev = "MRC", color = "#DD391F", shortname = "",},
["Citizen Association Jesús Lara"] = {abbrev = "", color = "#F9CC67", shortname = "",},
["Citizen Convergence Movement"] = {abbrev = "", color = "#37960F", shortname = "",},
["Citizen Force"] = {abbrev = "", color = "#F5A23E", shortname = "",},
["Citizen Force (Colombia)"] = {abbrev = "", color = "#FA6709", shortname = "",},
["Citizen Force (Peru)"] = {abbrev = "FC", color = "#E30B5C", shortname = "",},
["Citizen Forum (Spain)"] = {abbrev = "", color = "#1E90FF", shortname = "",},
["Citizen Forum of Cáceres"] = {abbrev = "", color = "#7EBA00", shortname = "",},
["Citizen Forum of Jerez"] = {abbrev = "", color = "#005AD6", shortname = "",},
["Citizen Hope (Spain)"] = {abbrev = "", color = "#F89430", shortname = "",},
["Citizen Initiative for Development"] = {abbrev = "", color = "#102547", shortname = "",},
["Citizen Initiative for Paracuellos"] = {abbrev = "", color = "#94C11F", shortname = "",},
["Citizen Initiative of Puertollano"] = {abbrev = "", color = "#FE6400", shortname = "",},
["Citizen Left"] = {abbrev = "", color = "#BB98C7", shortname = "",},
["Citizen Movement of Soria"] = {abbrev = "", color = "#EC9F42", shortname = "",},
["Citizen Open Platform of Lalín"] = {abbrev = "", color = "#999999", shortname = "",},
["Citizen Option for Macedonia"] = {abbrev = "GROM", color = "#00FFF7", shortname = "",},
["Citizen Option"] = {abbrev = "OC", color = "#FED403", shortname = "",},
["Citizen Party"] = {abbrev = "", color = "#707070", shortname = "Citizen",},
["Citizen Platform for Sabadell"] = {abbrev = "", color = "#CD3037", shortname = "",},
["Citizen Power (political party)"] = {abbrev = "", color = "#412560", shortname = "Citizen Power",},
["Citizen Prosperity"] = {abbrev = "PC", color = "#FFDC2A", shortname = "",},
["Citizen Revolution"] = {abbrev = "RC", color = "#00B0F6", shortname = "",},
["Citizen Revolution Movement"] = {abbrev = "RC", color = "#00AEEF", shortname = "",},
["Citizen Unity"] = {abbrev = "", color = "#CCE35F", shortname = "",},
["Citizen's Coalition for Justice Party (Mongolia)"] = {abbrev = "", color = "#f26022", shortname = "",},
["Citizen's Decision"] = {abbrev = "", color = "#82bb29", shortname = "",},
["Citizen's Unity"] = {abbrev = "", color = "#009CDE", shortname = "",},
["Citizens (Chilean political party)"] = {abbrev = "", color = "#db8f16", shortname = "Citizens",},
["Citizens (Georgia)"] = {abbrev = "", color = "#8BC43F", shortname = "Citizens",},
["Citizens (Spanish political party)"] = {abbrev = "Cs", color = "#EB6109", shortname = "",},
["Citizens & Ratepayers"] = {abbrev = "", color = "#00529F", shortname = "",},
["Citizens Coalition for Change"] = {abbrev = "CCC", color = "#FAE64D", shortname = "",},
["Citizens for Arona"] = {abbrev = "", color = "#77777B", shortname = "",},
["Citizens for Benidorm"] = {abbrev = "", color = "#855794", shortname = "",},
["Citizens for Blank Votes"] = {abbrev = "", color = "#969696", shortname = "",},
["Citizens for Cádiz"] = {abbrev = "", color = "#5E89AA", shortname = "",},
["Citizens for Canarian Change"] = {abbrev = "", color = "#1A3F98", shortname = "",},
["Citizens for Change"] = {abbrev = "", color = "#FF2F00", shortname = "",},
["Citizens for Ciempozuelos"] = {abbrev = "", color = "#2A277E", shortname = "",},
["Citizens for San Fernando"] = {abbrev = "", color = "#000B6F", shortname = "",},
["Citizens for their People"] = {abbrev = "", color = "#046305", shortname = "",},
["Citizens in Rage"] = {abbrev = "", color = "#0000AA", shortname = "",},
["Citizens of Alcalá de Guadaíra"] = {abbrev = "", color = "#23BEDC", shortname = "",},
["Citizens of Burgos"] = {abbrev = "", color = "#CA2D29", shortname = "",},
["Citizens of Democratic Centre–Independent Candidacy"] = {abbrev = "", color = "#F67A32", shortname = "",},
["Citizens of Galicia Democratic Action"] = {abbrev = "", color = "#63A6C6", shortname = "",},
["Citizens of Galicia"] = {abbrev = "", color = "#0BB70B", shortname = "",},
["Citizens of Logroño"] = {abbrev = "", color = "#E88005", shortname = "",},
["Citizens of Lorca"] = {abbrev = "", color = "#0D086E", shortname = "",},
["Citizens of Menorca"] = {abbrev = "", color = "#FA8100", shortname = "",},
["Citizens of Santa Cruz"] = {abbrev = "", color = "#0194E4", shortname = "",},
["Citizens Party (Hong Kong)"] = {abbrev = "", color = "#000000", shortname = "Citizens",},
["Citizens Party (US)"] = {abbrev = "", color = "#00FF90", shortname = "Citizens",},
["Citizens, Inhabitants and People of Marbella"] = {abbrev = "", color = "#FF9D21", shortname = "",},
["Citizens' Action for Málaga"] = {abbrev = "", color = "#A94699", shortname = "",},
["Citizens' Action Party (Costa Rica)"] = {abbrev = "PAC", color = "#FFD700", shortname = "",},
["Citizens' Action Party"] = {abbrev = "", color = "#FFE902", shortname = "",},
["Citizens' Alliance (Cyprus)"] = {abbrev = "SYPOL", color = "#9AB973", shortname = "",},
["Citizens' Assembly for Torrelavega"] = {abbrev = "", color = "#2F6623", shortname = "",},
["Citizens' Battle Against Corruption"] = {abbrev = "CIBAC", color = "#FDCD01", shortname = "",},
["Citizens' Coalition"] = {abbrev = "MED", color = "#506d28", shortname = "",},
["Citizens' Compromise"] = {abbrev = "", color = "#A0BE00", shortname = "",},
["Citizens' Convergence of the South-East"] = {abbrev = "", color = "#0824AD", shortname = "",},
["Citizens' Democratic Renewal Movement"] = {abbrev = "", color = "#6B2484", shortname = "",},
["Citizens' Forces"] = {abbrev = "", color = "#4C4B51", shortname = "",},
["Citizens' Forum Austria"] = {abbrev = "FRITZ", color = "#E43226", shortname = "",},
["Citizens' Initiative (Andorra)"] = {abbrev = "IC", color = "#390037", shortname = "",},
["Citizens' List"] = {abbrev = "", color = "darkgray", shortname = "",},
["Citizens' Movement (Iceland)"] = {abbrev = "", color = "#FF8C00", shortname = "",},
["Citizens' Movement (Mexico)"] = {abbrev = "MC", color = "#FF8C00", shortname = "",},
["Citizens' Movement of Cartagena"] = {abbrev = "", color = "#87305B", shortname = "",},
["Citizens' Party (Finland)"] = {abbrev = "KP", color = "#2354A8", shortname = "Citizens' Party",},
["Citizens' Party (Iceland, 1923)"] = {abbrev = "", color = "#0026FF", shortname = "Citizens'",},
["Citizens' Party (Iceland, 1987)"] = {abbrev = "", color = "#000000", shortname = "Citizens'",},
["Citizens' Party for Revival"] = {abbrev = "", color = "yellow", shortname = "",},
["Citizens' Radio"] = {abbrev = "", color = "#ff7e22", shortname = "",},
["Citizens' Rights Association"] = {abbrev = "ADDC", color = "#FFC0CB", shortname = "",},
["Citizens' Union–Independent Progressives of Canaries"] = {abbrev = "", color = "#181C21", shortname = "",},
["City Fusion Party"] = {abbrev = "", color = "#CF9FFF", shortname = "City Fusion",},
["City Independents"] = {abbrev = "", color = "#FFC0CB", shortname = "",},
["City Vision (Auckland political ticket)"] = {abbrev = "", color = "#B3FFB3", shortname = "City Vision",},
["CiU Space"] = {abbrev = "", color = "#2849C8", shortname = "",},
["Ciutadella de Menorca People's Union"] = {abbrev = "", color = "#CA6601", shortname = "",},
["Cives"] = {abbrev = "", color = "#729E2A", shortname = "",},
["Civic 10"] = {abbrev = "", color = "#4BD9FD", shortname = "",},
["Civic Act-up"] = {abbrev = "", color = "#000000", shortname = "",},
["Civic Alliance of Serbia"] = {abbrev = "GSS", color = "orange", shortname = "",},
["Civic and Social Agreement"] = {abbrev = "", color = "#005599", shortname = "",},
["Civic and Social Front of Catamarca"] = {abbrev = "FCSC", color = "#009241", shortname = "",},
["Civic Autonomy Power"] = {abbrev = "CAP", color = "#6CC6CF", shortname = "",},
["Civic Choice"] = {abbrev = "", color = "#1560BD", shortname = "",},
["Civic Coalition (Poland)"] = {abbrev = "KO", color = "#F68F2D", shortname = "",},
["Civic Coalition ARI"] = {abbrev = "CC-ARI", color = "#6fb53e", shortname = "",},
["Civic Coalition"] = {abbrev = "", color = "#008080", shortname = "",},
["Civic Commitment"] = {abbrev = "", color = "#1E889D", shortname = "",},
["Civic Community"] = {abbrev = "", color = "#F26524", shortname = "",},
["Civic Conservative Party (Slovakia)"] = {abbrev = "OKS", color = "#A00000", shortname = "",},
["Civic Conservative Party"] = {abbrev = "", color = "#990000", shortname = "",},
["Civic Democratic Alliance"] = {abbrev = "ODA", color = "#0000FF", shortname = "",},
["Civic Democratic Forum"] = {abbrev = "GDF", color = "#272361", shortname = "",},
["Civic Democratic Party (Bosnia and Herzegovina)"] = {abbrev = "GDS", color = "#ffdf00", shortname = "",},
["Civic Democratic Party (Czech Republic)"] = {abbrev = "ODS", color = "#034EA2", shortname = "",},
["Civic Democratic Party (Hungary)"] = {abbrev = "", color = "#96825A", shortname = "Civic Democratic",},
["Civic Democratic Party (Lithuania)"] = {abbrev = "PDP", color = "#023366", shortname = "",},
["Civic Democratic Union (Slovakia)"] = {abbrev = "", color = "#553D73", shortname = "",},
["Civic Force"] = {abbrev = "", color = "#3183CD", shortname = "",},
["Civic Forum (Central African Republic)"] = {abbrev = "", color = "#008080", shortname = "",},
["Civic Forum"] = {abbrev = "OF", color = "#386bA5", shortname = "",},
["Civic Freedom Party"] = {abbrev = "", color = "yellow", shortname = "Civic Freedom",},
["Civic Front (Córdoba)"] = {abbrev = "", color = "#FF6600", shortname = "",},
["Civic Front for Santiago"] = {abbrev = "", color = "#FF0080", shortname = "",},
["Civic Initiative of Gora"] = {abbrev = "", color = "#82D1F7", shortname = "",},
["Civic Initiative"] = {abbrev = "", color = "#1B3E89", shortname = "",},
["Civic League"] = {abbrev = "", color = "#B8BFFE", shortname = "",},
["Civic Liberal Alliance"] = {abbrev = "", color = "#067CBF", shortname = "",},
["Civic List (Slovenia)"] = {abbrev = "", color = "#0067A5", shortname = "",},
["Civic Movement"] = {abbrev = "OH", color = "#423F83", shortname = "",},
["Civic Party of Kazakhstan"] = {abbrev = "", color = "#2f2f2f", shortname = "",},
["Civic Party of Montenegro"] = {abbrev = "GPCG", color = "#2554C7", shortname = "",},
["Civic Party"] = {abbrev = "", color = "#7F3F98", shortname = "Civic",},
["Civic Passion–Proletariat Political Institute–Hong Kong Resurgence Order"] = {abbrev = "CP/PPI/HKRO", color = "#FBDD07", shortname = "",},
["Civic Passion"] = {abbrev = "", color = "#FBDD07", shortname = "",},
["Civic Platform (Russia)"] = {abbrev = "", color = "#420F77", shortname = "Civic Platform",},
["Civic Platform (Serbia)"] = {abbrev = "GP", color = "#002899", shortname = "",},
["Civic Platform"] = {abbrev = "PO", color = "#F68F2D", shortname = "",},
["Civic Renovation Party"] = {abbrev = "", color = "#183b69", shortname = "",},
["Civic Renewal Party"] = {abbrev = "PRC", color = "dodgerblue", shortname = "",},
["Civic Response"] = {abbrev = "PV", color = "#AE413A", shortname = "",},
["Civic Solidarity of Alicante"] = {abbrev = "", color = "#FFF200", shortname = "",},
["Civic Solidarity Party"] = {abbrev = "", color = "#0F88C9", shortname = "Civic Solidarity",},
["Civic Union (Latvia)"] = {abbrev = "", color = "#9e1b34", shortname = "",},
["Civic Union (Russia)"] = {abbrev = "", color = "#F73239", shortname = "Civic Union",},
["Civic Union (Uruguay)"] = {abbrev = "", color = "white", shortname = "Civic Union",},
["Civic Union"] = {abbrev = "", color = "#AB3C20", shortname = "",},
["Civic United Front"] = {abbrev = "CUF", color = "#0293E2", shortname = "",},
["Civic Unity Party (Azerbaijan)"] = {abbrev = "", color = "#F29923", shortname = "",},
["Civics of Italy"] = {abbrev = "CdI", color = "#5683B3", shortname = "",},
["Civil Alliance (Argentina)"] = {abbrev = "", color = "#F69A69", shortname = "Civil Alliance",},
["Civil Contract (Armenia)"] = {abbrev = "", color = "#5169B1", shortname = "Civil Contract",},
["Civil Democratic Alliance"] = {abbrev = "", color = "orange", shortname = "",},
["Civil Force"] = {abbrev = "", color = "#00a754", shortname = "",},
["Civil Liberties Party"] = {abbrev = "", color = "#0038A5", shortname = "",},
["Civil Movement"] = {abbrev = "CM", color = "#80BB3D", shortname = "",},
["Civil Party (Costa Rica)"] = {abbrev = "", color = "#C61318", shortname = "Civil",},
["Civil Party (Taiwan)"] = {abbrev = "", color = "red", shortname = "",},
["Civil Position"] = {abbrev = "", color = "#FFDD00", shortname = "",},
["Civil Response"] = {abbrev = "", color = "#AE413A", shortname = "",},
["Civil Revolution"] = {abbrev = "", color = "#FF6600", shortname = "",},
["Civil Rights Movement"] = {abbrev = "", color = "#000000", shortname = "",},
["Civil Rights Party (South Korea)"] = {abbrev = "CRP", color = "#4CA459", shortname = "Civil Rights",},
["Civil Rule Party"] = {abbrev = "CRP", color = "#FFD700", shortname = "Civil Rule",},
["Civil Society and Democracy"] = {abbrev = "", color = "#94969C", shortname = "",},
["Civil Watch"] = {abbrev = "", color = "#FF007F", shortname = "",},
["Civil Will–Green Party"] = {abbrev = "", color = "#027E40", shortname = "Civil Will-Green",},
["Civilian Power"] = {abbrev = "GS", color = "#00A650", shortname = "",},
["Civilista Party"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Civiqus"] = {abbrev = "", color = "#047235", shortname = "",},
["Civis (Montenegro)"] = {abbrev = "", color = "#D7D501", shortname = "",},
["Clann Éireann"] = {abbrev = "CÉ", color = "#228B22", shortname = "Clann Éireann",},
["Clann na Poblachta"] = {abbrev = "CnaP", color = "#DDFFDD", shortname = "Clann na Poblachta",},
["Clann na Talmhan"] = {abbrev = "CnaT", color = "#BDB76B", shortname = "Clann na Talmhan",},
["CLARO (political party)"] = {abbrev = "", color = "#314A82", shortname = "",},
["Class Action Reform Movement"] = {abbrev = "", color = "#000000", shortname = "CARM",},
["Class War"] = {abbrev = "", color = "Black", shortname = "",},
["Classical Liberal Party (Sweden)"] = {abbrev = "KLP", color = "#FFDF00", shortname = "",},
["Clause 28 Children's Protection Christian Democrats"] = {abbrev = "", color = "#bc8f8f", shortname = "Clause 28",},
["Clean Chile, Vote Happy"] = {abbrev = "", color = "green", shortname = "",},
["Clichy Club"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Climat Québec"] = {abbrev = "", color = "#0E9D0D", shortname = "",},
["Climate Party"] = {abbrev = "", color = "#36D0B6", shortname = "Climate",},
["Clive Palmer's United Australia Party"] = {abbrev = "UAP", color = "#FFED00", shortname = "",},
["Club 2002 – Party for the Unity and the Republic"] = {abbrev = "Club 2002-PUR", color = "#73160F", shortname = "Club 2002",},
["Club of Committed Non-Party Members"] = {abbrev = "KAN", color = "#10547d", shortname = "",},
["Clydesdale and South Scotland Independent"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Co-operative Party"] = {abbrev = "", color = "#3F1D70", shortname = "",},
["Co-operative Resources Centre"] = {abbrev = "CRC", color = "#DD6A45", shortname = "",},
["Coalició Compromís"] = {abbrev = "Compromís", color = "#EC8953", shortname = "",},
["Coalition (Australia)"] = {abbrev = "", color = "#00557C", shortname = "Coalition",},
["Coalition (Chile)"] = {abbrev = "", color = "blue", shortname = "",},
["Coalition Conservative"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Coalition for a New Socialist Party"] = {abbrev = "", color = "#D82E1E", shortname = "",},
["Coalition for a Solidary Europe"] = {abbrev = "", color = "#00309A", shortname = "",},
["Coalition for Cáceres"] = {abbrev = "", color = "#BE1C2B", shortname = "",},
["Coalition for Cayman"] = {abbrev = "C4C", color = "#0c1c47", shortname = "",},
["Coalition for Change"] = {abbrev = "", color = "Steelblue", shortname = "",},
["Coalition for Change (Sierra Leone)"] = {abbrev = "", color = "#FFAB3D", shortname = "",},
["Coalition for Democratic Change"] = {abbrev = "CDC", color = "#183883", shortname = "",},
["Coalition for El Bierzo"] = {abbrev = "", color = "#68A0D6", shortname = "",},
["Coalition for Europe"] = {abbrev = "", color = "#2D0680", shortname = "",},
["Coalition for Gran Canaria"] = {abbrev = "", color = "#0F47AF", shortname = "",},
["Coalition for L'Hospitalet"] = {abbrev = "", color = "#C32C25", shortname = "",},
["Coalition for Melilla"] = {abbrev = "CpM", color = "#298642", shortname = "",},
["Coalition for Peace and Tolerance"] = {abbrev = "KZMT", color = "#5D689C", shortname = "",},
["Coalition for Reform Party"] = {abbrev = "CRP", color = "#3AEB2A", shortname = "",},
["Coalition for Reforms and Democracy"] = {abbrev = "CORD", color = "#F6A438", shortname = "",},
["Coalition for the Balearics"] = {abbrev = "", color = "#692647", shortname = "",},
["Coalition for the Good of All"] = {abbrev = "CBT", color = "#FFCB01", shortname = "",},
["Coalition for Unity and Democracy"] = {abbrev = "", color = "blue", shortname = "",},
["Coalition Labour"] = {abbrev = "", color = "#e0afaf", shortname = "",},
["Coalition Movement"] = {abbrev = "", color = "#00CED1", shortname = "",},
["Coalition National Democratic and Labour Party"] = {abbrev = "", color = "#FFDEAD", shortname = "Coalition National Democratic",},
["Coalition of Democrats (Zimbabwe)"] = {abbrev = "CODE", color = "#ADD8E6", shortname = "",},
["Coalition of Democratic Forces (Kazakhstan)"] = {abbrev = "DKK", color = "#9A6DC0", shortname = "",},
["Coalition of Ethiopian Federalist Forces"] = {abbrev = "", color = "#4398B4", shortname = "",},
["Coalition of Independents"] = {abbrev = "COI", color = "#5ce1e6", shortname = "",},
["Coalition of Islamic Parties"] = {abbrev = "CIP", color = "", shortname = "",},
["Coalition of People's Accord"] = {abbrev = "KNS", color = "#ffe01c", shortname = "",},
["Coalition of Progressive Organizations"] = {abbrev = "", color = "#394184", shortname = "",},
["Coalition of the Left and the Progress"] = {abbrev = "", color = "#FFD000", shortname = "Coalition of the Left (SYN)",},
["Coalition of the Left of Movements and Ecology"] = {abbrev = "", color = "#FFD000", shortname = "Coalition of the Left (SYN)",},
["Coalition of the Pleasant Scent of Servitude"] = {abbrev = "CPSS", color = "blue", shortname = "",},
["Coalition Party (Norway)"] = {abbrev = "", color = "#99EDBD", shortname = "Coalition",},
["Coalition Together"] = {abbrev = "", color = "#1F8C87", shortname = "Together",},
["Coastal Party"] = {abbrev = "", color = "#00ad8e", shortname = "Coastal",},
["Cochinchinese Democratic Party"] = {abbrev = "", color = "#E3FF2A", shortname = "",},
["Code Orange (political party)"] = {abbrev = "", color = "#EF7601", shortname = "Code Orange",},
["Coexistence (political party)"] = {abbrev = "", color = "#32CD32", shortname = "",},
["Colère et espoir"] = {abbrev = "", color = "#BB0000", shortname = "",},
["Collectif Des Inkoruptibles"] = {abbrev = "", color = "#FFBF60", shortname = "",},
["Colombia First"] = {abbrev = "", color = "#800080", shortname = "",},
["Colombia Has a Future"] = {abbrev = "CFT", color = "#32CD32", shortname = "",},
["Colombia Justa Libres"] = {abbrev = "CJL", color = "#C29B61", shortname = "",},
["Colombian Communist Party"] = {abbrev = "", color = "#DA251D", shortname = "",},
["Colombian Community and Communal Political Movement"] = {abbrev = "MCCC", color = "#F5EC49", shortname = "",},
["Colombian Conservative Party"] = {abbrev = "", color = "#1935D0", shortname = "Conservative",},
["Colombian Liberal Party"] = {abbrev = "", color = "#FF3333", shortname = "Liberal",},
["Colorado Party (Paraguay)"] = {abbrev = "", color = "#EE1D23", shortname = "Colorado",},
["Colorado Party (Uruguay)"] = {abbrev = "", color = "#BB0000", shortname = "Colorado Party",},
["Colored Republican Party"] = {abbrev = "", color = "#FF5600", shortname = "Colored Republican",},
["Combatant Clergy Association"] = {abbrev = "CCA", color = "#009900", shortname = "",},
["Combatants' Party"] = {abbrev = "PdC", color = "#8B4513", shortname = "",},
["Come Venezuela"] = {abbrev = "VV", color = "#00BFFF", shortname = "",},
["Comité d'Action Musulman"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Comités Jeanne"] = {abbrev = "", color = "#202F55", shortname = "",},
["Commitment for Caspe"] = {abbrev = "", color = "#ED750E", shortname = "",},
["Commitment to Cantabria"] = {abbrev = "", color = "#28734C", shortname = "",},
["Commitment to Europe"] = {abbrev = "", color = "#E7995C", shortname = "",},
["Commitment to Galicia"] = {abbrev = "", color = "#087D42", shortname = "",},
["Commitment to Gran Canaria"] = {abbrev = "", color = "#8AAD53", shortname = "",},
["Commitment to Torrevieja"] = {abbrev = "", color = "#266E87", shortname = "",},
["Commitment with Aragon"] = {abbrev = "", color = "#ECD807", shortname = "",},
["Commitment, Renewal and Order"] = {abbrev = "CREO", color = "#FDAF17", shortname = "",},
["Committed Citizens"] = {abbrev = "CC", color = "#63277F", shortname = "",},
["Committee for a Worker's International (Ireland)"] = {abbrev = "", color = "#DC241F", shortname = "CWI (Ireland)",},
["Committee for Another Policy"] = {abbrev = "", color = "red", shortname = "",},
["Committee for the Defence of the Republic"] = {abbrev = "CDR", color = "#264E4E", shortname = "",},
["Committee of Freedom"] = {abbrev = "CdL", color = "#C71585", shortname = "",},
["Committee of National Unity"] = {abbrev = "", color = "#B93434", shortname = "",},
["Committees for the Defense of the Revolution"] = {abbrev = "CDR", color = "", shortname = "",},
["Common Action Political Party — Civil Congress"] = {abbrev = "PAC–CC", color = "#EF7F1A", shortname = "",},
["Common Alternative Revolutionary Force"] = {abbrev = "FARC", color = "#AF1120", shortname = "",},
["Common Choice"] = {abbrev = "", color = "#ED1B30", shortname = "",},
["Common Course"] = {abbrev = "", color = "#AD3801", shortname = "",},
["Common Force"] = {abbrev = "", color = "#ED5C3E", shortname = "",},
["Common Ground Alliance"] = {abbrev = "", color = "#005B54", shortname = "Common Ground",},
["Common Man's Front"] = {abbrev = "", color = "#00008B", shortname = "",},
["Common Sense (political party)"] = {abbrev = "", color = "#1a6862", shortname = "Common Sense",},
["Common Sense Party (UK)"] = {abbrev = "", color = "#FFFFFF", shortname = "Common Sense",},
["Common Wealth Party"] = {abbrev = "", color = "#ff7f50", shortname = "Common Wealth",},
["Commoner Party of Thailand"] = {abbrev = "", color = "#FF4500", shortname = "",},
["Commoners' Land"] = {abbrev = "TC–PNC", color = "#7A76B4", shortname = "",},
["Commoners' Party (Thailand)"] = {abbrev = "", color = "#000000", shortname = "",},
["Commons (Chilean political party)"] = {abbrev = "", color = "#461D3D", shortname = "",},
["Commons (Colombian political party)"] = {abbrev = "", color = "#AF1120", shortname = "Commons",},
["Commonwealth Labour Party"] = {abbrev = "ComLab", color = "#b22222", shortname = "Commonwealth Labour",},
["Commonwealth Land Party (US)"] = {abbrev = "", color = "#4C915F", shortname = "Commonwealth Land",},
["Commonwealth Liberal Party"] = {abbrev = "", color = "#8CB4D2", shortname = "Commonwealth Liberal",},
["Commonwealth Party (Gibraltar)"] = {abbrev = "", color = "#CE0F25", shortname = "Commonwealth",},
["Communal Democracy Party"] = {abbrev = "TDP", color = "#0D1AAF", shortname = "",},
["Communal Liberation Party"] = {abbrev = "TKP", color = "red", shortname = "",},
["Communal Liberation Party New Forces"] = {abbrev = "TKP-YG", color = "#E3000D", shortname = "",},
["Communist Alternative Party"] = {abbrev = "", color = "maroon", shortname = "",},
["Communist Archio-Marxist Party of Greece"] = {abbrev = "KAKE", color = "red", shortname = "",},
["Communist Collective of Catalonia"] = {abbrev = "", color = "#B82E35", shortname = "",},
["Communist League (New Zealand)"] = {abbrev = "", color = "#dd0048", shortname = "Communist League",},
["Communist League (Sweden)"] = {abbrev = "", color = "red", shortname = "",},
["Communist League (UK, 1988)"] = {abbrev = "", color = "#C71585", shortname = "Communist League",},
["Communist League of Great Britain"] = {abbrev = "", color = "red", shortname = "Communist League",},
["Communist League of Luxemburg"] = {abbrev = "", color = "red", shortname = "",},
["Communist League of West Germany"] = {abbrev = "KBW", color = "red", shortname = "",},
["Communist Marxist Party (John)"] = {abbrev = "", color = "#EE0000", shortname = "",},
["Communist Marxist Party"] = {abbrev = "CMP", color = "#FF0000", shortname = "",},
["Communist Movement (Spain)"] = {abbrev = "", color = "#BF4249", shortname = "",},
["Communist Movement of Turkey"] = {abbrev = "TKH", color = "#990000", shortname = "",},
["Communist Organization of Spain (Red Flag)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Communist Party"] = {abbrev = "", color = "#D50000", shortname = "Communist",},
["Communist Party (Argentina)"] = {abbrev = "PC", color = "#FF0000", shortname = "Communist Party",},
["Communist Party (bolsheviks) of Lithuania and Belorussia"] = {abbrev = "LBSSR", color = "#CC0000", shortname = "",},
["Communist Party (Bolsheviks) of Ukraine"] = {abbrev = "", color = "#DD0000", shortname = "Communist Party",},
["Communist Party (Bosnia and Herzegovina)"] = {abbrev = "", color = "red", shortname = "Communist Party",},
["Communist Party (Denmark)"] = {abbrev = "", color = "#FF0000", shortname = "Communist Party",},
["Communist Party (Italy)"] = {abbrev = "", color = "#F00000", shortname = "Communist Party",},
["Communist Party (Serbia)"] = {abbrev = "", color = "#C6363C", shortname = "Communist Party",},
["Communist Party (Sweden)"] = {abbrev = "", color = "#D91A12", shortname = "Communist",},
["Communist Party (Turkey, 2014)"] = {abbrev = "", color = "#c00", shortname = "Communist",},
["Communist Party (UK)"] = {abbrev = "", color = "red", shortname = "Communist",},
["Communist Party (US)"] = {abbrev = "CPUSA", color = "#D50000", shortname = "Communist",},
["Communist Party in Denmark"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Communist Party of Albania (1991)"] = {abbrev = "", color = "#E61919", shortname = "",},
["Communist Party of Aragon (1980)"] = {abbrev = "", color = "#C5000F", shortname = "",},
["Communist Party of Argentina (Extraordinary Congress)"] = {abbrev = "", color = "#E0040B", shortname = "",},
["Communist Party of Argentina"] = {abbrev = "", color = "#E22928", shortname = "",},
["Communist Party of Artsakh"] = {abbrev = "", color = "#FF1111", shortname = "",},
["Communist Party of Australia"] = {abbrev = "CPA", color = "#CD2027", shortname = "Communist",},
["Communist Party of Australia (1971)"] = {abbrev = "CPA", color = "#CD2027", shortname = "Communist",},
["Communist Party of Australia (Marxist–Leninist)"] = {abbrev = "CPA", color = "#CD2027", shortname = "Communist",},
["Communist Party of Austria"] = {abbrev = "KPÖ", color = "#AA0000", shortname = "",},
["Communist Party of Bangladesh (Marxist–Leninist) (Barua)"] = {abbrev = "CPB (M-L)", color = "#FB6F76", shortname = "",},
["Communist Party of Bangladesh"] = {abbrev = "CPB", color = "#E91621", shortname = "",},
["Communist Party of Belarus"] = {abbrev = "CPB", color = "#D30400", shortname = "",},
["Communist Party of Belgium (1989)"] = {abbrev = "", color = "red", shortname = "Communist",},
["Communist Party of Benin"] = {abbrev = "", color = "#B22222", shortname = "",},
["Communist Party of Bohemia and Moravia"] = {abbrev = "KSČM", color = "#FF0000", shortname = "",},
["Communist Party of Bolivia (Marxist–Leninist)"] = {abbrev = "", color = "#C9021A", shortname = "",},
["Communist Party of Bolivia"] = {abbrev = "", color = "red", shortname = "",},
["Communist Party of Brazil"] = {abbrev = "PCdoB", color = "#820000", shortname = "",},
["Communist Party of Britain (Marxist–Leninist)"] = {abbrev = "", color = "#EE1F23", shortname = "Communist (ML)",},
["Communist Party of Britain"] = {abbrev = "", color = "#F93822", shortname = "Communist",},
["Communist Party of Bulgaria"] = {abbrev = "CPB", color = "#B20406", shortname = "",},
["Communist Party of Byelorussia"] = {abbrev = "CPB", color = "#DC143C", shortname = "",},
["Communist Party of Canada (Marxist–Leninist)"] = {abbrev = "", color = "#F5191A", shortname = "Marxist–Leninist",},
["Communist Party of Canada"] = {abbrev = "", color = "#FF6347", shortname = "Communist",},
["Communist Party of Chile"] = {abbrev = "", color = "#B22222", shortname = "Communist",},
["Communist Party of Cuba"] = {abbrev = "PCC", color = "#CE2029", shortname = "",},
["Communist Party of Czechoslovakia"] = {abbrev = "KSČ", color = "#DC241F", shortname = "",},
["Communist Party of Denmark"] = {abbrev = "", color = "#A52A2A", shortname = "Communists",},
["Communist Party of Denmark/Marxist–Leninists"] = {abbrev = "DKP/ML", color = "red", shortname = "",},
["Communist Party of Ecuador"] = {abbrev = "", color = "#da251d", shortname = "",},
["Communist Party of England (Marxist-Leninist)"] = {abbrev = "", color = "#660000", shortname = "Marxist-Leninist (England)",},
["Communist Party of Finland (1994)"] = {abbrev = "SKP", color = "#8B0000", shortname = "Communist Party of Finland",},
["Communist Party of Finland"] = {abbrev = "", color = "#DA2301", shortname = "Communist Party",},
["Communist Party of Georgia (Soviet Union)"] = {abbrev = "SKP", color = "#CD0000", shortname = "",},
["Communist Party of Georgia"] = {abbrev = "", color = "red", shortname = "",},
["Communist Party of Germany (1990)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Communist Party of Germany"] = {abbrev = "KPD", color = "#8B0000", shortname = "",},
["Communist Party of Germany/Marxists–Leninists"] = {abbrev = "KPD/ML", color = "red", shortname = "",},
["Communist Party of Great Britain (Marxist–Leninist)"] = {abbrev = "", color = "#FF0000", shortname = "Communist GB (ML)",},
["Communist Party of Great Britain (Provisional Central Committee)"] = {abbrev = "", color = "red", shortname = "Communist (PCC)",},
["Communist Party of Great Britain"] = {abbrev = "", color = "red", shortname = "Communist",},
["Communist Party of Greece (Interior)"] = {abbrev = "", color = "red", shortname = "KKE Interior",},
["Communist Party of Greece (Marxist–Leninist)"] = {abbrev = "KKE-M-L", color = "#960018", shortname = "",},
["Communist Party of Greece"] = {abbrev = "KKE", color = "#e30301", shortname = "",},
["Communist Party of Iceland"] = {abbrev = "", color = "#FF0000", shortname = "Communist",},
["Communist Party of Iceland (Marxist–Leninist)"] = {abbrev = "", color = "red", shortname = "Communist (M-L)",},
["Communist Party of India (Marxist-Leninist) (Kanu Sanyal)"] = {abbrev = "CPI(M-L)", color = "#FF0000", shortname = "",},
["Communist Party of India (Marxist-Leninist)"] = {abbrev = "CPI(ML)", color = "#FF0000", shortname = "",},
["Communist Party of India (Marxist–Leninist) Liberation"] = {abbrev = "CPI(ML)L", color = "#C41301", shortname = "",},
["Communist Party of India (Marxist–Leninist) Red Star"] = {abbrev = "CPI(ML) Red Star", color = "red", shortname = "",},
["Communist Party of India (Marxist)"] = {abbrev = "CPI(M)", color = "#FF1D15", shortname = "",},
["Communist Party of India"] = {abbrev = "CPI", color = "#e70d21", shortname = "",},
["Communist Party of Indonesia"] = {abbrev = "", color = "#ED3237", shortname = "Communist",},
["Communist Party of Ireland (Marxist–Leninist)"] = {abbrev = "", color = "#660000", shortname = "Marxist–Leninist (Ireland)",},
["Communist Party of Ireland"] = {abbrev = "", color = "#E3170D", shortname = "Communist",},
["Communist Party of Italy"] = {abbrev = "", color = "#C72F35", shortname = "",},
["Communist Party of Kampuchea"] = {abbrev = "", color = "#E61919", shortname = "",},
["Communist Party of Kazakhstan"] = {abbrev = "", color = "#D40000", shortname = "Communist Party",},
["Communist Party of Kenya"] = {abbrev = "", color = "#D40000", shortname = "",},
["Communist Party of Korea"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Communist Party of Kurdistan – Iraq"] = {abbrev = "", color = "#dd0000", shortname = "",},
["Communist Party of Kurdistan (Turkey)"] = {abbrev = "KKP", color = "#DA221C", shortname = "",},
["Communist Party of Kyrgyzstan"] = {abbrev = "", color = "#B22222", shortname = "",},
["Communist Party of Latvia"] = {abbrev = "", color = "#D40000", shortname = "",},
["Communist Party of Lithuania"] = {abbrev = "LKP", color = "#D1020A", shortname = "",},
["Communist Party of Luxembourg"] = {abbrev = "KPL", color = "#CC0000", shortname = "",},
["Communist Party of Macedonia (1992)"] = {abbrev = "KPM", color = "red", shortname = "",},
["Communist Party of Malta"] = {abbrev = "", color = "Red", shortname = "",},
["Communist Party of Mexico (Marxist–Leninist)"] = {abbrev = "", color = "#FE3A22", shortname = "",},
["Communist Party of Moldavia"] = {abbrev = "PCM", color = "#DF0000", shortname = "",},
["Communist Party of National Liberation"] = {abbrev = "", color = "#D00620", shortname = "",},
["Communist Party of Nepal (Maoist) (1994)"] = {abbrev = "", color = "#8B0000", shortname = "CPN (Maoist)",},
["Communist Party of Nepal (Maoist Centre)"] = {abbrev = "CPN (MC)", color = "#8B0000", shortname = "Maoist Centre",},
["Communist Party of Nepal (Marxist–Leninist) (2002)"] = {abbrev = "", color = "indianred", shortname = "",},
["Communist Party of Nepal (Marxist) (1991–2005)"] = {abbrev = "", color = "crimson", shortname = "CPN (Marxist)",},
["Communist Party of Nepal (Unified Marxist–Leninist)"] = {abbrev = "UML", color = "#DC241F", shortname = "CPN (UML)",},
["Communist Party of Nepal (Unified Socialist)"] = {abbrev = "CPN (US)", color = "#f4230c", shortname = "Unified Socialist",},
["Communist Party of Nepal (Unified)"] = {abbrev = "", color = "#ff007f", shortname = "CPN (Unified)",},
["Communist Party of Nepal (United Marxist)"] = {abbrev = "", color = "crimson", shortname = "CPN (United Marxist)",},
["Communist Party of Nepal (United) (1991–2005)"] = {abbrev = "", color = "red", shortname = "",},
["Communist Party of Nepal (United)"] = {abbrev = "", color = "palevioletred", shortname = "CPN (United)",},
["Communist Party of Nepal (Unity Centre)"] = {abbrev = "", color = "Red", shortname = "",},
["Communist party of Nepal (Unity National Campaign)"] = {abbrev = "CPN (UNC)", color = "#FF0000", shortname = "Unity Campaign",},
["Communist Party of New Zealand"] = {abbrev = "", color = "#800000", shortname = "Communist",},
["Communist Party of Nicaragua"] = {abbrev = "", color = "red", shortname = "",},
["Communist Party of Northern Ireland"] = {abbrev = "", color = "red", shortname = "Communist (NI)",},
["Communist Party of Norway"] = {abbrev = "", color = "#990000", shortname = "Communist",},
["Communist Party of Poland"] = {abbrev = "KPP", color = "#E20001", shortname = "",},
["Communist Party of Réunion"] = {abbrev = "PCR", color = "#DD0000", shortname = "",},
["Communist Party of Revolutionary Marxists"] = {abbrev = "CPRM", color = "#FF0000", shortname = "",},
["Communist Party of Scotland"] = {abbrev = "", color = "red", shortname = "Communist (Scotland)",},
["Communist Party of Slovakia – 91"] = {abbrev = "", color = "red", shortname = "",},
["Communist Party of Slovakia (1939)"] = {abbrev = "KSS", color = "#8B0000", shortname = "",},
["Communist Party of Slovakia"] = {abbrev = "KSS", color = "#e70101", shortname = "",},
["Communist Party of South Ossetia"] = {abbrev = "HIKP", color = "#CA0808", shortname = "",},
["Communist Party of Spain (Marxist–Leninist)"] = {abbrev = "", color = "#DF0020", shortname = "",},
["Communist Party of Spain (Marxist–Leninist) (historical)"] = {abbrev = "", color = "#CD5C5C", shortname = "",},
["Communist Party of Spain"] = {abbrev = "PCE", color = "#971324", shortname = "",},
["Communist Party of Sri Lanka"] = {abbrev = "", color = "#FF0000", shortname = "Communist Party",},
["Communist Party of Sweden (1921-1967)"] = {abbrev = "", color = "#b00000", shortname = "Communist",},
["Communist Party of Sweden (1924)"] = {abbrev = "", color = "#800000", shortname = "Höglund Communist",},
["Communist Party of Sweden (1967)"] = {abbrev = "", color = "red", shortname = "Communist",},
["Communist Party of Sweden (1995)"] = {abbrev = "", color = "#990000", shortname = "Communist - APK",},
["Communist Party of Sweden (Kilbommare)"] = {abbrev = "", color = "#b00000", shortname = "Kilbommare Communist",},
["Communist Party of Switzerland"] = {abbrev = "", color = "#D50000", shortname = "Communist",},
["Communist Party of Tajikistan"] = {abbrev = "", color = "#D91D1D", shortname = "Communist",},
["Communist Party of the Basque Homelands"] = {abbrev = "PCTV/EHAK", color = "#800118", shortname = "",},
["Communist Party of the Donetsk People's Republic"] = {abbrev = "", color = "#CF0A13", shortname = "",},
["Communist Party of the Netherlands"] = {abbrev = "CPN", color = "#BB5555", shortname = "",},
["Communist Party of the Peoples of Spain"] = {abbrev = "", color = "#D1141A", shortname = "",},
["Communist Party of the Philippines"] = {abbrev = "CPP", color = "#FF0000", shortname = "",},
["Communist Party of the Russian Federation"] = {abbrev = "", color = "#CC1111", shortname = "Communist",},
["Communist Party of the Russian Soviet Federative Socialist Republic"] = {abbrev = "", color = "#CD0000", shortname = "",},
["Communist Party of the Soviet Union"] = {abbrev = "CPSU", color = "#D40000", shortname = "",},
["Communist Party of the Workers of Spain"] = {abbrev = "", color = "#CD0711", shortname = "",},
["Communist Party of Turkey (modern)"] = {abbrev = "TKP", color = "#A63931", shortname = "",},
["Communist Party of Ukraine (renewed)"] = {abbrev = "KPU(o)", color = "red", shortname = "",},
["Communist Party of Ukraine (Soviet Union)"] = {abbrev = "CPU", color = "#CD0000", shortname = "",},
["Communist Party of Ukraine"] = {abbrev = "KPU", color = "#B70100", shortname = "",},
["Communist Party of Uruguay"] = {abbrev = "", color = "#123E89", shortname = "",},
["Communist Party of Uzbekistan (1994)"] = {abbrev = "", color = "#CC0000", shortname = "",},
["Communist Party of Venezuela"] = {abbrev = "", color = "#8B0000", shortname = "",},
["Communist Party of Vietnam"] = {abbrev = "", color = "#EA0504", shortname = "Communist Party",},
["Communist Party of Workers and Peasants"] = {abbrev = "KPRS", color = "#f31206", shortname = "Communist Party",},
["Communist Party Opposition (Switzerland)"] = {abbrev = "KPO", color = "#FF0000", shortname = "",},
["Communist Party USA"] = {abbrev = "", color = "#D50000", shortname = "Communist",},
["Communist People's Party of Kazakhstan"] = {abbrev = "QKHP", color = "#D5271E", shortname = "",},
["Communist Refoundation Party"] = {abbrev = "PRC", color = "#A1292F", shortname = "",},
["Communist Unification of Spain"] = {abbrev = "", color = "#EF2808", shortname = "",},
["Communist Vanguard of the Revolutionary Workers' Party"] = {abbrev = "", color = "#aa0000", shortname = "",},
["Communist Workers League (Spain)"] = {abbrev = "", color = "#B1343A", shortname = "",},
["Communist Workers' Party – For Peace and Socialism"] = {abbrev = "KTP", color = "#FF4D00", shortname = "",},
["Communist Workers Party (Denmark)"] = {abbrev = "KAP", color = "#de0000", shortname = "",},
["Communist Workers Party of Turkey"] = {abbrev = "", color = "#CB2027", shortname = "",},
["Communist"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Communistes"] = {abbrev = "", color = "#BB0000", shortname = "",},
["Communists and Allies"] = {abbrev = "COM", color = "#990000", shortname = "",},
["Communists of Catalonia"] = {abbrev = "", color = "#CC082D", shortname = "",},
["Communists of Russia"] = {abbrev = "CPCR", color = "#D71A21", shortname = "",},
["Communities & Residents"] = {abbrev = "", color = "#0066CC", shortname = "",},
["Communities United Party"] = {abbrev = "", color = "Orange", shortname = "Communities United",},
["Community Action Party"] = {abbrev = "", color = "#33FF33", shortname = "Community Action",},
["Community Alliance"] = {abbrev = "", color = "#1E4399", shortname = "",},
["Community Campaign (Hart)"] = {abbrev = "CCH", color = "#8d19ff", shortname = "",},
["Community Democrats of Ireland"] = {abbrev = "CDI", color = "#9FE2BF", shortname = "Community Democrats",},
["Community for Social Justice People's Party"] = {abbrev = "KTI", color = "#1C39BB", shortname = "",},
["Community Group"] = {abbrev = "", color = "#808080", shortname = "",},
["Community Integration Party"] = {abbrev = "", color = "#0869AD", shortname = "",},
["Community March"] = {abbrev = "", color = "#BDDC06", shortname = "",},
["Community Movement"] = {abbrev = "", color = "#800080", shortname = "",},
["Community Municipalist Party"] = {abbrev = "PMC", color = "#000000", shortname = "",},
["Community of the Lipovan Russians in Romania"] = {abbrev = "ORL", color = "#DA7C3E", shortname = "",},
["Community Performance First"] = {abbrev = "", color = "yellowgreen", shortname = "",},
["Community Representatives"] = {abbrev = "", color = "#FF719D", shortname = "Community Representative",},
["Community Sha Tin"] = {abbrev = "", color = "#00B2BD", shortname = "",},
["Comorian Democratic Union"] = {abbrev = "UDC", color = "#008000", shortname = "",},
["Comorian Union for Progress"] = {abbrev = "UCP", color = "#77BC11", shortname = "",},
["Compatriots of South Africa"] = {abbrev = "", color = "#98E03A", shortname = "",},
["Compostela Aberta"] = {abbrev = "", color = "#69C8EC", shortname = "",},
["Compromís amb Formentera"] = {abbrev = "", color = "#0AC5B3", shortname = "",},
["Compromís pel País Valencià"] = {abbrev = "Compromís PV", color = "#F2635B", shortname = "",},
["Compromisu por Asturies"] = {abbrev = "", color = "#7CB900", shortname = "",},
["Comú de Lleida"] = {abbrev = "", color = "#8B001F", shortname = "",},
["Comunes (political party)"] = {abbrev = "", color = "#412560", shortname = "",},
["Concentration of People's Forces"] = {abbrev = "CFP", color = "#000000", shortname = "",},
["Conceptual Party \"Unity\""] = {abbrev = "", color = "#11007D", shortname = "",},
["Concern for the Nation Functional Party"] = {abbrev = "PKPB", color = "#014133", shortname = "",},
["Concern Group for Tseung Kwan O People's Livelihood"] = {abbrev = "CGPLTKO", color = "#E3572B", shortname = "",},
["Concerned Citizens Party"] = {abbrev = "", color = "#A356DE", shortname = "Concerned Citizens",},
["Concerned Citizens' Movement"] = {abbrev = "CCM", color = "#3DADF2", shortname = "",},
["Concert of Parties for Democracy & Juntos Podemos Más"] = {abbrev = "", color = "Orange", shortname = "",},
["Concertación"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Concertación (Paraguay)"] = {abbrev = "", color = "#003399", shortname = "Concertación",},
["Conceyu Abiertu"] = {abbrev = "", color = "#214AFF", shortname = "",},
["Conceyu"] = {abbrev = "", color = "#D9DB4C", shortname = "",},
["Concord (political party)"] = {abbrev = "", color = "#0C6D76", shortname = "Concord",},
["Concordance (Bolivia)"] = {abbrev = "", color = "#4E81BD", shortname = "",},
["Concordancia (Argentina)"] = {abbrev = "", color = "#bfd0da", shortname = "Concordancia",},
["Concordia Association of Manchukuo"] = {abbrev = "", color = "#FFC500", shortname = "",},
["Concretely"] = {abbrev = "", color = "#0053A5", shortname = "",},
["Condado–Paradanta Union"] = {abbrev = "", color = "#008675", shortname = "",},
["Confederation Liberty and Independence"] = {abbrev = "", color = "#122746", shortname = "Confederation",},
["Confederation of Democracy"] = {abbrev = "", color = "#104F7C", shortname = "",},
["Confederation of Feminist Organizations"] = {abbrev = "", color = "#530F66", shortname = "",},
["Confederation of Independent Poland"] = {abbrev = "KPN", color = "#333300", shortname = "",},
["Confederation of the Greens (1987)"] = {abbrev = "", color = "#36A119", shortname = "",},
["Confederation of the Greens"] = {abbrev = "", color = "#74B32A", shortname = "",},
["Confederation of the Polish Crown"] = {abbrev = "", color = "#D4AA00", shortname = "",},
["Conference Party"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Congolese Movement for Democracy and Integral Development"] = {abbrev = "", color = "#374CCB", shortname = "",},
["Congolese Party of Labour"] = {abbrev = "PCT", color = "#DC241F", shortname = "",},
["Congress (A)"] = {abbrev = "INC (A)", color = "#30D5C8", shortname = "",},
["Congress (J)"] = {abbrev = "INC(J)", color = "black", shortname = "",},
["Congress (Secular)"] = {abbrev = "Cong(S)", color = "#FF7F7F", shortname = "",},
["Congress for Democracy and Progress"] = {abbrev = "CDP", color = "#E5321C", shortname = "",},
["Congress for Democratic Change"] = {abbrev = "CDC", color = "#183883", shortname = "",},
["Congress for Progressive Change"] = {abbrev = "CPC", color = "lightskyblue", shortname = "",},
["Congress for the Republic (Niger)"] = {abbrev = "", color = "#11580C", shortname = "",},
["Congress for the Republic"] = {abbrev = "CPR", color = "#77B32A", shortname = "",},
["Congress Nationalist Party"] = {abbrev = "CNP", color = "#0099CC", shortname = "",},
["Congress of Democrats"] = {abbrev = "COD", color = "#0040FC", shortname = "",},
["Congress of Russian Communities"] = {abbrev = "KRO", color = "#FCCA19", shortname = "",},
["Congress of the New Right"] = {abbrev = "KNP", color = "#1B3458", shortname = "",},
["Congress of the People (South African political party)"] = {abbrev = "COPE", color = "#FFCA08", shortname = "",},
["Congress of the People (Trinidad and Tobago)"] = {abbrev = "COP", color = "#000000", shortname = "",},
["Congress of Ukrainian Nationalists"] = {abbrev = "KUN", color = "#B30027", shortname = "",},
["Congress Party Alliance"] = {abbrev = "", color = "#FCC800", shortname = "",},
["Congress Party for the Independence of Madagascar"] = {abbrev = "AKFM", color = "#B20000", shortname = "",},
["Connect Andalusia"] = {abbrev = "", color = "#FECB00", shortname = "",},
["Conscience of Fatherland"] = {abbrev = "", color = "#B8860B", shortname = "",},
["Conservatism sidebar"] = {abbrev = "", color = "#0000FF", shortname = "Conservative",},
["Conservative (New Zealand)"] = {abbrev = "", color = "#9999CC", shortname = "Conservative",},
["Conservative (Norwegian political party)"] = {abbrev = "", color = "#2E316F", shortname = "Conservative",},
["Conservative (South Korea)"] = {abbrev = "", color = "#E61E2B", shortname = "Conservative",},
["Conservative Alliance-Matanitu Vanua"] = {abbrev = "CAMV", color = "blue", shortname = "",},
["Conservative Alliance of Zimbabwe"] = {abbrev = "CAZ", color = "#800080", shortname = "",},
["Conservative and Liberal Unionist"] = {abbrev = "", color = "#0281aa", shortname = "",},
["Conservative and Unionist Party (UK)"] = {abbrev = "Con", color = "#0087DC", shortname = "Conservative",},
["Conservative Ascension Party"] = {abbrev = "", color = "#0053CF", shortname = "",},
["Conservative bloc (Hong Kong)"] = {abbrev = "", color = "#0D3B68", shortname = "Conservative",},
["Conservative Christian Party – BPF"] = {abbrev = "", color = "#B31B20", shortname = "",},
["Conservative-Democratic Party"] = {abbrev = "PCD", color = "#66CCFF", shortname = "",},
["Conservative Democratic Party (Greece)"] = {abbrev = "KSD", color = "#9F99E5", shortname = "",},
["Conservative Democratic Party of Switzerland"] = {abbrev = "BDP", color = "#FBD918", shortname = "",},
["Conservative Democrats of Slovakia"] = {abbrev = "", color = "#6F0470", shortname = "",},
["Conservative Group"] = {abbrev = "", color = "#006EB7", shortname = "",},
["Conservative Ministerialist"] = {abbrev = "", color = "darkblue", shortname = "Ministerialist",},
["Conservative Movement/Alt-Info"] = {abbrev = "", color = "#4E0A0E", shortname = "Alt-Info",},
["Conservative Party (Bolivia)"] = {abbrev = "", color = "#0F52BA", shortname = "",},
["Conservative Party (Brazil)"] = {abbrev = "", color = "#00913D", shortname = "Conservative",},
["Conservative Party (Bulgaria)"] = {abbrev = "", color = "#00008b", shortname = "",},
["Conservative Party (Chile)"] = {abbrev = "", color = "#1935D0", shortname = "Conservative",},
["Conservative Party (Czech Republic)"] = {abbrev = "", color = "#4b0082", shortname = "KONS",},
["Conservative Party (Ecuador)"] = {abbrev = "PC", color = "#0000FF", shortname = "",},
["Conservative Party (Egypt)"] = {abbrev = "", color = "#B31E46", shortname = "",},
["Conservative Party (Guatemala)"] = {abbrev = "", color = "navy", shortname = "Conservative",},
["Conservative Party (Hong Kong)"] = {abbrev = "", color = "#0A4C90", shortname = "Conservative",},
["Conservative Party (Iceland)"] = {abbrev = "", color = "#87add7", shortname = "Conservative",},
["Conservative Party (Mexico)"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Conservative Party (New Zealand)"] = {abbrev = "", color = "#00AEEF", shortname = "Conservative",},
["Conservative Party (Nicaragua)"] = {abbrev = "", color = "#008000", shortname = "Conservative",},
["Conservative Party (Norway)"] = {abbrev = "", color = "#87add7", shortname = "Conservative",},
["Conservative Party (Panama)"] = {abbrev = "", color = "#095498", shortname = "",},
["Conservative Party (Prussia)"] = {abbrev = "", color = "#0781E5", shortname = "Conservatives",},
["Conservative Party (Romania, 1880–1918)"] = {abbrev = "", color = "#0047AB", shortname = "",},
["Conservative Party (Romania)"] = {abbrev = "", color = "#01357E", shortname = "",},
["Conservative Party (Serbia)"] = {abbrev = "", color = "#60AFFF", shortname = "Conservative",},
["Conservative Party (South Africa)"] = {abbrev = "", color = "#FFD700", shortname = "Conservative",},
["Conservative Party (Spain)"] = {abbrev = "", color = "#1286CB", shortname = "Conservative",},
["Conservative Party (Thailand)"] = {abbrev = "", color = "#FF0800", shortname = "",},
["Conservative Party (Uganda)"] = {abbrev = "", color = "purple", shortname = "",},
["Conservative Party (US)"] = {abbrev = "", color = "#FF8C00", shortname = "Conservative",},
["Conservative Party (Venezuela)"] = {abbrev = "", color = "#ED2939", shortname = "",},
["Conservative Party (Virginia, 1965)"] = {abbrev = "", color = "#FF8C00", shortname = "",},
["Conservative Party (Virginia)"] = {abbrev = "", color = "#FF8C00", shortname = "",},
["Conservative Party of Albania"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Conservative Party of Canada"] = {abbrev = "", color = "#6495ED", shortname = "Conservative",},
["Conservative Party of Canada (1867–1942)"] = {abbrev = "", color = "#9999FF", shortname = "Conservative (historical)",},
["Conservative Party of Norway (2020)"] = {abbrev = "", color = "#0065F1", shortname = "",},
["Conservative Party of Russia"] = {abbrev = "", color = "#1093EC", shortname = "",},
["Conservative People's Party (Argentina)"] = {abbrev = "PCP", color = "#000081", shortname = "Conservative People's Party",},
["Conservative People's Party (Denmark)"] = {abbrev = "", color = "#6B9249", shortname = "Conservatives",},
["Conservative People's Party (Germany)"] = {abbrev = "KVP", color = "#455B95", shortname = "",},
["Conservative People's Party (Poland)"] = {abbrev = "SKL", color = "#4B61D1", shortname = "Conservative People's Party",},
["Conservative People's Party of Estonia"] = {abbrev = "EKRE", color = "#0063AF", shortname = "",},
["Conservative People's Party"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Conservative Republican Party"] = {abbrev = "PRC", color = "#3333FF", shortname = "",},
["Conservative Resident"] = {abbrev = "", color = "#00ADEF", shortname = "",},
["Conservative Trade Unionist"] = {abbrev = "", color = "white", shortname = "",},
["Conservative Union (Spain)"] = {abbrev = "", color = "#27A6E2", shortname = "Silvelist",},
["Conservative"] = {abbrev = "", color = "#318CE7", shortname = "",},
["Conservatives and Reformists (Italy)"] = {abbrev = "", color = "#0054A5", shortname = "",},
["Conservatives of Catalonia"] = {abbrev = "", color = "#2A52BE", shortname = "",},
["Constitution Democracy Republic Party"] = {abbrev = "CDRP", color = "#BB443E", shortname = "",},
["Constitution Party (Egypt)"] = {abbrev = "", color = "#0A72BB", shortname = "Constitution Party",},
["Constitution Party (Estonia)"] = {abbrev = "", color = "#E56509", shortname = "",},
["Constitution Party (US)"] = {abbrev = "C", color = "#A356DE", shortname = "Constitution",},
["Constitution Party (US, 1952)"] = {abbrev = "C", color = "#000000", shortname = "Constitution",},
["Constitutional Action Party"] = {abbrev = "", color = "#9ab27d", shortname = "",},
["Constitutional and Democratic Party (Spain)"] = {abbrev = "", color = "#9999FF", shortname = "",},
["Constitutional and Democratic Popular Movement"] = {abbrev = "", color = "#D0353B", shortname = "",},
["Constitutional Bloc (Bulgaria)"] = {abbrev = "", color = "#0092CB", shortname = "",},
["Constitutional Bloc (Lebanon)"] = {abbrev = "", color = "orange", shortname = "Constitutional Bloc",},
["Constitutional Democratic Party (Italy)"] = {abbrev = "", color = "#6495ed", shortname = "",},
["Constitutional Democratic Party (Japan)"] = {abbrev = "", color = "#3773BE", shortname = "Rikken Minseitō",},
["Constitutional Democratic Party of Japan"] = {abbrev = "CDP", color = "#184589", shortname = "",},
["Constitutional Democratic Party"] = {abbrev = "", color = "#0087DC", shortname = "Cadet",},
["Constitutional Front (Thailand)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Constitutional Movement"] = {abbrev = "", color = "DarkGoldenrod", shortname = "",},
["Constitutional Nationalist Party UNIR"] = {abbrev = "", color = "#2E4371", shortname = "",},
["Constitutional Party (Costa Rica)"] = {abbrev = "", color = "#FF0000", shortname = "Constitutional",},
["Constitutional Party (Malta)"] = {abbrev = "", color = "#C71585", shortname = "",},
["Constitutional Party (Peru)"] = {abbrev = "", color = "#0072BB", shortname = "",},
["Constitutional Party (Spain)"] = {abbrev = "", color = "#58B474", shortname = "Constitutional",},
["Constitutional Party (Vietnam)"] = {abbrev = "", color = "#D99FE8", shortname = "",},
["Constitutional Reform Association of Hong Kong"] = {abbrev = "CRA", color = "#000080", shortname = "",},
["Constitutional Right Party"] = {abbrev = "", color = "darkblue", shortname = "",},
["Constitutional Union (Morocco)"] = {abbrev = "UC", color = "#F29400", shortname = "",},
["Constitutional Union of Cuba"] = {abbrev = "", color = "#537AB0", shortname = "",},
["Constitutional Union Party (Iraq)"] = {abbrev = "CUP", color = "#A52A2A", shortname = "",},
["Constitutional Union Party (US)"] = {abbrev = "CU", color = "#F59100", shortname = "Constitutional Union",},
["Constitutionalist (UK)"] = {abbrev = "", color = "#8C92AC", shortname = "Constitutionalist",},
["Constitutionalist Liberal Party"] = {abbrev = "PLC", color = "#FF2400", shortname = "",},
["Constitutionalist Party of Iran"] = {abbrev = "", color = "#000099", shortname = "",},
["Constitutionalist Party of São Paulo"] = {abbrev = "PCSP", color = "#CC0000", shortname = "",},
["Constitutionalist"] = {abbrev = "", color = "white", shortname = "",},
["ConstitutionUSA Party"] = {abbrev = "", color = "#A356DE", shortname = "",}, -- TODO: is duplicate?
["Consultative Council for Indonesian Citizenship"] = {abbrev = "", color = "#800080", shortname = "Baperki",},
["Contigo (political party)"] = {abbrev = "", color = "#E2007A", shortname = "",},
["Contigo Más"] = {abbrev = "", color = "#DF617D", shortname = "",},
["Contigo Navarra"] = {abbrev = "", color = "#4DAE97", shortname = "Contigo/Zurekin",},
["Contigo Somos Democracia"] = {abbrev = "", color = "#85BE3D", shortname = "",},
["Convention for a Progressive Alternative"] = {abbrev = "CAP", color = "#FF0000", shortname = "",},
["Convention for the Renewal of the Comoros"] = {abbrev = "CRC", color = "#0471C3", shortname = "",},
["Convention Muslim League"] = {abbrev = "CML", color = "#00CCCC", shortname = "",},
["Convention of Christian Democrats"] = {abbrev = "", color = "#556627", shortname = "",},
["Convention of Democratic Forces"] = {abbrev = "", color = "green", shortname = "",},
["Convention of Republican Institutions"] = {abbrev = "", color = "#E75480", shortname = "",},
["Convention People's Party"] = {abbrev = "CPP", color = "#C80815", shortname = "",},
["Convergence (Guatemala)"] = {abbrev = "", color = "#3481B9", shortname = "",},
["Convergence (Mexico)"] = {abbrev = "", color = "#F18130", shortname = "Convergence",},
["Convergence and Union"] = {abbrev = "CiU", color = "#18307B", shortname = "",},
["Convergence for Development"] = {abbrev = "CODEM", color = "blue", shortname = "",},
["Convergence for Extremadura"] = {abbrev = "", color = "#0A892E", shortname = "",},
["Convergence for Social Democracy (Equatorial Guinea)"] = {abbrev = "CPDS", color = "red", shortname = "",},
["Convergence for the Development of Mali"] = {abbrev = "", color = "#3BB9FF", shortname = "",},
["Convergence for the Isles"] = {abbrev = "", color = "#02AECA", shortname = "",},
["Convergence for Vigo"] = {abbrev = "", color = "#CE1126", shortname = "",},
["Convergence of Democrats of Navarre"] = {abbrev = "CDN", color = "#9D3E4D", shortname = "",},
["Convergence of Independents of Galicia"] = {abbrev = "", color = "#0062E3", shortname = "",},
["Convergence of Manacor"] = {abbrev = "", color = "#E2C767", shortname = "",},
["Convergence of Melilla"] = {abbrev = "", color = "#F04E98", shortname = "",},
["Convergents"] = {abbrev = "", color = "#172A88", shortname = "",},
["Converxencia XXI"] = {abbrev = "", color = "#FDB812", shortname = "",},
["Cook Islands First Party"] = {abbrev = "", color = "#FFDDFF", shortname = "",},
["Cook Islands National Party"] = {abbrev = "CINP", color = "#0000FF", shortname = "",},
["Cook Islands Party"] = {abbrev = "", color = "#005a00", shortname = "Cook Islands",},
["Cook Islands United Party"] = {abbrev = "", color = "#0000fe", shortname = "Cook Islands United",},
["Cooperation and Brotherhood"] = {abbrev = "", color = "#AF0000", shortname = "",},
["Cooperation Party"] = {abbrev = "", color = "#311179", shortname = "",},
["Cooperative NATCCO Network Party"] = {abbrev = "", color = "#6495ED", shortname = "",},
["Cooperative Power Party"] = {abbrev = "", color = "#038F48", shortname = "",},
["Copei"] = {abbrev = "", color = "#009900", shortname = "",},
["Coraggio Italia"] = {abbrev = "", color = "#E5007D", shortname = "",},
["Córas na Poblachta"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Cordeliers club"] = {abbrev = "", color = "#374d5f", shortname = "",},
["Córdoba Neighbourhood Encounter"] = {abbrev = "", color = "#E76003", shortname = "",},
["Cordobese Union"] = {abbrev = "", color = "#067237", shortname = "",},
["Cork Socialist Party"] = {abbrev = "", color = "#D20000", shortname = "",},
["Cornellà en Comú–Crida per Cornellà"] = {abbrev = "", color = "#783E8B", shortname = "",},
["Cornellà Left Alternative"] = {abbrev = "", color = "#581960", shortname = "",},
["Cornish Nationalist Party"] = {abbrev = "", color = "#000000", shortname = "",},
["Corsaris Democràtics"] = {abbrev = "", color = "#E7D072", shortname = "",},
["Corsica Libera"] = {abbrev = "CL", color = "#CC5500", shortname = "",},
["Corunnan Democracy"] = {abbrev = "", color = "#166CBF", shortname = "",},
["Corunnan Union"] = {abbrev = "", color = "#804B32", shortname = "",},
["Costa del Sol Sí Puede"] = {abbrev = "", color = "#269283", shortname = "",},
["Costa Rica Fair"] = {abbrev = "CRJ", color = "#00A5DB", shortname = "",},
["Costa Rican Concord Party"] = {abbrev = "PCC", color = "#4366F1", shortname = "",},
["Costa Rican People's Party"] = {abbrev = "", color = "Red", shortname = "",},
["Costa Rican Peoples' Front"] = {abbrev = "FPC", color = "#800000", shortname = "",},
["Costa Rican Renewal Party"] = {abbrev = "PRC", color = "#013ca6", shortname = "",},
["Council Muslim League"] = {abbrev = "", color = "#00ffff", shortname = "",},
["Council of Serbian Unity"] = {abbrev = "SSJ", color = "#36454F", shortname = "",},
["Country Alliance (Dominican Republic)"] = {abbrev = "", color = "#00ACA1", shortname = "",},
["Country and Progressive National Party"] = {abbrev = "CPNP", color = "#008B8B", shortname = "",},
["Country Liberal Party"] = {abbrev = "", color = "#f8981d", shortname = "Country Liberal",},
["Country of Living"] = {abbrev = "", color = "#FC283F", shortname = "",},
["Country-Liberal Coalition"] = {abbrev = "", color = "#006644", shortname = "Coalition",},
["Country/Liberal Coalition"] = {abbrev = "", color = "#006644", shortname = "Coalition",},
["Country Party (New Zealand)"] = {abbrev = "", color = "#B9F58B", shortname = "Country Party",},
["Country Party (NSW)"] = {abbrev = "", color = "#006644", shortname = "Country",},
["Country Party (South Australia)"] = {abbrev = "", color = "#006644", shortname = "Country",},
["Country Party (Victoria)"] = {abbrev = "", color = "#006644", shortname = "Country",},
["Country Party of Australia"] = {abbrev = "", color = "#006644", shortname = "Country",},
["Country Party of Australia (1920)"] = {abbrev = "", color = "#006644", shortname = "Country",},
["Country with Managers"] = {abbrev = "", color = "#EAFF00", shortname = "",},
["Countryside Party (UK)"] = {abbrev = "", color = "olive", shortname = "Countryside",},
["Courage Party"] = {abbrev = "", color = "#CC66FF", shortname = "Courage",},
["Course of Freedom"] = {abbrev = "PE", color = "#9F1897", shortname = "",},
["Covenant Party (Northern Mariana Islands)"] = {abbrev = "", color = "#CCFFCC", shortname = "Covenant",},
["Covenant Society"] = {abbrev = "", color = "#DC143C", shortname = "",},
["Cowry Forces for an Emerging Benin"] = {abbrev = "", color = "#56963F", shortname = "FCBE",},
["CPC"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Crawford Republican"] = {abbrev = "", color = "#5FD35F", shortname = "",},
["Creando Melilla"] = {abbrev = "CREAME", color = "#3182C1", shortname = "",},
["Creating Opportunities"] = {abbrev = "CREO", color = "#1B5DA6", shortname = "",},
["Creative Korea Party"] = {abbrev = "", color = "#B30000", shortname = "Creative Korea",},
["Creemos"] = {abbrev = "", color = "#d02d69", shortname = "",},
["Creemos Colombia"] = {abbrev = "", color = "#e40078", shortname = "",},
["Creo en Huelva"] = {abbrev = "", color = "#18B3B7", shortname = "",},
["Crescent Star Party (Indonesia)"] = {abbrev = "PBB", color = "#005825", shortname = "",},
["Crida per Palma"] = {abbrev = "", color = "#F3CB2D", shortname = "",},
["Cristiannan Uni Reforzando Potencial di Aruba"] = {abbrev = "", color = "purple", shortname = "",},
["Croat People's Union"] = {abbrev = "", color = "blue", shortname = "",},
["Croat-Serb Coalition"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Croatia is Growing"] = {abbrev = "", color = "#e00f20", shortname = "",},
["Croatian Bunjevac-Šokac Party"] = {abbrev = "HBŠS", color = "#AD3201", shortname = "",},
["Croatian Christian Democratic Union of Bosnia and Herzegovina"] = {abbrev = "", color = "blue", shortname = "",},
["Croatian Christian Democratic Union"] = {abbrev = "", color = "cornflowerblue", shortname = "",},
["Croatian Civic Initiative"] = {abbrev = "HGI", color = "#f08080", shortname = "",},
["Croatian Civic Party"] = {abbrev = "HGS", color = "#1F75FE", shortname = "",},
["Croatian Coalition (2010)"] = {abbrev = "", color = "#E61717", shortname = "",},
["Croatian Conservative Party"] = {abbrev = "", color = "#002366", shortname = "",},
["Croatian Demochristian Party"] = {abbrev = "", color = "#1974D2", shortname = "",},
["Croatian Democratic Alliance of Slavonia and Baranja"] = {abbrev = "HDSSB", color = "#990000", shortname = "",},
["Croatian Democratic Peasant Party"] = {abbrev = "", color = "green", shortname = "",},
["Croatian Democratic Union 1990"] = {abbrev = "HDZ 1990", color = "#A3DCFF", shortname = "",},
["Croatian Democratic Union of Bosnia and Herzegovina"] = {abbrev = "HDZ BiH", color = "#0064AA", shortname = "",},
["Croatian Democratic Union"] = {abbrev = "HDZ", color = "#005BAA", shortname = "",},
["Croatian Growth"] = {abbrev = "", color = "#5299E1", shortname = "",},
["Croatian Independent Party"] = {abbrev = "", color = "#5CA8EC", shortname = "",},
["Croatian Labourists – Labour Party"] = {abbrev = "", color = "#F4A460", shortname = "Labour",},
["Croatian Labourists"] = {abbrev = "HL", color = "#F4A460", shortname = "",},
["Croatian Liberation Movement"] = {abbrev = "HOP", color = "#FF0000", shortname = "",},
["Croatian National Shift"] = {abbrev = "HNP", color = "#EB332D", shortname = "",},
["Croatian Party of Pensioners"] = {abbrev = "", color = "#004B88", shortname = "HSU",},
["Croatian Party of Rights 1861"] = {abbrev = "HSP 1861", color = "#000000", shortname = "",},
["Croatian Party of Rights Dr. Ante Starčević"] = {abbrev = "HSP AS", color = "#6082B6", shortname = "",},
["Croatian Party of Rights of Bosnia and Herzegovina"] = {abbrev = "", color = "#000000", shortname = "",},
["Croatian Party of Rights"] = {abbrev = "HSP", color = "#000000", shortname = "",},
["Croatian Peasant Party of Bosnia and Herzegovina"] = {abbrev = "HSS BiH", color = "#3D863D", shortname = "",},
["Croatian Peasant Party"] = {abbrev = "HSS", color = "#02B14B", shortname = "",},
["Croatian People's Party – Liberal Democrats"] = {abbrev = "HNS-LD", color = "#FF931E", shortname = "",},
["Croatian People's Party"] = {abbrev = "HNS", color = "#F4A460", shortname = "",},
["Croatian Popular Party (1919)"] = {abbrev = "", color = "blue", shortname = "",},
["Croatian Pure Party of Rights"] = {abbrev = "HČSP", color = "#000000", shortname = "",},
["Croatian Republican Party"] = {abbrev = "HRS", color = "#004E9C", shortname = "",},
["Croatian Republican Union"] = {abbrev = "", color = "#000000", shortname = "",},
["Croatian Right Bloc"] = {abbrev = "", color = "#000000", shortname = "",},
["Croatian Romani Union \"Kali Sara\""] = {abbrev = "", color = "#FF0000", shortname = "Kali Sara",},
["Croatian Social Democrats"] = {abbrev = "HSD", color = "#FF0000", shortname = "",},
["Croatian Social Liberal Party"] = {abbrev = "HSLS", color = "#FFE01A", shortname = "",},
["Croatian Syrmian Initiative"] = {abbrev = "HSI", color = "#AA8251", shortname = "",},
["Croatian True Revival"] = {abbrev = "HIP", color = "darkblue", shortname = "",},
["Croatian Workers Party"] = {abbrev = "HRS", color = "Blue", shortname = "",},
["Croats Together"] = {abbrev = "HZ", color = "#A3DCFF", shortname = "",},
["Crofters Party"] = {abbrev = "", color = "#ddff55", shortname = "Crofters",},
["Cross-Community Labour Alternative"] = {abbrev = "", color = "#cd5c5c", shortname = "Labour Alternative",},
["Crossbencher"] = {abbrev = "", color = "grey", shortname = "Crossbench",},
["Crusade of Romanianism"] = {abbrev = "CR", color = "#390E0C", shortname = "",},
["Crystal Party"] = {abbrev = "", color = "#88309E", shortname = "Kristall.",},
["Cuban National Party"] = {abbrev = "PNC", color = "#0080FF", shortname = "",},
["Cuban Popular Party"] = {abbrev = "", color = "#C71585", shortname = "",},
["Cuenca Nos Une"] = {abbrev = "", color = "#13A69E", shortname = "",},
["Culleredo Neighborhood Tide"] = {abbrev = "", color = "#00ACEE", shortname = "",},
["Cultural Association of the GDR"] = {abbrev = "", color = "#011993", shortname = "",},
["Cultural Union of Ruthenians of Romania"] = {abbrev = "KTRR", color = "red", shortname = "",},
["Cumann na nGaedheal"] = {abbrev = "CnaG", color = "#87CEFA", shortname = "Cumann na nGaedheal",},
["Cumann Poblachta na hÉireann"] = {abbrev = "", color = "#008800", shortname = "",},
["Cumbernauld Independent Councillors Alliance"] = {abbrev = "CICA", color = "#DDDDDD", shortname = "",},
["Curaçao a New Dutch Municipality"] = {abbrev = "", color = "#FE8A23", shortname = "",},
["Current of Love"] = {abbrev = "", color = "#C49A6C", shortname = "",},
["Cymru Rydd"] = {abbrev = "", color = "#E32636", shortname = "",},
["Cymru Sovereign"] = {abbrev = "", color = "#fbff3c", shortname = "",},
["Cynon Valley Party"] = {abbrev = "", color = "#fac43a", shortname = "",},
["Czech Christian Social Party in the Kingdom of Bohemia"] = {abbrev = "ČKSSKČ", color = "#d6c3a5", shortname = "",},
["Czech National Social Party"] = {abbrev = "ČSNS", color = "#FAC469", shortname = "",},
["Czech National Socialist Party"] = {abbrev = "ČSNS 2005", color = "#C80000", shortname = "",},
["Czech Pirate Party"] = {abbrev = "", color = "#000000", shortname = "Pirates",},
["Czech Realist Party"] = {abbrev = "ČSP", color = "#6495ED", shortname = "",},
["Czech Social Democratic Party"] = {abbrev = "ČSSD", color = "#EC5800", shortname = "",},
["Czech Social Democratic Party (2021)"] = {abbrev = "ČSSD (2021)", color = "#EF331A", shortname = "",},
["Czechoslovak Agrarian and Conservative Party"] = {abbrev = "ČSAK", color = "#004953", shortname = "",},
["Czechoslovak National Democracy"] = {abbrev = "ČsND", color = "#2B347F", shortname = "",},
["Czechoslovak National Socialist Party"] = {abbrev = "ČSNS", color = "#FAC469", shortname = "",},
["Czechoslovak People's Party"] = {abbrev = "ČSL", color = "#FFD700", shortname = "",},
["Czechoslovak Social Democracy"] = {abbrev = "ČSSD", color = "#EC5800", shortname = "",},
["Czechoslovak Traders' Party"] = {abbrev = "ČŽOS", color = "#F27A7A", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
95d3d419d3c65618e6f6db50651bf64aa730443a
Module:Political party/D
828
228
449
448
2023-12-24T02:13:34Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Political_party/D]]
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["Direct Democracy New Zealand"] = "Direct Democracy Party of New Zealand",
["DAB"] = "Democratic Alliance for the Betterment and Progress of Hong Kong",
["DABHK"] = "Democratic Alliance for the Betterment and Progress of Hong Kong",
["Delaware Democratic Party"] = "Democratic Party (United States)",
["Demócrata Party"] = "Democrata Party",
["Democratic Agrarian Party of Moldova"] = "Agrarian Party of Moldova",
["Democratic Alliance for the Betterment of Hong Kong"] = "Democratic Alliance for the Betterment and Progress of Hong Kong",
["Democratic and Social Centre – People's Party"] = "CDS – People's Party",
["Democratic and Social Centre – People´s Party"] = "CDS – People's Party", -- acute accent difference
["Democratic Awakening"] = "Democratic Beginning",
["Democratic Center Party of Latvia"] = "Democratic Party \"Saimnieks\"",
["Democratic Centre Union (Greece)"] = "Centre Union",
["Democratic Coalition"] = "Democratic Coalition (Hungary)",
["Democratic Front (France)"] = "Democratic Movement (France)",
["Democratic Front for the Reunification of the Fatherland"] = "Democratic Front for the Reunification of Korea",
["Democratic Front of the Francophones"] = "DéFI",
["Democratic Group"] = "Democratic Party (Luxembourg)",
["Democratic Group (Luxembourg)"] = "Democratic Party (Luxembourg)",
["Democratic Labour Party (UK)"] = "Democratic Labour Party (UK, 1998)",
["Democratic Labour Party"] = "Lincoln Democratic Labour Association",
["Democratic Liberal Party (Italy)"] = "Italian Democratic Liberal Party",
["Democratic Modernist Pole"] = "Ettajdid Movement",
["Democratic National Alliance"] = "Democratic National Alliance (Sri Lanka)",
["Democratic Obedience Party"] = "Democratic Conviction",
["Democratic Party - demokraci.pl"] = "Democratic Party – demokraci.pl",
["Democratic Party (Burma)"] = "Democratic Party (Myanmar)",
["Democratic Party (Japan)"] = "Democratic Party (Japan, 2016)",
["Democratic Party (Slovakia)"] = "Democratic Party (Slovakia, 1989)",
["Democratic Party (Turkey, historical)"] = "Democrat Party (Turkey, 1946–1961)",
["Democratic Party (US)"] = "Democratic Party (United States)",
["Democratic Party (Alabama)"] = "Democratic Party (United States)",
["Democratic Party (Alaska)"] = "Democratic Party (United States)",
["Democratic Party (Arizona)"] = "Democratic Party (United States)",
["Democratic Party (Arkansas)"] = "Democratic Party (United States)",
["Democratic Party (California)"] = "Democratic Party (United States)",
["Democratic Party (Colorado)"] = "Democratic Party (United States)",
["Democratic Party (Connecticut)"] = "Democratic Party (United States)",
["Democratic Party (Delaware)"] = "Democratic Party (United States)",
["Democratic Party (Georgia, US)"] = "Democratic Party (United States)",
["Democratic Party (Guam)"] = "Democratic Party (United States)",
["Democratic Party (Hawaii)"] = "Democratic Party (United States)",
["Democratic Party (Idaho)"] = "Democratic Party (United States)",
["Democratic Party (Illinois)"] = "Democratic Party (United States)",
["Democratic Party (Iowa)"] = "Democratic Party (United States)",
["Democratic Party (Maryland)"] = "Democratic Party (United States)",
["Democratic Party (Massachusetts)"] = "Democratic Party (United States)",
["Democratic Party (Michigan)"] = "Democratic Party (United States)",
["Democratic Party (Minnesota)"] = "Minnesota Democratic–Farmer–Labor Party",
["Democratic Party (Missouri)"] = "Democratic Party (United States)",
["Democratic Party (Nevada)"] = "Democratic Party (United States)",
["Democratic Party (New Mexico)"] = "Democratic Party (United States)",
["Democratic Party (New York)"] = "Democratic Party (United States)",
["Democratic Party (North Dakota)"] = "North Dakota Democratic–Nonpartisan League Party",
["Democratic Party (Northern Mariana Islands)"] = "Democratic Party (United States)",
["Democratic Party (Pennsylvania)"] = "Democratic Party (United States)",
["Democratic Party (Rhode Island)"] = "Democratic Party (United States)",
["Democratic Party (Turkey, current)"] = "Democrat Party (Turkey, current)",
["Democratic Party (Utah)"] = "Democratic Party (United States)",
["Democratic Party (Vermont)"] = "Democratic Party (United States)",
["Democratic Party (Virginia)"] = "Democratic Party (United States)",
["Democratic Party (Washington State)"] = "Democratic Party (United States)",
["Democratic Party (Washington)"] = "Democratic Party (United States)",
["Democratic Party (West Virginia)"] = "Democratic Party (United States)",
["Democratic Party of Arkansas"] = "Democratic Party (United States)",
["Democratic Party of Connecticut"] = "Democratic Party (United States)",
["Democratic Party of Côte d'Ivoire – African Democratic Rally"] = "Democratic Party of Ivory Coast – African Democratic Rally",
["Democratic Party of Georgia"] = "Democratic Party (United States)",
["Democratic Party of Guam"] = "Democratic Party (United States)",
["Democratic Party of Hawaii"] = "Democratic Party (United States)",
["Democratic Party of Illinois"] = "Democratic Party (United States)",
["Democratic Party of Japan (1996)"] = "Democratic Party (Japan, 1996)",
["Democratic Party of Japan"] = "Democratic Party (Japan, 1998)",
["Democratic Party of Minnesota"] = "Democratic Party (United States)",
["Democratic Party of New Mexico"] = "Democratic Party (United States)",
["Democratic Party of Oregon"] = "Democratic Party (United States)",
["Democratic Party of the Virgin Islands"] = "Democratic Party (United States)",
["Democratic Party of Virginia"] = "Democratic Party (United States)",
["Democratic Party of Wisconsin"] = "Democratic Party (United States)",
["Democratic Patriots' Movement"] = "Democratic Patriots' Unified Party",
["Democratic People's Liberation Front"] = "People's Liberation Organisation of Tamil Eelam",
["Democratic Popular Party (Spain)"] = "People's Democratic Party (Spain)",
["Democratic Socialist Party (Nepal)"] = "Loktantrik Samajwadi Party, Nepal",
["Democratic Turnhalle Alliance"] = "Popular Democratic Movement",
["Democratic Union of the Greek Minority"] = "Omonoia (organization)",
["Democratic Union"] = "Democratic Union (Poland)",
["Democratic Unity Coalition"] = "Unitary Democratic Coalition",
["Democratic Workers' Congress"] = "Democratic People's Front",
["Democratic-Farmer-Labor Party (Minnesota)"] = "Minnesota Democratic–Farmer–Labor Party",
["Democratic-NPL Party"] = "North Dakota Democratic–Nonpartisan League Party",
["Democratic-Republican Party (United States)"] = "Democratic-Republican Party",
["Democratic-Republican Party (US)"] = "Democratic-Republican Party",
["Democratic-Republican"] = "Democratic-Republican Party",
["Democratic–Farmer–Labor Party (Minnesota)"] = "Minnesota Democratic–Farmer–Labor Party",
["Democratic–Nonpartisan League Party (North Dakota)"] = "North Dakota Democratic–Nonpartisan League Party",
["Democratic–NPL Party"] = "North Dakota Democratic–Nonpartisan League Party",
["Democratic–Republican Party (United States)"] = "Democratic-Republican Party",
["Democrats (Norway)"] = "Norway Democrats",
["Democrats and Progressives"] = "Article One (political party)",
["Democrats for Social Credit"] = "New Zealand Democratic Party for Social Credit",
["Democrats in Norway"] = "Norway Democrats",
["Demokraatit"] = "Democrats (Greenland)",
["Denk (Dutch political party)"] = "DENK (political party)",
["Denk (political party)"] = "DENK (political party)",
["DENK"] = "DENK (political party)",
["Deutsche Rechtspartei"] = "German Right Party",
["Dignity and Truth Platform Party"] = "Dignity and Truth Platform",
["Direction – Social Democracy"] = "Direction – Slovak Social Democracy",
["Direction (Slovakia)"] = "Direction – Slovak Social Democracy",
["District of Columbia Democratic State Committee"] = "Democratic Party (United States)",
["District of Columbia Republican Party"] = "Republican Party (United States)",
["Dixiecrat Party (United States)"] = "Dixiecrat",
["DMK"] = "Dravida Munnetra Kazhagam",
["Dodd Independent Party"] = "Independent (US)",
["DPHK"] = "Democratic Party (Hong Kong)",
["Dutch Labour Party"] = "Labour Party (Netherlands)",
}
local full = {
["D.C. Statehood Green Party"] = {abbrev = "", color = "#17AA5C", shortname = "DC Statehood Green",},
["D.C. Statehood Party"] = {abbrev = "", color = "#0BDA51", shortname = "DC Statehood",},
["Da'am Workers Party"] = {abbrev = "", color = "#C60408", shortname = "",},
["Dabalorivhuwa Patriotic Front"] = {abbrev = "", color = "#FF8000", shortname = "",},
["Dad, This is for You"] = {abbrev = "ĆOJZT", color = "#000000", shortname = "",},
["Dai Le and Frank Carbone Network"] = {abbrev = "DLFCN", color = "#FF7F7F", shortname = "",},
["Đại Việt National Socialist Party"] = {abbrev = "ĐVQXĐ", color = "#DC143C", shortname = "",},
["Dagga Party"] = {abbrev = "", color = "#009245", shortname = "",},
["Dahomeyan Democratic Movement"] = {abbrev = "", color = "#91ADBC", shortname = "",},
["Dahomeyan Democratic Union"] = {abbrev = "", color = "#5CBB72", shortname = "",},
["Dahomeyan Progressive Union"] = {abbrev = "UPD", color = "#5CBB72", shortname = "",},
["Dainiin Club"] = {abbrev = "", color = "#587dab", shortname = "",},
["Dalit Janajati Party"] = {abbrev = "", color = "blue", shortname = "",},
["Dalit Mazdoor Kisan Party"] = {abbrev = "DMKP", color = "#A5CBFA", shortname = "",},
["Dalit Muslim Vikas Party"] = {abbrev = "DMVP", color = "#293A03", shortname = "",},
["Dalmatian Action"] = {abbrev = "", color = "darkblue", shortname = "",},
["Danish Party"] = {abbrev = "", color = "#CE1126", shortname = "",},
["Danish People's Party"] = {abbrev = "DPP", color = "#FCD03B", shortname = "",},
["Danish Social Liberal Party"] = {abbrev = "", color = "#733280", shortname = "Social Liberals",},
["Danish Unity"] = {abbrev = "", color = "#002366", shortname = "",},
["Dawn – National Coalition"] = {abbrev = "", color = "#004071", shortname = "Dawn",},
["Dawn (Iceland)"] = {abbrev = "", color = "#eab943", shortname = "",},
["Dawn of Direct Democracy"] = {abbrev = "", color = "#66BDFF", shortname = "Dawn",},
["Dayak Unity Party"] = {abbrev = "PPD", color = "#0093dd", shortname = "",},
["Daylight Saving"] = {abbrev = "", color = "#FFFD7A", shortname = "",},
["Daylight Saving Party"] = {abbrev = "", color = "#FFFD7A", shortname = "Daylight Savings",},
["DCIDE"] = {abbrev = "", color = "#3B9F40", shortname = "",},
["De Basis"] = {abbrev = "", color = "#DDDC05", shortname = "Basis",},
["De Nou Reus"] = {abbrev = "", color = "#5CBACC", shortname = "",},
["Death to the System (Spain)"] = {abbrev = "", color = "#0A0A0A", shortname = "",},
["Deák Party"] = {abbrev = "", color = "#AAD8E6", shortname = "",},
["Debout la France"] = {abbrev = "DLF", color = "#0087CD", shortname = "",},
["Debout la République"] = {abbrev = "DLR", color = "#8040C0", shortname = "",},
["Debout Les Belges!"] = {abbrev = "", color = "#CA232B", shortname = "",},
["Decentralist Social Force Party"] = {abbrev = "", color = "#82BC1C", shortname = "",},
["DecideT–EligeT"] = {abbrev = "", color = "#21297C", shortname = "",},
["Decidix"] = {abbrev = "", color = "#DC4868", shortname = "",},
["Decolonization and Social Emancipation Movement"] = {abbrev = "", color = "#AA0000", shortname = "",},
["Defense of the Andalusian People's Interests"] = {abbrev = "", color = "#40903B", shortname = "",},
["DéFI"] = {abbrev = "", color = "#DD0081", shortname = "",},
["Degel HaTorah"] = {abbrev = "", color = "#3E3E3E", shortname = "",},
["Degrowth Party"] = {abbrev = "", color = "#BB0000", shortname = "",},
["Delhi Janata Party"] = {abbrev = "DJP", color = "#CEF6EC", shortname = "",},
["Delhi Poorvanchal Party"] = {abbrev = "DPP", color = "#BCA9F5", shortname = "",},
["Deliberation Tsuen Wan"] = {abbrev = "", color = "#7CBECC", shortname = "Deliberation TW",},
["Demo-Social 12"] = {abbrev = "", color = "#4D955D", shortname = "",},
["Demo-Social 60"] = {abbrev = "", color = "#F58025", shortname = "",},
["Demochristian Party of Albania"] = {abbrev = "PDK", color = "orange", shortname = "",},
["Democracy (Thailand)"] = {abbrev = "", color = "#EE82EE", shortname = "Democracy",},
["Democracy and Catalonia"] = {abbrev = "", color = "#F6BA1B", shortname = "",},
["Democracy and Freedom"] = {abbrev = "DiL", color = "#212765", shortname = "",},
["Democracy and Human Rights Party"] = {abbrev = "", color = "#2E3492", shortname = "",},
["Democracy and Progress Party"] = {abbrev = "", color = "#0069A7", shortname = "",},
["Democracy at Home Party"] = {abbrev = "PPDA", color = "#003399", shortname = "",},
["Democracy First"] = {abbrev = "", color = "#ff8c00", shortname = "",},
["Democracy Groundwork"] = {abbrev = "", color = "#FEED59", shortname = "",},
["Democracy in Europe Movement 2025"] = {abbrev = "DiEM25", color = "#ec5122", shortname = "",},
["Democracy in Motion"] = {abbrev = "DiB", color = "#263d80", shortname = "",},
["Democracy is Freedom – The Daisy"] = {abbrev = "", color = "#3CB371", shortname = "The Daisy",},
["DemocracyNZ"] = {abbrev = "", color = "#30B6C1", shortname = "",},
["Democracy Power Party"] = {abbrev = "", color = "#BC1D2D", shortname = "",},
["Democracy Yes"] = {abbrev = "", color = "#B713C5", shortname = "",},
["Democracy and Development through Unity"] = {abbrev = "DOE", color = "#C8ED69", shortname = "",},
["Democracy, Citizenry and Republic"] = {abbrev = "", color = "#FCDB10", shortname = "",},
["Democrat Party (Chile)"] = {abbrev = "", color = "#E3431F", shortname = "Democrat",},
["Democrat Party (Thailand)"] = {abbrev = "", color = "#00A1F1", shortname = "Democrat",},
["Democrat Party (Turkey, 1946–1961)"] = {abbrev = "", color = "#F7819F", shortname = "Democrat",},
["Democrat Party (Turkey, current)"] = {abbrev = "DP", color = "#CC0000", shortname = "",},
["Democrat Party of Iran"] = {abbrev = "", color = "#093", shortname = "Democrat Party",},
["Democrat Social Movement"] = {abbrev = "", color = "#4CBB17", shortname = "",},
["Democrat Turkey Party"] = {abbrev = "DTP", color = "#DA7766", shortname = "",},
["Democrata Party"] = {abbrev = "", color = "#1434A4", shortname = "Democrata",},
["Democratic Accountants"] = {abbrev = "", color = "#47954E", shortname = "",},
["Democratic Action (El Salvador)"] = {abbrev = "AD", color = "#F95400", shortname = "",},
["Democratic Action (Thailand)"] = {abbrev = "", color = "#BA55D3", shortname = "Democratic Action",},
["Democratic Action (Venezuela)"] = {abbrev = "", color = "#C0C0C0", shortname = "Democratic Action",},
["Democratic Action Congress"] = {abbrev = "DAC", color = "#aa00d4", shortname = "",},
["Democratic Action Party (Spain)"] = {abbrev = "", color = "#3E4E3E", shortname = "",},
["Democratic Action Party"] = {abbrev = "DAP", color = "#ED1C24", shortname = "",},
["Democratic Agrarian Party of Romania"] = {abbrev = "PDAR", color = "yellow", shortname = "",},
["Democratic Action"] = {abbrev = "", color = "#C0C0C0", shortname = "",},
["Democratic Alignment (2015)"] = {abbrev = "", color = "#2D902D", shortname = "",},
["Democratic Alliance (Bulgaria)"] = {abbrev = "", color = "gray", shortname = "",},
["Democratic Alliance (France)"] = {abbrev = "", color = "#FFBF00", shortname = "",},
["Democratic Alliance (Greece)"] = {abbrev = "", color = "#6D85CB", shortname = "",},
["Democratic Alliance (Italy)"] = {abbrev = "", color = "#228B22", shortname = "",},
["Democratic Alliance (New Zealand)"] = {abbrev = "", color = "#FFE802", shortname = "Democratic Alliance",},
["Democratic Alliance (Philippines)"] = {abbrev = "DA", color = "#DC143C", shortname = "Democratic Alliance",},
["Democratic Alliance (Portugal)"] = {abbrev = "AD", color = "#2A52BE", shortname = "",},
["Democratic Alliance (South Africa)"] = {abbrev = "DA", color = "#005BA6", shortname = "Democratic Alliance",},
["Democratic Alliance (Ukraine)"] = {abbrev = "DA", color = "#193695", shortname = "",},
["Democratic Alliance (Venezuela)"] = {abbrev = "", color = "#0F52BA", shortname = "",},
["Democratic Alliance for Niger"] = {abbrev = "", color = "#337585", shortname = "",},
["Democratic Alliance for the Betterment and Progress of Hong Kong"] = {abbrev = "DAB", color = "#1861AC", shortname = "",},
["Democratic Alliance of Croats in Vojvodina"] = {abbrev = "DSHV", color = "#EE1C25", shortname = "",},
["Democratic Alliance of Hungarians in Romania"] = {abbrev = "UDMR", color = "#296633", shortname = "",},
["Democratic Alliance of Wales"] = {abbrev = "DAW", color = "#CCCCCC", shortname = "",},
["Democratic Alliance Party (Albania)"] = {abbrev = "AD", color = "#1369B2", shortname = "",},
["Democratic Alliance Party (Solomon Islands)"] = {abbrev = "", color = "#68C76D", shortname = "Democratic Alliance",},
["Democratic Alliance Party (Tunisia)"] = {abbrev = "", color = "Salmon", shortname = "",},
["Democratic Alternative '91"] = {abbrev = "DA'91", color = "#FFF212", shortname = "",},
["Democratic Alternative (Chile)"] = {abbrev = "", color = "#9ACD32", shortname = "",},
["Democratic Alternative (Finland)"] = {abbrev = "", color = "#FF4D00", shortname = "",},
["Democratic Alternative (Malta)"] = {abbrev = "", color = "#7AC143", shortname = "",},
["Democratic Alternative (North Macedonia)"] = {abbrev = "DA", color = "#800080", shortname = "",},
["Democratic Alternative (Serbia)"] = {abbrev = "DA", color = "#FA8383", shortname = "",},
["Democratic Alternative Party"] = {abbrev = "", color = "#EF7619", shortname = "",},
["Democratic Angola – Coalition"] = {abbrev = "AD–C", color = "#FF0000", shortname = "AD–Coligação",},
["Democratic and Independent Cape Verdean Union"] = {abbrev = "", color = "#0066ff", shortname = "",},
["Democratic and Popular Union"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Democratic and Progressive Union"] = {abbrev = "UDP/DPU", color = "#DAA520", shortname = "",},
["Democratic and Republican Alliance"] = {abbrev = "ADERE", color = "#1935D0", shortname = "",},
["Democratic and Social Centre (Spain)"] = {abbrev = "CDS", color = "#049456", shortname = "",},
["Democratic and Social Convention"] = {abbrev = "", color = "#679A6C", shortname = "CDS-Rahama",},
["Democratic and Social Movement (Algeria)"] = {abbrev = "MDS", color = "#006FB6", shortname = "",},
["Democratic and Social Movement (Morocco)"] = {abbrev = "", color = "#9AAD35", shortname = "",},
["Democratic and Social Party of Ceuta"] = {abbrev = "", color = "#29806D", shortname = "",},
["Democratic and Socialist Union of the Resistance"] = {abbrev = "UDSR", color = "#EF5327", shortname = "",},
["Democratic Ashkali Party of Kosovo"] = {abbrev = "", color = "#01B965", shortname = "",},
["Democratic Axe"] = {abbrev = "", color = "#84171C", shortname = "",},
["Democratic Azad Party"] = {abbrev = "DAP", color = "#FEF01E", shortname = "",},
["Democratic Beginning"] = {abbrev = "DA", color = "#000000", shortname = "",},
["Democratic Bloc (Poland)"] = {abbrev = "BD", color = "#F02F2A", shortname = "",},
["Democratic Bloc (Ukraine)"] = {abbrev = "", color = "#0087DC", shortname = "Democratic Bloc",},
["Democratic Bloc"] = {abbrev = "", color = "blue", shortname = "",},
["Democratic Bulgaria"] = {abbrev = "DB", color = "#004A80", shortname = "",},
["Democratic Center (Colombia)"] = {abbrev = "", color = "#1E90FF", shortname = "Democratic Center",},
["Democratic Center (Ecuador)"] = {abbrev = "", color = "#FF4500", shortname = "",},
["Democratic Centre of Macau"] = {abbrev = "CDM", color = "#DD0000", shortname = "Democratic",},
["Democratic Centre (Croatia)"] = {abbrev = "DC", color = "#006bb3", shortname = "",},
["Democratic Centre (France)"] = {abbrev = "CD", color = "#00CCCC", shortname = "",},
["Democratic Centre (Italy, 2013)"] = {abbrev = "", color = "#FF9900", shortname = "",},
["Democratic Centre (Italy)"] = {abbrev = "", color = "#E86055", shortname = "",},
["Democratic Centre (Latvia)"] = {abbrev = "", color = "blue", shortname = "Democratic Centre",},
["Democratic Centre (Serbia)"] = {abbrev = "DC", color = "#FFFF99", shortname = "",},
["Democratic Centre Coalition"] = {abbrev = "", color = "#4CB034", shortname = "",},
["Democratic Change (El Salvador)"] = {abbrev = "CD", color = "#FFFF00", shortname = "",},
["Democratic Change (Panama)"] = {abbrev = "CD", color = "#2A889B", shortname = "",},
["Democratic Change (South Sudan)"] = {abbrev = "", color = "#FB2026", shortname = "",},
["Democratic Choice of Kazakhstan"] = {abbrev = "", color = "#0083cd", shortname = "",},
["Democratic Choice of Russia – United Democrats"] = {abbrev = "DVR–OD", color = "#3A46CE", shortname = "",},
["Democratic Choice of Russia"] = {abbrev = "", color = "#29166F", shortname = "",},
["Democratic Coalition (Hungary)"] = {abbrev = "DK", color = "#0067AA", shortname = "",},
["Democratic Coalition (Spain)"] = {abbrev = "CD", color = "#8E9629", shortname = "",},
["Democratic Coalition for DC Election"] = {abbrev = "", color = "#D38D4F", shortname = "Democratic Coalition",},
["Democratic Committee of Human Rights"] = {abbrev = "DCHR", color = "#691F6C", shortname = "",},
["Democratic Community of Welfare and Freedom"] = {abbrev = "JESZ", color = "#80BB3D", shortname = "",},
["Democratic Confederation of Labour (Morocco)"] = {abbrev = "", color = "#020202", shortname = "",},
["Democratic Congress"] = {abbrev = "DC", color = "#B70002", shortname = "",},
["Democratic Consent–Republican Party"] = {abbrev = "ID–PR", color = "#317C41", shortname = "",},
["Democratic Conservative Party"] = {abbrev = "PCD", color = "#0000FF", shortname = "",},
["Democratic Constitutional Rally"] = {abbrev = "RCD", color = "FireBrick", shortname = "",},
["Democratic Convention of African Peoples"] = {abbrev = "", color = "red", shortname = "",},
["Democratic Convention of Moldova"] = {abbrev = "CDM", color = "#0061D4", shortname = "",},
["Democratic Convergence (El Salvador)"] = {abbrev = "CVD", color = "#DC241F", shortname = "",},
["Democratic Convergence of Catalonia"] = {abbrev = "CDC", color = "#232D7B", shortname = "",},
["Democratic Convergence Party (Guinea-Bissau)"] = {abbrev = "", color = "#0099FF", shortname = "",},
["Democratic Convergence Party (São Tomé and Príncipe)"] = {abbrev = "", color = "#1102DE", shortname = "",},
["Democratic Conviction"] = {abbrev = "", color = "#0098D8", shortname = "",},
["Democratic Current"] = {abbrev = "", color = "#FE6500", shortname = "",},
["Democratic Development Forum"] = {abbrev = "FDD", color = "#F0F040", shortname = "",},
["Democratic Development Party"] = {abbrev = "DDP", color = "red", shortname = "",},
["Democratic Electoral Commission"] = {abbrev = "", color = "darkred", shortname = "",},
["Democratic European Force"] = {abbrev = "", color = "#00CCCC", shortname = "",},
["Democratic Farmers' Party of Germany"] = {abbrev = "DBD", color = "#006600", shortname = "",},
["Democratic Fellowship of Vojvodina Hungarians"] = {abbrev = "VMDK", color = "green", shortname = "",},
["Democratic Force (Costa Rica)"] = {abbrev = "PFD", color = "#EB6109", shortname = "",},
["Democratic Force Party"] = {abbrev = "", color = "#CA3634", shortname = "Democratic Force",},
["Democratic Forces of Guiana"] = {abbrev = "", color = "#A71585", shortname = "",},
["Democratic Forum (Spain)"] = {abbrev = "", color = "#1C5530", shortname = "",},
["Democratic Forum for Labour and Liberties"] = {abbrev = "", color = "#660000", shortname = "Ettakatol",},
["Democratic Forum for Modernity"] = {abbrev = "", color = "purple", shortname = "",},
["Democratic Forum of Germans in Romania"] = {abbrev = "", color = "#AA2421", shortname = "",},
["Democratic Front (Bosnia and Herzegovina)"] = {abbrev = "DF", color = "#F16822", shortname = "",},
["Democratic Front (Cyprus)"] = {abbrev = "DIPA", color = "#26ACE2", shortname = "",},
["Democratic Front (Montenegro)"] = {abbrev = "DF", color = "#00008B", shortname = "",},
["Democratic Front (Peru)"] = {abbrev = "FREDEMO", color = "#50a7f7", shortname = "",},
["Democratic Front (Thailand)"] = {abbrev = "", color = "#FE9059", shortname = "Democratic Front",},
["Democratic Front for the Liberation of Palestine"] = {abbrev = "DFLP", color = "#D10A2B", shortname = "",},
["Democratic Front for the Reunification of Korea"] = {abbrev = "FF", color = "#FF3333", shortname = "Fatherland Front",},
["Democratic Front of Albania"] = {abbrev = "", color = "#EF4A2E", shortname = "Democratic Front",},
["Democratic Front Party"] = {abbrev = "", color = "#87CEFA", shortname = "",},
["Democratic Galicianist Party"] = {abbrev = "", color = "#3886AC", shortname = "",},
["Democratic Generation Party"] = {abbrev = "", color = "#A9A5B4", shortname = "",},
["Democratic Green Party of Rwanda"] = {abbrev = "", color = "#00FA9A", shortname = "",},
["Democratic Groundwork"] = {abbrev = "", color = "#FEED59", shortname = "",},
["Democratic Group of Albacete"] = {abbrev = "ADA", color = "#4F836A", shortname = "",},
["Democratic Group of the Centre"] = {abbrev = "GDC", color = "yellow", shortname = "",},
["Democratic Hygiene"] = {abbrev = "", color = "#4F6179", shortname = "",},
["Democratic Independence Party"] = {abbrev = "", color = "#AE872A", shortname = "",},
["Democratic Independent Party"] = {abbrev = "", color = "gold", shortname = "",},
["Democratic Independent Regionalist Party"] = {abbrev = "", color = "#4A1C51", shortname = "",},
["Democratic Indira Congress (Karunakaran)"] = {abbrev = "DIC", color = "darkblue", shortname = "",},
["Democratic Initiative for Benalmádena"] = {abbrev = "", color = "#22305E", shortname = "",},
["Democratic Innovation Party"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Democratic Israel"] = {abbrev = "", color = "#0E0348", shortname = "",},
["Democratic Jewish Union"] = {abbrev = "ŽDS", color = "#7F51C7", shortname = "",},
["Democratic Justice Party"] = {abbrev = "DJP", color = "#004C97", shortname = "Democratic Justice",},
["Democratic Justice Party (1987)"] = {abbrev = "DJP", color = "#0A84E9", shortname = "Democratic Justice",},
["Democratic Korea Party"] = {abbrev = "DKP", color = "#ED2939", shortname = "Democratic Korea",},
["Democratic Labor Party (historical)"] = {abbrev = "DLP", color = "#008080", shortname = "",},
["Democratic Labor Party (South Korea)"] = {abbrev = "DLP", color = "#FF6600", shortname = "Democratic Labor",},
["Democratic Labor Party"] = {abbrev = "", color = "#FF9C00", shortname = "",},
["Democratic Labour Party (Australia)"] = {abbrev = "DLP", color = "#EEAF30", shortname = "",},
["Democratic Labour Party (Barbados)"] = {abbrev = "DLP", color = "#FFD700", shortname = "",},
["Democratic Labour Party (Brazil)"] = {abbrev = "PDT", color = "#DC143C", shortname = "",},
["Democratic Labour Party (New Zealand)"] = {abbrev = "", color = "#FFA500", shortname = "Democratic Labour",},
["Democratic Labour Party (Trinidad and Tobago)"] = {abbrev = "DLP", color = "#e25822", shortname = "",},
["Democratic Labour Party (UK, 1972)"] = {abbrev = "", color = "#FF6600", shortname = "Democratic Labour",},
["Democratic Labour Party (UK, 1998)"] = {abbrev = "", color = "#E32636", shortname = "Democratic Labour",},
["Democratic Labour Party of Lithuania"] = {abbrev = "LDDP", color = "#E75480", shortname = "",},
["Democratic League (Catalonia)"] = {abbrev = "", color = "#002D70", shortname = "",},
["Democratic League in Montenegro"] = {abbrev = "DSCG", color = "cornflowerblue", shortname = "",},
["Democratic League of Dardania"] = {abbrev = "", color = "#005CA7", shortname = "",},
["Democratic League of Kosovo"] = {abbrev = "LDK", color = "#F37476", shortname = "",},
["Democratic League/Movement for the Labour Party"] = {abbrev = "", color = "#E392B6", shortname = "",},
["Democratic Left (Ecuador)"] = {abbrev = "ID", color = "#FFA500", shortname = "",},
["Democratic Left (Greece)"] = {abbrev = "DIMAR", color = "#FF4100", shortname = "",},
["Democratic Left (Ireland)"] = {abbrev = "DL", color = "#C700C7", shortname = "Democratic Left",},
["Democratic Left (Spain)"] = {abbrev = "", color = "#DB0000", shortname = "",},
["Democratic Left (UK)"] = {abbrev = "", color = "#CC0033", shortname = "Democratic Left",},
["Democratic Left Alliance – Labour Union"] = {abbrev = "SLD-UP", color = "#CA2021", shortname = "",},
["Democratic Left Alliance (Poland)"] = {abbrev = "SLD", color = "#E2001A", shortname = "",},
["Democratic Left Association"] = {abbrev = "SLD", color = "#E30A15", shortname = "",},
["Democratic Left Front (Spain)"] = {abbrev = "", color = "#7F517C", shortname = "",},
["Democratic Left Front (Sri Lanka)"] = {abbrev = "", color = "#F90818", shortname = "",},
["Democratic Left Movement (Lebanon)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Democratic Left of Catalonia"] = {abbrev = "", color = "#FFE507", shortname = "",},
["Democratic Left Party (Turkey)"] = {abbrev = "DSP", color = "#0087DC", shortname = "",},
["Democratic Left Scotland"] = {abbrev = "", color = "#CC0033", shortname = "Democratic Left",},
["Democratic Leftwing Republican Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Democratic Liberal Congress"] = {abbrev = "", color = "#F70000", shortname = "",},
["Democratic Liberal Party (Japan)"] = {abbrev = "DLP", color = "#42A46B", shortname = "Democratic Liberal",},
["Democratic Liberal Party (Romania)"] = {abbrev = "PDL", color = "#FF6633", shortname = "",},
["Democratic Liberal Party (South Korea)"] = {abbrev = "DLP", color = "#003990", shortname = "Democratic Liberal",},
["Democratic List"] = {abbrev = "", color = "#FDFF46", shortname = "",},
["Democratic List for Israeli Arabs"] = {abbrev = "", color = "#AF0000", shortname = "",},
["Democratic List of Nazareth"] = {abbrev = "", color = "#AF0000", shortname = "",},
["Democratic Majority (Spain)"] = {abbrev = "", color = "#0086D6", shortname = "",},
["Democratic Montenegro"] = {abbrev = "DCG", color = "#F5911D", shortname = "",},
["Democratic Movement – United Georgia"] = {abbrev = "", color = "#0067A5", shortname = "",},
["Democratic Movement (France)"] = {abbrev = "", color = "#EF5327", shortname = "MoDem",},
["Democratic Movement (San Marino)"] = {abbrev = "MD", color = "#F80000", shortname = "",},
["Democratic Movement for Change"] = {abbrev = "", color = "#253EFE", shortname = "Dash",},
["Democratic Movement of Mozambique"] = {abbrev = "MDM", color = "#F9B63C", shortname = "",},
["Democratic Movement of Serbia"] = {abbrev = "DEPOS", color = "#1A4A96", shortname = "",},
["Democratic Municipal Action"] = {abbrev = "", color = "#FF610F", shortname = "",},
["Democratic Nasserist Party"] = {abbrev = "", color = "green", shortname = "",},
["Democratic National Alliance (Antigua & Barbuda)"] = {abbrev = "DNA", color = "#EB8123", shortname = "",},
["Democratic National Alliance (Bahamas)"] = {abbrev = "DNA", color = "#419b41", shortname = "",},
["Democratic National Alliance (Sri Lanka)"] = {abbrev = "", color = "#CCCC33", shortname = "Democratic National Alliance",},
["Democratic National Assembly"] = {abbrev = "", color = "#add8e6", shortname = "",},
["Democratic National Association"] = {abbrev = "", color = "#00008B", shortname = "",},
["Democratic National Front Party"] = {abbrev = "", color = "#BA0E00", shortname = "",},
["Democratic National Front"] = {abbrev = "", color = "#EB6F53", shortname = "",},
["Democratic National Initiative"] = {abbrev = "IDN", color = "#FF00D4", shortname = "",},
["Democratic National Party (Cyprus)"] = {abbrev = "DEK", color = "#783B12", shortname = "",},
["Democratic National Rally"] = {abbrev = "RND", color = "#003153", shortname = "",},
["Democratic National Salvation Front"] = {abbrev = "FDSN", color = "#cc3333", shortname = "",},
["Democratic Nationalist Party (Malta, 1959–1966)"] = {abbrev = "PDN", color = "#A02C2C", shortname = "",},
["Democratic Nationalist Party (Romania)"] = {abbrev = "PND", color = "#000000", shortname = "",},
["Democratic Nationalist Party (South Korea)"] = {abbrev = "DNP", color = "#9acd32", shortname = "Democratic Nationalist",},
["Democratic Nationalists"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Democratic Nationhood Party"] = {abbrev = "PDK", color = "#054C30", shortname = "",},
["Democratic Network"] = {abbrev = "", color = "white", shortname = "",},
["Democratic Non-Partisan Alliance"] = {abbrev = "DNPA", color = "#FF0D6C", shortname = "",},
["Democratic New Macau Association"] = {abbrev = "", color = "#008000", shortname = "",},
["Democratic Opposition of Serbia"] = {abbrev = "DOS", color = "#C0C0C0", shortname = "",},
["Democratic Pact for Catalonia"] = {abbrev = "PDC", color = "#FFC400", shortname = "",},
["Democratic Partnership"] = {abbrev = "", color = "khaki", shortname = "",},
["Democratic Party – demokraci.pl"] = {abbrev = "", color = "#FF9900", shortname = "",},
["Democratic Party (1912)"] = {abbrev = "", color = "#008000", shortname = "Democratic",},
["Democratic Party (1943)"] = {abbrev = "", color = "#6482BF", shortname = "",},
["Democratic Party (Argentina)"] = {abbrev = "PD", color = "#192B6B", shortname = "Democratic Party",},
["Democratic Party (Brazil, 1925-1934)"] = {abbrev = "PD", color = "#191198", shortname= "",},
["Democratic Party (Bulgaria)"] = {abbrev = "", color = "gold", shortname = "",},
["Democratic Party (Cambodia)"] = {abbrev = "", color = "#800080", shortname = "Democratic",},
["Democratic Party (Chile)"] = {abbrev = "", color = "#00FF00", shortname = "",},
["Democratic Party (Cook Islands)"] = {abbrev = "", color = "#1E90FF", shortname = "Democratic",},
["Democratic Party (Costa Rica)"] = {abbrev = "", color = "#2136C2", shortname = "Democratic",},
["Democratic Party (Cuba)"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Democratic Party (Curaçao)"] = {abbrev = "", color = "#E41E2A", shortname = "",},
["Democratic Party (Cyprus)"] = {abbrev = "DIKO", color = "#E07C00", shortname = "",},
["Democratic Party (East Timor)"] = {abbrev = "PD", color = "#004080", shortname = "Democratic",},
["Democratic Party (Georgia)"] = {abbrev = "", color = "#8F8FBF", shortname = "",},
["Democratic Party (Hong Kong)"] = {abbrev = "", color = "#5FB04A", shortname = "Democratic",},
["Democratic Party (Hungary)"] = {abbrev = "DEMP", color = "#1560BD", shortname = "",},
["Democratic Party (Indonesia)"] = {abbrev = "", color = "#2643A3", shortname = "Demokrat",},
["Democratic Party (Italy)"] = {abbrev = "", color = "#EF1C27", shortname = "Democratic Party",},
["Democratic Party (Japan, 1947)"] = {abbrev = "", color = "#EC9502", shortname = "Democratic",},
["Democratic Party (Japan, 1954)"] = {abbrev = "", color = "#A49E05", shortname = "Democratic",},
["Democratic Party (Japan, 1996)"] = {abbrev = "", color = "#E60000", shortname = "Democratic",},
["Democratic Party (Japan, 1998)"] = {abbrev = "", color = "#CE2029", shortname = "Democratic",},
["Democratic Party (Japan, 2016)"] = {abbrev = "", color = "#02217b", shortname = "Democratic",},
["Democratic Party (Kenya)"] = {abbrev = "", color = "#336600", shortname = "Democratic",},
["Democratic Party (Laos)"] = {abbrev = "", color = "#FFCD00", shortname = "",},
["Democratic Party (Luxembourg)"] = {abbrev = "DP", color = "#002C4F", shortname = "",},
["Democratic Party (Macedonia)"] = {abbrev = "DP", color = "#3016C8", shortname = "",},
["Democratic Party (Malta)"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Democratic Party (Mendoza)"] = {abbrev = "", color = "#192B6B", shortname = "Democratic Party",},
["Democratic Party (Mongolia)"] = {abbrev = "DP", color = "#11479E", shortname = "",},
["Democratic Party (Montenegro)"] = {abbrev = "", color = "#09B2ED", shortname = "",},
["Democratic Party (Myanmar)"] = {abbrev = "DP", color = "#FFB00D", shortname = "",},
["Democratic Party (Nicaragua)"] = {abbrev = "", color = "#800000", shortname = "Democratic",},
["Democratic Party (Northern Cyprus)"] = {abbrev = "DP", color = "#DC241f", shortname = "",},
["Democratic Party (Peru)"] = {abbrev = "", color = "#FF3333", shortname = "",},
["Democratic Party (Philippines)"] = {abbrev = "", color = "#1E90FF", shortname = "Democratic",},
["Democratic Party (Poland)"] = {abbrev = "SD", color = "#6495ED", shortname = "",},
["Democratic Party (Portugal)"] = {abbrev = "PD", color = "#FF69B4", shortname = "Democratic",},
["Democratic Party (Romania)"] = {abbrev = "PD", color = "#FF6633", shortname = "",},
["Democratic Party (Serbia)"] = {abbrev = "DS", color = "#FFE000", shortname = "",},
["Democratic Party (Singapore)"] = {abbrev = "DP", color = "#DD6777", shortname = "",},
["Democratic Party (Sint Eustatius)"] = {abbrev = "DP", color = "#C00000", shortname = "",},
["Democratic Party (SL)"] = {abbrev = "", color = "#800080", shortname = "",},
["Democratic Party (Slovakia, 1944)"] = {abbrev = "DS", color = "#002FA7", shortname = "",},
["Democratic Party (Slovakia, 1989)"] = {abbrev = "DS", color = "#002FA7", shortname = "",},
["Democratic Party (Solomon Islands)"] = {abbrev = "", color = "#FFEB33", shortname = "Democratic Party",},
["Democratic Party (South Africa)"] = {abbrev = "DP", color = "#6699CC", shortname = "",},
["Democratic Party (South Korea, 1955)"] = {abbrev = "DP", color = "#000080", shortname = "Democratic",},
["Democratic Party (South Korea, 1990)"] = {abbrev = "DP", color = "#DA2C43", shortname = "Democratic",},
["Democratic Party (South Korea, 1991)"] = {abbrev = "DP", color = "#D82634", shortname = "Democratic",},
["Democratic Party (South Korea, 1995)"] = {abbrev = "DP", color = "#009D68", shortname = "Democratic",},
["Democratic Party (South Korea, 2005)"] = {abbrev = "DP", color = "#00736D", shortname = "Democratic",},
["Democratic Party (South Korea, 2008)"] = {abbrev = "DP", color = "#019E33", shortname = "Democratic",},
["Democratic Party (South Korea, 2011)"] = {abbrev = "DP", color = "#FAC71A", shortname = "Democratic",},
["Democratic Party (South Korea, May 2013)"] = {abbrev = "DP", color = "#28A54A", shortname = "Democratic",},
["Democratic Party (South Korea, September 2013)"] = {abbrev = "DP", color = "#015DA9", shortname = "Democratic",},
["Democratic Party (Sri Lanka)"] = {abbrev = "", color = "#800080", shortname = "Democratic",},
["Democratic Party (Switzerland)"] = {abbrev = "", color = "#0B3861", shortname = "Democratic",},
["Democratic Party (Tajikistan)"] = {abbrev = "", color = "#0080FF", shortname = "",},
["Democratic Party (Tanzania)"] = {abbrev = "", color = "black", shortname = "",},
["Democratic Party (Turkey, 1970)"] = {abbrev = "DP", color = "#ffa500", shortname = "",},
["Democratic Party (Turkey, 1992)"] = {abbrev = "DP", color = "#341D47", shortname = "",},
["Democratic Party (Uganda)"] = {abbrev = "DP", color = "#0C713A", shortname = "",},
["Democratic Party (UK, 1942)"] = {abbrev = "", color = "lightyellow", shortname = "Democratic",},
["Democratic Party (UK, 1969)"] = {abbrev = "", color = "#ffffff", shortname = "Democratic Party",},
["Democratic Party (United States)"] = {abbrev = "D", color = "#3333FF", shortname = "Democratic",},
["Democratic Party (Yugoslavia)"] = {abbrev = "DS", color = "#FFD300", shortname = "",},
["Democratic Party (Zambia)"] = {abbrev = "", color = "#ff338c", shortname = "",},
["Democratic Party \"Saimnieks\""] = {abbrev = "", color = "#861623", shortname = "",},
["Democratic Party – Democratic and Progressive Italy"] = {abbrev = "", color = "#E30613", shortname = "Democratic Party – IDP",},
["Democratic Party Adilet"] = {abbrev = "", color = "#0085fc", shortname = "",},
["Democratic Party for a British Gibraltar"] = {abbrev = "DPBG", color = "", shortname = "",},
["Democratic Party for Progress – Angolan National Alliance"] = {abbrev = "PDP–ANA", color = "#009900", shortname = "",},
["Democratic Party for the People"] = {abbrev = "DPP", color = "#FFBA00", shortname = "",},
["Democratic Party of Albania"] = {abbrev = "PD", color = "#00529C", shortname = "",},
["Democratic Party of Albanians"] = {abbrev = "PDSh", color = "black", shortname = "",},
["Democratic Party of Armenia"] = {abbrev = "", color = "#EC1B24", shortname = "",},
["Democratic Party of Artsakh"] = {abbrev = "", color = "#0072B9", shortname = "Democratic Party",},
["Democratic Party of Chile (1988)"] = {abbrev = "", color = "#000080", shortname = "",},
["Democratic Party of Equatorial Guinea"] = {abbrev = "PDGE", color = "#3051A3", shortname = "",},
["Democratic Party of Greens"] = {abbrev = "DSZ", color = "#007b33", shortname = "",},
["Democratic Party of Guinea – African Democratic Rally"] = {abbrev = "PDG-RDA", color = "#000000", shortname = "",},
["Democratic Party of India (Ambedkar)"] = {abbrev = "DPIA (A)", color = "", shortname = "",},
["Democratic Party of Iranian Kurdistan"] = {abbrev = "KDPI", color = "#FC0000", shortname = "",},
["Democratic Party of Ivory Coast – African Democratic Rally"] = {abbrev = "PDCI–RDA", color = "#0FAF32", shortname = "",},
["Democratic Party of Kazakhstan"] = {abbrev = "", color = "#01AEF3", shortname = "",},
["Democratic Party of Korea"] = {abbrev = "DPK", color = "#004EA2", shortname = "Democratic",},
["Democratic Party of Kosovo"] = {abbrev = "PDK", color = "#2E96D2", shortname = "",},
["Democratic Party of Labour"] = {abbrev = "PDM", color = "#ED2128", shortname = "",},
["Democratic Party of Lesotho"] = {abbrev = "DPL", color = "#4c196e", shortname = "",},
["Democratic Party of Macedonia"] = {abbrev = "DPM", color = "blue", shortname = "",},
["Democratic Party of Macedonians"] = {abbrev = "DPM", color = "#F7D10C", shortname = "",},
["Democratic Party of Moldova"] = {abbrev = "PDM", color = "#264B9D", shortname = "",},
["Democratic Party of Nauru"] = {abbrev = "", color = "#002B7F", shortname = "",},
["Democratic Party of Pensioners of Slovenia"] = {abbrev = "DeSUS", color = "#8DC63F", shortname = "",},
["Democratic Party of Pensioners"] = {abbrev = "", color = "grey", shortname = "",},
["Democratic Party of Republika Srpska"] = {abbrev = "", color = "blue", shortname = "",},
["Democratic Party of Russia"] = {abbrev = "DPR", color = "#DBB726", shortname = "",},
["Democratic Party of Serbia"] = {abbrev = "DSS", color = "#126180", shortname = "",},
["Democratic Party of Serbs in Macedonia"] = {abbrev = "DPSM", color = "#DE0000", shortname = "",},
["Democratic Party of Slovenia"] = {abbrev = "", color = "#3300B2", shortname = "",},
["Democratic Party of Socialists of Montenegro (2021)"] = {abbrev = "DPS", color = "#524FA1", shortname = "",},
["Democratic Party of Socialists of Montenegro"] = {abbrev = "DPS", color = "#F58634", shortname = "",},
["Democratic Party of the Atlantic"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Democratic Party of the Friendly Islands"] = {abbrev = "DPFI", color = "#C20100", shortname = "",},
["Democratic Party of the Left"] = {abbrev = "PDS", color = "#C72F35", shortname = "",},
["Democratic Party of the New Left"] = {abbrev = "", color = "#FD3C0B", shortname = "",},
["Democratic Party of the Philippines"] = {abbrev = "DPP", color = "#0054A5", shortname = "",},
["Democratic Party of Trinidad and Tobago"] = {abbrev = "DPTT", color = "#2A3A8C", shortname = "",},
["Democratic Party of Turkmenistan"] = {abbrev = "TDP", color = "#1CC858", shortname = "",},
["Democratic Party of Turks"] = {abbrev = "DPTM", color = "red", shortname = "",},
["Democratic Party of Ukraine"] = {abbrev = "DPU", color = "#025BAB", shortname = "",},
["Democratic Party of Vietnam"] = {abbrev = "", color = "#0055A4", shortname = "",},
["Democratic Party of Vojvodina Hungarians"] = {abbrev = "", color = "#5c7b59", shortname = "",},
["Democratic Party of Zagorje"] = {abbrev = "", color = "#70bd5d", shortname = "",},
["Democratic Party Sint Maarten"] = {abbrev = "DP", color = "#e21c1a", shortname = "",},
["Democratic Patriotic Alliance of Kurdistan"] = {abbrev = "DPAK", color = "#CCFF33", shortname = "",},
["Democratic Patriots' Unified Party"] = {abbrev = "", color = "#D80100", shortname = "",},
["Democratic Peace Party"] = {abbrev = "", color = "#8DB7E9", shortname = "",},
["Democratic Peasants' Party–Lupu"] = {abbrev = "", color = "#B7D749", shortname = "PȚD–Lupu",},
["Democratic People (Spain)"] = {abbrev = "DP", color = "#5BB829", shortname = "",},
["Democratic People's Alliance"] = {abbrev = "DNS", color = "#2B0E72", shortname = "",},
["Democratic People's Front"] = {abbrev = "DPF", color = "#FF0000", shortname = "",},
["Democratic People's Movement"] = {abbrev = "DPM", color = "#FF4500", shortname = "",},
["Democratic People's Party (Ghana)"] = {abbrev = "DPP", color = "#FF0000", shortname = "",},
["Democratic People's Party (Montenegro)"] = {abbrev = "DPP", color = "#005DA3", shortname = "",},
["Democratic People's Party (San Marino)"] = {abbrev = "PDP", color = "#0068C1", shortname = "",},
["Democratic People's Party (South Korea)"] = {abbrev = "DPP", color = "#353F9C", shortname = "Democratic People's",},
["Democratic People's Party (Turkey)"] = {abbrev = "DEHAP", color = "#984A03", shortname = "Democratic People's",},
["Democratic People's Union"] = {abbrev = "DNZ", color = "#048AEB", shortname = "",},
["Democratic People"] = {abbrev = "DP", color = "#5AC2C5", shortname = "",},
["Democratic Progress Party"] = {abbrev = "DGP", color = "#FF0000", shortname = "",},
["Democratic Progressive Party (Argentina)"] = {abbrev = "PDP", color = "#005C9E", shortname = "Democratic Progressive Party",},
["Democratic Progressive Party (Austria)"] = {abbrev = "DFP", color = "#FFE500", shortname = "",},
["Democratic Progressive Party (Malawi)"] = {abbrev = "DPP", color = "#1E90FF", shortname = "",},
["Democratic Progressive Party (Singapore)"] = {abbrev = "DPP", color = "#FF9900", shortname = "",},
["Democratic Progressive Party (Spain)"] = {abbrev = "", color = "#C92B7D", shortname = "Democratic",},
["Democratic Progressive Party"] = {abbrev = "DPP", color = "#1B9431", shortname = "",},
["Democratic Prosperous Macau Association"] = {abbrev = "", color = "#006400", shortname = "",},
["Democratic Rally of the Comorian People"] = {abbrev = "RDPC", color = "#FFFFFF", shortname = "",},
["Democratic Rally of the Comoros"] = {abbrev = "RDC", color = "#32CD32", shortname = "",},
["Democratic Rally"] = {abbrev = "DISY", color = "#1569C7", shortname = "",},
["Democratic Reform Party (Japan)"] = {abbrev = "", color = "#FF0000", shortname = "Democratic Reform",},
["Democratic Reform"] = {abbrev = "", color = "#2A52BE", shortname = "",},
["Democratic Reform Party of Muslims"] = {abbrev = "DRSM", color = "#74C365", shortname = "",},
["Democratic Reformist Party"] = {abbrev = "", color = "#D13C21", shortname = "",},
["Democratic Reforms Party (Azerbaijan)"] = {abbrev = "", color = "#333399", shortname = "",},
["Democratic Regional Union"] = {abbrev = "DPE", color = "darkorange", shortname = "",},
["Democratic Regions Party"] = {abbrev = "DBP", color = "#30A13E", shortname = "",},
["Democratic Renewal (Andorra)"] = {abbrev = "", color = "orange", shortname = "",},
["Democratic Renewal of Macedonia"] = {abbrev = "", color = "#8DC73F", shortname = "",},
["Democratic Renewal Party (Angola)"] = {abbrev = "PRD", color = "#662531", shortname = "",},
["Democratic Renewal Party (Brazil)"] = {abbrev = "PRD", color = "#008000", shortname = "",},
["Democratic Renewal Party (Benin)"] = {abbrev = "PRD", color = "#FFFA00", shortname = "",},
["Democratic Renewal Party (Cape Verde)"] = {abbrev = "", color = "#02569F", shortname = "",},
["Democratic Renewal Party (Portugal)"] = {abbrev = "PRD", color = "#008000", shortname = "",},
["Democratic Renewal"] = {abbrev = "DIANA", color = "#007FFF", shortname = "",},
["Democratic Renewal Party (Costa Rica)"] = {abbrev = "PRD", color = "#2C93FB", shortname = "",},
["Democratic Renovation"] = {abbrev = "", color = "orange", shortname = "",},
["Democratic Republic of Timor-Leste Party"] = {abbrev = "PDRT", color = "#DE5D83", shortname = "",},
["Democratic Republican Party (South Korea)"] = {abbrev = "", color = "#835B38", shortname = "Democratic Republican",},
["Democratic Republican Party (South Korea, 1997)"] = {abbrev = "", color = "#0D90D6", shortname = "Democratic Republican",},
["Democratic Republican Union"] = {abbrev = "", color = "#feed01", shortname = "",},
["Democratic Revival"] = {abbrev = "DA", color = "darkblue", shortname = "",},
["Democratic Revolution"] = {abbrev = "", color = "#1D4C4F", shortname = "",},
["Democratic Revolutionary Alliance (Bolivia)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Democratic Revolutionary Front – New Alternative"] = {abbrev = "FDR", color = "#1FA045", shortname = "",},
["Democratic Revolutionary Nationalist Party"] = {abbrev = "", color = "#bb0000", shortname = "",},
["Democratic Revolutionary Party"] = {abbrev = "PRD", color = "#003F87", shortname = "",},
["Democratic Revolutionary Peoples Party"] = {abbrev = "DRPP", color = "#006400", shortname = "",},
["Democratic Rioja"] = {abbrev = "", color = "#FFFF6F", shortname = "",},
["Democratic Senate"] = {abbrev = "", color = "#DB64DB", shortname = "",},
["Democratic Serb Party (Montenegro)"] = {abbrev = "DSS", color = "Darkblue", shortname = "",},
["Democratic Social Christian Party"] = {abbrev = "", color = "#556627", shortname = "",},
["Democratic Social Justice Party"] = {abbrev = "DSJP", color = "#A91B0D", shortname = "",},
["Democratic Social Movement"] = {abbrev = "DIKKI", color = "#FF7F00", shortname = "",},
["Democratic Social Party"] = {abbrev = "PDS", color = "#0067A5", shortname = "",},
["Democratic Social-Revolutionary Party of Cuba"] = {abbrev = "", color = "#D21F1B", shortname = "",},
["Democratic Socialism (Chile)"] = {abbrev = "SD", color = "#B7051F", shortname = "",},
["Democratic Socialist Alliance (Spain)"] = {abbrev = "", color = "#EE3507", shortname = "",},
["Democratic Socialist Alliance"] = {abbrev = "", color = "#CC4E5C", shortname = "",},
["Democratic Socialist Coalition"] = {abbrev = "CSD", color = "#00BFFF", shortname = "",},
["Democratic Socialist Left"] = {abbrev = "", color = "#D2323A", shortname = "",},
["Democratic Socialist Party (Argentina)"] = {abbrev = "PSD", color = "#FF9900", shortname = "Democratic Socialist Party",},
["Democratic Socialist Party (Ireland)"] = {abbrev = "DSP", color = "#FF0099", shortname = "Democratic Socialist",},
["Democratic Socialist Party (Japan)"] = {abbrev = "", color = "#FF4F4F", shortname = "Democratic Socialist",},
["Democratic Socialist Party (Morocco)"] = {abbrev = "", color = "#188410", shortname = "",},
["Democratic Socialist Party (Prabodh Chandra)"] = {abbrev = "DSP(PC)", color = "#FF033E", shortname = "",},
["Democratic Socialist Party (South Korea)"] = {abbrev = "", color = "#FF8000", shortname = "Democratic Socialist",},
["Democratic Socialist Party of Greece"] = {abbrev = "", color = "Yellow", shortname = "",},
["Democratic Socialist Radical Party"] = {abbrev = "", color = "#800080", shortname = "",},
["Democratic Socialist Unionist Party"] = {abbrev = "", color = "red", shortname = "",},
["Democratic Socialists '70"] = {abbrev = "DS'70", color = "#A21756", shortname = "",},
["Democratic Socialists of America"] = {abbrev = "", color = "#EB2128", shortname = "",},
["Democratic Society Alliance"] = {abbrev = "", color = "#74C365", shortname = "",},
["Democratic Society Congress"] = {abbrev = "DTK", color = "#029E4A", shortname = "",},
["Democratic Society Party"] = {abbrev = "DTP", color = "#008000", shortname = "",},
["Democratic swaraj party"] = {abbrev = "DSP", color = "#000000", shortname = "",},
["Democratic Tamil National Alliance"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Democratic Tumu Party"] = {abbrev = "", color = "#C8102E", shortname = "Democratic Tumu",},
["Democratic Turkish Union of Romania"] = {abbrev = "RDTB", color = "#E30A17", shortname = "",},
["Democratic Unification Party (South Korea)"] = {abbrev = "", color = "#c93", shortname = "Democratic Unification",},
["Democratic Unification Party"] = {abbrev = "UD", color = "#FEF100", shortname = "",},
["Democratic Union (Czech Republic)"] = {abbrev = "DEU", color = "#6D051C", shortname = "",},
["Democratic Union (Greece)"] = {abbrev = "DE", color = "#FFC0CB", shortname = "",},
["Democratic Union (Greece, 1956)"] = {abbrev = "DE", color = "#FFA500", shortname = "",},
["Democratic Union (Guatemala)"] = {abbrev = "UD", color = "#4fadea", shortname = "",},
["Democratic Union (Israel)"] = {abbrev = "", color = "#029A3D", shortname = "Democratic Union",},
["Democratic Union (Italy)"] = {abbrev = "", color = "#800080", shortname = "",},
["Democratic Union (Bosnia and Herzegovina)"] = {abbrev = "DEMOS", color = "#ED1C24", shortname = "",},
["Democratic Union (Poland)"] = {abbrev = "UD", color = "#DB812E", shortname = "",},
["Democratic Union Coalition (1996–2000)"] = {abbrev = "", color = "#074DA9", shortname = "Democratic Union",},
["Democratic Union for Integration"] = {abbrev = "BDI", color = "#344b9b", shortname = "",},
["Democratic Union for Revival"] = {abbrev = "DAK", color = "#1F2563", shortname = "",},
["Democratic Union for the Respect of Labour"] = {abbrev = "UDRT/RAD", color = "black", shortname = "",},
["Democratic Union for the Republic"] = {abbrev = "", color = "#FF7F00", shortname = "",},
["Democratic Union Movement"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Democratic Union of Albanians"] = {abbrev = "UDSH", color = "#E65532", shortname = "",},
["Democratic Union of Catalonia"] = {abbrev = "", color = "#0053A1", shortname = "",},
["Democratic Union of Croats"] = {abbrev = "DZH", color = "#E5111D", shortname = "",},
["Democratic Union of Hungarians in Romania"] = {abbrev = "", color = "#15803C", shortname = "",},
["Democratic Union of Hungarians of Croatia"] = {abbrev = "DZMH", color = "#15803C", shortname = "",},
["Democratic Union of Slovakia"] = {abbrev = "DEÚS", color = "#007BA7", shortname = "",},
["Democratic Union of Slovaks and Czechs of Romania"] = {abbrev = "UDSCR", color = "#1136F2", shortname = "",},
["Democratic Union of Taiwan"] = {abbrev = "", color = "#FF9826", shortname = "Democratic Union",},
["Democratic Union of the Malian People"] = {abbrev = "UDPM", color = "#008000", shortname = "",},
["Democratic Union of the Region of Murcia"] = {abbrev = "", color = "#039C06", shortname = "",},
["Democratic Union of the Rwandan People"] = {abbrev = "", color = "#344EA3", shortname = "",},
["Democratic Union of the Vlachs of Macedonia"] = {abbrev = "DSVM", color = "", shortname = "",},
["Democratic Union of Turkish-Muslim Tatars of Romania"] = {abbrev = "RMTTDB", color = "yellow", shortname = "",},
["Democratic Union Party (Romania)"] = {abbrev = "PDU", color = "blue", shortname = "",},
["Democratic Union–Broad Centre"] = {abbrev = "", color = "#F6643D", shortname = "",},
["Democratic Unionist Party (Sudan)"] = {abbrev = "DUP", color = "#00A6EF", shortname = "",},
["Democratic Unionist Party"] = {abbrev = "DUP", color = "#D46A4C", shortname = "",},
["Democratic United National Front"] = {abbrev = "", color = "green", shortname = "",},
["Democratic United Party"] = {abbrev = "", color = "#FFD400", shortname = "Democratic United",},
["Democratic Unity Alliance"] = {abbrev = "", color = "#F8A718", shortname = "",},
["Democratic Unity Roundtable"] = {abbrev = "MUD", color = "#0F52BA", shortname = "",},
["Democratic Way (Spain)"] = {abbrev = "", color = "#FFAE00", shortname = "",},
["Democratic Way Party"] = {abbrev = "", color = "#87a1fe", shortname = "",},
["Democratic Women's League of Germany"] = {abbrev = "", color = "#3d61d6", shortname = "",},
["Democratic-Independent Party (North Dakota)"] = {abbrev = "", color = "#66CCFF", shortname = "",},
["Democratic-People's Party"] = {abbrev = "", color = "#3333FF", shortname = "Democratic-People's",},
["Democratic-Republican (Adams)"] = {abbrev = "", color = "#68C468", shortname = "",},
["Democratic-Republican (Jackson)"] = {abbrev = "", color = "#698DC5", shortname = "",},
["Democratic-Republican (Crawford)"] = {abbrev = "", color = "#FF9955", shortname = "",},
["Democratic-Republican Party (1844)"] = {abbrev = "", color = "#808000", shortname = "",},
["Democratic-Republican Party"] = {abbrev = "", color = "#008000", shortname = "Democratic-Republican",},
["Democratic-Social Movement (Poland)"] = {abbrev = "RDS", color = "#FAAA49", shortname = "",},
["Democratic/Country coalition"] = {abbrev = "", color = "#6495ED", shortname = "",},
["Democratic/Hold"] = {abbrev = "", color = "#EEF6FF", shortname = "",},
["Democrats (Brazil)"] = {abbrev = "DEM", color = "#8CC63E", shortname = "",},
["Democrats (Chile)"] = {abbrev = "", color = "#DA1764", shortname = "",},
["Democrats (Croatia)"] = {abbrev = "", color = "#B00F1F", shortname = "",},
["Democrats (Greece)"] = {abbrev = "", color = "midnightblue", shortname = "Democrats",},
["Democrats (Greenland)"] = {abbrev = "", color = "#152D49", shortname = "Democrats",},
["Democrats (Slovakia)"] = {abbrev = "", color = "#50168E", shortname = "Democrats",},
["Democrats 66"] = {abbrev = "D66", color = "#00CD67", shortname = "",},
["Democrats and Veterans"] = {abbrev = "", color = "#000000", shortname = "",},
["Democrats for a Strong Bulgaria"] = {abbrev = "DSB", color = "#02528A", shortname = "",},
["Democrats for Andorra"] = {abbrev = "DA", color = "#EA7A28", shortname = "",},
["Democrats for Liechtenstein"] = {abbrev = "", color = "#005EA8", shortname = "DpL",},
["Democrats for Responsibility, Solidarity and Tolerance"] = {abbrev = "", color = "#1A70B8", shortname = "",},
["Democrats of Catalonia"] = {abbrev = "DC", color = "#1375CE", shortname = "",},
["Democrats of the Left"] = {abbrev = "DS", color = "#C72F35", shortname = "",},
["DEMOS (Montenegro)"] = {abbrev = "DEMOS", color = "#89CFF0", shortname = "",},
["Demos+"] = {abbrev = "", color = "#F97D19", shortname = "",},
["Demosisto"] = {abbrev = "", color = "#37C8B4", shortname = "",},
["Demosistō"] = {abbrev = "", color = "#37C8B4", shortname = "",},
["DENK (political party)"] = {abbrev = "DENK", color = "#00B7B2", shortname = "",},
["Denmark Democrats"] = {abbrev = "", color = "#1273FF", shortname = "Denmark Democrats",},
["Denok Hiritar"] = {abbrev = "", color = "#FEF900", shortname = "",},
["Der Wandel"] = {abbrev = "", color = "#D32C0B", shortname = "Wandel",},
["Derekh Eretz (political faction)"] = {abbrev = "", color = "#277EE5", shortname = "",},
["Derryn Hinch's Justice Party"] = {abbrev = "", color = "#002F5D", shortname = "Justice",},
["Derwentside Independents"] = {abbrev = "", color = "#9F009F", shortname = "",},
["Derzhava (Russian party)"] = {abbrev = "", color = "#959698", shortname = "",},
["Derzhava (Ukrainian party)"] = {abbrev = "", color = "#FF0000", shortname = "Derzhava",},
["Des de Baix"] = {abbrev = "", color = "#EF7D00", shortname = "",},
["Desh Bhakt Party"] = {abbrev = "DBP", color = "#B404AE", shortname = "",},
["Desire the Right Party"] = {abbrev = "", color = "#0087DC", shortname = "Desire the Right",},
["Desiya Murpokku Dravida Kazhagam"] = {abbrev = "DMDK", color = "#FFEA19", shortname = "",},
["Destiny New Zealand"] = {abbrev = "", color = "#FFFF00", shortname = "Destiny",},
["Destour"] = {abbrev = "", color = "#7F1A03", shortname = "",},
["Destourian Movement"] = {abbrev = "", color = "RebeccaPurple", shortname = "",},
["Deutsche Mitte"] = {abbrev = "DM", color = "#284f8d", shortname = "",},
["Deutsche Reichspartei"] = {abbrev = "", color = "#8B4726", shortname = "",},
["Development and Peace (political party)"] = {abbrev = "", color = "#6A287E", shortname = "Flatto-Sharon",},
["Development Movement"] = {abbrev = "", color = "#8F188F", shortname = "",},
["Development/For!"] = {abbrev = "AP!", color = "#FFEC00", shortname = "",},
["Devizes Guardians"] = {abbrev = "", color = "#9A114F", shortname = "",},
["Dharmacracy Party"] = {abbrev = "DP", color = "#F46A26", shortname = "",},
["Dharmacracy Party (Thailand)"] = {abbrev = "", color = "#C8BCA7", shortname = "Dharmacracy",},
["Dhivehi Rayyithunge Party"] = {abbrev = "DRP", color = "#3F89C0", shortname = "",},
["Diàleg Republicà"] = {abbrev = "", color = "#CD2E33", shortname = "",},
["Dialogue – The Greens' Party"] = {abbrev = "PZ", color = "#39B54A", shortname = "",},
["Dialogue for Hungary"] = {abbrev = "PM", color = "#3CB34D", shortname = "",},
["Dialogue Party"] = {abbrev = "", color = "#D32270", shortname = "",},
["Dibyojyoti Singh Deo"] = {abbrev = "", color = "#DD4561", shortname = "",},
["Die PARTEI"] = {abbrev = "PARTEI", color = "#B5152B", shortname = "",},
["Die Urbane. Eine HipHop Partei"] = {abbrev = "du.", color = "#E66346", shortname = "",},
["DierAnimal"] = {abbrev = "", color = "#148C8B", shortname = "",},
["Different Cantabria"] = {abbrev = "", color = "#96D351", shortname = "",},
["Digital Party"] = {abbrev = "", color = "#F36F21", shortname = "Digital",},
["Dignidad Ahora"] = {abbrev = "", color = "#EC8431", shortname = "",},
["Dignity and Charity"] = {abbrev = "DM", color = "#0BC3AD", shortname = "",},
["Dignity and Truth Platform"] = {abbrev = "PPDA", color = "#409FD9", shortname = "",},
["Dignity Coalition"] = {abbrev = "", color = "#3D7254", shortname = "",},
["Dignity Now!"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Dignity Party (Algeria)"] = {abbrev = "", color = "#008000", shortname = "Dignity",},
["Dignity Party (Egypt)"] = {abbrev = "", color = "#008000", shortname = "",},
["Dignity Party (South Australia)"] = {abbrev = "", color = "#69359C", shortname = "Dignity",},
["Dikwankwetla Party of South Africa"] = {abbrev = "", color = "#4B393B", shortname = "Dikwankwetla Party",},
["Direct Democracy (Peru)"] = {abbrev = "", color = "yellow", shortname = "",},
["Direct Democracy (Poland)"] = {abbrev = "DB", color = "#00FFFF", shortname = "Direct Democracy",},
["Direct Democracy Ireland"] = {abbrev = "", color = "#87CEFA", shortname = "Direct Democracy",},
["Direct Democracy Party of New Zealand"] = {abbrev = "", color = "#F28317", shortname = "Direct Democracy",},
["Direct Democratic Participation of Galicia"] = {abbrev = "", color = "#4FAECD", shortname = "",},
["Direct Democrats (Sweden)"] = {abbrev = "DD", color = "orange", shortname = "",},
["Direction – Slovak Social Democracy"] = {abbrev = "SMER–SD", color = "#d82222", shortname = "",},
["Dissident Left"] = {abbrev = "", color = "#66CC99", shortname = "Dissident Left",},
["Dixiecrat"] = {abbrev = "", color = "#FF9955", shortname = "",},
["Do not let Belgrade drown"] = {abbrev = "NDB", color = "#276030", shortname = "",},
["Doctrinaires"] = {abbrev = "", color = "#87CEFA", shortname = "",},
["Domani Motus Liberi"] = {abbrev = "DML", color = "#039ADA", shortname = "",},
["Dōmei Seisha"] = {abbrev = "", color = "#825C8C", shortname = "",},
["Dominica Freedom Party"] = {abbrev = "DFP", color = "#008000", shortname = "",},
["Dominica Labour Party"] = {abbrev = "DLP", color = "#F0001C", shortname = "",},
["Dominica United People's Party"] = {abbrev = "", color = "orange", shortname = "",},
["Dominican Communist Party"] = {abbrev = "", color = "#CE2029", shortname = "",},
["Dominican Humanist Party"] = {abbrev = "", color = "#FFEF52", shortname = "",},
["Dominican Liberation Party"] = {abbrev = "PLD", color = "#870B9C", shortname = "",},
["Dominican Party"] = {abbrev = "", color = "#964B00", shortname = "",},
["Dominican Revolutionary Party"] = {abbrev = "PRD", color = "#ADD8E6", shortname = "",},
["Dominicans for Change"] = {abbrev = "", color = "#12e3ff", shortname = "",},
["Dominion Labor Party (Alberta)"] = {abbrev = "", color = "transparent", shortname = "Labor",},
["Dominion Party (South Africa)"] = {abbrev = "", color = "#50C878", shortname = "Dominion",},
["Donegal Progressive Party"] = {abbrev = "", color = "#FF7F00", shortname = "",},
["Donetsk Republic (political party)"] = {abbrev = "", color = "#005087", shortname = "",},
["Doordarshi Party"] = {abbrev = "", color = "#00FF99", shortname = "",},
["Dor (political party)"] = {abbrev = "", color = "#409199", shortname = "",},
["Dōshi Club (1900s)"] = {abbrev = "", color = "#0018ED", shortname = "",},
["Dōshi Seisha"] = {abbrev = "", color = "#4D5269", shortname = "",},
["Dovira"] = {abbrev = "", color = "#1A9DAA", shortname = "Dovira",},
["Downlands Resident Group"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Dr. A. P. J. Abdul Kalam"] = {abbrev = "", color = "#DB7099", shortname = "",},
["Drago Project"] = {abbrev = "", color = "#232323", shortname = "",},
["Drassi"] = {abbrev = "", color = "#f37021", shortname = "",},
["Dravida Munnetra Kazhagam"] = {abbrev = "DMK", color = "#FF0D0D", shortname = "",},
["Druk Chirwang Tshogpa"] = {abbrev = "", color = "#FCB116", shortname = "",},
["Druk Nyamrup Tshogpa"] = {abbrev = "DNT", color = "#F9C6D9", shortname = "",},
["Druk Phuensum Tshogpa"] = {abbrev = "DPT", color = "#E48400", shortname = "",},
["Druk Thuendrel Tshogpa"] = {abbrev = "DTT", color = "#4a85c4", shortname = "",},
["Dublin Trades Council"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Duma Polska"] = {abbrev = "", color = "#E04A4B", shortname = "",},
["Dutch People's Union"] = {abbrev = "", color = "red", shortname = "",},
["Dveri"] = {abbrev = "", color = "#E32636", shortname = "",},
["Dynastic Left"] = {abbrev = "", color = "#5FA082", shortname = "Leftist",},
["Džemijet"] = {abbrev = "", color = "black", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
3cd0a7dc0bb4a4b108493fadc38e3404795bd873
Module:Political party/R
828
229
451
450
2023-12-24T02:13:34Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Political_party/R]]
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["Radical and Radical-Socialist Party"] = "Radical Party (France)",
["Radical Democracy Party (Chile)"] = "Radical Democracy (Chile)",
["Radical List"] = "Liberal League (Luxembourg)",
["Radical Party (Italy, 1877)"] = "Italian Radical Party",
["Radical Party (UK)"] = "Radicals (UK)",
["Radical Party (Ukraine)"] = "Radical Party of Oleh Liashko",
["Radical Party (Chile)"] = "Radical Party of Chile",
["Radical Party of Oleh Lyashko"] = "Radical Party of Oleh Liashko",
["Rainbow Group (1984-1989)"] = "Rainbow Group (1984–1989)",
["Rainbow Group"] = "Greens–European Free Alliance",
["Rally Wallonia France"] = "Rassemblement Wallonie France",
["Rassemblement bleu Marine"] = "National Rally",
["Resurgence Party"] = "Rastakhiz Party",
["Ratepayers Association"] = "Ratepayers' Association",
["Ratepayers Associations"] = "Ratepayers' Association",
["Razem"] = "Left Together",
["Reason of the Polish Left"] = "Reason Party (Poland)",
["Readjuster Party (United States)"] = "Readjuster Party",
["Red-Green Alliance (Denmark)"] = "Red–Green Alliance (Denmark)",
["Referendum Party (UK)"] = "Referendum Party",
["Reform and Development Misruna Party"] = "Reform and Development Party (Egypt)",
["Reform Party (Iceland, 2016)"] = "Reform Party (Iceland)",
["Reform Party (United States)"] = "Reform Party (US)",
["Reform Party of New York State"] = "Reform Party (New York State)",
["Reform Party of the United States of America"] = "Reform Party (US)",
["Reform Party"] = "Reform Party (Southern Rhodesia)",
["Reform"] = "Estonian Reform Party",
["Reformed Political Party - Reformatory Political Federation - Reformed Political League"] = "Reformed Political Party – Reformatory Political Federation – Reformed Political League",
["Regionalist"] = "Regionalism (politics)",
["Regionalists"] = "Regionalism (politics)",
["Regionalists and separatists"] = "Regionalism (politics)",
["Regionalist Aragonese Party"] = "Aragonese Party",
["Régions et Peuples Solidaires"] = "Regionalism (politics)",
["Renaissance Party"] = "Ennahda Movement",
["Renew Britain"] = "Renew Party",
["Renewal (Transnistria)"] = "Obnovlenie",
["Renua Ireland"] = "Renua",
["REPUBLIC (Slovakia)"] = "Republic (Slovakia)",
["Republic Arise"] = "Debout la République",
["Republic Party"] = "Party of the Republic",
["Republican Coalition (Spain, 1891)"] = "Republican Fusion",
["Republican Coalition (Spain, 1996)"] = "Alliance for the Republic (Spain)",
["Republican Left of Catalonia-Sovereigntists"] = "Republican Left of Catalonia",
["Republican Left of Catalonia–Catalonia Yes"] = "Republican Left of Catalonia",
["Republican Left of Catalonia–Sovereigntists"] = "Republican Left of Catalonia", -- dash difference
["Republican Left of the Valencian Country"] = "Republican Left of Catalonia",
["Republican Moderate Party of Alaska"] = "Republican Moderate Party (Alaska)",
["Republican Party (Chile)"] = "Republican Party (Chile, 2019)",
["Republican Party (Faroe Islands)"] = "Republic (Faroe Islands)",
["Republican Party (Poland)"] = "The Republicans (Poland)",
["Republican Party (US)"] = "Republican Party (United States)",
["Republican Party (Alabama)"] = "Republican Party (United States)",
["Republican Party (Alaska)"] = "Republican Party (United States)",
["Republican Party (Arizona)"] = "Republican Party (United States)",
["Republican Party (Arkansas)"] = "Republican Party (United States)",
["Republican Party (California)"] = "Republican Party (United States)",
["Republican Party (Colorado)"] = "Republican Party (United States)",
["Republican Party (Connecticut)"] = "Republican Party (United States)",
["Republican Party (Delaware)"] = "Republican Party (United States)",
["Republican Party (Georgia, US)"] = "Republican Party (United States)",
["Republican Party (Guam)"] = "Republican Party (United States)",
["Republican Party (Hawaii)"] = "Republican Party (United States)",
["Republican Party (Idaho)"] = "Republican Party (United States)",
["Republican Party (Illinois)"] = "Republican Party (United States)",
["Republican Party (Iowa)"] = "Republican Party (United States)",
["Republican Party (Maryland)"] = "Republican Party (United States)",
["Republican Party (Massachusetts)"] = "Republican Party (United States)",
["Republican Party (Michigan)"] = "Republican Party (United States)",
["Republican Party (Minnesota)"] = "Republican Party (United States)",
["Republican Party (Missouri)"] = "Republican Party (United States)",
["Republican Party (Nevada)"] = "Republican Party (United States)",
["Republican Party (New Mexico)"] = "Republican Party (United States)",
["Republican Party (New York)"] = "Republican Party (United States)",
["Republican Party (North Dakota)"] = "Republican Party (United States)",
["Republican Party (Northern Mariana Islands)"] = "Republican Party (United States)",
["Republican Party (Pennsylvania)"] = "Republican Party (United States)",
["Republican Party (Rhode Island)"] = "Republican Party (United States)",
["Republican Party (Utah)"] = "Republican Party (United States)",
["Republican Party (Vermont)"] = "Republican Party (United States)",
["Republican Party (Virginia)"] = "Republican Party (United States)",
["Republican Party (Washington State)"] = "Republican Party (United States)",
["Republican Party (Washington)"] = "Republican Party (United States)",
["Republican Party (West Virginia)"] = "Republican Party (United States)",
["Republican Party of Alaska"] = "Republican Party (United States)",
["Republican Party of Arkansas"] = "Republican Party (United States)",
["Republican Party of Florida"] = "Republican Party (United States)",
["Republican Party of Georgia"] = "Republican Party (United States)",
["Republican Party of India (A)"] = "Republican Party of India (Athawale)",
["Republican Party of India (Athvale)"] = "Republican Party of India (Athawale)",
["Republican Party of Iowa"] = "Republican Party (United States)",
["Republican Party of Kentucky"] = "Republican Party (United States)",
["Republican Party of Louisiana"] = "Republican Party (United States)",
["Republican Party of Minnesota"] = "Republican Party (United States)",
["Republican Party of New Mexico"] = "Republican Party (United States)",
["Republican Party of São Paulo"] = "Paulista Republican Party",
["Republican Party of Texas"] = "Republican Party (United States)",
["Republican Party of Virginia"] = "Republican Party (United States)",
["Republican Party of Wisconsin"] = "Republican Party (United States)",
["Republican People's Party (Turkey)"] = "Republican People's Party",
["Republican Pole"] = "Citizen and Republican Movement",
["Republican Popular Unity"] = "Communist Party of Spain (Marxist–Leninist) (historical)",
["Republican Statehood Party"] = "Partido Estadista Republicano",
["Republican Union (Spain, 1886)"] = "Republican Fusion",
["Republican Union (Spain, 1893)"] = "Republican Fusion",
["Republican, Radical and Radical-Socialist Party (historical)"] = "Radical Party (France)",
["Republican, Radical and Radical-Socialist Party"] = "Radical Party (France)",
["Reconquête (political party)"] = "Reconquête",
["Respect - The Unity Coalition"] = "Respect Party",
["Respect – The Unity Coalition"] = "Respect Party",
["RESPECT The Unity Coalition"] = "Respect Party",
["Respublika Party of Kyrgyzstan"] = "Respublika (political party)",
["Restoration Political Party - New Wind"] = "Ishin Seito Shimpu",
["Reunited National Party"] = "Herenigde Nasionale Party",
["Revival (Moldova)"] = "Revival Party (Moldova)",
["Revolution Continues"] = "The Revolution Continues Alliance",
["Revolutionary Committee of the Kuomintang"] = "Revolutionary Committee of the Chinese Kuomintang",
["Revolutionary Communist Party (Furedi)"] = "Revolutionary Communist Party (UK, 1978)",
["Revolutionary Front for an Independent East Timor"] = "Fretilin",
["Revolutionary Nationalist Movement-Alliance"] = "Revolutionary Nationalist Movement",
["Revolutionary Nationalist Movement–Alliance"] = "Revolutionary Nationalist Movement", -- dash difference
["Revolutionary Nationalist Movement – Vanguard"] = "9 April Revolutionary Vanguard",
["Revolutionary Communist League (Luxembourg)"] = "Revolutionary Socialist Party (Luxembourg)",
["Revolutionary Workers Party (United States)"] = "Revolutionary Workers Party (US)",
["Rhode Island Democratic Party"] = "Democratic Party (United States)",
["Rhode Island Republican Party"] = "Republican Party (United States)",
["Right Cause (political party)"] = "Right Cause",
["Right to Life Party (US)"] = "New York State Right to Life Party",
["Right to Life Party (New York)"] = "New York State Right to Life Party",
["Rightist Party"] = "Moderate Party",
["Rightist Socialist Party of Japan"] = "Right Socialist Party of Japan",
["Rikken Seiyukai"] = "Rikken Seiyūkai",
["Rikken Minseito"] = "Constitutional Democratic Party (Japan)",
["Rikken Minseitō"] = "Constitutional Democratic Party (Japan)",
["Ring of Independents"] = "Alliance of Independents",
["Riojan Party (1990–2012)"] = "Riojan Party",
["RISE - Scotland's Left Alliance"] = "RISE – Scotland's Left Alliance",
["Rivers State People's Democratic Party"] = "Rivers State Peoples Democratic Party",
["Rodina"] = "Rodina (political party)",
["Romandy Citizens' Movement"] = "Geneva Citizens' Movement",
["Romanian National Party (Moldova)"] = "New Historical Option",
["Romanian Socialist Party (present day)"] = "Romanian Socialist Party (2003)",
["RSP Against Racism and Fascism"] = "Revolutionary Socialist Party (Luxembourg)",
["Rule of Law (Armenia)"] = "Orinats Yerkir",
["Runnymede Independent Residents Group"] = "Runnymede Independent Residents' Group",
["Runnymede Residents Association"] = "Runnymede Independent Residents' Group",
}
local full = {
["Radcliffe First"] = {abbrev = "", color = "#F86204", shortname = "",},
["Radical Cause"] = {abbrev = "LCR", color = "#1E90FF", shortname = "",},
["Radical Change"] = {abbrev = "", color = "#FB656F", shortname = "",},
["Radical Civic Union"] = {abbrev = "UCR", color = "#E10019", shortname = "",},
["Radical Democracy (Chile)"] = {abbrev = "", color = "#00E2C8", shortname = "",},
["Radical Democratic Party (Bulgaria)"] = {abbrev = "", color = "#1C4482", shortname = "",},
["Radical Democratic Party (Spain)"] = {abbrev = "", color = "#DD6284", shortname = "Radical",},
["Radical Doctrinaire Party"] = {abbrev = "", color = "lightseagreen", shortname = "",},
["Radical League"] = {abbrev = "RL", color = "#FFFF00", shortname = "",},
["Radical Left (Luxembourg)"] = {abbrev = "", color = "#800080", shortname = "",},
["Radical Left Front"] = {abbrev = "MERA", color = "indianred", shortname = "",},
["Radical Left Party (Chile)"] = {abbrev = "", color = "yellow", shortname = "",},
["Radical Liberal Party (Luxembourg)"] = {abbrev = "", color = "#F4EE00", shortname = "",},
["Radical Liberal Party (Paraguay)"] = {abbrev = "", color = "#808080", shortname = "Radical Liberal",},
["Radical Movement"] = {abbrev = "MR", color = "#E0B0FF", shortname = "",},
["Radical Party of Chile"] = {abbrev = "", color = "#CD5C5C", shortname = "Radical",},
["Radical Party of Chile (2018)"] = {abbrev = "", color = "#CD5C5C", shortname = "Radical",},
["Radical Party (Belgium)"] = {abbrev = "", color = "#800080", shortname = "Radical",},
["Radical Party (France)"] = {abbrev = "PRV", color = "#E0B0FF", shortname = "",},
["Radical Party (Italy)"] = {abbrev = "PR", color = "#FFD700", shortname = "Radical Party",},
["Radical Party (Luxembourg)"] = {abbrev = "", color = "#F3C400", shortname = "",},
["Radical Party of Oleh Liashko"] = {abbrev = "RPOL", color = "#D64541", shortname = "",},
["Radical Party of Republika Srpska"] = {abbrev = "", color = "Darkblue", shortname = "RS RS",},
["Radical Party of the Left"] = {abbrev = "PRG", color = "#F0C200", shortname = "",},
["Radical Peasant Party"] = {abbrev = "CSR", color = "#33452D", shortname = "",},
["Radical People's Party (Finland)"] = {abbrev = "", color = "Red", shortname = "",},
["Radical People's Party (Norway)"] = {abbrev = "", color = "#59A421", shortname = "Radical People's",},
["Radical Republican Party"] = {abbrev = "PRR", color = "#A871A8", shortname = "",},
["Radical Socialist Catalan Left"] = {abbrev = "", color = "#AF2A88", shortname = "",},
["Radical Socialist Party (Luxembourg)"] = {abbrev = "", color = "#F3C400", shortname = "",},
["Radical Socialist Republican Party"] = {abbrev = "PRRS", color = "#9A0DBC", shortname = "",},
["Radical Union (Cuba)"] = {abbrev = "", color = "#FA8072", shortname = "",},
["Radicals (UK)"] = {abbrev = "", color = "#FF3333", shortname = "Radical",},
["Rafi (political party)"] = {abbrev = "", color = "#1935D0", shortname = "Rafi",},
["Rafidain List"] = {abbrev = "", color = "#5f21a9", shortname = "",},
["Rah-e-Haq Party"] = {abbrev = "RHP", color = "#A9A9A9", shortname = "",},
["Rahanweyn Resistance Army"] = {abbrev = "RRA", color = "#DC143C", shortname = "",},
["Raijor Dal"] = {abbrev = "RD", color = "#FEE502", shortname = "",},
["Rainbow (Greece)"] = {abbrev = "", color = "#E2725B", shortname = "Rainbow",},
["Rainbow (Iceland)"] = {abbrev = "", color = "#CC0000", shortname = "Rainbow",},
["Rainbow (Netherlands)"] = {abbrev = "", color = "#76EE00", shortname = "Rainbow",},
["Rainbow Greens (Italy)"] = {abbrev = "", color = "#4B6F44", shortname = "Rainbow Greens",},
["Rainbow Group (1984–1989)"] = {abbrev = "RBW", color = "#ADFF2F", shortname = "",},
["Rainbow Group (1989–1994)"] = {abbrev = "RBW", color = "#ADFF2F", shortname = "",},
["Rainbow Party (Zambia)"] = {abbrev = "", color = "#E3001B", shortname = "",},
["Rainham & Wennington Independent Residents Group"] = {abbrev = "", color = "#dddddd", shortname = "",},
["RAIZ"] = {abbrev = "", color = "#2d3e4e", shortname = "",},
["Raise Extremadura"] = {abbrev = "", color = "#169744", shortname = "",},
["Rajasthan Vikas Party"] = {abbrev = "RJVP", color = "#FF3366", shortname = "",},
["Rajyadhikara Party"] = {abbrev = "", color = "#DDD", shortname = "",},
["Rak Santi Party"] = {abbrev = "", color = "green", shortname = "Rak Santi",},
["Rak Thailand Party"] = {abbrev = "", color = "#0000FF", shortname = "Rak Thailand",},
["Rakhine Nationalities Development Party"] = {abbrev = "RNDP", color = "#EB1D27", shortname = "",},
["Ralliement citoyen pour la patrie"] = {abbrev = "", color = "#7FFFD4", shortname = "",},
["Rally & Issues"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Rally for an Alternative of Harmonious and Integrated Development"] = {abbrev = "RADHI", color = "#A31124", shortname = "",},
["Rally for Caledonia"] = {abbrev = "RPC", color = "#1270C2", shortname = "",},
["Rally for Congolese Democracy"] = {abbrev = "", color = "green", shortname = "",},
["Rally for Culture and Democracy"] = {abbrev = "RCD", color = "#264989", shortname = "",},
["Rally for Democracy and Progress (Namibia)"] = {abbrev = "RDP", color = "#166B37", shortname = "",},
["Rally for Democracy and Progress (Niger)"] = {abbrev = "", color = "#FBD127", shortname = "RDP-Jama'a",},
["Rally for Democracy and Renewal"] = {abbrev = "RDR", color = "", shortname = "",},
["Rally for Democracy and Social Progress"] = {abbrev = "RDPS", color = "#00B100", shortname = "",},
["Rally for Democracy and Unity"] = {abbrev = "RDU", color = "#4D92F1", shortname = "",},
["Rally for France"] = {abbrev = "RPF", color = "#003399", shortname = "",},
["Rally for Hope for Algeria"] = {abbrev = "TAJ", color = "#8C71FA", shortname = "",},
["Rally for Mali"] = {abbrev = "RPM", color = "#FCD116", shortname = "",},
["Rally for the Independence of France"] = {abbrev = "", color = "#003399", shortname = "",},
["Rally for the Monegasque Family"] = {abbrev = "", color = "#AB7141", shortname = "",},
["Rally for the Republic – Republican Party of Czechoslovakia"] = {abbrev = "SPR–RSČ", color = "#3E3E3E", shortname = "",},
["Rally for the Republic"] = {abbrev = "RPR", color = "#08206F", shortname = "",},
["Rally of Congolese Ecologists – The Greens"] = {abbrev = "", color = "green", shortname = "",},
["Rally of Democratic Forces"] = {abbrev = "RFD", color = "#000000", shortname = "",},
["Rally of Democrats, Progressive and Independent"] = {abbrev = "RDPI", color = "#08A1E3", shortname = "",},
["Rally of Houphouëtists for Democracy and Peace"] = {abbrev = "RHDP", color = "#FF7900", shortname = "",},
["Rally of Progressive National Democrats"] = {abbrev = "RPND", color = "#008000", shortname = "",},
["Rally of Republican Lefts"] = {abbrev = "RGR", color = "#FFBF00", shortname = "",},
["Rally of the Ecologists of Burkina"] = {abbrev = "", color = "green", shortname = "",},
["Rally of the Ecologists of Senegal"] = {abbrev = "", color = "green", shortname = "",},
["Rally of the French People"] = {abbrev = "RPF", color = "#25038E", shortname = "",},
["Rally of the Guinean People"] = {abbrev = "RPG", color = "#FEF200", shortname = "",},
["Rally of the Republicans"] = {abbrev = "RDR", color = "#FF9933", shortname = "",},
["Rally of the Togolese People"] = {abbrev = "RPT", color = "#037338", shortname = "",},
["Rally Responsibility Success"] = {abbrev = "", color = "red", shortname = "",},
["Ramgavar"] = {abbrev = "", color = "#2554C7", shortname = "",},
["RAŚ"] = {abbrev = "", color = "yellow", shortname = "",},
["Rashtra Bhakt Dal"] = {abbrev = "RBD", color = "#F75808", shortname = "",},
["Rashtravadi Bahujan Hitay Party"] = {abbrev = "RBHP", color = "#81F7F3", shortname = "",},
["Rashtravadi Janata Party"] = {abbrev = "RJP", color = "#cdfecd", shortname = "",},
["Rashtrawadi Labour Party"] = {abbrev = "RALP", color = "#BCA9F5", shortname = "",},
["Rashtrawadi Sena"] = {abbrev = "RWS", color = "blue", shortname = "",},
["Rashtriya Aadiwasi Bahujan Party"] = {abbrev = "RABP", color = "#cc0066", shortname = "",},
["Rashtriya Aikta Manch Party"] = {abbrev = "RAM", color = "#81F781", shortname = "",},
["Rashtriya Ali Sena"] = {abbrev = "RAS", color = "#0F6433", shortname = "",},
["Rashtriya Bahujan Congress Party"] = {abbrev = "RBCP", color = "#afeeee", shortname = "",},
["Rashtriya Bahujan Hitay Party"] = {abbrev = "RBHP", color = "#ffb5da", shortname = "",},
["Rashtriya Hith Congress"] = {abbrev = "RHC", color = "#5FB404", shortname = "",},
["Rashtriya Janadhikar Suraksha Party"] = {abbrev = "RJSP", color = "#ffdacc", shortname = "",},
["Rashtriya Janasachetan Party"] = {abbrev = "RJP", color = "orange", shortname = "",},
["Rashtriya Janata Dal"] = {abbrev = "RJD", color = "#056D05", shortname = "",},
["Rashtriya Janata Party"] = {abbrev ="RJP", color = "#FFC0CB" , shortname= "",},
["Rashtriya Janmorcha"] = {abbrev = "", color = "#CA7EE4", shortname = "",},
["Rashtriya Kamgar Party"] = {abbrev = "RKAP", color = "#1E76D5", shortname = "",},
["Rashtriya Kranti Party"] = {abbrev = "RTKP", color = "#B47011", shortname = "",},
["Rashtriya Krantikari Janata Party"] = {abbrev = "RKJP", color = "#a8e4bc", shortname = "",},
["Rashtriya Krantikari Samajwadi Party"] = {abbrev = "RKSP", color = "#8A0886", shortname = "",},
["Rashtriya Lok Dal"] = {abbrev = "RLD", color = "#006400", shortname = "",},
["Rashtriya Lok Janshakti Party"] = {abbrev = "RLJP", color = "#39833C", shortname = "",},
["Rashtriya Lok Samata Party"] = {abbrev = "RLSP", color = "#999966", shortname = "",},
["Rashtriya Lok Samta Party"] = {abbrev = "RLSP", color = "#999966", shortname = "",},
["Rashtriya Loktantrik Party"] = {abbrev = "RLP", color = "#FFD42A", shortname = "",},
["Rashtriya Manav Samman Party"] = {abbrev = "RMSP", color = "#BDDC9D", shortname = "",},
["Rashtriya Matrabhoomi Party"] = {abbrev = "RMP", color = "#CA8610", shortname = "",},
["Rashtriya Mazdoor Ekta Party"] = {abbrev = "RMEP", color = "#5E610B", shortname = "",},
["Rashtriya Muslim Mujhahid Party"] = {abbrev = "RMMP", color = "#1F9E1D", shortname = "",},
["Rashtriya Parivartan Dal"] = {abbrev = "RPD", color = "#66FFCC", shortname = "",},
["Rashtriya Raksha Dal"] = {abbrev = "RRD", color = "#F79F81", shortname = "",},
["Rashtriya Samaj Paksha"] = {abbrev = "RSPS", color = "yellow", shortname = "",},
["Rashtriya Samajwadi Party (United)"] = {abbrev = "RSP(U)", color = "#A9F5F2", shortname = "",},
["Rashtriya Samanta Dal"] = {abbrev = "RSMD", color = "#D0FA58", shortname = "",},
["Rashtriya Samata Party (Secular)"] = {abbrev = "RSP(S)", color = "Brown", shortname = "",},
["Rashtriya Sawarn Shakti Party"] = {abbrev = "RSSHP", color = "#647E81", shortname = "",},
["Rashtriya Secular Majlis Party"] = {abbrev = "", color = "Green", shortname = "",},
["Rashtriya Swabhimaan Party"] = {abbrev = "RSBP", color = "#F5D0A9", shortname = "",},
["Rashtriya Swabhiman Party"] = {abbrev = "RSBP", color = "#2c2c8a", shortname = "",},
["Rashtriya Ulama Council"] = {abbrev = "RUC", color = "#ACFA58", shortname = "",},
["Rashtriya Unnatisheel Dal"] = {abbrev = "RUD", color = "#26B062", shortname = "",},
["Rashtriya Vikas Party"] = {abbrev = "RVP", color = "#D0A9F5", shortname = "",},
["Rassemblement Wallonie France"] = {abbrev = "", color = "blue", shortname = "",},
["Rastakhiz Party"] = {abbrev = "", color = "Blue", shortname = "",},
["Rastriya Janamorcha"] = {abbrev = "", color = "firebrick", shortname = "",},
["Rastriya Janamukti Party"] = {abbrev = "", color = "DodgerBlue", shortname = "Janamukti",},
["Rastriya Janata Dal Nepal"] = {abbrev = "", color = "#E6DBCF", shortname = "RJD Nepal",},
["Rastriya Janata Party Nepal"] = {abbrev = "RJPN", color = "#FFb300", shortname = "",},
["Rastriya Janshakti Party"] = {abbrev = "", color = "khaki", shortname = "Janashakti",},
["Rastriya Prajatantra Party (Chand)"] = {abbrev = "", color = "yellow", shortname = "RPP (Chand)",},
["Rastriya Prajatantra Party (Samyukta)"] = {abbrev = "", color = "#4682B4", shortname = "",},
["Rastriya Prajatantra Party Nepal"] = {abbrev = "", color = "orange", shortname = "RPP-Nepal",},
["Rastriya Prajatantra Party"] = {abbrev = "RPP", color = "gold", shortname = "",},
["Rastriya Swatantra Party"] = {abbrev = "RSP", color = "#0095DA", shortname = "RSP",},
["Rat Withi Party"] = {abbrev = "", color = "#1C359A", shortname = "",},
["Ratana"] = {abbrev = "", color = "#A52A2A", shortname = "",},
["Ratepayers and Residents Associations"] = {abbrev = "", color = "#dddddd", shortname = "Ratepayers & Residents",},
["Ratepayers' Association"] = {abbrev = "", color = "#dddddd", shortname = "Ratepayers",},
["Ratepayers' and Citizens' Association"] = {abbrev = "", color = "#dddddd", shortname = "Ratepayers & Citizens",},
["Ratz (political party)"] = {abbrev = "", color = "#C80004", shortname = "Ratz",},
["Ravah Party"] = {abbrev = "", color = "#E7EB16", shortname = "",},
["Raving Loony Green Giant Party"] = {abbrev = "", color = "green", shortname = "Raving Loony Green Giant",},
["Rayalaseema Parirakshana Samithi"] = {abbrev = "", color = "red", shortname = "",},
["Rayyithunge Muthagaddim Party"] = {abbrev = "RMP", color = "#CC0000", shortname = "",},
["Raza Unida Party"] = {abbrev = "", color = "#CC853F", shortname = "Raza Unida",},
["Re-open Nominations"] = {abbrev = "RON", color = "Black", shortname = "",},
["Readjuster Party"] = {abbrev = "", color = "Black", shortname = "Readjuster",},
["Reagrupament"] = {abbrev = "", color = "#841039", shortname = "",},
["Real Alternative Party"] = {abbrev = "PAR", color = "#FECD0B", shortname = "",},
["Real Alternative Party (Botswana)"] = {abbrev = "RAP", color = "#76402b", shortname = "",},
["Real Democracy Movement"] = {abbrev = "", color = "#BFFF00", shortname = "Real Democracy",},
["Real Democracy"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Real Democratic Party"] = {abbrev = "", color = "#0CB14B", shortname = "Real Democratic",},
["Real NZ"] = {abbrev = "", color = "#72bfe8", shortname = "",},
["Real Politics Union"] = {abbrev = "UPR", color = "#151a3a", shortname = "",},
["Realists (political party)"] = {abbrev = "", color = "#013888", shortname = "",},
["Reality Party"] = {abbrev = "", color = "Grey", shortname = "Reality",},
["Realizing Goals"] = {abbrev = "", color = "#0B76C0", shortname = "",},
["Reason Party (Australia)"] = {abbrev = "", color = "#4BB8B3", shortname = "Reason",},
["Reason Party (Poland)"] = {abbrev = "RACJA", color = "#000000", shortname = "Reason Party",},
["Rebel Almería"] = {abbrev = "", color = "#981403", shortname = "",},
["Rebirth Party (Northern Cyprus)"] = {abbrev = "YDP", color = "#00CCFF", shortname = "",},
["Reborn Armenia"] = {abbrev = "", color = "#1E4277", shortname = "",},
["Reclaim Australia: Reduce Immigration"] = {abbrev = "RARI", color = "#734812", shortname = "Reclaim Australia"},
["Reclaim Party"] = {abbrev = "", color = "#C03F31", shortname = "Reclaim",},
["Reconciliation and Liberation Bloc"] = {abbrev = "", color = "black", shortname = "",},
["Reconquête"] = {abbrev = "REC", color = "#170066", shortname = "",},
["Reconstitution Party"] = {abbrev = "", color = "#00FFFF", shortname = "",},
["Recover Madrid"] = {abbrev = "RM", color = "#E9AE12", shortname = "",},
["Recrear"] = {abbrev = "", color = "#35649C", shortname = "",},
["Recreate Greece"] = {abbrev = "DX", color = "#F19914", shortname = "",},
["Recuperar Badajoz"] = {abbrev = "", color = "#6A1E5E", shortname = "",},
["Recuperemos El Ejido"] = {abbrev = "", color = "#01781E", shortname = "",},
["Red Current"] = {abbrev = "", color = "#CE1000", shortname = "",},
["Red Dot United"] = {abbrev = "RDU", color = "#DC6698", shortname = "",},
["Red Electoral Alliance"] = {abbrev = "", color = "#d4001a", shortname = "Red",},
["Red Flag Party"] = {abbrev = "", color = "red", shortname = "",},
["Red Front (UK)"] = {abbrev = "", color = "Red", shortname = "Red Front",},
["Red Lions (political party)"] = {abbrev = "", color = "#DC143C", shortname = "Red Lions",},
["Red Party (Dominican Republic)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Red Party (Norway)"] = {abbrev = "", color = "#EA0000", shortname = "Red",},
["Red-Green Alliance"] = {abbrev = "", color = "#D30B55", shortname = "",},
["Red-Greens (Sweden)"] = {abbrev = "", color = "#F0002D", shortname = "Red-Greens",},
["Red–Green Alliance (Denmark)"] = {abbrev = "", color = "#F7660D", shortname = "Red–Green",},
["Redondela Electors' Group"] = {abbrev = "", color = "#9A2428", shortname = "",},
["Redondela Pode"] = {abbrev = "", color = "#3C0C40", shortname = "",},
["Referendum Party"] = {abbrev = "", color = "#bf475c", shortname = "Referendum",},
["Reform and Development Party (Egypt)"] = {abbrev = "", color = "#C7A317", shortname = "",},
["Reform and Development Party (Morocco)"] = {abbrev = "", color = "#8CB803", shortname = "",},
["Reform Club of Hong Kong"] = {abbrev = "", color = "#D04627", shortname = "Reform",},
["Reform Front Party"] = {abbrev = "", color = "DodgerBlue", shortname = "",},
["Reform Group (Finland)"] = {abbrev = "", color = "#E6E600", shortname = "Reform",},
["Reform Jersey"] = {abbrev = "", color = "#01547C", shortname = "",},
["Reform Party (19th-century Wisconsin)"] = {abbrev = "", color = "#3333FF", shortname = "Reform",},
["Reform Party (Iceland)"] = {abbrev = "", color = "#FF7D14", shortname = "Reform",},
["Reform Party (Latvia)"] = {abbrev = "", color = "#10A5DF", shortname = "Reform",},
["Reform Party (Mauritania)"] = {abbrev = "", color = "#715331", shortname = "El Islah",},
["Reform Party (Minnesota)"] = {abbrev = "", color = "#6A287E", shortname = "Reform",},
["Reform Party (Mississippi)"] = {abbrev = "", color = "#6A287E", shortname = "Reform",},
["Reform Party (New York State)"] = {abbrev = "", color = "#6A287E", shortname = "Reform",},
["Reform Party (New Zealand)"] = {abbrev = "", color = "#00BB00", shortname = "Reform",},
["Reform Party (Philippines)"] = {abbrev = "", color = "#0000CD", shortname = "Reform",},
["Reform Party (Singapore)"] = {abbrev = "RP", color = "#FFC000", shortname = "",},
["Reform Party (Southern Rhodesia)"] = {abbrev = "", color = "#99FF99", shortname = "Reform",},
["Reform Party (US)"] = {abbrev = "RE", color = "#6A287E", shortname = "Reform",},
["Reform Party of Canada"] = {abbrev = "", color = "#3CB371", shortname = "Reform",},
["Reform PH - People's Party"] = {abbrev = "RP", color = "#800000", shortname = "",},
["Reform Progressive Party"] = {abbrev = "PPR", color = "#0000FF", shortname = "",},
["Reform Star Party"] = {abbrev = "PBR", color = "#BCDA00", shortname = "",},
["Reform UK"] = {abbrev = "", color = "#12B6CF", shortname = "",},
["Reformatory Political Federation"] = {abbrev = "RPF", color = "#7FD3E9", shortname = "",},
["Reformed Congress of Lesotho"] = {abbrev = "RCL", color = "#067a3e", shortname = "",},
["Reformed Democratic Party"] = {abbrev = "", color = "#F0E68C", shortname = "",},
["Reformed Political Alliance"] = {abbrev = "", color = "#f7af20", shortname = "",},
["Reformed Political League"] = {abbrev = "GPV", color = "#6CBFD9", shortname = "",},
["Reformed Political Party – Reformatory Political Federation – Reformed Political League"] = {abbrev = "SGP/RPF/GPV", color = "#00a7eb", shortname = "",},
["Reformed Political Party"] = {abbrev = "SGP", color = "#EA5B0B", shortname = "",},
["Reformers (Hungarian political party)"] = {abbrev = "", color = "#D19E33", shortname = "",},
["Reformist Bloc"] = {abbrev = "RB", color = "#2A3A79", shortname = "",},
["Reformist Canarian Centre"] = {abbrev = "", color = "#FDBB4A", shortname = "",},
["Reformist Coalition"] = {abbrev = "", color = "#00B1F0", shortname = "",},
["Reformist Movement"] = {abbrev = "MR", color = "#0047AB", shortname = "",},
["Reformist Party (Dominican Republic)"] = {abbrev = "", color = "#ff0000", shortname = "",},
["Reformist Party (Costa Rica)"] = {abbrev = "", color = "#8B0000", shortname = "Reformist",},
["Reformist Party (Portugal)"] = {abbrev = "", color = "#FB607F", shortname = "",},
["Reformist Party (Serbia)"] = {abbrev = "RS", color = "#FF6600", shortname = "",},
["Reformist Party (Spain)"] = {abbrev = "", color = "#F28500", shortname = "Reformist",},
["Reformist Party ORA"] = {abbrev = "", color = "#29106B", shortname = "",},
["Reformists of Vojvodina"] = {abbrev = "RV", color = "#E46713", shortname = "",},
["Reforms and Freedom"] = {abbrev = "", color = "red", shortname = "",},
["Reforms and Order Party"] = {abbrev = "PRP", color = "#2581CC", shortname = "",},
["Reform the Legal System"] = {abbrev = "RLS", color = "#FF6900", shortname = "Legal System Reform",},
["Regenerator Party"] = {abbrev = "", color = "#0054A5", shortname = "",},
["Regional Citizens' Coalition"] = {abbrev = "", color = "#CE1244", shortname = "",},
["Regional Murcianist Party"] = {abbrev = "", color = "#FAE800", shortname = "",},
["Regional Integration Movement"] = {abbrev = "MIR", color = "#ADEEF7", shortname = "",},
["Regional Unity Party"] = {abbrev = "", color = "#0066FF", shortname = "",},
["Regionalism (politics)"] = {abbrev = "REG", color = "#DDDD00", shortname = "Regionalists",},
["Regionalist (Restoration)"] = {abbrev = "", color = "#B4E0CA", shortname = "",},
["Regionalist Action Party of Chile"] = {abbrev = "", color = "#FDFA2F", shortname = "",},
["Regionalist Alicantine Party"] = {abbrev = "", color = "#095387", shortname = "",},
["Regionalist Call for Andalusia"] = {abbrev = "", color = "#08B618", shortname = "",},
["Regionalist Democracy of Castile and León"] = {abbrev = "", color = "#5DA923", shortname = "",},
["Regionalist Independent Party"] = {abbrev = "", color = "purple", shortname = "",},
["Regionalist League of Catalonia"] = {abbrev = "LRC", color = "#D5AD0F", shortname = "",},
["Regionalist League of the Balearic Islands"] = {abbrev = "", color = "#834098", shortname = "",},
["Regionalist Local Party"] = {abbrev = "", color = "#82CF05", shortname = "",},
["Regionalist Party for Eastern Andalusia"] = {abbrev = "", color = "#A6004D", shortname = "",},
["Regionalist Party of Cantabria"] = {abbrev = "PRC", color = "#C2CE0C", shortname = "",},
["Regionalist Party of Castilla-La Mancha"] = {abbrev = "", color = "#DC143C", shortname = "",},
["Regionalist Party of Castilla–La Mancha"] = {abbrev = "", color = "#DC143C", shortname = "",},
["Regionalist Party of El Bierzo"] = {abbrev = "", color = "#005DA1", shortname = "",},
["Regionalist Party of Guadalajara"] = {abbrev = "", color = "#7310AD", shortname = "",},
["Regionalist Party of Independents"] = {abbrev = "", color = "green", shortname = "",},
["Regionalist Party of the Independents"] = {abbrev = "", color = "#00FF00", shortname = "Regionalist",},
["Regionalist Party of the Leonese Country"] = {abbrev = "", color = "#D20062", shortname = "",},
["Regionalist Union of Castile and León"] = {abbrev = "", color = "#1E4D79", shortname = "",},
["Regionalist Unitary Party"] = {abbrev = "", color = "#882222", shortname = "",},
["Regionalist Unity of Castile and León"] = {abbrev = "", color = "#FE0000", shortname = "",},
["Regionalist Unity"] = {abbrev = "", color = "#C9286B", shortname = "",},
["Reich Party for Civil Rights and Deflation"] = {abbrev = "", color = "#0075EB", shortname = "",},
["Reich Party of the German Middle Class"] = {abbrev = "WP", color = "#CCAA7A", shortname = "",},
["Reigate and Banstead Residents Association"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Reinicia Sant Antoni"] = {abbrev = "", color = "#570D9E", shortname = "",},
["Reiwa Shinsengumi"] = {abbrev = "", color = "#ED008C", shortname = "Reiwa",},
["Rejoin EU"] = {abbrev = "", color = "#003399", shortname = "",},
["Religious Torah Front"] = {abbrev = "", color = "#000", shortname = "",},
["Religious Zionist Party"] = {abbrev = "", color = "#214785", shortname = "Religious Zionist",},
["Reload Bulgaria"] = {abbrev = "", color = "black", shortname = "",},
["Renaissance (French political party)"] = {abbrev = "RE", color = "#03215A", shortname = "",},
["Renaissance (Italian political party)"] = {abbrev = "", color = "#56A5EC", shortname = "Renaissance",},
["Renaissance and Union of Europe Party"] = {abbrev = "", color = "#000000", shortname = "",},
["Renaissance group"] = {abbrev = "RE", color = "#0089BF", shortname = "",},
["RENAMO"] = {abbrev = "", color = "#113077", shortname = "",},
["Renew Europe"] = {abbrev = "RE", color = "gold", shortname = "",},
["Renew Party"] = {abbrev = "", color = "#16C0D7", shortname = "Renew",},
["Renewal Bloc"] = {abbrev = "RB", color = "#092f56", shortname = "Renewal Bloc",},
["Renewal (Greece)"] = {abbrev = "", color = "#FAFF5F", shortname = "",},
["Renewal (political party)"] = {abbrev = "", color = "#2B4F32", shortname = "",},
["Renewal Crusade"] = {abbrev = "", color = "SkyBlue", shortname = "",},
["Renewal Front"] = {abbrev = "FR", color = "#0E3C61", shortname = "",},
["Renewal Liberal Centre"] = {abbrev = "", color = "#BD782D", shortname = "",},
["Renewal Party of Ibiza and Formentera"] = {abbrev = "", color = "#354B84", shortname = "",},
["Renewal–Nationalist Brotherhood"] = {abbrev = "", color = "#3EA3D2", shortname = "",},
["Renewed Caledonian Union"] = {abbrev = "UC-R", color = "green", shortname = "",},
["Renewed Democratic Liberty"] = {abbrev = "LIDER", color = "#E20A17", shortname = "",},
["Renewed United Democratic Centre"] = {abbrev = "", color = "#009191", shortname = "",},
["Renewing Romania's European Project"] = {abbrev = "REPER", color = "#c40075", shortname = "",},
["Renewing Communist Ecological Left"] = {abbrev = "", color = "#FF4900", shortname = "",},
["Renmen Ayiti"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Renovating Action Party"] = {abbrev = "PAR", color = "#FDF38E", shortname = "",},
["Renovator Labour Party"] = {abbrev = "", color = "#E7393D", shortname = "",},
["Rent Is Too Damn High Party"] = {abbrev = "", color = "#703642", shortname = "Rent Is Too Damn High",},
["Renua"] = {abbrev = "Ren", color = "#FFA500", shortname = "Renua",},
["Repeal Association"] = {abbrev = "", color = "#DDFFDD", shortname = "Irish Repeal",},
["Repons Peyizan"] = {abbrev = "", color = "#009A17", shortname = "",},
["Republic (Faroe Islands)"] = {abbrev = "", color = "#BED630", shortname = "Republic",},
["Republic (Latvia)"] = {abbrev = "", color = "#075895", shortname = "",},
["Republic (Slovakia)"] = {abbrev = "", color = "#e30512", shortname = "Republic",},
["Republic (Transnistria)"] = {abbrev = "", color = "#990000", shortname = "Republic",},
["Republic National Independent Party"] = {abbrev = "RNIP", color = "#30347B", shortname = "",},
["Republic of Fiji Military Forces"] = {abbrev = "RFMF", color = "#C3B091", shortname = "",},
["Republican (Ireland, 1923)"] = {abbrev = "Rep", color = "#008800", shortname = "Republican",},
["Republican (Ireland)"] = {abbrev = "", color = "#66BB66", shortname = "",},
["Republican Action (Spain)"] = {abbrev = "AR", color = "#FF7028", shortname = "",},
["Republican Alternative (Spain)"] = {abbrev = "", color = "#75246C", shortname = "",},
["Republican Alternative Party (Azerbaijan)"] = {abbrev = "", color = "#EF3340", shortname = "",},
["Republican and Socialist Front"] = {abbrev = "FRS", color = "#FF2E3F", shortname = "",},
["Republican and Socialist Left (2018)"] = {abbrev = "", color = "#D23150", shortname = "",},
["Republican and Socialist Left"] = {abbrev = "", color = "#D53150", shortname = "",},
["Republican Bicentennial Vanguard"] = {abbrev = "", color = "#BE4736", shortname = "",},
["Republican Bloc"] = {abbrev = "BR", color = "", shortname = "",},
["Republican Candidacy"] = {abbrev = "", color = "#6C3E89", shortname = "",},
["Republican Catalan Action"] = {abbrev = "", color = "#E2A554", shortname = "",},
["Republican Clubs"] = {abbrev = "", color = "#EE0000", shortname = "",},
["Republican Coalition (Spain, 1901)"] = {abbrev = "CR", color = "#7A1B6A", shortname = "",},
["Republican Coalition (Spain, 1914)"] = {abbrev = "", color = "#864891", shortname = "",},
["Republican Constitutional Union"] = {abbrev = "UCR", color = "#A352A3", shortname = "",},
["Republican Democratic Movement"] = {abbrev = "", color = "#808080", shortname = "",},
["Republican Democratic Union"] = {abbrev = "UDR", color = "#0000BB", shortname = "",},
["Republican Equality Front"] = {abbrev = "FER", color = "#B9E16F", shortname = "",},
["Republican Fascist Party"] = {abbrev = "", color = "#000000", shortname = "",},
["Republican Federation (Spain)"] = {abbrev = "", color = "#804AB5", shortname = "",},
["Republican Federation"] = {abbrev = "", color = "#005ACA", shortname = "",},
["Republican Force"] = {abbrev = "", color = "#0070B8", shortname = "",},
["Republican Front (Catalonia)"] = {abbrev = "", color = "#EB2071", shortname = "",},
["Republican Front for Unity and Democracy"] = {abbrev = "FRUD", color = "#3080B7", shortname = "",},
["Republican Fusion"] = {abbrev = "", color = "#711A5B", shortname = "Republican",},
["Republican Group of Coslada"] = {abbrev = "", color = "#82177F", shortname = "",},
["Republican Labour Party"] = {abbrev = "RepLab", color = "#85de59", shortname = "Republican Labour",},
["Republican Left (Spain, 1977)"] = {abbrev = "", color = "#B5047B", shortname = "",},
["Republican Left (Spain)"] = {abbrev = "IR", color = "#E25822", shortname = "",},
["Republican Left of Catalonia"] = {abbrev = "ERC", color = "#FFB232", shortname = "",},
["Republican Liberal Party (Panama)"] = {abbrev = "PLR", color = "pink", shortname = "",},
["Republican Liberal Party (Portugal)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Republican Moderate Party (Alaska)"] = {abbrev = "", color = "#DD4444", shortname = "Republican Moderate",},
["Republican Movement (Mauritius)"] = {abbrev = "", color = "red", shortname = "",},
["Republican Movement (Switzerland)"] = {abbrev = "", color = "#61380B", shortname = "Republican",},
["Republican Nation Party"] = {abbrev = "CMP", color = "#6F4E37", shortname = "",},
["Republican Nationalist Centre"] = {abbrev = "", color = "#CC9933", shortname = "",},
["Republican Nationalist Federal Union"] = {abbrev = "", color = "#993366", shortname = "Nationalist Federal",},
["Republican Nationalist Party of Ourense"] = {abbrev = "", color = "#4040C0", shortname = "",},
["Republican Network for Unity"] = {abbrev = "", color = "#004400", shortname = "Republican Network",},
["Republican Party (Belarus)"] = {abbrev = "", color = "#811F20", shortname = "Republican",},
["Republican Party (Bolivia)"] = {abbrev = "", color = "#3CB371", shortname = "",},
["Republican Party (Bosnia and Herzegovina)"] = {abbrev = "", color = "Lightblue", shortname = "",},
["Republican Party (Brazil)"] = {abbrev = "PR", color = "#009F3C", shortname = "",},
["Republican Party (Cambodia)"] = {abbrev = "", color = "#0000FF", shortname = "Republican",},
["Republican Party (Chile, 2019)"] = {abbrev = "", color = "#22446D", shortname = "",},
["Republican Party (China)"] = {abbrev = "", color = "#FFC500", shortname = "Republican",},
["Republican Party (Costa Rica)"] = {abbrev = "", color = "#0018A8", shortname = "Republican",},
["Republican Party (East Timor)"] = {abbrev = "", color = "#24A236", shortname = "",},
["Republican Party (France)"] = {abbrev = "", color = "#00CCCC", shortname = "",},
["Republican Party (Guatemala)"] = {abbrev = "PR", color = "#243467", shortname = "Republican Party",},
["Republican Party (Hungary)"] = {abbrev = "KP", color = "#0067A5", shortname = "",},
["Republican Party (Liberia)"] = {abbrev = "", color = "#FF0000", shortname = "Republican",},
["Republican Party (Maldives)"] = {abbrev = "", color = "#DC0A0A", shortname = "",},
["Republican Party (Namibia)"] = {abbrev = "RP", color = "#FFF100", shortname = "",},
["Republican Party (Pakistan)"] = {abbrev = "", color = "#6495ED", shortname = "Republican Party",},
["Republican Party (Panama)"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Republican Party (Philippines)"] = {abbrev = "", color = "#191970", shortname = "Republican",},
["Republican Party (Serbia)"] = {abbrev = "", color = "#c2121d", shortname = "",},
["Republican Party (Spain)"] = {abbrev = "", color = "#D69652", shortname = "",},
["Republican Party (Spain, 1913)"] = {abbrev = "", color = "#A83E90", shortname = "",},
["Republican Party (Tunisia)"] = {abbrev = "", color = "#CF171F", shortname = "",},
["Republican Party (United States)"] = {abbrev = "R", color = "#E81B23", shortname = "Republican",},
["Republican Party for Democracy and Renewal"] = {abbrev = "PRDS", color = "#981c24", shortname = "",},
["Republican Party for Independence and Development"] = {abbrev = "PRID", color = "#f8d568", shortname = "",},
["Republican Party of Afghanistan"] = {abbrev = "", color = "skyblue", shortname = "",},
["Republican Party of Agricultural and Smallholder People"] = {abbrev = "", color = "#008000", shortname = "",},
["Republican Party of Albania"] = {abbrev = "PR", color = "#20267A", shortname = "",},
["Republican Party of Armenia"] = {abbrev = "", color = "#D2691E", shortname = "Republican",},
["Republican Party of Dahomey"] = {abbrev = "", color = "#F38C22", shortname = "",},
["Republican Party of Farmers and Peasants"] = {abbrev = "RSZML", color = "#008000", shortname = "",},
["Republican Party of Havana"] = {abbrev = "", color = "#CD5C5C", shortname = "Republican",},
["Republican Party of India (Athawale)"] = {abbrev = "RPI(A)", color = "#000080", shortname = "",},
["Republican Party of India (Gavai)"] = {abbrev = "RPI(G)", color = "#6633EE", shortname = "",},
["Republican Party of India (Khobragade)"] = {abbrev = "RPI(K)", color = "darkblue", shortname = "",},
["Republican Party of India Ektavadi"] = {abbrev = "RPIE", color = "#BFFF00", shortname = "",},
["Republican Party of India"] = {abbrev = "RPI", color = "#000066", shortname = "",},
["Republican Party of Labour and Justice"] = {abbrev = "RPTS", color = "#DE7673", shortname = "",},
["Republican Party of Liberty"] = {abbrev = "PRL", color = "#4CA2E7", shortname = "",},
["Republican Party of Paraná"] = {abbrev = "", color = "#768000", shortname = "PR Paraná",},
["Republican Party of Puerto Rico"] = {abbrev = "", color = "#E81B23", shortname = "Republican",},
["Republican Party of Russia"] = {abbrev = "RPR", color = "#FE4801", shortname = "",},
["Republican Party of Russia – People's Freedom Party"] = {abbrev = "RPR–PARNAS", color = "#8A1739", shortname = "",},
["Republican Party of the Social Order"] = {abbrev = "PROS", color = "#F68F22", shortname = "",},
["Republican Patriotic Rally"] = {abbrev = "RPR", color = "", shortname = "",},
["Republican People's Party (Egypt)"] = {abbrev = "RPP", color = "#B7800B", shortname = "Republican People's",},
["Republican People's Party"] = {abbrev = "CHP", color = "#ED1C24", shortname = "",},
["Republican Peronism"] = {abbrev = "", color = "#007FFF", shortname = "",},
["Republican Platform"] = {abbrev = "", color = "#0066FF", shortname = "",},
["Republican Progressive Democratic Front"] = {abbrev = "FDPR", color = "#EE2C21", shortname = "",},
["Republican Proposal"] = {abbrev = "PRO", color = "#ffd700", shortname = "",},
["Republican Reliance Party"] = {abbrev = "CGP", color = "#FF4500", shortname = "",},
["Republican Sinn Féin"] = {abbrev = "RSF", color = "#008800", shortname = "Republican Sinn Féin",},
["Republican Social Movement"] = {abbrev = "", color = "#313439", shortname = "",},
["Republican Socialist Unity Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Republican Turkish Party"] = {abbrev = "CTP", color = "#008000", shortname = "",},
["Republican Union (France)"] = {abbrev = "", color = "#C0504D", shortname = "",},
["Republican Union (Portugal)"] = {abbrev = "PUR", color = "#A52A2A", shortname = "Republican Union",},
["Republican Union (Puerto Rico)"] = {abbrev = "", color = " ", shortname = "Republican Union",},
["Republican Union (Spain, 1934)"] = {abbrev = "", color = "#672F6C", shortname = "",},
["Republican Union (Guatemala)"] = {abbrev = "UR", color = "#2c3592", shortname = "Republican Union",},
["Republican Union Party (Colombia)"] = {abbrev = "", color = "#FBCEB1", shortname = "",},
["Republican Union Party (Ecuador)"] = {abbrev = "PUR", color = "#D0FF14", shortname = "",},
["Republican Union Party (Spain)"] = {abbrev = "PUR", color = "#931585", shortname = "",},
["Republican Union Party"] = {abbrev = "", color = "#ADD8E6", shortname = "",},
["Republican Unity Party"] = {abbrev = "", color = "#D0FF14", shortname = "",},
["Republican Villagers Nation Party"] = {abbrev = "CKMP", color = "#DF7401", shortname = "",},
["Republican-Socialist Party"] = {abbrev = "PRS", color = "#DE3163", shortname = "",},
["Republican–Socialist Conjunction"] = {abbrev = "", color = "#C11956", shortname = "Republican–Socialist",},
["Republican, Ecologist and Social Alliance"] = {abbrev = "ARES", color = "#4169E1", shortname = "",},
["Republican/Hold"] = {abbrev = "", color = "#FFF1EE", shortname = "",},
["Republicans (Brazil)"] = {abbrev = "", color = "#0070C5", shortname = "Republicanos",},
["Republicans for Bulgaria"] = {abbrev = "RzB", color = "#2B4A99", shortname = "",},
["Republicans"] = {abbrev = "", color = "#AB0EA7", shortname = "",},
["Res Publica Party"] = {abbrev = "", color = "#04427C", shortname = "Res Publica",},
["Residents Action Movement"] = {abbrev = "RAM", color = "#467CFA", shortname = "",},
["Residents Association of London"] = {abbrev = "", color = "teal", shortname = "Residents",},
["Residents Association"] = {abbrev = "", color = "#d3d3d3", shortname = "Residents",},
["Residents Associations of Epsom and Ewell"] = {abbrev = "", color = "pink", shortname = "Residents Association",},
["Residents for Guildford and Villages"] = {abbrev = "R4GV", color = "#CA1F7B", shortname = "",},
["Residents for Uttlesford"] = {abbrev = "R4U", color = "#00a88f", shortname = "",},
["Residents' Association of Barnet"] = {abbrev = "", color = "#669966", shortname = "Residents' Association",},
["Residents' Association of London"] = {abbrev = "", color = "gray", shortname = "",},
["Residents' association"] = {abbrev = "RA", color = "#666666", shortname = "",},
["RESIST (electoral list)"] = {abbrev = "", color = "#00A94F", shortname = "",},
["Resistance Front of Islamic Iran"] = {abbrev = "RFII", color = "#23aba1", shortname = "",},
["Resistance of Guinea-Bissau-Bafatá Movement"] = {abbrev = "", color = "#0A86F8", shortname = "",},
["Resistance Party (France)"] = {abbrev = "", color = "#0072BB", shortname = "",},
["Résistons!"] = {abbrev = "", color = "#034EA1", shortname = "",},
["Resni.ca"] = {abbrev = "", color = "#67359A", shortname = "",},
["Résoatao Party"] = {abbrev = "", color = "#154FE6", shortname = "",},
["Respect (Haiti)"] = {abbrev = "", color = "#0000FF", shortname = "Respect",},
["Respect Party"] = {abbrev = "", color = "#46801c", shortname = "Respect",},
["Respeto"] = {abbrev = "", color = "#8E1919", shortname = "",},
["Responsibility – Social Democratic Alliance of Political Parties"] = {abbrev = "", color = "#ADD8E6", shortname = "",},
["Responsible Future (Iceland)"] = {abbrev = "", color = "#322757", shortname = "",},
["Responsible Government Association"] = {abbrev = "", color = "#FF7F00", shortname = "",},
["Respublica (Kazakh political party)"] = {abbrev = "", color = "#4A78EC", shortname = "Respublica",},
["Respublika (political party)"] = {abbrev = "", color = "#20959E", shortname = "Respublika",},
["Respublika–Ata Zhurt"] = {abbrev = "", color = "#FFCF06", shortname = "",},
["Restart Coalition"] = {abbrev = "", color = "#e00f20", shortname = "Restart",},
["Restoration of Ukraine"] = {abbrev = "", color = "#FFDD00", shortname = "Restoration",},
["Restore and Build Kenya"] = {abbrev = "", color = "#0000ff", shortname = "",},
["Restore Democracy Sack Dan Andrews Party"] = {abbrev = "RDSD", color = "#C72C32", shortname = "Restore Democracy",},
["Restore Scotland"] = {abbrev = "", color = "#006EB6", shortname = "",},
["Restore the Family for Children's Sake"] = {abbrev = "", color = "Goldenrod", shortname = "",},
["RETE Movement"] = {abbrev = "RETE", color = "#275956", shortname = "",},
["Retirees Party for the Future"] = {abbrev = "", color = "#59A35A", shortname = "",},
["RETO Movement"] = {abbrev = "RETO", color = "#012F71", shortname = "",},
["Reunification Democratic Party"] = {abbrev = "RDP", color = "#E60026", shortname = "Reunification Democratic",},
["Reunification Movement for Change"] = {abbrev = "RMC", color = "#F16A26", shortname = "",},
["Reus Independent Coordinator"] = {abbrev = "", color = "#A71F21", shortname = "",},
["Revenue Tariff Party (Tasmania)"] = {abbrev = "", color = "#FFDB58", shortname = "Revenue Tariff",},
["Revival (Bulgarian political party)"] = {abbrev = "", color = "#C09F62", shortname = "Revival",},
["Revival (Ukraine)"] = {abbrev = "", color = "#90BEDC", shortname = "Revival",},
["Revival Party"] = {abbrev = "", color = "Crimson", shortname = "",},
["Revival Party (Moldova)"] = {abbrev = "Revival", color = "#FF0000", shortname = "",},
["Revolutionary Action Party"] = {abbrev = "PAR", color = "#4682b4", shortname = "",},
["Revolutionary Anticapitalist Left"] = {abbrev = "", color = "#B41E17", shortname = "",},
["Revolutionary Civic Union"] = {abbrev = "UCR", color = "#6B8E23", shortname = "",},
["Revolutionary Agrarian Movement of the Bolivian Peasantry"] = {abbrev = "MARC", color = "#D29D7D", shortname = "",},
["Revolutionary Committee of the Chinese Kuomintang"] = {abbrev = "RCCK", color = "#1b65af", shortname = "",},
["Revolutionary Communist League (France)"] = {abbrev = "LCR", color = "#C41E3A", shortname = "",},
["Revolutionary Communist League (Spain)"] = {abbrev = "", color = "#DF0101", shortname = "",},
["Revolutionary Communist Movement of Greece"] = {abbrev = "EKKE", color = "red", shortname = "",},
["Revolutionary Communist Party (Argentina)"] = {abbrev = "PCR", color = "#E00000", shortname = "Revolutionary Communist Party",},
["Revolutionary Communist Party (Spain)"] = {abbrev = "", color = "#DF0101", shortname = "Revolutionary Communist Party",},
["Revolutionary Communist Party (UK, 1978)"] = {abbrev = "", color = "#880000", shortname = "Revolutionary Communist",},
["Revolutionary Communist Party of Britain (Marxist-Leninist)"] = {abbrev = "", color = "red", shortname = "",},
["Revolutionary Communist Party of Britain (Marxist–Leninist)"] = {abbrev = "RCP (GB) (ML)", color = "#660000", shortname = "",},
["Revolutionary Communist Party of India"] = {abbrev = "RCPI", color = "Red", shortname = "",},
["Revolutionary Communist Party, USA"] = {abbrev = "", color = "#C80815", shortname = "",},
["Revolutionary Democratic Coalition"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Revolutionary Democratic Party of India"] = {abbrev = "RDP(I)", color = "#F78181", shortname = "",},
["Revolutionary Febrerista Party"] = {abbrev = "PRF", color = "#01a755", shortname = "",},
["Revolutionary Goans Party"] = {abbrev = "RGP", color = "#E3C773", shortname = "",},
["Revolutionary Left Front (Bolivia)"] = {abbrev = "", color = "red", shortname = "",},
["Revolutionary Left Front"] = {abbrev = "", color = "#0500BE", shortname = "",},
["Revolutionary Left Movement (Bolivia)"] = {abbrev = "", color = "#FF8000", shortname = "",},
["Revolutionary Left Movement (Venezuela)"] = {abbrev = "", color = "red", shortname = "",},
["Revolutionary Left Party"] = {abbrev = "", color = "darkred", shortname = "",},
["Revolutionary Liberation Movement Túpac Katari"] = {abbrev = "MRTKL", color = "#A57DAD", shortname = "",},
["Revolutionary Marxist Party of India"] = {abbrev = "RMPI", color = "red", shortname = "",},
["Revolutionary Middle Class"] = {abbrev = "", color = "Black", shortname = "",},
["Revolutionary Nationalist Movement"] = {abbrev = "MNR", color = "#F19CBB", shortname = "",},
["Revolutionary Organization"] = {abbrev = "RO", color = "#ee1c25", shortname = "",},
["Revolutionary Party (Guatemala)"] = {abbrev = "", color = "#964B00", shortname = "",},
["Revolutionary Party of Democratic Unification"] = {abbrev = "PRUD", color = "#FAAFBE", shortname = "",},
["Revolutionary Party of the Nationalist Left"] = {abbrev = "", color = "#D62222", shortname = "",},
["Revolutionary People's Liberation Party/Front"] = {abbrev = "DHKP-C", color = "#D40000", shortname = "",},
["Revolutionary Social Democratic Party"] = {abbrev = "", color = "#200040", shortname = "",},
["Revolutionary Socialist Party (Bolshevik)"] = {abbrev = "RSP(B)", color = "#FF0000", shortname = "",},
["Revolutionary Socialist Party (India)"] = {abbrev = "RSP", color = "#FF4A4A", shortname = "",},
["Revolutionary Socialist Party (Leninist)"] = {abbrev = "RSP(L)", color = "#FF0000", shortname = "",},
["Revolutionary Socialist Party (Luxembourg)"] = {abbrev = "", color = "#960018", shortname = "",},
["Revolutionary Socialist Party (Netherlands)"] = {abbrev = "", color = "#990000", shortname = "",},
["Revolutionary Socialist Party (Peru)"] = {abbrev = "", color = "Red", shortname = "",},
["Revolutionary Socialist Party of Kerala (Bolshevik)"] = {abbrev = "", color = "red", shortname = "",},
["Revolutionary Socialist Workers' Party (Turkey)"] = {abbrev = "DSİP", color = "#000000", shortname = "",},
["Revolutionary Socialists (Egypt)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Revolutionary Union (Peru)"] = {abbrev = "", color = "black", shortname = "",},
["Revolutionary United Front"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Revolutionary Workers Party (Chile)"] = {abbrev = "", color = "#BE0411", shortname = "",},
["Revolutionary Workers Party (US)"] = {abbrev = "", color = "#aa0000", shortname = "Revolutionary Workers",},
["Revolutionary Workers Party of Bangladesh"] = {abbrev = "BRWP", color = "#E38B9F", shortname = "",},
["Revolutionary Workers' Party (Bolivia)"] = {abbrev = "", color = "#8B0000", shortname = "",},
["Revolutionary Workers' Party (Russia)"] = {abbrev = "", color = "#DE0403", shortname = "",},
["Revolutionary Workers' Party (Spain)"] = {abbrev = "", color = "#B22222", shortname = "",},
["Revolutionary Workers' Party (Uruguay)"] = {abbrev = "POR", color = "#fff44f", shortname = "",},
["Revolution for Prosperity"] = {abbrev = "RFP", color = "#411144", shortname = "",},
["Rewmi"] = {abbrev = "", color = "#E68F3F", shortname = "",},
["Rex Patrick Team"] = {abbrev = "", color = "#16b7cd", shortname = "",},
["Rexist Party"] = {abbrev = "", color = "#D31212", shortname = "Rexist",},
["Rezistans ek Alternativ"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Rhinoceros Party"] = {abbrev = "", color = "#D8BFD8", shortname = "Rhinoceros",},
["Rhodesia Labour Party"] = {abbrev = "", color = "#DC241f", shortname = "Labour",},
["Rhodesia Party"] = {abbrev = "", color = "#FF7F00", shortname = "",},
["Rhodesian Action Party"] = {abbrev = "RAP", color = "#ffd700", shortname = "",},
["Rhodesian Front"] = {abbrev = "RF", color = "#C247C2", shortname = "",},
["Rhodesian Party"] = {abbrev = "", color = "Orange", shortname = "",},
["Rhuddlan Debt Protest Campaign"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Right Alliance (Belarus)"] = {abbrev = "", color = "#959492", shortname = "",},
["Right Bloc"] = {abbrev = "PB", color = "#8DB600", shortname = "",},
["Right Cause"] = {abbrev = "", color = "#F0BD48", shortname = "",},
["Right-Green People's Party"] = {abbrev = "", color = "#008000", shortname = "",},
["Right Person Electorate Coalition"] = {abbrev = "RPEC", color = "#6D3290", shortname = "",},
["Right Romania Alliance"] = {abbrev = "ARD", color = "#318CE7", shortname = "",},
["Right Sector"] = {abbrev = "", color = "#110C17", shortname = "",},
["Right to Change"] = {abbrev = "RTOC", color = "#EE4035", shortname = "",},
["Right Wing of the Republic"] = {abbrev = "", color = "#BE282D", shortname = "",},
["Right-wing independent"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Righteous Party"] = {abbrev = "", color = "#901380", shortname = "",},
["Rightist Opposition"] = {abbrev = "", color = "#7C1F3C", shortname = "Right Opposition",},
["Right Socialist Party of Japan"] = {abbrev = "", color = "#EE5807", shortname = "Right Socialist",},
["Right to Recall Party"] = {abbrev = "RRP", color = "#FFFF00", shortname = "",},
["Rights and Equality Party"] = {abbrev = "HEPAR", color = "#000000", shortname = "",},
["Rights and Freedoms Party (Turkey)"] = {abbrev = "", color = "#FFDB4D", shortname = "",},
["Rights and Freedoms Party"] = {abbrev = "HAK-PAR", color = "#E6E600", shortname = "",},
["Rights and Justice Party"] = {abbrev = "HAP", color = "#996633", shortname = "",},
["Rights and Liberties Party"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Rights Party"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Rikken Doshikai"] = {abbrev = "", color = "#DA7B8B", shortname = "",},
["Rikken Kaishintō"] = {abbrev = "", color = "#cd5c5c", shortname = "",},
["Rikken Kakushintō"] = {abbrev = "", color = "#00AE9D", shortname = "",},
["Rikken Kokumintō"] = {abbrev = "", color = "#A090E0", shortname = "",},
["Rikken Seiyūkai"] = {abbrev = "", color = "#2E980F", shortname = "",},
["Rikken Yōseikai"] = {abbrev = "", color = "#B0313F", shortname = "",},
["Rio-grandense Republican Party"] = {abbrev = "PRR", color = "#DE2910", shortname = "",},
["Rinnovu"] = {abbrev = "", color = "#500F0B", shortname = "",},
["Riojan Party"] = {abbrev = "PR+", color = "#00AA42", shortname = "",},
["Rionegrin Provincial Party"] = {abbrev = "", color = "#EB3721", shortname = "",},
["RISE – Scotland's Left Alliance"] = {abbrev = "RISE", color = "#f15723", shortname = "",},
["RISE (Ireland)"] = {abbrev = "", color = "#ED161F", shortname = "RISE",},
["Rise Party"] = {abbrev = "", color = "#2E127D", shortname = "",},
["Rise Up Australia Party"] = {abbrev = "RUA", color = "#0080FF", shortname = "Rise Up",},
["Rising Sun Party"] = {abbrev = "RIS", color = "#FFB040", shortname = "",},
["Ritō (government supporters)"] = {abbrev = "", color = "#009933", shortname = "",},
["Rivas Puede"] = {abbrev = "", color = "#812868", shortname = "",},
["Rivers State Peoples Democratic Party"] = {abbrev = "PDP", color = "#FF0000", shortname = "",},
["Robbie the Pict (Independent)"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Rochford District Residents"] = {abbrev = "", color = "#930000", shortname = "Rochford Resident",},
["Rock 'n' Roll Loony Party"] = {abbrev = "", color = "#c71585", shortname = "Rock 'n' Roll Loony",},
["Rock The Vote NZ"] = {abbrev = "", color = "#012268", shortname = "",},
["Rockingham Whigs"] = {abbrev = "", color = "#F0DC82", shortname = "",},
["Rodina (political party)"] = {abbrev = "", color = "#E61B23", shortname = "Rodina",},
["Rodney First"] = {abbrev = "", color = "#009999", shortname = "",},
["Rodrigues Movement"] = {abbrev = "", color = "#21FF21", shortname = "",},
["Rodrigues People's Organisation"] = {abbrev = "OPR", color = "#8B664B", shortname = "",},
["Roma Civic Initiative"] = {abbrev = "ROI", color = "brown", shortname = "",},
["Roma Party"] = {abbrev = "RP", color = "#016830", shortname = "",},
["Roma Union of Serbia"] = {abbrev = "URS", color = "#A3C5EA", shortname = "",},
["Roman Catholic Party of the Netherlands"] = {abbrev = "RKPN", color = "#0033BB", shortname = "",},
["Roman Catholic People's Party"] = {abbrev = "RKVP", color = "#7F7F99", shortname = "",},
["Roman Catholic State Party"] = {abbrev = "RKSP", color = "#003319", shortname = "",},
["Romanian Communist Party"] = {abbrev = "PCR", color = "#CC0000", shortname = "",},
["Romanian Democratic Convention"] = {abbrev = "CDR", color = "#004A92", shortname = "",},
["Romanian ethnic minority parties"] = {abbrev = "", color = "#000000", shortname = "Minority parties",},
["Romanian National Party"] = {abbrev = "PNR", color = "#5087B2", shortname = "",},
["Romanian National Unity Party"] = {abbrev = "PUNR", color = "#1BB0E8", shortname = "",},
["Romanian Nationhood Party"] = {abbrev = "NR", color = "#F7D117", shortname = "",},
["Romanian People's Party"] = {abbrev = "VNS", color = "#FFFF00", shortname = "",},
["Romanian Popular Party"] = {abbrev = "PPR", color = "#FFFF00", shortname = "",},
["Romanian Social Democratic Party (1927–1948)"] = {abbrev = "PSD", color = "#D40000", shortname = "",},
["Romanian Social Democratic Party (1990–2001)"] = {abbrev = "", color = "pink", shortname = "PSDR (Social)",},
["Romanian Social Party"] = {abbrev = "", color = "#ff0000", shortname = "",},
["Romanian Socialist Democratic Party"] = {abbrev = "", color = "#ED2128", shortname = "PSDR (Socialist)",},
["Romanian Socialist Party (1992–2015)"] = {abbrev = "PSR", color = "#CC0000", shortname = "",},
["Romanian Socialist Party (2003)"] = {abbrev = "", color = "#E30615", shortname = "",},
["Romantic Mutual Support Party"] = {abbrev = "", color = "#FFC0CB", shortname = "",},
["Ronda Green Space"] = {abbrev = "", color = "#52886E", shortname = "",},
["Ronda Sí Se Puede"] = {abbrev = "", color = "#63376A", shortname = "",},
["Rondeños por Ronda"] = {abbrev = "", color = "#7F7F7F", shortname = "",},
["Roos Party"] = {abbrev = "", color = "#FFD700", shortname = "Roos",},
["Roots in Macau"] = {abbrev = "", color = "#33FF00", shortname = "",},
["Roots Party of Kenya"] = {abbrev = "", color = "#EC3237", shortname = "",},
["Roque Aguayro"] = {abbrev = "", color = "#D93224", shortname = "",},
["Roque de Gando"] = {abbrev = "", color = "#FFF200", shortname = "",},
["Rose in the Fist"] = {abbrev = "", color = "gold", shortname = "",},
["ROSSEM"] = {abbrev = "", color = "#B7007D", shortname = "",},
["Rother Association of Independent Councillors"] = {abbrev = "RAOIC", color = "#BD8E00", shortname = "",},
["Round Table—Free Georgia"] = {abbrev = "", color = "#BA2B27", shortname = "Round Table",},
["Roundhead"] = {abbrev = "", color = "white", shortname = "",},
["Roundtable (Hong Kong)"] = {abbrev = "", color = "#509ccd", shortname = "Roundtable",},
["Royalist"] = {abbrev = "", color = "#66023C", shortname = "",},
["Royal Italy"] = {abbrev = "IR", color = "#0C0066", shortname = "",},
["RPR-UDF"] = {abbrev = "", color = "#0066CC", shortname = "",},
["Ruam Jai Thai Party"] = {abbrev = "", color = "#F07F07", shortname = "",},
["Ruiz-Mateos Group"] = {abbrev = "", color = "#28365D", shortname = "Ruiz-Mateos",},
["Rukhaniyat Party"] = {abbrev = "", color = "green", shortname = "Rukhaniyat",},
["Ruktam Party"] = {abbrev = "", color = "#799C44", shortname = "Ruktam",},
["Runnymede Independent Residents' Group"] = {abbrev = "RIRG", color = "#264404", shortname = "",},
["Rural Development Party"] = {abbrev = "RDP", color = "", shortname = "",},
["Rural Development Party (Vanuatu)"] = {abbrev = "RDP", color = "#000000", shortname = "Rural Development",},
["Rural Independents Group"] = {abbrev = "", color = "#CCFFCC", shortname = "",},
["Rural Nationalist Bloc"] = {abbrev = "", color = "#048043", shortname = "",},
["Rural Party"] = {abbrev = "", color = "#808000", shortname = "",},
["Rural Party (Iceland)"] = {abbrev = "", color = "purple", shortname = "",},
["Rurality Movement"] = {abbrev = "LMR", color = "#0049A1", shortname = "",},
["Rushcliffe Independents"] = {abbrev = "RI", color = "pink", shortname = "Rushcliffe Ind."},
["Russellite Unionist"] = {abbrev = "", color = "orange", shortname = "",},
["Russia of the Future"] = {abbrev = "", color = "#44B4E3", shortname = "",},
["Russian All-National Union"] = {abbrev = "RONS", color = "#322E2E", shortname = "",},
["Russian All-People's Union"] = {abbrev = "ROS", color = "#FF9C00", shortname = "",},
["Russian Communist Workers Party"] = {abbrev = "", color = "#D50000", shortname = "",},
["Russian Communist Workers' Party of the Communist Party of the Soviet Union"] = {abbrev = "", color = "#A9231B", shortname = "",},
["Russian Democratic Reform Movement"] = {abbrev = "RDDR", color = "#E9E26E", shortname = "",},
["Russian Ecological Party \"The Greens\""] = {abbrev = "", color = "#00953B", shortname = "The Greens",},
["Russian Labour Front"] = {abbrev = "RTF", color = "#34499A", shortname = "",},
["Russian National Party"] = {abbrev = "RNP", color = "blue", shortname = "",},
["Russian Opposition Coordination Council"] = {abbrev = "KSO", color = "#737587", shortname = "",},
["Russian Party (Serbia)"] = {abbrev = "RS", color = "#0D3B66", shortname = "",},
["Russian Party in Estonia"] = {abbrev = "", color = "#2b677f", shortname = "",},
["Russian Party of Freedom and Justice"] = {abbrev = "RPSS", color = "#AC0907", shortname = "",},
["Russian Party of Life"] = {abbrev = "RPL", color = "#D82828", shortname = "",},
["Russian Party of Pensioners for Social Justice"] = {abbrev = "RPPSJ", color = "#C52030", shortname = "",},
["Russian Party of Social Democracy"] = {abbrev = "", color = "#D51F76", shortname = "",},
["Russian Party"] = {abbrev = "", color = "#3CB371", shortname = "",},
["Russian People's Democratic Union"] = {abbrev = "", color = "#D00032", shortname = "",},
["Russian Social Democratic Labour Party"] = {abbrev = "RSDLP", color = "#D40000", shortname = "",},
["Russian Social Democratic Labour Party (Mensheviks)"] = {abbrev = "", color = "#ED1B34", shortname = "Mensheviks",},
["Russian Socialist Movement"] = {abbrev = "", color = "#D62B24", shortname = "",},
["Russian Socialist Party"] = {abbrev = "", color = "#020266", shortname = "",},
["Ruthenian Peasants Party"] = {abbrev = "PKP", color = "#36454F", shortname = "",},
["Russian Bloc (party)"] = {abbrev = "", color = "#0A347C", shortname = "",},
["Russian Unity"] = {abbrev = "", color = "#054C9F", shortname = "",},
["Russophiles for the Revival of the Fatherland"] = {abbrev = "", color = "#3EB149", shortname = "",},
["Rwandan Patriotic Front"] = {abbrev = "RPF", color = "#0087DC", shortname = "",},
["Rwandan Socialist Party"] = {abbrev = "", color = "#FFC0CB", shortname = "",},
["Ryokufūkai (1947–1960)"] = {abbrev = "", color = "#9ACBAB", shortname = "Ryokufūkai",},
}
return {
full = full,
alternate = alternate,
}
5a4e80f6c06079d25c9e66aa66bad2a7e63d0458
Template:Start date
10
230
453
452
2023-12-24T02:13:35Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Start_date]]
wikitext
text/x-wiki
<includeonly>{{#if: {{{4|}}}
|{{#if: {{{5|}}}
|{{padleft:{{{4}}}|2|0}}:{{padleft:{{{5}}}|2|0}}{{#if: {{{6|}}}
|:{{padleft:{{{6}}}|2|0}} }}, }} }}<!--ABOVE FOR TIME; BELOW FOR DATE
-->{{#if: {{{1|}}}
|{{#if: {{{2|}}}
|{{#if: {{{3|}}}
|{{#if: {{{df|}}}|{{#expr:{{{3}}}}} {{MONTHNAME|{{{2}}}}}|{{MONTHNAME|{{{2}}}}} {{#expr:{{{3}}}}},}} {{{1}}}|{{MONTHNAME|{{{2}}}}} {{{1}}}}}|{{{1}}}}}}}{{#if: {{{7|}}}
| ({{#ifeq: {{{7}}}|Z|UTC|{{{7}}}}})}}<!-- BELOW FOR hCalendar
--><span style="display:none"> (<span class="bday dtstart published updated">{{#if: {{{1|}}}
| {{{1}}}{{#if: {{{2|}}}
| -{{padleft:{{{2}}}|2|0}}{{#if: {{{3|}}}
| -{{padleft:{{{3}}}|2|0}} }} }}<!--
-->{{#if: {{{4|}}}
| T{{padleft:{{{4}}}|2|0}}{{#if: {{{5|}}}
| :{{padleft:{{{5}}}|2|0}}{{#if: {{{6|}}}
| :{{padleft:{{{6}}}|2|0}} }} }} }} }}{{{7|}}}</span>)</span></includeonly><noinclude>
{{documentation}}
</noinclude>
2bdc464c20f7d568f3d482c9fb2d04f5d266f982
Module:Ustring
828
231
455
454
2023-12-24T02:13:35Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Ustring]]
Scribunto
text/plain
require('strict')
return setmetatable({}, {
__index = function(t, k)
local what = mw.ustring[k]
if type(what) ~= "function" then
return what
end
return function(frame)
local fargs = frame.args
local fargsused = { tag = true }
local args = {}
local str_i = 1
while fargs['s' .. str_i] do
fargsused['s' .. str_i] = true
args[str_i] = fargs['s' .. str_i]
str_i = str_i + 1
end
for i, v in ipairs(fargs) do
fargsused[i] = true
args[i + str_i - 1] = tonumber(v) or v:gsub("^\\", "", 1)
end
if not fargs.tag then
return (what(unpack(args))) -- Outside parens truncate to first result avoiding tail call
end
local tagargs = {}
for x, y in pairs(fargs) do
if not fargsused[x] then tagargs[x] = y end
end
return frame:extensionTag{name = fargs.tag, content = what(unpack(args)), args = tagargs}
end
end
})
e0455dab4b66831f7596e77432ad865faeef506c
Template:Navbar
10
232
457
456
2023-12-24T02:13:36Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Navbar]]
wikitext
text/x-wiki
<includeonly>{{#invoke:Navbar|navbar}}</includeonly><noinclude>
{{documentation}}
</noinclude>
868e3566b7e8a9a5a7f3dac75cac429c47de10d3
Template:Country data United Kingdom
10
233
459
458
2023-12-24T02:13:37Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Country_data_United_Kingdom]]
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = United Kingdom
| flag alias = Flag of the United Kingdom.svg
| flag alias-1707 = Naval ensign of Great Britain (1707–1800).svg
| flag alias-air force = Ensign of the Royal Air Force.svg
| flag alias-army = Flag of the British Army.svg
| flag alias-civil = Civil Ensign of the United Kingdom.svg
| flag alias-civil-air = Civil Air Ensign of the United Kingdom.svg
| flag alias-coast guard = Flag of Her Majesty's Coastguard.svg
| flag alias-consulate = UK-Consular.svg
| flag alias-embassy = British Ambassador Ensign.svg
| flag alias-government = Government Ensign of the United Kingdom.svg
| flag alias-marines = Flag of the Royal Marines.svg
| flag alias-military = Flag of the United Kingdom (3-5).svg
| flag alias-naval = Naval Ensign of the United Kingdom.svg
| flag alias-GS = Government Service Ensign.svg
| flag alias-merchant = Civil Ensign of the United Kingdom.svg
| flag alias-RFA = British-Royal-Fleet-Auxiliary-Ensign.svg
| flag alias-RMAS = British Royal Maritime Auxiliary Ensign.svg
| flag alias-RNLI = Flag of the Royal National Lifeboat Institution.svg
| flag alias-naval-1707 = Naval ensign of Great Britain (1707–1800).svg
| flag alias-naval-GS = Government Service Ensign.svg
| flag alias-naval-merchant = Civil Ensign of the United Kingdom.svg
| flag alias-naval-RFA = British-Royal-Fleet-Auxiliary-Ensign.svg
| flag alias-naval-RMAS = British Royal Maritime Auxiliary Ensign.svg
| flag alias-naval-RNLI = Flag of the Royal National Lifeboat Institution.svg
| flag alias-navy = Naval Ensign of the United Kingdom.svg
| link alias-air force = Royal Air Force
| link alias-army = British Army
| link alias-coast guard = His Majesty's Coastguard
| link alias-marines = Royal Marines
| link alias-military = British Armed Forces
| link alias-navy = Royal Navy
| link alias-naval = {{#switch:{{{variant|}}}
| merchant = Merchant Navy (United Kingdom){{!}}Merchant Navy
| reserve = Royal Naval Reserve
| RFA = Royal Fleet Auxiliary
| RMAS = Royal Maritime Auxiliary Service
| RNLI = Royal National Lifeboat Institution
| naval-merchant = Merchant Navy (United Kingdom){{!}}Merchant Navy
| naval-reserve = Royal Naval Reserve
| naval-RFA = Royal Fleet Auxiliary
| naval-RMAS = Royal Maritime Auxiliary Service
| naval-RNLI = Royal National Lifeboat Institution
| #default = Royal Navy
}}
| size = {{{size|}}}
| name = {{#ifeq:{{{name|}}}|Britain|United Kingdom|{{{name|}}}}}
| altlink = {{{altlink|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = civil
| var2 = government
| var3 = 1707
| var4 = civil-air
| var5 = embassy
| var6 = consulate
| var7 = GS
| var8 = merchant
| var9 = RFA
| var10 = RMAS
| var11 = RNLI
| var12 = naval-1707
| var13 = naval-GS
| var14 = naval-merchant
| var15 = naval-RFA
| var16 = naval-RMAS
| var17 = naval-RNLI
| redir1 = UK
| redir2 = U.K.
| redir3 = the United Kingdom
| related1 = Great Britain
| related2 = London
| related3 = Kingdom of Great Britain
| related4 = British Empire
| related5 = United Kingdom of Great Britain and Ireland
| related6 = Kingdom of England
| related7 = Kingdom of Scotland
</noinclude>
}}
f35f7e64c499db65b9894d7fb917c4c07d791aa4
Template:Max
10
234
461
460
2023-12-24T02:13:39Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Max]]
wikitext
text/x-wiki
<includeonly>{{#invoke:Math|max}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
f052e3a9b5b08740be624045e49f31d86e09f0ad
Module:Political party/L
828
235
463
462
2023-12-24T02:13:40Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Political_party/L]]
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["La France insoumise"] = "La France Insoumise",
["Labor Front"] = "Labour Front",
["Labor Party (United States, 1996)"] = "Labor Party (US, 1996)",
["Labor Party (United States)"] = "Labor Party (US)",
["Labor Party (US, 19th century)"] = "Labor Party (United States, 19th century)",
["Labor Party"] = "Labour Party",
["Labour Party–GroenLinks"] = "GroenLinks–PvdA",
["Labor-Farm Party of Wisconsin"] = "Labor–Farm Party of Wisconsin",
["Labour '87"] = "Labour Party of Northern Ireland",
["Labour Co-operative"] = "Labour and Co-operative Party",
["Labour and Co-operative"] = "Labour and Co-operative Party",
["Labour Coalition"] = "Labour coalition",
["Labour (Ireland)"] = "Labour Party (Ireland)",
["Labour Party (Mexico)"] = "Labor Party (Mexico)",
["Lakas Kampi CMD"] = "Lakas–Kampi",
["Lakas-Christian Muslim Democrats"] = "Lakas–CMD",
["Lakas-CMD"] = "Lakas–CMD",
["Lakas-CMD (1991)"] = "Lakas–CMD (1991)",
["Lakas-CMD (2009)"] = "Lakas–CMD",
["Lakas-Kampi-CMD"] = "Lakas–Kampi",
["Lakas-NUCD-UMDP"] = "Lakas–CMD (1991)",
["Lakas-NUCD"] = "Lakas–CMD (1991)",
["Lakas–Christian Muslim Democrats"] = "Lakas–CMD",
["Lakas–CMD (2009)"] = "Lakas–CMD",
["Lakas–Kampi–CMD"] = "Lakas–CMD",
["Lakas–NUCD–UMDP"] = "Lakas–CMD (1991)",
["Lakas–NUCD"] = "Lakas–CMD (1991)",
["Lalit"] = "Lalit (Mauritius)",
["Lanka Democratic Party"] = "Lanka Prajathanthravadi Pakshaya",
["Lantmannapartiet"] = "Lantmanna Party",
["LaRouche movement"] = "National Democratic Policy Committee",
["Latvian Centrist Party"] = "Centre Party (Latvia)",
["Latvian Social Democratic Alliance"] = "Latvian Social Democratic Workers' Party",
["Law and Order (Latvia)"] = "For Each and Every One",
["Law and Order Party (United States)"] = "Law and Order Party (US)",
["LDPR (political party)"] = "Liberal Democratic Party of Russia",
["Left for the Right to Decide"] = "Republican Left of Catalonia",
["Left Front (India)"] = "Left Front",
["Left Front (Sri Lanka)"] = "Left Liberation Front",
["Left of the Peoples (1987)"] = "Left of the Peoples",
["Left of the Peoples (1989)"] = "Left of the Peoples",
["Left Option"] = "Estonian Left Party",
["Left Party – Communists"] = "Left Party (Sweden)",
["Left Party-Communists"] = "Left Party (Sweden)",
["Left Radical Party"] = "Radical Party of the Left",
["Left Unity (European Parliament)"] = "European United Left–Nordic Green Left",
["Leftist Socialist Party of Japan"] = "Left Socialist Party of Japan",
["Leftist Workers and Farm Labourers"] = "Communist Party of Latvia",
["Lega per Salvini Premier"] = "Lega (political party)",
["Les Engagés"] = "Les Engagés (political party)",
["Libertarian Party (Alaska)"] = "Libertarian Party (US)",
["Liberal–Democratic List"] = "Liberal League (Luxembourg)",
["Liberal/Country Coalition"] = "Coalition (Australia)",
["Liberal-Country Coalition"] = "Coalition (Australia)",
["Liberal–Country Coalition"] = "Coalition (Australia)",
["Liberal/National Coalition"] = "Coalition (Australia)",
["Liberal-National Coalition"] = "Coalition (Australia)",
["Liberal–National Coalition"] = "Coalition (Australia)",
["Lib-Lab"] = "Liberal-Labour (UK)",
["Liberal Coalition Party"] = "Liberals (Sweden)",
["Liberal Constitutional Party (Italy)"] = "Historical Right (Italy)",
["Liberal Democratic Party (Chile)"] = "Liberal Democratic Party (Chile, 1893)",
["Liberal Democratic Party (Italy)"] = "Italian Democratic Liberal Party",
["Liberal Democratic Party (Lithuania)"] = "Order and Justice",
["Liberal Democratic Party (Serbia 2005)"] = "Liberal Democratic Party (Serbia)",
["Liberal Democratic Party (Spain)"] = "Liberal Democratic Party (Spain, 1982)",
["Liberal Democratic Party of Japan"] = "Liberal Democratic Party (Japan)",
["Liberal Democratic Party of Switzerland"] = "Liberal Party of Switzerland",
["Liberal Democrats"] = "Liberal Democrats (UK)",
["Liberal Movement"] = "Liberal Movement (Australia)",
["Liberal Movement (Lithuania)"] = "Liberals' Movement (Lithuania)",
["Liberal National Party (UK, 1931)"] = "National Liberal Party (UK, 1931)",
["Liberal Party (Japan, 1945)"] = "Liberal Party (Japan, 1950)",
["Liberal Party (Luxembourg)"] = "Liberal League (Luxembourg)",
["Liberal Party (Scotland)"] = "Scottish Liberal Party",
["Liberal Party (Serbia, 1989)"] = "Liberal Democratic Party (Serbia, 1989)",
["Liberal Party of Australia (Australian Capital Territory Division)"] = "Liberal Party of Australia (A.C.T. Division)",
["Liberal Party of New York"] = "Liberal Party (New York)",
["Liberal Party of Sweden"] = "Liberals (Sweden)",
["Liberal Party"] = "Democratic Liberal Party (Japan)",
["Liberal People's Party (Sweden)"] = "Liberals (Sweden)",
["Liberal People's Party"] = "Liberals (Sweden)",
["Liberal Reformist Party + Democratic Front of Francophones"] = "Reformist Movement",
["Liberal Reformist Party"] = "Liberal Reformist Party (Belgium)",
["Liberal Republican Party (United States)"] = "Liberal Republican Party (US)",
["Liberal Socialist Party"] = "Liberal Socialist Party (Singapore)",
["Liberal Socialists Party"] = "Liberal Socialists Party (Egypt)",
["Liberal Unionist"] = "Liberal Unionist Party",
["Liberal Unionist Party (UK)"] = "Liberal Unionist Party",
["Liberal-Labour (New Zealand)"] = "Liberal–Labour (New Zealand)",
["Liberals (Italy)"] = "Liberal Union (Italy)",
["Liberals–Democrats–Radicals"] = "Liberals, Democrats and Radicals",
["Liberals' Movement of the Republic of Lithuania"] = "Liberals' Movement (Lithuania)",
["Liberal Party of Andorra"] = "Liberals of Andorra",
["Libertad y Refundación"] = "Liberty and Refoundation",
["Libertarian, Direct, Democratic"] = "Libertair, Direct, Democratisch",
["Libertarian Party UK"] = "Libertarian Party (UK)",
["Libertarian Party (United Kingdom)"] = "Libertarian Party (UK)",
["Libertarian Party (United States)"] = "Libertarian Party (US)",
["Libertarian Party (Alaska)"] = "Libertarian Party (US)",
["Libertarian Party (Arizona)"] = "Libertarian Party (US)",
["Libertarian Party (California)"] = "Libertarian Party (US)",
["Libertarian Party (Colorado)"] = "Libertarian Party (US)",
["Libertarian Party (Connecticut)"] = "Libertarian Party (US)",
["Libertarian Party (Delaware)"] = "Libertarian Party (US)",
["Libertarian Party (Iowa)"] = "Libertarian Party (US)",
["Libertarian Party (Massachusetts)"] = "Libertarian Party (US)",
["Libertarian Party (Michigan)"] = "Libertarian Party (US)",
["Libertarian Party (Missouri)"] = "Libertarian Party (US)",
["Libertarian Party (Nevada)"] = "Libertarian Party (US)",
["Libertarian Party (New Mexico)"] = "Libertarian Party (US)",
["Libertarian Party (New York)"] = "Libertarian Party (US)",
["Libertarian Party (Oregon)"] = "Libertarian Party (US)",
["Libertarian Party (Vermont)"] = "Libertarian Party (US)",
["Libertarian Party (Washington)"] = "Libertarian Party (US)",
["Libertarian Party of Arizona"] = "Libertarian Party (US)",
["Libertarian Party of California"] = "Libertarian Party (US)",
["Libertarian Party of Colorado"] = "Libertarian Party (US)",
["Libertarian Party of Connecticut"] = "Libertarian Party (US)",
["Libertarian Party of Delaware"] = "Libertarian Party (US)",
["Libertarian Party of the District of Columbia"] = "Libertarian Party (US)",
["Libertarian Party of Florida"] = "Libertarian Party (US)",
["Libertarian Party of Georgia"] = "Libertarian Party (US)",
["Libertarian Party of Hawaii"] = "Libertarian Party (US)",
["Libertarian Party of Kentucky"] = "Libertarian Party (US)",
["Libertarian Party of Maryland"] = "Libertarian Party (US)",
["Libertarian Party of Massachusetts"] = "Libertarian Party (US)",
["Libertarian Party of Michigan"] = "Libertarian Party (US)",
["Libertarian Party of Minnesota"] = "Libertarian Party (US)",
["Libertarian Party of Missouri"] = "Libertarian Party (US)",
["Libertarian Party of Montana"] = "Libertarian Party (US)",
["Libertarian Party of Nevada"] = "Libertarian Party (US)",
["Libertarian Party of New Mexico"] = "Libertarian Party (US)",
["Libertarian Party of New York"] = "Libertarian Party (US)",
["Libertarian Party of North Carolina"] = "Libertarian Party (US)",
["Libertarian Party of North Dakota"] = "Libertarian Party (US)",
["Libertarian Party of Ohio"] = "Libertarian Party (US)",
["Libertarian Party of Oklahoma"] = "Libertarian Party (US)",
["Libertarian Party of Oregon"] = "Libertarian Party (US)",
["Libertarian Party of Pennsylvania"] = "Libertarian Party (US)",
["Libertarian Party of Texas"] = "Libertarian Party (US)",
["Libertarian Party of Utah"] = "Libertarian Party (US)",
["Libertarian Party of Washington"] = "Libertarian Party (US)",
["Libertarian Party of Wisconsin"] = "Libertarian Party (US)",
["Libertas (lobby group)"] = "Libertas.eu",
["Libertas Spain"] = "Libertas.eu",
["Liberty Forward Party"] = "Advancement Unification Party",
["Liberty Party (United States, 1840)"] = "Liberty Party (US)",
["Liberty Party (United States, 1932)"] = "Liberty Party (US)",
["Liberty Party (United States)"] = "Liberty Party (US)",
["Liberty Party (US, 1840)"] = "Liberty Party (US)",
["Liberty Party"] = "Liberty Party (US)",
["Liberal People's Party (Finland)"] = "Liberals (Finland)",
["Libra Party (Albania)"] = "Libra Party",
["Libyan Arab Socialist Union"] = "Arab Socialist Union (Libya)",
["LID"] = "Left and Democrats",
["Ligue du Midi"] = "Ligue du Sud",
["Local"] = "Localist",
["Lok Dal"] = "Lokdal",
["Lok Jan Shakti Party"] = "Lok Janshakti Party",
["Long Live Tunisia"] = "Tahya Tounes",
["Louisiana Democratic Party"] = "Democratic Party (United States)",
["LPHK"] = "Liberal Party (Hong Kong)",
["LPR"] = "League of Polish Families",
["LSSP"] = "Lanka Sama Samaja Party",
["Luxembourg Workers' Party"] = "Luxembourg Socialist Workers' Party",
["Luys Alliance"] = "Bright Alliance",
}
local full = {
["L'Alternativa c'è"] = {abbrev = "", color = "#FE9F07", shortname = "",},
["L'Hospitalet Left Alternative"] = {abbrev = "", color = "#42837D", shortname = "",},
["La Axarquía Progress"] = {abbrev = "", color = "#FF990E", shortname = "",},
["La España en Marcha"] = {abbrev = "", color = "#111011", shortname = "",},
["La Falange (1999)"] = {abbrev = "", color = "#29191E", shortname = "",},
["La France En Action"] = {abbrev = "", color = "#F8F1BB", shortname = "",},
["La France Insoumise"] = {abbrev = "LFI", color = "#E53D40", shortname = "",},
["La Fresneda Local Platform"] = {abbrev = "", color = "#004D21", shortname = "",},
["La Fuerza de Santa Fe"] = {abbrev = "", color = "#5F8748", shortname = "",},
["La Libertad Avanza"] = {abbrev = "LLA", color = "#6C4C99", shortname = "",},
["La Línea 100x100"] = {abbrev = "", color = "#FA5841", shortname = "",},
["La Palma Group of Independents"] = {abbrev = "", color = "#072357", shortname = "",},
["La République En Marche!"] = {abbrev = "LREM", color = "#FFD600", shortname = "",},
["Laban ng Demokratikong Pilipino"] = {abbrev = "LDP", color = "#0000CD", shortname = "",},
["Laban ng Makabayang Masang Pilipino"] = {abbrev = "LAMMP", color = "#ffa500", shortname = "",},
["Labor and Agrarian Party"] = {abbrev = "PALA", color = "royalblue", shortname = "",},
["Labor Party (Mexico)"] = {abbrev = "PT", color = "#DB2017", shortname = "",},
["Labor Party (South Korea)"] = {abbrev = "", color = "#DC143C", shortname = "Labor",},
["Labor Party (Taiwan)"] = {abbrev = "", color = "red", shortname = "",},
["Labor Party (United States, 19th century)"] = {abbrev = "", color = "#FF6347", shortname = "Labor",},
["Labor Party (US, 1996)"] = {abbrev = "", color = "#FF6347", shortname = "Labor",},
["Labor Party (US)"] = {abbrev = "", color = "#FF6347", shortname = "Labor",},
["Labor Party of the United States"] = {abbrev = "", color = "#FF6347", shortname = "Labor",},
["Labor Party Philippines"] = {abbrev = "WPP", color = "#00039F", shortname = "",},
["Labor Solidarity"] = {abbrev = "SL", color = "purple", shortname = "",},
["Labor Union of Games and Gambling in Macau"] = {abbrev = "", color = "#B2FFFF", shortname = "",},
["Labor–Farm Party of Wisconsin"] = {abbrev = "", color = "#17aa5c", shortname = "Labor–Farm",},
["Labor-Gesher-Meretz"] = {abbrev = "", color = "#ED1B25", shortname = "Emet",},
["Labor-Gesher"] = {abbrev = "", color = "#EE161F", shortname = "",},
["Labor"] = {abbrev = "", color = "#FF6347", shortname = "",},
["Laboring People's Party"] = {abbrev = "", color = "red", shortname = "",},
["Laborious Ukraine Electoral Bloc"] = {abbrev = "", color = "#872558", shortname = "Labour Ukraine",},
["Laborist Party (Mexico)"] = {abbrev = "", color = "#CE1126", shortname = "Laborist",},
["Laborista Party"] = {abbrev = "", color = "green", shortname = "Laborista",},
["Labour and Co-operative Party"] = {abbrev = "", color = "#E4003B", shortname = "Labour Co-op",},
["Labour and Equity Party"] = {abbrev = "", color = "#4e92d3", shortname = "",},
["Labour and Freedom Alliance"] = {abbrev = "", color = "#90268F", shortname = "Labour and Freedom",},
["Labour and Justice Party (Spain)"] = {abbrev = "", color = "#AD0000", shortname = "",},
["Labour and Social Justice – The Electoral Alternative"] = {abbrev = "WASG", color = "#FF8000", shortname = "Labour and Social Justice",},
["Labour and Solidarity Party"] = {abbrev = "", color = "#5963cf", shortname = "",},
["Labour and Trade Union Group"] = {abbrev = "", color = "#D44442", shortname = "Labour and Trade Union",},
["Labour Cause's Party"] = {abbrev = "", color = "#9F030A", shortname = "",},
["Labour coalition"] = {abbrev = "", color = "#cd5c5c", shortname = "",},
["Labour Democrat Party"] = {abbrev = "", color = "", shortname = "Labour Democrat",},
["Labour Democratic Party"] = {abbrev = "", color = "Pink", shortname = "Labour Democracy",},
["Labour Democrats"] = {abbrev = "", color = "#59A421", shortname = "",},
["Labour Electoral Association"] = {abbrev = "LEA", color = "#B22222", shortname = "",},
["Labour Faction (1937)"] = {abbrev = "SP", color = "#1693F4", shortname = "",},
["Labour Front"] = {abbrev = "LF", color = "#AA5634", shortname = "",},
["Labour Gathering Party"] = {abbrev = "", color = "#8B0000", shortname = "",},
["Labour Independent Group"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Labour Party (Argentina)"] = {abbrev = "PL", color = "#00708B", shortname = "Labour Party",},
["Labour Party (Greenland)"] = {abbrev = "", color = "pink", shortname = "Labour",},
["Labour Party (Hong Kong)"] = {abbrev = "", color = "#F7941E", shortname = "Labour",},
["Labour Party (Indonesia, 1949)"] = {abbrev = "PB", color = "red", shortname = "",},
["Labour Party (Indonesia, 1998)"] = {abbrev = "PB", color = "#000080", shortname = "",},
["Labour Party (Indonesia, 2021)"] = {abbrev = "PB", color = "#ff6800", shortname = "",},
["Labour Party (Ireland)"] = {abbrev = "Lab", color = "#CC0000", shortname = "Labour",},
["Labour Party (Lithuania)"] = {abbrev = "DP", color = "#1D578C", shortname = "",},
["Labour Party (Malta)"] = {abbrev = "", color = "#EE3224", shortname = "Labour",},
["Labour Party (Mauritius)"] = {abbrev = "", color = "#FF0000", shortname = "Labour Party",},
["Labour Party (Morocco)"] = {abbrev = "", color = "#D04933", shortname = "",},
["Labour Party (Netherlands)"] = {abbrev = "PvdA", color = "#DF111A", shortname = "",},
["Labour Party (New Caledonia)"] = {abbrev = "PT", color = "#9A0000", shortname = "",},
["Labour Party (Nigeria)"] = {abbrev = "LP", color = "#DA251C", shortname = "",},
["Labour Party (Norway)"] = {abbrev = "", color = "#D70926", shortname = "Labour",},
["Labour Party (Poland)"] = {abbrev = "SP", color = "#083A7F", shortname = "",},
["Labour Party (Secular)"] = {abbrev = "LP(S)", color = "#2E64FE", shortname = "",},
["Labour Party (Singapore)"] = {abbrev = "", color = "#CC8955", shortname = "Labour Party",},
["Labour Party (Slovakia)"] = {abbrev = "SP", color = "#C31B3E", shortname = "",},
["Labour Party (South Africa, 1969)"] = {abbrev = "", color = "#8D0000", shortname = "Labour",},
["Labour Party (South Africa)"] = {abbrev = "", color = "#FF0000", shortname = "Labour",},
["Labour Party (Thailand)"] = {abbrev = "", color = "#FF0000", shortname = "Labour",},
["Labour Party (Turkey)"] = {abbrev = "", color = "#FFDE4D", shortname = "Labour",},
["Labour Party (UK)"] = {abbrev = "Lab", color = "#E4003B", shortname = "Labour",},
["Labour Party in Northern Ireland"] = {abbrev = "", color = "#DC241F", shortname = "",},
["Labour Party of Bosnia and Herzegovina"] = {abbrev = "", color = "#013971", shortname = "",},
["Labour Party of Brazil"] = {abbrev = "PTdoB", color = "#00FF00", shortname = "",},
["Labour Party of Hong Kong"] = {abbrev = "", color = "#DE2910", shortname = "Labour",},
["Labour Party of India (V V Prasad)"] = {abbrev = "LPI(V)", color = "#4C81B6", shortname = "",},
["Labour Party of India"] = {abbrev = "LPI", color = "#E0E6F8", shortname = "",},
["Labour Party of Malaya"] = {abbrev = "", color = "#FAAFBA", shortname = "",},
["Labour Party of Northern Ireland"] = {abbrev = "", color = "#DC241f", shortname = "Labour Party NI",},
["Labour Party of Serbia"] = {abbrev = "LPS", color = "#2274A5", shortname = "",},
["Labour Party Pakistan"] = {abbrev = "", color = "#FE2712", shortname = "",},
["Labour Party"] = {abbrev = "", color = "#FF0000", shortname = "Labour",},
["Labour Progressive"] = {abbrev = "", color = "red", shortname = "",},
["Labour Renewal Movement"] = {abbrev = "", color = "#23FF00", shortname = "",},
["Labour Representation Committee (1900)"] = {abbrev = "", color = "#b22222", shortname = "Labour Repr. Cmte.",},
["Labour Representation Committee"] = {abbrev = "", color = "#b22222", shortname = "Labour",},
["Labour Republican Party"] = {abbrev = "", color = "#FF9340", shortname = "",},
["Labour Solidarity"] = {abbrev = "SP", color = "#D33F49", shortname = "",},
["Labour Ukraine"] = {abbrev = "", color = "Purple", shortname = "",},
["Labour Union (Poland)"] = {abbrev = "UP", color = "#ED1C24", shortname = "",},
["Labour Unionist"] = {abbrev = "", color = "#DDEEFF", shortname = "",},
["Labour-Farmer Party"] = {abbrev = "", color = "#FF5C85", shortname = "",},
["Labour-Farmer Masses Party"] = {abbrev = "", color = "#FF5C85", shortname = "",},
["Labour, Co-operative and Trade Union"] = {abbrev = "", color = "white", shortname = "Labour, Co-op & Trade Union",},
["Labourers and Farmers Party"] = {abbrev = "", color = "#FE7580", shortname = "Labourers and Farmers",},
["Ladlad"] = {abbrev = "", color = "#FFC0CB", shortname = "",},
["Lahu National Development Party"] = {abbrev = "LHNDP", color = "#A66971", shortname = "",},
["Lakas ng Bansa"] = {abbrev = "LnB", color = "#0000CD", shortname = "",},
["Lakas ng Bayan Coalition"] = {abbrev = "LABAN", color = "#FFFF40", shortname = "",},
["Lakas ng Bayan"] = {abbrev = "LABAN", color = "#FFFF00", shortname = "",},
["Lakas–CMD (1991)"] = {abbrev = "", color = "#B0E0E6", shortname = "Lakas–CMD",},
["Lakas–CMD"] = {abbrev = "", color = "#B0E0E6", shortname = "Lakas",},
["Lakas–Kampi"] = {abbrev = "LKS-KAM", color = "#B0E0E6", shortname = "Lakas–Kampi",},
["Lakas-Laban Coalition"] = {abbrev = "L–L", color = "#B0E0E6", shortname = "Lakas–Laban",},
["Lalit (Mauritius)"] = {abbrev = "", color = "#F7CC06", shortname = "",},
["Land and Justice Party"] = {abbrev = "", color = "#DC261B", shortname = "Land & Justice",},
["Land development"] = {abbrev = "", color = "#CDB79E", shortname = "",},
["Land Justice League"] = {abbrev = "", color = "#73BC7C", shortname = "",},
["Land of Dharma Party"] = {abbrev = "", color = "#593012", shortname = "",},
["Land Party (South Africa)"] = {abbrev = "", color = "#7e803e", shortname = "Land Party",},
["Land Party"] = {abbrev = "", color = "#4898B9", shortname = "",},
["Landbund"] = {abbrev = "", color = "#385A38", shortname = "",},
["Landless People's Movement (Namibia)"] = {abbrev = "LPM", color = "#FC7B2C", shortname = "",},
["Lang Labor"] = {abbrev = "", color = "#E2725B", shortname = "",},
["Lanka Prajathanthravadi Pakshaya"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Lanka Sama Samaja Party"] = {abbrev = "LSSP", color = "#FF0000", shortname = "",},
["Lantmanna and Bourgeois Party"] = {abbrev = "", color = "#ff9933", shortname = "Lantmanna and Bourgeois",},
["Lantmanna Party"] = {abbrev = "", color = "#00529C", shortname = "Lantmanna",},
["Lanzarote Avanza"] = {abbrev = "", color = "#037468", shortname = "",},
["Lanzarote En Pie"] = {abbrev = "", color = "#238EAD", shortname = "",},
["Lanzarote Independents Party"] = {abbrev = "", color = "#31B404", shortname = "",},
["Lanzarote Neighborhood Force"] = {abbrev = "", color = "#98CCFE", shortname = "",},
["Lao National Union Party"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Lao Patriotic Front"] = {abbrev = "", color = "#CE1126", shortname = "",},
["Lao People's Revolutionary Party"] = {abbrev = "LPRP", color = "#CE1126", shortname = "",},
["Lapian ng Masang Pilipino"] = {abbrev = "LAMP", color = "#ffa500", shortname = "",},
["Lapiang Manggagawa"] = {abbrev = "LM", color = "#00039f", shortname = "",},
["LaPrimaire.org"] = {abbrev = "", color = "#800080", shortname = "",},
["Las Palmas de Gran Canaria Puede"] = {abbrev = "", color = "#96CA2D", shortname = "",},
["Latgale Party"] = {abbrev = "", color = "#004B84", shortname = "",},
["Latvia First"] = {abbrev = "LPV", color = "#A8343C", shortname = "",},
["Latvia's First Party"] = {abbrev = "", color = "#582B64", shortname = "",},
["Latvia's First Party/Latvian Way"] = {abbrev = "", color = "#682376", shortname = "",},
["Latvian Association of Regions"] = {abbrev = "LRA", color = "#0E3267", shortname = "",},
["Latvian Farmers' Union"] = {abbrev = "LZS", color = "#D5D900", shortname = "",},
["Latvian Green Party"] = {abbrev = "", color = "#00683A", shortname = "",},
["Latvian National Independence Movement"] = {abbrev = "", color = "#902E3B", shortname = "",},
["Latvian Nationalists"] = {abbrev = "", color = "#9E2B38", shortname = "",},
["Latvian Russian Union"] = {abbrev = "", color = "#3560A9", shortname = "",},
["Latvian Social Democratic Workers' Party"] = {abbrev = "LSDSP", color = "#830D30", shortname = "",},
["Latvian Unity Party"] = {abbrev = "", color = "#DC5356", shortname = "",},
["Latvian Way"] = {abbrev = "", color = "#FFE200", shortname = "",},
["Lauredian Union"] = {abbrev = "UL", color = "#000000", shortname = "",},
["Law and Justice (Georgia)"] = {abbrev = "", color = "#01FFFF", shortname = "",},
["Law and Justice"] = {abbrev = "PiS", color = "#263778", shortname = "",},
["Law and Order Party (US)"] = {abbrev = "", color = "#00DDDD", shortname = "Law and Order",},
["Law Preservation Party"] = {abbrev = "", color = "#FF00FF", shortname = "Law Preservation",},
["Le Trèfle"] = {abbrev = "", color = "#77FF77", shortname = "",},
["Leaders Party of Vanuatu"] = {abbrev = "", color = "#3DAB48", shortname = "Leaders Party",},
["Leading Thai Party"] = {abbrev = "", color = "#DEB887", shortname = "Leading Thai",},
["League Against Usury"] = {abbrev = "LCC", color = "lightgreen", shortname = "",},
["League for Democracy Party"] = {abbrev = "", color = "#3BB9FF", shortname = "",},
["League Nepal Shanti Ekta Party"] = {abbrev = "", color = "#E6DBCF", shortname = "",},
["League of Albanians of Romania"] = {abbrev = "LSR", color = "#444444", shortname = "",},
["League of Anti-Corruption Governors"] = {abbrev = "LIGA", color = "#F5EC49", shortname = "",},
["League of Catalonia–Catalan Liberal Party"] = {abbrev = "", color = "#99FF00", shortname = "",},
["League of Communists – Movement for Yugoslavia"] = {abbrev = "", color = "#FF0000", shortname = "",},
["League of Communists of Bosnia and Herzegovina"] = {abbrev = "SK BiH", color = "#DD0000", shortname = "",},
["League of Communists of Croatia"] = {abbrev = "SKH", color = "#DD0000", shortname = "",},
["League of Communists of Montenegro"] = {abbrev = "SKCG", color = "#DD0000", shortname = "",},
["League of Communists of Serbia"] = {abbrev = "SKS", color = "#DD0000", shortname = "",},
["League of Communists of Slovenia"] = {abbrev = "ZKS", color = "#DD0000", shortname = "",},
["League of Communists of Yugoslavia"] = {abbrev = "SKJ", color = "#DD0000", shortname = "",},
["League of Communists of Yugoslavia in Serbia"] = {abbrev = "SKJS", color = "red", shortname = "",},
["League of Democratic Socialists"] = {abbrev = "BDS", color = "red", shortname = "",},
["League of Free Liberals"] = {abbrev = "BVL", color = "#3399FF", shortname = "",},
["League of Polish Families"] = {abbrev = "LPR", color = "#2DA0D2", shortname = "",},
["League of Social Democrats of Vojvodina"] = {abbrev = "LSV", color = "#03C03C", shortname = "",},
["League of Social Democrats"] = {abbrev = "LSD", color = "#e0050d", shortname = "",},
["League of Socialist Youth of Bosnia and Herzegovina"] = {abbrev = "", color = "#FF6347", shortname = "",},
["League of Supporters of Indonesian Independence"] = {abbrev = "IPKI", color = "#D1E231", shortname = "",},
["League of the South (France)"] = {abbrev = "", color = "#C60B27", shortname = "",},
["League of West German Communists"] = {abbrev = "BWK", color = "red", shortname = "",},
["Lebanese Forces"] = {abbrev = "LF", color = "#ED2027", shortname = "Lebanese Forces",},
["Lecompton Democrat"] = {abbrev = "", color = "#ACCCFE", shortname = "Lecompton Democratic",},
["Leeds Left Alliance"] = {abbrev = "", color = "#00A86B", shortname = "",},
["LEF – For the New Generation"] = {abbrev = "LEF", color = "#6B6BFF", shortname = "",},
["Left (Austria)"] = {abbrev = "", color = "#FF0000", shortname = "Left",},
["Left Alliance (Finland)"] = {abbrev = "Vas.", color = "#F00A64", shortname = "Left Alliance",},
["Left Alternative"] = {abbrev = "", color = "red", shortname = "",},
["Left and Democrats"] = {abbrev = "LiD", color = "#D22833", shortname = "",},
["Left Andalusian Bloc"] = {abbrev = "", color = "#32754C", shortname = "",},
["Left Assembly of Tudela"] = {abbrev = "", color = "#CC7EAE", shortname = "",},
["Left Assembly–Initiative for Andalusia"] = {abbrev = "", color = "#ADA0A3", shortname = "",},
["Left Bloc (Portugal)"] = {abbrev = "BE", color = "#8B0000", shortname = "",},
["Left Bloc for National Liberation"] = {abbrev = "", color = "#FF9933", shortname = "",},
["Left Bloc"] = {abbrev = "", color = "#8B0000", shortname = "",},
["Left Camp of Israel"] = {abbrev = "Sheli", color = "#DC241F", shortname = "",},
["Left Centre"] = {abbrev = "", color = "#2CBFE3", shortname = "",},
["Left Coalition (Serbia)"] = {abbrev = "LK", color = "#A60C19", shortname = "",},
["Left Communists (Weimar Republic)"] = {abbrev = "LK", color = "red", shortname = "",},
["Left Democratic Front (Kerala)"] = {abbrev = "LDF", color = "#EE0000", shortname = "",},
["Left and Democratic Front (India)"] = {abbrev = "LDF", color = "#FF0000", shortname = "",},
["Left Ecology Freedom"] = {abbrev = "", color = "#C80815", shortname = "",},
["Left for Almería"] = {abbrev = "", color = "#037949", shortname = "",},
["Left for Independence"] = {abbrev = "", color = "#DAC125", shortname = "",},
["Left Front (Asturias)"] = {abbrev = "", color = "#76319B", shortname = "",},
["Left Front (France)"] = {abbrev = "FG", color = "#D6232B", shortname = "",},
["Left Front (Russia)"] = {abbrev = "Left Front", color = "#FF131C", shortname = "",},
["Left Front (West Bengal)"] = {abbrev = "LF", color = "#FF0000", shortname = "",},
["Left Front"] = {abbrev = "LF", color = "red", shortname = "",},
["Left in Positive"] = {abbrev = "", color = "#9B0F3B", shortname = "",},
["Left Independentists"] = {abbrev = "", color = "#AF1B1D", shortname = "",},
["Left Liberals"] = {abbrev = "", color = "#00FF00", shortname = "",},
["Left Liberation Front"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Left List"] = {abbrev = "", color = "red", shortname = "",},
["Left Movement"] = {abbrev = "", color = "#BD1928", shortname = "",},
["Left Nationalists"] = {abbrev = "", color = "#E53E13", shortname = "",},
["Left of Catalonia–Democratic Electoral Front"] = {abbrev = "", color = "#EFF24C", shortname = "",},
["Left of Galicia"] = {abbrev = "", color = "#E80810", shortname = "",},
["Left of the Peoples"] = {abbrev = "", color = "#D56545", shortname = "",},
["Left Party - Communists"] = {abbrev = "", color = "#b00000", shortname = "Left-Communist",},
["Left Party (France)"] = {abbrev = "", color = "#AA0000", shortname = "Left Party",},
["Left Party (Sweden)"] = {abbrev = "V", color = "#B00000", shortname = "Left",},
["Left Party (Turkey)"] = {abbrev = "", color = "#0069B4", shortname = "SOL",},
["Left Peraltese Union"] = {abbrev = "", color = "#A1138C", shortname = "",},
["Left Platform of Coslada"] = {abbrev = "", color = "#244E0E", shortname = "",},
["Left Republican Party (Spain)"] = {abbrev = "", color = "#7F1E6D", shortname = "",},
["Left Segovia"] = {abbrev = "", color = "#F53000", shortname = "",},
["Left Socialist Initiative"] = {abbrev = "", color = "#DE0929", shortname = "",},
["Left Socialist Party (Belgium)"] = {abbrev = "", color = "red", shortname = "",},
["Left Socialist Party (Sweden)"] = {abbrev = "", color = "red", shortname = "Left Socialist",},
["Left Socialists"] = {abbrev = "", color = "#E72240", shortname = "",},
["Left Socialist Party of Japan"] = {abbrev = "", color = "#C90F36", shortname = "Left Socialist",},
["Left Struggle"] = {abbrev = "MA", color = "red", shortname = "",},
["Left Together"] = {abbrev = "", color = "#870f57", shortname = "",},
["Left Union for a Clean and Holy Republic"] = {abbrev = "", color = "#F11928", shortname = "",},
["Left Unity (UK)"] = {abbrev = "", color = "red", shortname = "Left Unity",},
["Left Unity"] = {abbrev = "", color = "#990000", shortname = "",},
["Left-Green Movement"] = {abbrev = "", color = "#00B878", shortname = "Left-Green",},
["Left-wing Workers"] = {abbrev = "PTK", color = "#FF0000", shortname = "",},
["Left-wing Revolutionary Nationalist Movement"] = {abbrev = "MNRI", color = "#E34234", shortname = "",},
["Left-wing Revolutionary Nationalist Movement – 1"] = {abbrev = "MNRI-1", color = "#EF86B5", shortname = "",},
["Lega Alpina Lumbarda"] = {abbrev = "LAL", color = "green", shortname = "",},
["Lega Autonomia Veneta"] = {abbrev = "LAV", color = "gold", shortname = "",},
["Lega Lombarda"] = {abbrev = "", color = "green", shortname = "",},
["Lega Marche"] = {abbrev = "", color = "#008000", shortname = "",},
["Lega Nord"] = {abbrev = "", color = "#008000", shortname = "",},
["Lega Piemonte"] = {abbrev = "", color = "#008000", shortname = "",},
["Lega (political party)"] = {abbrev = "", color = "#008000", shortname = "Lega",},
["Legal Marijuana Now Party"] = {abbrev = "", color = "#50C878", shortname = "Legal Marijuana Now",},
["Legalise Cannabis Australia"] = {abbrev = "", color = "#6fc442", shortname = "",},
["Legalise Cannabis Alliance"] = {abbrev = "", color = "#669966", shortname = "Legalise Cannabis",},
["Legality Movement Party"] = {abbrev = "PLL", color = "#FFFF05", shortname = "",},
["Leganemos"] = {abbrev = "", color = "#8183D8", shortname = "",},
["Legitimists"] = {abbrev = "", color = "#1F497D", shortname = "",},
["Lelo for Georgia"] = {abbrev = "", color = "#F0CE0D", shortname = "Lelo",},
["Leighton Baker Party"] = {abbrev = "", color = "#26A805", shortname = "",},
["León Despierta"] = {abbrev = "", color = "#4B244C", shortname = "",},
["León en Común"] = {abbrev = "", color = "#9D181D", shortname = "",},
["Leonese Autonomist Party–Leonesist Unity"] = {abbrev = "", color = "#D44F0C", shortname = "",},
["Leonese Convergence"] = {abbrev = "", color = "#FFCBDB", shortname = "",},
["Leonese People's Union"] = {abbrev = "UPL", color = "#B41062", shortname = "",},
["Leonid Chernovetskyi Bloc"] = {abbrev = "", color = "Gold", shortname = "",},
["Lepsza Polska"] = {abbrev = "", color = "white", shortname = "",},
["Les Centristes"] = {abbrev = "LC", color = "#6F97CF", shortname = "",},
["Les Écologistes"] = {abbrev = "LE", color = "#1F7B52", shortname = "",},
["Les Engagés (political party)"] = {abbrev = "LE", color = "#02E5D2", shortname = "",},
["Les Verts Fraternels"] = {abbrev = "", color = "#32CD32", shortname = "",},
["Lesotho Congress for Democracy"] = {abbrev = "LCD", color = "#78a22c", shortname = "",},
["Lesotho People's Congress"] = {abbrev = "LPC", color = "", shortname = "",},
["Lesotho Workers' Party"] = {abbrev = "LWP", color = "", shortname = "",},
["Lespwa"] = {abbrev = "", color = "#30B700", shortname = "",},
["Let Every Child Have Both Parents"] = {abbrev = "", color = "#DAA520", shortname = "",},
["Let London Live"] = {abbrev = "", color = "#2d1e6d", shortname = "",},
["Let us Give the Change"] = {abbrev = "", color = "#F7D102", shortname = "",},
["Let's Connect Slovenia"] = {abbrev = "PoS", color = "#FDB92E", shortname = "",},
["Let's Go Peru"] = {abbrev = "", color = "#FA8072", shortname = "",},
["Letterkenny Residents Party"] = {abbrev = "", color = "#9900CC", shortname = "",},
["Levantemos El Puerto"] = {abbrev = "", color = "#93117E", shortname = "",},
["Leviathan Movement"] = {abbrev = "", color = "#000000", shortname = "",},
["Lewisham People Before Profit"] = {abbrev = "", color = "#9400d3", shortname = "People Before Profit",},
["Lewisham Peoples' Alliance"] = {abbrev = "", color = "#CCCCCC", shortname = "",},
["Liaison Committee for the Presidential Majority"] = {abbrev = "", color = "#0047AB", shortname = "Presidential Majority",},
["Libera San Marino"] = {abbrev = "", color = "#14AABC", shortname = "Libera",},
["Liberal (Costa Rica)"] = {abbrev = "", color = "#BF1313", shortname = "Liberal",},
["Liberal (South Korea)"] = {abbrev = "", color = "#004EA2", shortname = "",},
["Liberal Alliance (Brazil)"] = {abbrev = "AL", color = "#FF8C00", shortname = "",},
["Liberal Alliance (Chile)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Alliance (Denmark)"] = {abbrev = "", color = "#3FB2BE", shortname = "Liberal Alliance",},
["Liberal Alliance (Denmark, 2021)"] = {abbrev = "", color = "#18354B", shortname = "Liberal Alliance",},
["Liberal Alliance (Greece)"] = {abbrev = "FISY", color = "#800080", shortname = "",},
["Liberal Alliance (Spain)"] = {abbrev = "", color = "#99FF00", shortname = "",},
["Liberal Alliance Focus Team"] = {abbrev = "LIBAFT", color = "#FDBB30", shortname = "Liberal Alliance FT",},
["Liberal Alliance of Montenegro"] = {abbrev = "LSCG", color = "#007F00", shortname = "",},
["Liberal Alternative for Manacor"] = {abbrev = "", color = "#291562", shortname = "",},
["Liberal Alternative"] = {abbrev = "", color = "#846394", shortname = "",},
["Liberal and Centre Union"] = {abbrev = "LiCS", color = "#FFD126", shortname = "",},
["Liberal and Country League (SA)"] = {abbrev = "", color = "#0095B6", shortname = "",},
["Liberal and Country League"] = {abbrev = "", color = "#0095B6", shortname = "",},
["Liberal and Country Party"] = {abbrev = "", color = "#080CAB", shortname = "Liberal and Country",},
["Liberal and Democratic Union"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Liberal and Social Alternative"] = {abbrev = "", color = "#4A4999", shortname = "",},
["Liberal Appeal"] = {abbrev = "", color = "#4A48CF", shortname = "",},
["Liberal bloc (Hong Kong)"] = {abbrev = "", color = "#297329", shortname = "Liberal",},
["Liberal Coalition (Spain)"] = {abbrev = "", color = "#ACAE34", shortname = "",},
["Liberal Centre (Spain)"] = {abbrev = "", color = "#0DB85E", shortname = "",},
["Liberal Centre"] = {abbrev = "", color = "#00CCA3", shortname = "",},
["Liberal Centrist Union (Spain)"] = {abbrev = "", color = "#3399FF", shortname = "",},
["Liberal Citizens Action"] = {abbrev = "", color = "#F96611", shortname = "",},
["Liberal Conservative Reformers"] = {abbrev = "LKR", color = "#F29200", shortname = "",},
["Liberal Constitutional Party (Egypt)"] = {abbrev = "", color = "#483D8B", shortname = "Liberal Constitutional",},
["Liberal Constitutionalist Party (Mexico)"] = {abbrev = "PLC", color = "#D4AA00", shortname = "",},
["Liberal Democracy (France)"] = {abbrev = "DL", color = "#004B8C", shortname = "",},
["Liberal Democracy of Slovenia"] = {abbrev = "LDS", color = "#00BBF0", shortname = "",},
["Liberal Democrat Party (Turkey)"] = {abbrev = "", color = "#00008B", shortname = "Liberal Democrat",},
["Liberal Democrat Party of Chile"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Democratic Alliance for Italy"] = {abbrev = "ALI", color = "#195385", shortname = "",},
["Liberal Democratic Centre"] = {abbrev = "", color = "#21A631", shortname = "",},
["Liberal Democratic Congress"] = {abbrev = "KLD", color = "#007FB2", shortname = "",},
["Liberal Democratic Federation of Hong Kong"] = {abbrev = "LDF", color = "#DC2A2A", shortname = "",},
["Liberal Democratic Focus Team"] = {abbrev = "", color = "#FDBB30", shortname = "Lib Dem Focus Team",},
["Liberal Democratic Party (Angola)"] = {abbrev = "PLD", color = "#FFCB48", shortname = "",},
["Liberal Democratic Party (Australia)"] = {abbrev = "", color = "#FEC327", shortname = "Liberal Democrats",},
["Liberal Democratic Party (Bangladesh)"] = {abbrev = "LDP", color = "#FFBF00", shortname = "",},
["Liberal Democratic Party (Bosnia and Herzegovina)"] = {abbrev = "LDS BiH", color = "#28166F", shortname = "",},
["Liberal Democratic Party (Cambodia)"] = {abbrev = "", color = "blue", shortname = "",},
["Liberal Democratic Party (Chile, 1893)"] = {abbrev = "", color = "#00CCCC", shortname = "Liberal Democratic",},
["Liberal Democratic Party (El Salvador)"] = {abbrev = "PDL", color = "#E7D055", shortname = "",},
["Liberal Democratic Party (France)"] = {abbrev = "PLD", color = "#0080FF", shortname = "",},
["Liberal Democratic Party (Iceland)"] = {abbrev = "", color = "#3466E4", shortname = "",},
["Liberal Democratic Party (Japan)"] = {abbrev = "LDP", color = "#3CA324", shortname = "Liberal Democratic",},
["Liberal Democratic Party (Japan, 2017)"] = {abbrev = "LDP", color = "#D7003A", shortname = "",},
["Liberal Democratic Party (Kenya)"] = {abbrev = "", color = "yellow", shortname = "",},
["Liberal Democratic Party (Malaysia)"] = {abbrev = "", color = "#FF7F00", shortname = "",},
["Liberal Democratic Party (Netherlands)"] = {abbrev = "", color = "#333399", shortname = "",},
["Liberal Democratic Party (North Macedonia)"] = {abbrev = "LDP", color = "#2B2F7D", shortname = "",},
["Liberal Democratic Party (Romania)"] = {abbrev = "PLD", color = "#ff6633", shortname = "",},
["Liberal Democratic Party (Serbia)"] = {abbrev = "LDP", color = "#6901d4", shortname = "",},
["Liberal Democratic Party (Serbia, 1989)"] = {abbrev = "LDS", color = "#D85313", shortname = "",},
["Liberal Democratic Party (Slovenia)"] = {abbrev = "LDS", color = "#139BEA", shortname = "",},
["Liberal Democratic Party (Spain, 1913)"] = {abbrev = "", color = "#009933", shortname = "Liberal Democratic",},
["Liberal Democratic Party (Spain, 1982)"] = {abbrev = "PDL", color = "#339CD5", shortname = "",},
["Liberal Democratic Party (Sri Lanka)"] = {abbrev = "LDP", color = "#FFDE17", shortname = "Liberal Democratic Party",},
["Liberal Democratic Party (Thailand)"] = {abbrev = "", color = "#ffd700", shortname = "Liberal Democratic",},
["Liberal Democratic Party (Turkey)"] = {abbrev = "LDP", color = "#000099", shortname = "",},
["Liberal Democratic Party of the Soviet Union"] = {abbrev = "LDPSU", color = "#7295DB", shortname = "",},
["Liberal Democratic Party of Belarus"] = {abbrev = "LDPB", color = "#011E41", shortname = "",},
["Liberal Democratic Party of Germany"] = {abbrev = "LDPD", color = "#FFA500", shortname = "",},
["Liberal Democratic Party of Moldova"] = {abbrev = "PLDM", color = "#0E8A4A", shortname = "",},
["Liberal Democratic Party of Russia"] = {abbrev = "LDPR", color = "#48C", shortname = "",},
["Liberal Democratic Party of Ukraine"] = {abbrev = "", color = "orange", shortname = "Liberal Democratic",},
["Liberal Democratic Republican Party"] = {abbrev = "", color = "#1DACD6", shortname = "",},
["Liberal Democratic Union (Albania)"] = {abbrev = "BLD", color = "#2EA5E9", shortname = "",},
["Liberal Democrats (Germany)"] = {abbrev = "LD", color = "#F98113", shortname = "",},
["Liberal Democrats (UK)"] = {abbrev = "Lib Dem", color = "#FAA61A", shortname = "Liberal Democrats",},
["Liberal Democrats' Rally for National Reconstruction – Vivoten"] = {abbrev = "", color = "yellow", shortname = "",},
["Liberal Egyptian Party"] = {abbrev = "", color = "#FF3333", shortname = "",},
["Liberal Federation"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Liberal Focus Team"] = {abbrev = "LIBFT", color = "#FDBB30", shortname = "Liberal FT",},
["Liberal Force"] = {abbrev = "FL", color = "#FFDD93", shortname = "",},
["Liberal Forum"] = {abbrev = "LiF", color = "#FFDC00", shortname = "",},
["Liberal Front Party"] = {abbrev = "PFL", color = "#8CC63E", shortname = "",},
["Liberal Group of Andratx"] = {abbrev = "", color = "#6699CC", shortname = "",},
["Liberal Group Sanxenxo"] = {abbrev = "", color = "#0078B3", shortname = "",},
["Liberal Independent Group"] = {abbrev = "", color = "#009B31", shortname = "",},
["Liberal Initiative"] = {abbrev = "IL", color = "#00ADEF", shortname = "",},
["Liberal Integrity Party"] = {abbrev = "", color = "#ff69b4", shortname = "Liberal Integrity",},
["Liberal League (Finland)"] = {abbrev = "", color = "mediumblue", shortname = "",},
["Liberal League (Japan)"] = {abbrev = "", color = "#FFDF00", shortname = "Liberal League",},
["Liberal League (Luxembourg)"] = {abbrev = "", color = "yellow", shortname = "",},
["Liberal Left (France)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Left (Spain)"] = {abbrev = "", color = "#007138", shortname = "Liberal Left",},
["Liberal Left Coalition"] = {abbrev = "", color = "#6EBD57", shortname = "Liberal Left",},
["Liberal Movement (Australia)"] = {abbrev = "", color = "#8B008B", shortname = "Liberal Movement",},
["Liberal National Party of Queensland"] = {abbrev = "", color = "#1456F1", shortname = "Liberal National",},
["Liberal Opening Movement"] = {abbrev = "", color = "yellow", shortname = "",},
["Liberal Oppositionist"] = {abbrev = "", color = "#FFBF00", shortname = "Oppositionist",},
["Liberal Party – Freedom to Choose"] = {abbrev = "Lib.", color = "#F19321", shortname = "Liberal Party",},
["Liberal Party (Armenia)"] = {abbrev = "", color = "#EB5F10", shortname = "",},
["Liberal Party (Belgium)"] = {abbrev = "", color = "#3C40D2", shortname = "Liberal",},
["Liberal Party (Bolivia)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Party (Bourbon Restoration)"] = {abbrev = "", color = "#FDEE00", shortname = "",},
["Liberal Party (Brazil, 1831)"] = {abbrev = "", color = "#F7C100", shortname = "Liberal",},
["Liberal Party (Brazil, 1985)"] = {abbrev = "PL", color = "#080074", shortname = "",},
["Liberal Party (Brazil, 2006)"] = {abbrev = "PL", color = "#015AAA", shortname = "",},
["Liberal Party (Bulgaria)"] = {abbrev = "", color = "#EAC117", shortname = "",},
["Liberal Party (Cambodia)"] = {abbrev = "", color = "#FAAC58", shortname = "Liberal",},
["Liberal Party (Chile)"] = {abbrev = "", color = "#FFAE34", shortname = "",},
["Liberal Party (Chile, 1849)"] = {abbrev = "", color = "#FFD700", shortname = "Liberal",},
["Liberal Party (Chile, 1988)"] = {abbrev = "", color = "#F5D60A", shortname = "",},
["Liberal Party (Chile, 1998)"] = {abbrev = "", color = "#FFEE00", shortname = "",},
["Liberal Party (Croatia)"] = {abbrev = "", color = "#0303fa", shortname = "",},
["Liberal Party (East Timor)"] = {abbrev = "", color = "#2C43DB", shortname = "Liberal",},
["Liberal Party (Greece)"] = {abbrev = "", color = "#FFA500", shortname = "Liberal",},
["Liberal Party (Greece, modern)"] = {abbrev = "", color = "orange", shortname = "Liberal",},
["Liberal Party (Guatemala)"] = {abbrev = "", color = "#0000ff", shortname = "Liberal",},
["Liberal Party (Haiti)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Party (Hong Kong)"] = {abbrev = "", color = "#00aeef", shortname = "Liberal",},
["Liberal Party (Hungary)"] = {abbrev = "", color = "#AAD8E6", shortname = "Liberal",},
["Liberal Party (Iceland, historical)"] = {abbrev = "", color = "#00C6FF", shortname = "Liberal",},
["Liberal Party (Iceland)"] = {abbrev = "", color = "#406899", shortname = "Liberal",},
["Liberal Party (Israel)"] = {abbrev = "", color = "#FFCC00", shortname = "Liberal",},
["Liberal Party (Japan, 1890)"] = {abbrev = "", color = "#EFAB93", shortname = "Liberal",},
["Liberal Party (Japan, 1950)"] = {abbrev = "", color = "#128A45", shortname = "Liberal",},
["Liberal Party (Japan, 1998)"] = {abbrev = "", color = "#000099", shortname = "Liberal",},
["Liberal Party (Japan, 2016)"] = {abbrev = "", color = "#0950A0", shortname = "Liberal",},
["Liberal Party (Kingdom of Serbia)"] = {abbrev = "", color = "#FFDF00", shortname = "Liberal",},
["Liberal Party (Mexico)"] = {abbrev = "PL", color = "#FF3333", shortname = "Liberal",},
["Liberal Party (Moldova)"] = {abbrev = "PL", color = "#73C2FB", shortname = "",},
["Liberal Party (New York)"] = {abbrev = "", color = "#CC0000", shortname = "Liberal",},
["Liberal Party (Nicaragua)"] = {abbrev = "", color = "#800000", shortname = "Liberal",},
["Liberal Party (Norway)"] = {abbrev = "", color = "#006666", shortname = "Liberal",},
["Liberal Party (Panama)"] = {abbrev = "", color = "#FF0000", shortname = "Liberal",},
["Liberal Party (Papua New Guinea)"] = {abbrev = "LP", color = "#1F509F", shortname = "Liberal",},
["Liberal Party (Paraguay)"] = {abbrev = "", color = "#0000FF", shortname = "Liberal",},
["Liberal Party (Philippines)"] = {abbrev = "LP", color = "#f0e68c", shortname = "Liberal",},
["Liberal Party (Radoslavists)"] = {abbrev = "", color = "maroon", shortname = "",},
["Liberal Party (Rwanda)"] = {abbrev = "PL", color = "#03b464", shortname = "",},
["Liberal Party (Serbia)"] = {abbrev = "", color = "#FAFC38", shortname = "",},
["Liberal Party (Slovenia)"] = {abbrev = "", color = "#FFCC00", shortname = "",},
["Liberal Party (South Korea)"] = {abbrev = "", color = "#254170", shortname = "Liberal",},
["Liberal Party (South Korea, 1963)"] = {abbrev = "", color = "#485142", shortname = "Liberal",},
["Liberal Party (Spain, 1880)"] = {abbrev = "", color = "#83C53A", shortname = "Liberal",},
["Liberal Party (Spain, 1976)"] = {abbrev = "", color = "#006C95", shortname = "",},
["Liberal Party (Thailand)"] = {abbrev = "", color = "#00008B", shortname = "Liberal",},
["Liberal Party (UK, 1989)"] = {abbrev = "", color = "#EB7A43", shortname = "Liberal",},
["Liberal Party (UK)"] = {abbrev = "Lib", color = "#FFD700", shortname = "Liberal",},
["Liberal Party (Uruguay)"] = {abbrev = "", color = "#1047a1", shortname = "Liberal",},
["Liberal Party (Venezuela)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Party–Hatoyama"] = {abbrev = "", color = "#8DA405", shortname = "",},
["Liberal Party Bangladesh"] = {abbrev = "", color = "#EA6D6A", shortname = "",},
["Liberal Party of Albania"] = {abbrev = "", color = "#F2D863", shortname = "",},
["Liberals of Andorra"] = {abbrev = "L'A", color = "#019DC5", shortname = "",},
["Liberal Party of Australia (A.C.T. Division)"] = {abbrev = "LP", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia (New South Wales Division)"] = {abbrev = "LP", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia (Queensland Division)"] = {abbrev = "LP", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia (South Australian Division)"] = {abbrev = "LP", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia (Tasmanian Division)"] = {abbrev = "LP", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia (Victorian Division)"] = {abbrev = "LP", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia (Western Australian Division)"] = {abbrev = "LP", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia"] = {abbrev = "LP", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Chile (2013)"] = {abbrev = "", color = "#FF432C", shortname = "Liberal",},
["Liberal Party of Canada"] = {abbrev = "", color = "#D71920", shortname = "Liberal",},
["Liberal Party of Corrientes"] = {abbrev = "", color = "#35AAE0", shortname = "",},
["Liberal Party of Cuba"] = {abbrev = "", color = "#75AADB", shortname = "Liberal",},
["Liberal Party of Ghana"] = {abbrev = "", color = "#F96128", shortname = "",},
["Liberal Party of Gibraltar"] = {abbrev = "", color = "#EF4135", shortname = "Liberal",},
["Liberal Party of Honduras"] = {abbrev = "", color = "#CE2029", shortname = "Liberal",},
["Liberal Party of Ireland"] = {abbrev = "LPI", color = "#ADD8E6", shortname = "Liberal",},
["Liberal Party of Kosovo"] = {abbrev = "", color = "brown", shortname = "",},
["Liberal Party of Macedonia"] = {abbrev = "LPM", color = "#FFFF00", shortname = "",},
["Liberal Party of Montenegro"] = {abbrev = "LPCG", color = "#87CEEB", shortname = "",},
["Liberal Party of Norway"] = {abbrev = "", color = "#8CD600", shortname = "Liberal",},
["Liberal Party of South Africa"] = {abbrev = "", color = "#FED86F", shortname = "",},
["Liberal Party of Sri Lanka"] = {abbrev = "", color = "#FFDE17", shortname = "",},
["Liberal Party of State Employment and Housing"] = {abbrev = "", color = "#311829", shortname = "",},
["Liberal Party of Switzerland"] = {abbrev = "", color = "#134B94", shortname = "Liberals",},
["Liberal Party of the Right"] = {abbrev = "", color = "#4955A1", shortname = "",},
["Liberal Party of Ukraine"] = {abbrev = "", color = "blue", shortname = "Liberal",},
["Liberal People's Party (Norway)"] = {abbrev = "", color = "purple", shortname = "",},
["Liberal People's Party (Norway, 1972)"] = {abbrev = "", color = "red", shortname = "",},
["Liberal Poland – Entrepreneurs' Strike"] = {abbrev = "PL!SP", color = "#FFD900", shortname = "",},
["Liberal Popular Alliance"] = {abbrev = "", color = "#3366FF", shortname = "",},
["Liberal Progressive Party (Costa Rica)"] = {abbrev = "PLP", color = "#ff7300", shortname = "",},
["Liberal-Radical Party"] = {abbrev = "", color = "#ffcc00", shortname = "Liberal-Radical",},
["Liberal Reform Party (Australia)"] = {abbrev = "", color = "#00CED1", shortname = "Liberal Reform",},
["Liberal Reform Party (Czech Republic)"] = {abbrev = "LiRA", color = "yellow", shortname = "",},
["Liberal Reformist Party (Belgium)"] = {abbrev = "PRL", color = "blue", shortname = "",},
["Liberal Reformist Party (Dominican Republic)"] = {abbrev = "", color = "#32cd32", shortname = "",},
["Liberal Reformist Party (Puerto Rico)"] = {abbrev = "", color = "#B9245D", shortname = "",},
["Liberal Reformist Party (Romania)"] = {abbrev = "", color = "#1A92D0", shortname = "",},
["Liberal Reformist Party (Spain)"] = {abbrev = "", color = "#13CED2", shortname = "Liberal Reformist",},
["Liberal Regenerator Party"] = {abbrev = "", color = "#1935D0", shortname = "",},
["Liberal–Republican Coalition (Spain)"] = {abbrev = "", color = "#B1855B", shortname = "",},
["Liberal Republican Party (Turkey)"] = {abbrev = "", color = "#348AC9", shortname = "",},
["Liberal Republican Party (US)"] = {abbrev = "", color = "#FF69B4", shortname = "Liberal Republican",},
["Liberal Republican Right"] = {abbrev = "DLR", color = "#4EC766", shortname = "",},
["Liberal Samajbadi Party"] = {abbrev = "", color = "yellow", shortname = "",},
["Liberal Socialist Party (Singapore)"] = {abbrev = "LSP", color = "#EE5533", shortname = "",},
["Liberal Socialist Party (Switzerland)"] = {abbrev = "PLSS", color = "#F0D90B", shortname = "",},
["Liberal Socialists Party (Egypt)"] = {abbrev = "", color = "#00EE00", shortname = "",},
["Liberal State Party"] = {abbrev = "LSP", color = "#5A5CBD", shortname = "",},
["Liberal Swedish Party"] = {abbrev = "", color = "Blue", shortname = "",},
["Liberal Unification Party"] = {abbrev = "", color = "#013792", shortname = "Liberal Unification",},
["Liberal Union (Australia)"] = {abbrev = "", color = "#0000FF", shortname = "Liberal Union",},
["Liberal Union (Germany)"] = {abbrev = "LV", color = "#EEDC82", shortname = "",},
["Liberal Union (Italy)"] = {abbrev = "", color = "#0047AB", shortname = "Liberal Union",},
["Liberal Union (Netherlands)"] = {abbrev = "LU", color = "#5873DF", shortname = "",},
["Liberal Union (Spain, 1983)"] = {abbrev = "", color = "#1E90FF", shortname = "",},
["Liberal Union (Spain)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Union–Brătianu"] = {abbrev = "UL–B", color = "#FFDD00", shortname = "",},
["Liberal Union of Lithuania"] = {abbrev = "LLS", color = "#E8CA58", shortname = "",},
["Liberal Unionist Party"] = {abbrev = "LibU", color = "#2061A2", shortname = "Liberal Unionist",},
["Liberal Unity"] = {abbrev = "", color = "#FFD300", shortname = "",},
["Liberal Vannin Party"] = {abbrev = "", color = "#FA8000", shortname = "Liberal Vannin",},
["Liberal-Labour (UK)"] = {abbrev = "Lib-Lab", color = "orange", shortname = "",},
["Liberal-Labour"] = {abbrev = "", color = "orange", shortname = "",},
["Liberal–Labour (New Zealand)"] = {abbrev = "", color = "#FFA500", shortname = "Liberal–Labour",},
["Liberal-Social Union"] = {abbrev = "LSU", color = "#50C878", shortname = "",},
["Liberal–Socialist Kartels"] = {abbrev = "", color = "#800080", shortname = "Liberal–Socialist",},
["Liberal/Country coalition"] = {abbrev = "", color = "#0047AB", shortname = "",},
["Liberal/National coalition"] = {abbrev = "", color = "#0047AB", shortname = "",},
["Liberal/NCP coalition"] = {abbrev = "", color = "#0047AB", shortname = "",},
["Liberal"] = {abbrev = "", color = "#FFFF00", shortname = "",}, -- Generic color, not a party color; specify the actual party
["Liberalism in the Netherlands"] = {abbrev = "", color = "#e7cf25", shortname = "",},
["Liberalism"] = {abbrev = "", color = "#FFFF00", shortname = "Liberal",},
["Liberals (Finland)"] = {abbrev = "", color = "gold", shortname = "Liberals",},
["Liberals (Sweden)"] = {abbrev = "L", color = "#006AB3", shortname = "Liberals",},
["Liberals for Åland"] = {abbrev = "", color = "#1F66CA", shortname = "",},
["Liberals for Forests"] = {abbrev = "LFF", color = "#05A593", shortname = "Liberals for Forests",},
["Liberals of Benidorm"] = {abbrev = "", color = "#359E74", shortname = "",},
["Liberals of Serbia"] = {abbrev = "LS", color = "#FF4F00", shortname = "",},
["Liberals' Movement (Lithuania)"] = {abbrev = "LRLS", color = "#F48100", shortname = "",},
["Liberals, Democrats and Radicals"] = {abbrev = "LDR", color = "Gold", shortname = "",},
["Liberate the People"] = {abbrev = "YAW", color = "#FF1493", shortname = "",},
["Liberation Rally"] = {abbrev = "", color = "#CD7F32", shortname = "",},
["Liberation Movement (Serbia)"] = {abbrev = "O", color = "#18478e", shortname = "",},
["Liberator Party (Brazil)"] = {abbrev = "", color = "#F9AF1E", shortname = "",},
["Liberia Destiny Party"] = {abbrev = "LDP", color = "#BEC2CB", shortname = "",},
["Liberia National Union"] = {abbrev = "LNU", color = "#2E7286", shortname = "",},
["Liberia Restoration Party"] = {abbrev = "LRP", color = "#008000", shortname = "",},
["Liberia Transformation Party"] = {abbrev = "LTP", color = "#330104", shortname = "",},
["Liberian Action Party"] = {abbrev = "LAP", color = "#00FFFF", shortname = "",},
["Liberian People's Party"] = {abbrev = "LPP", color = "#DC143C", shortname = "",},
["Libertair, Direct, Democratisch"] = {abbrev = "LDD", color = "#6DCFF6", shortname = "",},
["Libertarian Left (Chile)"] = {abbrev = "", color = "#451255", shortname = "",},
["Libertarian Movement (Costa Rica)"] = {abbrev = "PML", color = "#DC143C", shortname = "",},
["Libertarian Movement Party"] = {abbrev = "", color = "#BA151B", shortname = "",},
["Libertarian Party (Argentina)"] = {abbrev = "PL", color = "#7D03FE", shortname = "",},
["Libertarian Party (Netherlands)"] = {abbrev = "", color = "#1170ce", shortname = "",},
["Libertarian Party (Spain)"] = {abbrev = "", color = "#C9A900", shortname = "",},
["Libertarian Party (Switzerland)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Libertarian Party (US)"] = {abbrev = "LI", color = "#FED105", shortname = "Libertarian",},
["Libertarian Party (UK)"] = {abbrev = "", color = "#FCC820", shortname = "Libertarian",},
["Libertarian Party of Australia"] = {abbrev = "", color = "#E5C601", shortname = "",},
["Libertarian Party of Canada"] = {abbrev = "", color = "#F2BA00", shortname = "",},
["Libertarian Party of South Africa"] = {abbrev = "", color = "#BE9F4D", shortname = "",},
["Libertarianz"] = {abbrev = "", color = "#09296B", shortname = "",},
["Libertas Estonia"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Libertas France"] = {abbrev = "", color = "#003366", shortname = "Libertas",},
["Libertas Ireland"] = {abbrev = "", color = "#3333CC", shortname = "Libertas",},
["Libertas United Kingdom"] = {abbrev = "", color = "#900020", shortname = "Pro-Democracy: Libertas.eu",},
["Libertas.eu"] = {abbrev = "Lib.eu", color = "#2c296e", shortname = "",},
["Liberties, Independents, Overseas and Territories"] = {abbrev = "", color = "#38D4C7", shortname = "LIOT",},
["Liberty (political party, Palestine)"] = {abbrev = "", color = "#C69F14", shortname = "",},
["Liberty (political party)"] = {abbrev = "", color = "#1882C5", shortname = "Volia",},
["Liberty and Lawfulness"] = {abbrev = "WiP", color = "grey", shortname = "",},
["Liberty and Refoundation"] = {abbrev = "", color = "#8B0000", shortname = "Libre",},
["Liberty GB"] = {abbrev = "", color = "#000168", shortname = "",},
["Liberty Korea Party"] = {abbrev = "", color = "#C9151E", shortname = "Liberty Korea",},
["Liberty Party (Liberia)"] = {abbrev = "LP", color = "#FFD600", shortname = "",},
["Liberty Party (US, 1932)"] = {abbrev = "", color = "#00DDDD", shortname = "Liberty",},
["Liberty Party (US)"] = {abbrev = "", color = "#00DDDD", shortname = "Liberty",},
["Liberty Republican Party"] = {abbrev = "", color = "#009944", shortname = "",},
["Liberty Unification Party"] = {abbrev = "", color = "#E12F33", shortname = "Liberty Unification",},
["Liberty Union Party"] = {abbrev = "", color = "#D6FF33", shortname = "Liberty Union",},
["Liberty, Worth Voting For"] = {abbrev = "", color = "#DDDDDD", shortname = "Liberty",},
["Libra Party"] = {abbrev = "", color = "#F8D308", shortname = "",},
["Libre (Guatemala)"] = {abbrev = "", color = "#3467A1", shortname = "Libre",},
["Libres"] = {abbrev = "", color = "#194955", shortname = "",},
["Lider (political party)"] = {abbrev = "", color = "#00AFF0", shortname = "",},
["Liepāja Party"] = {abbrev = "", color = "#50A640", shortname = "",},
["Life – National Party"] = {abbrev = "Život–NS", color = "#032F67", shortname = "",},
["Life and Liberty Party"] = {abbrev = "", color = "black", shortname = "Life and Liberty",},
["Liga Veneta"] = {abbrev = "", color = "#0030AA", shortname = "",},
["LiGanDo"] = {abbrev = "", color = "#02A24A", shortname = "",},
["Light Blue and White Union"] = {abbrev = "", color = "blue", shortname = "",},
["Light of Faith (political party)"] = {abbrev = "", color = "#10C8DF", shortname = "Yiman Nuru",},
["Ligue du Sud"] = {abbrev = "LS", color = "#404040", shortname = "",},
["Likud Yisrael Beiteinu"] = {abbrev = "", color = "#1f5aa5", shortname = "",},
["Likud"] = {abbrev = "", color = "#1f5aa5", shortname = "",},
["Linares First"] = {abbrev = "", color = "#1F1715", shortname = "",},
["Lincoln Democratic Labour Association"] = {abbrev = "", color = "#FF6600", shortname = "Democratic Labour",},
["Lincolnshire Independents"] = {abbrev = "", color = "#000000", shortname = "Lincolnshire Independent",},
["Linese Alternative"] = {abbrev = "", color = "#0CB7F2", shortname = "",},
["Lingkod Taguig"] = {abbrev = "", color = "#0051B0", shortname = "",},
["Linyon Demokratik Seselwa"] = {abbrev = "", color = "#2C50A4", shortname = "",},
["List Burgenland"] = {abbrev = "", color = "#F8D323", shortname = "",},
["List Dedecker"] = {abbrev = "", color = "#000080", shortname = "",},
["List for Fiume"] = {abbrev = "", color = "#545AA7", shortname = "",},
["List for Sandžak"] = {abbrev = "LZS", color = "#307A4D", shortname = "",},
["List for Trieste"] = {abbrev = "", color = "#4CBB17", shortname = "",},
["List of Decency"] = {abbrev = "", color = "#CC00CC", shortname = "",},
["List of Marjan Šarec"] = {abbrev = "LMŠ", color = "#005AAB", shortname = "",},
["Lists of Slavs and Germans"] = {abbrev = "LST", color = "#B00000", shortname = "",},
["Lista del Apruebo"] = {abbrev = "", color = "#6F4D9A", shortname = "",},
["Lista Niun Paso Atras"] = {abbrev = "", color = "gold", shortname = "",},
["Lisu National Development Party"] = {abbrev = "LNDP", color = "#DC0723", shortname = "",},
["Lithuanian Centre Party"] = {abbrev = "", color = "#0CA13B", shortname = "",},
["Lithuanian Centre Union"] = {abbrev = "LCS", color = "#D6D40F", shortname = "",},
["Lithuanian Christian Democratic Party"] = {abbrev = "LKDP", color = "#3D6DBF", shortname = "",},
["Lithuanian Christian Democrats"] = {abbrev = "", color = "#3333CC", shortname = "",},
["Lithuanian Citizens' Alliance"] = {abbrev = "LPA", color = "#799B6F", shortname = "",},
["Lithuanian Democratic Party"] = {abbrev = "LDP", color = "#007272", shortname = "",},
["Lithuanian Farmers and Greens Union"] = {abbrev = "LVŽS", color = "#00A651", shortname = "",},
["Lithuanian Green Party"] = {abbrev = "LŽP", color = "#92C83E", shortname = "",},
["Lithuanian Labour Federation"] = {abbrev = "", color = "#2C6BC7", shortname = "Labour Federation",},
["Lithuanian Liberty Union"] = {abbrev = "LLS", color = "#FBB800", shortname = "",},
["Lithuanian List"] = {abbrev = "LS", color = "#810305", shortname = "",},
["Lithuanian Nationalist and Republican Union"] = {abbrev = "", color = "#FDC52A", shortname = "",},
["Lithuanian Nationalist Union"] = {abbrev = "LTS", color = "#FFD700", shortname = "",},
["Lithuanian Peasant Popular Union"] = {abbrev = "", color = "#BBFF02", shortname = "",},
["Lithuanian Peasants Party"] = {abbrev = "LVP", color = "#BAD759", shortname = "",},
["Lithuanian People's Party"] = {abbrev = "LLP", color = "#E6AD1E", shortname = "",},
["Lithuanian Popular Peasants' Union"] = {abbrev = "LVLS", color = "green", shortname = "",},
["Lithuanian Popular Socialist Democratic Party"] = {abbrev = "LSLDP", color = "", shortname = "",},
["Lithuanian Regions Party"] = {abbrev = "LRP", color = "#CE2C29", shortname = "",},
["Lithuanian Russian Union"] = {abbrev = "SRL", color = "red", shortname = "",},
["Lithuanian Social Democratic Union"] = {abbrev = "LSDS", color = "#901d78", shortname = "",},
["Lithuanian Union of Political Prisoners and Deportees"] = {abbrev = "LPKTS", color = "#216319", shortname = "",},
["Livable Netherlands"] = {abbrev = "LN", color = "#FF4400", shortname = "",},
["Liverpool Community Independents"] = {abbrev = "", color = "#800000", shortname = "Community Independents",},
["Liverpool Independent Party"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Liverpool Protestant Party"] = {abbrev = "", color = "#F88017", shortname = "Protestant",},
["Living Ourense"] = {abbrev = "", color = "#0082CD", shortname = "",},
["LIVRE"] = {abbrev = "", color = "#C2D216", shortname = "",},
["Llais Gwynedd"] = {abbrev = "", color = "#006400", shortname = "",},
["Llantwit First Independents"] = {abbrev = "", color = "#999999", shortname = "Llantwit First Independent",},
["Lliures"] = {abbrev = "", color = "#E75C73", shortname = "",},
["Lloc Espai Independent"] = {abbrev = "", color = "#E6302B", shortname = "",},
["LMP – Hungary's Green Party"] = {abbrev = "LMP", color = "#36CA8B", shortname = "",},
["Lower Hutt Citizens' Association"] = {abbrev = "", color = "#B8BFFE", shortname = "Citizens'",},
["Local Alliance"] = {abbrev = "", color = "#000000", shortname = "",},
["Local and Rural Issues"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Local Danish parties"] = {abbrev = "", color = "#C7C3BF", shortname = "",},
["Local Education Action by Parents"] = {abbrev = "", color = "#CCCCCC", shortname = "",},
["Local Option"] = {abbrev = "", color = "silver", shortname = "",},
["Local Progressive Party"] = {abbrev = "", color = "#FF4500", shortname = "",},
["Localist Bloc of Melilla"] = {abbrev = "", color = "#217118", shortname = "",},
["Localist"] = {abbrev = "", color = "#bb00bb", shortname = "",},
["Localist groups (Hong Kong)"] = {abbrev = "", color = "#002366", shortname = "Localist",},
["Loktantrik Morcha (Rajasthan)"] = {abbrev = "LM", color = "#FF1D15", shortname = "",},
["Lok Bhalai Party"] = {abbrev = "LBP", color = "#386059", shortname = "",},
["Lok Insaaf Party"] = {abbrev = "LIP", color = "Maroon", shortname = "",},
["Lok Janshakti Party (Ram Vilas)"] = {abbrev = "LJP(RV)", color = "#5B006A", shortname = "",},
["Lok Janshakti Party"] = {abbrev = "LJP", color = "#0093DD", shortname = "",},
["Lok Kalayankari Janata Party Nepal"] = {abbrev = "", color = "#FFEFD5", shortname = "Lok Kalayankari Janata Party",},
["Lok Paritran"] = {abbrev = "LKPT", color = "#f3c0f3", shortname = "",},
["Lok Raj Party Himachal Pradesh"] = {abbrev = "LRP", color = "indigo", shortname = "",},
["Lok Rajya Party"] = {abbrev = "", color = "#9900FF", shortname = "",},
["Lok Satta Party"] = {abbrev = "LSP", color = "#FF1493", shortname = "",},
["Lok Sewak Dal"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Lok Sewak Sangh"] = {abbrev = "", color = "#00FF00", shortname = "",},
["Lok Shakti"] = {abbrev = "", color = "#336600", shortname = "",},
["Lokdal"] = {abbrev = "LKD", color = "#00FF66", shortname = "",},
["Lokpriya Samaj Party"] = {abbrev = "LPSP", color = "#66FF99", shortname = "",},
["Loktanter Suraksha Party"] = {abbrev = "LSP", color = "#FF9900", shortname = "",},
["Loktantra Suraksha Party"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Loktantrik Jan Samta Party"] = {abbrev = "LJSP", color = "grey", shortname = "",},
["Loktantrik Janata Dal"] = {abbrev = "LJD", color = "#2E8B57", shortname = "",},
["Loktantrik Janata Party (Secular)"] = {abbrev = "LJP(S)", color = "pink", shortname = "",},
["Loktantrik Morcha Himachal Pradesh"]={abbrev="LHMP",color="",shortname=""},
["Loktantrik Samajwadi Party, Nepal"] = {abbrev = "LSWP", color = "#c7f884 ", shortname = "Loktantrik Samajwadi",},
["Londependence Party"] = {abbrev = "", color = "#751056", shortname = "Londependence",},
["London Real Party"] = {abbrev = "", color = "#af0823", shortname = "London Real",},
["London Socialist Alliance"] = {abbrev = "", color = "red", shortname = "London Socialist",},
["Longthornton and Tamworth Residents Association"] = {abbrev = "", color = "#000000", shortname = "Longthornton and Tamworth Residents",},
["Lord Fusituʻa"] = {abbrev = "", color = "#D3D3D3", shortname = "",},
["Lord Nuku"] = {abbrev = "", color = "#D3D3D3", shortname = "",},
["Lord Speaker"] = {abbrev = "", color = "black", shortname = "",},
["Lord Tuʻiʻafitu"] = {abbrev = "", color = "#D3D3D3", shortname = "",},
["Lords Spiritual"] = {abbrev = "", color = "#7F00FF", shortname = "",},
["Loss"] = {abbrev = "", color = "#999999", shortname = "",},
["Loughton Residents Association"] = {abbrev = "", color = "#50C878", shortname = "Loughton Residents",},
["Love Malaysia Party"] = {abbrev = "", color = "#DAE2EA", shortname = "",},
["Love Party (Italy)"] = {abbrev = "", color = "#FF91AF", shortname = "",},
["Love Sabah Party"] = {abbrev = "", color = "#FB5B47", shortname = "",},
["Love, Faith, Hope"] = {abbrev = "", color = "#BC413C", shortname = "",},
["Lower Cinca Between Everyone"] = {abbrev = "ETXSBC", color = "#F57D02", shortname = "",},
["Lower Minho Independents"] = {abbrev = "", color = "#824941", shortname = "",},
["Loyalty and Dignity"] = {abbrev = "", color = "#1e90ff", shortname = "",},
["Luen Wo United"] = {abbrev = "", color = "#000000", shortname = "",},
["Lugonovo"] = {abbrev = "", color = "#E5432C", shortname = "",},
["Luhansk Economic Union"] = {abbrev = "LES", color = "#76C5F0", shortname = "",},
["Lung Mun Concern Group"] = {abbrev = "LMCG", color = "#11A0B4", shortname = "",},
["Lutte Ouvrière"] = {abbrev = "LO", color = "#AA0000", shortname = "",},
["Luxembourg Socialist Workers' Party"] = {abbrev = "LSAP", color = "#F10035", shortname = "",},
["LXE"] = {abbrev = "", color = "#47B9AF", shortname = "",},
["Lytvyn Bloc"] = {abbrev = "", color = "#01B8A4", shortname = "",},
["Lytyn Bloc"] = {abbrev = "", color = "Green", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
020379feeb53789093f466bb911be68ec969ba1c
Template:Country data Bolivia
10
236
465
464
2023-12-24T02:13:40Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Country_data_Bolivia]]
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = Bolivia
| flag alias = Bandera de Bolivia (Estado).svg
| flag alias-state = Bandera de Bolivia (Estado).svg
| flag alias-football = Flag of Bolivia.svg
| flag alias-spain = Flag of Cross of Burgundy.svg
| flag alias-1825 = State flag of Bolivia (1825-1826).svg
| flag alias-1825a = Civil flag of Bolivia (1825-1826).svg
| flag alias-1831 = Flag of Bolivia (state, 1826-1851).svg
| flag alias-1831a = Flag of Bolivia (1826-1851).svg
| flag alias-confederation = Flag of the Peru-Bolivian Confederation.svg
| flag alias-wiphala = Banner of the Qulla Suyu.svg
| flag alias-patuju =
| flag alias-army=Flag of Bolivia (military).svg
| link alias-army=Bolivian Army
| flag alias-air force=Flag of Bolivia (military).svg
| link alias-air force=Bolivian Air Force
| flag alias-naval = Naval Ensign of Bolivia.svg
| link alias-naval = Bolivian Naval Force
| flag alias-naval old = Naval Ensign of Bolivia (1966-2013).svg
| flag alias-naval jack = Naval Jack of Bolivia.svg
| flag alias-military = Flag of Bolivia (military).svg
| link alias-military = Bolivian Armed Forces
| flag alias-navy = Naval Ensign of Bolivia.svg
| link alias-navy = Bolivian Naval Force
| flag alias-civil = Flag of Bolivia.svg
| size = {{{size|}}}
| name = {{{name|}}}
| altvar = {{{altvar|}}}
| altlink = {{{altlink|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = state
| var2 = football
| var3 = spain
| var4 = 1825
| var5 = 1825a
| var6 = 1831
| var7 = 1831a
| var8 = confederation
| var9 = wiphala
| var10 = patuju
| var11 = naval old
| var12 = naval jack
| var13 = civil
| redir1 = BOL
</noinclude>
}}
fc39b1f8371694f21ce6a216dd3737657a3ebd07
Template:Align
10
237
467
466
2023-12-24T02:13:42Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Align]]
wikitext
text/x-wiki
{{safesubst<noinclude/>:#switch: {{safesubst<noinclude/>:lc:{{{1|center}}}}}
|left = <div style="float: left;{{safesubst<noinclude/>:#if: {{{style|}}} | {{{style}}};}}">{{{2}}}</div>
|right = <div style="float: right;{{safesubst<noinclude/>:#if: {{{style|}}} | {{{style}}};}}">{{{2}}}</div>
|center = {{safesubst<noinclude/>:center|{{{2}}}|style={{{style|}}} }}
|#default = Error in [[Template:Align]]: the alignment setting "{{{1}}}" is invalid.
}}<noinclude>
{{documentation}}
</noinclude>
6d03351dca1cab3abf83d24f4e7dfe2c1948f615
Module:Political party/U
828
238
469
468
2023-12-24T02:13:44Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Political_party/U]]
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["U.S. Labor Party of the District of Columbia"] = "U.S. Labor Party",
["U.S. Taxpayers' Party"] = "Constitution Party (US)",
["UDAR"] = "Ukrainian Democratic Alliance for Reform",
["UDI"] = "Union of Democrats and Independents",
["UK National Government"] = "National Government (United Kingdom)",
["UKIP"] = "UK Independence Party",
["Ukrainian Strategy"] = "Ukrainian Strategy of Groysman",
["Ulster Conservatives and Unionists - New Force"] = "Ulster Conservatives and Unionists",
["Ulster Conservatives and Unionists – New Force"] = "Ulster Conservatives and Unionists", -- dash differences
["Ultra-royalist"] = "Legitimists",
["Unaffiliated"] = "Unaffiliated politician",
["Unconditional Unionist Party (US)"] = "Unconditional Unionist Party",
["Unidas Podemos cambiar Europa"] = "Unidas Podemos",
["Unidos Podemos"] = "Unidas Podemos",
["United Left (Greece)"] = "Communist Party of Greece",
["United Opposition (Hungary)"] = "United for Hungary",
["Unified Communist Party of Nepal (Maoist)"] = "Communist Party of Nepal (Maoist Centre)",
["Unified Socialist Party"] = "Unified Socialist Party (France)",
["Union Démocratique Bretonne"] = "Breton Democratic Union",
["Union for Democracy (Finland)"] = "Finnish People's Unity Party",
["Union for France"] = "Rally for the Republic",
["Union for French Democracy (alliance)"] = "Union for French Democracy",
["Union for Latvia"] = "For a Humane Latvia",
["Union for the Presidential Majority"] = "Union for a Popular Movement",
["Union for the Republic-Res Publica"] = "Res Publica Party",
["Union for the Republic–Res Publica"] = "Res Publica Party", -- dash differences
["Union for the Fatherland"] = "Union for the Homeland",
["Union Labor Party (California)"] = "Union Labor Party",
["Union Labor Party (United States)"] = "Union Labor Party",
["Union of Centrists of Menorca"] = "Menorcan Union",
["Union of Christian and Centre Democrats"] = "Union of the Centre (2002)",
["Union of Franchophones"] = "Union des Francophones",
["Union of the Centre (2008)"] = "Union of the Centre (2002)",
["Union of the Left (Luxembourg)"] = "Radical Socialist Party (Luxembourg)",
["Union of the Left (Poland)"] = "Freedom and Equality",
["Union of the Right (Poland)"] = "Real Politics Union",
["Union Party (United States)"] = "Union Party (US)",
["Unión por la Patria"] = "Union for the Homeland",
["Unionist Party (United States)"] = "Unionist Party (US)",
["Unionist Party"] = "Unionist Party (US)",
["United Canarian Left"] = "United Left (Spain)",
["United Citizens Association of Macau"] = "Macau United Citizens Association",
["United Country Party (Australia)"] = "National Party of Australia",
["United Democratic Party (Gambia)"] = "United Democratic Party (The Gambia)",
["United Front (Singapore)"] = "Democratic Progressive Party (Singapore)",
["United Future New Zealand"] = "United Future",
["United Galicia Party"] = "United Galicia",
["United Kingdom Independence Party"] = "UK Independence Party",
["United Kingdom Libertarian Party"] = "Libertarian Party (UK)",
["United Labour Party"] = "Unity Labour Party",
["United Land Party"] = "Sahaphum Party",
["United Left (Galicia)"] = "United Left (Spain)",
["United Left and Peasants"] = "Justice Party (Ukraine)",
["United Left Catalonia"] = "United Left (Spain)",
["United Left Extremadura"] = "United Left (Spain)",
["United Left of Aragon"] = "United Left (Spain)",
["United Left of Asturias"] = "United Left (Spain)",
["United Left of Cantabria"] = "United Left (Spain)",
["United Left of Castile and León"] = "United Left (Spain)",
["United Left of Navarre"] = "United Left (Spain)",
["United Left of the Balearic Islands"] = "United Left (Spain)",
["United Left of the Community of Madrid"] = "United Left (Spain)",
["United Left of the Valencian Country"] = "United Left (Spain)",
["United Left–Assembly for Andalusia"] = "United Left (Spain)",
["United Left–Greens of the Region of Murcia"] = "United Left (Spain)",
["United Left–Madrid"] = "United Left (Spain)",
["United National Movement"] = "United National Movement (Georgia)",
["United National South West Party"] = "United Party (South Africa)",
["United New Democratic Party"] = "Grand Unified Democratic New Party",
["United People's Party (Malaysia)"] = "Sarawak United Party",
["United States Independence Party"] = "Independence Party (US)",
["United States Marijuana Party"] = "Marijuana Party (US)",
["United States Natural Law Party"] = "Natural Law Party (US)",
["United States Whig Party"] = "Whig Party (US)",
["United Thai Nation"] = "United Thai Nation Party",
["United/Reform Coalition"] = "United–Reform Coalition",
["Units Podem Més"] = "Unidas Podemos",
["Unity (Latvian political party)"] = "Unity (Latvia)",
["Unity (political party, Latvia)"] = "Unity (Latvia)",
["Unity (Ukraine)"] = "Unity of Oleksandr Omelchenko",
["Unity For Peace And Socialism"] = "Unity for Peace and Socialism",
["Unity List (Denmark)"] = "Red–Green Alliance (Denmark)",
["Unity"] = "Unity (Northern Ireland)",
["Unrepresented People’s Party"] = "Unrepresented Peoples Party",
["Unsubmissive France"] = "La France Insoumise",
["Upper House branch of the Lantmanna Party"] = "Lantmanna Party",
["Urban Tax Reform Party"] = "Other parties",
["US Marijuana Party"] = "Marijuana Party (US)",
["US Taxpayers Party"] = "Constitution Party (US)",
["Utah Constitution Party"] = "Constitution Party (US)",
["Utah Democratic Party"] = "Democratic Party (United States)",
["Utah Republican Party"] = "Republican Party (United States)",
["Uttama Prajakeeya Party"] = "Uttama Prajaakeeya Party",
}
local full = {
["U.S. Labor Party"] = {abbrev = "", color = "#800000", shortname = "U.S. Labor",},
["U.S. Taxpayers Party"] = {abbrev = "", color = "transparent", shortname = "U.S. Taxpayers",},
["UAP/Country coalition"] = {abbrev = "", color = "#00008B", shortname = "",},
["Ubuntu Connected Front"] = {abbrev = "", color = "#EA0512", shortname = "",},
["Ubuntu Party"] = {abbrev = "", color = "Lightblue", shortname = "",},
["Udalberri"] = {abbrev = "", color = "#428E89", shortname = "",},
["UDEUR Populars for the South"] = {abbrev = "", color = "#0080FF", shortname = "",},
["UDM"] = {abbrev = "", color = "orange", shortname = "",},
["Ue-Kedadji"] = {abbrev = "", color = "#FFF700", shortname = "",},
["Uganda People's Congress"] = {abbrev = "UPC", color = "#E70000", shortname = "",},
["Ugyon Kita Capiz"] = {abbrev = "", color = "#98fb98", shortname = "",},
["Ujedinjeni"] = {abbrev = "", color = "#EC4242", shortname = "",},
["UK Community Issues Party"] = {abbrev = "", color = "#C0C0C0", shortname = "",},
["UK European Union Party"] = {abbrev = "UKEU", color = "#1A347E", shortname = "",},
["UK Independence Party"] = {abbrev = "UKIP", color = "#6D3177", shortname = "",},
["UK Unionist Party"] = {abbrev = "", color = "#660066", shortname = "UK Unionist",},
["UK Veteran's and People's Party"] = {abbrev = "UKVPP", color = "#053360", shortname = "",},
["Ukraine – Forward!"] = {abbrev = "", color = "SlateBlue", shortname = "",},
["Ukraine is Our Home"] = {abbrev = "", color = "#F4C711", shortname = "",},
["Ukrainian Conservative Republican Party"] = {abbrev = "UCRP", color = "#0C7EBD", shortname = "",},
["Ukrainian Democratic Alliance for Reform"] = {abbrev = "UDAR", color = "#C93732", shortname = "",},
["Ukrainian Galician Party"] = {abbrev = "", color = "#FCCD3F", shortname = "",},
["Ukrainian Marine Party"] = {abbrev = "UMP", color = "#3249B3", shortname = "",},
["Ukrainian National Assembly"] = {abbrev = "UNA", color = "#D80100", shortname = "",},
["Ukrainian National Assembly – Ukrainian People's Self-Defence"] = {abbrev = "UNA–UNSO", color = "#d90000", shortname = "",},
["Ukrainian National Bloc of Kostenko and Plyushch"] = {abbrev = "", color = "Blue", shortname = "Kostenko and Plyushch Bloc",},
["Ukrainian National Democratic Alliance"] = {abbrev = "UNDO", color = "#87CEEB", shortname = "",},
["Ukrainian National State Union"] = {abbrev = "", color = "#5F9EA0", shortname = "",},
["Ukrainian Peasant Democratic Party"] = {abbrev = "", color = "#d29443", shortname = "Peasant Democratic",},
["Ukrainian People's Party"] = {abbrev = "", color = "#0A4595", shortname = "",},
["Ukrainian Radical Party"] = {abbrev = "URP", color = "red", shortname = "",},
["Ukrainian Republican Party"] = {abbrev = "URP", color = "#FEBF10", shortname = "",},
["Ukrainian Republican Party (2006)"] = {abbrev = "URP", color = "#194582", shortname = "",},
["Ukrainian Social Democratic Labour Party"] = {abbrev = "", color = "#CE0000", shortname = "",},
["Ukrainian Social Democratic Party (1899)"] = {abbrev = "USDP", color = "red", shortname = "",},
["Ukrainian Strategy of Groysman"] = {abbrev = "USH", color = "#FFDD00", shortname = "",},
["UKROP"] = {abbrev = "", color = "#0B9444", shortname = "",},
["Ulster Conservatives and Unionists"] = {abbrev = "UCU-NF", color = "#9999FF", shortname = "",},
["Ulster Constitution Party"] = {abbrev = "", color = "black", shortname = "Ulster Constitution",},
["Ulster Democratic Party"] = {abbrev = "", color = "black", shortname = "Ulster Democratic",},
["Ulster Independence Movement"] = {abbrev = "", color = "darkgray", shortname = "Ulster Independence",},
["Ulster Liberal Party"] = {abbrev = "ULib", color = "#DAA520", shortname = "Ulster Liberal",},
["Ulster Popular Unionist Party"] = {abbrev = "UPUP", color = "#ffdead", shortname = "",},
["Ulster Progressive Unionist Association"] = {abbrev = "", color = "#e0afaf", shortname = "Progressive Unionist",},
["Ulster Unionist Labour Association"] = {abbrev = "", color = "#9999FF", shortname = "Labour Unionist",},
["Ulster Unionist Party"] = {abbrev = "UUP", color = "#48A5EE", shortname = "Ulster Unionist",},
["Ulster's Independent Voice"] = {abbrev = "", color = "darkorange", shortname = "Independent Voice",},
["Ultra-Tory"] = {abbrev = "", color = "#333352", shortname = "",},
["Umbrella for Democratic Change"] = {abbrev = "UDC", color = "#244197", shortname = "",},
["Umbrella for Democratic Change (2014)"] = {abbrev = "", color = "#e97810", shortname = "",},
["Ummah Party (Indonesia)"] = {abbrev = "", color = "#000000", shortname = "Ummat",},
["Umoja Party"] = {abbrev = "", color = "#000045", shortname = "Umoja",},
["Un Kòrsou Hustu"] = {abbrev = "", color = "#3F00FF", shortname = "",},
["Unaffiliated politician"] = {abbrev = "", color = "EEEEEE", shortname = "Unaffiliated",},
["Unang Sigaw ng Nueva Ecija"] = {abbrev = "", color = "#000084", shortname = "Unang Sigaw",},
["Unbought Tenants Association"] = {abbrev = "", color = "#bb00bb", shortname = "Unbought Tenants",},
["Unconditional Spanish Party"] = {abbrev = "", color = "#325688", shortname = "",},
["Unconditional Union Party"] = {abbrev = "", color = "#FFAABB", shortname = "Unconditional Union",},
["Unconditional Unionist Party"] = {abbrev = "", color = "#FFAABB", shortname = "",},
["Unendorsed Labour candidates, 1931"] = {abbrev = "", color = "#D03030", shortname = "Other unendorsed Labour",},
["Unid@s Se Puede"] = {abbrev = "", color = "#5A134B", shortname = "",},
["Unidá"] = {abbrev = "", color = "#08B610", shortname = "",},
["Unidad Popular"] = {abbrev = "", color = "#DC0C0C", shortname = "",},
["Unidas Podemos por Andalucía"] = {abbrev = "", color = "#37773E", shortname = "",},
["Unidas Podemos"] = {abbrev = "", color = "#7B4977", shortname = "",},
["Unidas por Llangreu"] = {abbrev = "", color = "#7CB742", shortname = "",},
["Unidos Móstoles"] = {abbrev = "", color = "#DC196F", shortname = "",},
["Unidos"] = {abbrev = "", color = "#333399", shortname = "",},
["Unidos (political party)"] = {abbrev = "", color = "#E32132", shortname = "",},
["Unification Party (South Korea)"] = {abbrev = "UP", color = "#008080", shortname = "Unification",},
["Unification National Party"] = {abbrev = "UNP", color = "#22B14D", shortname = "Unification National",},
["Unified – Alternative for Patriots"] = {abbrev = "JAP", color = "#FFBFF7", shortname = "",},
["Unified Armenians Party"] = {abbrev = "", color = "blue", shortname = "",},
["Unified Communist Party of Georgia"] = {abbrev = "SEKP", color = "red", shortname = "",},
["Unified Communist Party of Spain"] = {abbrev = "", color = "#D20B12", shortname = "",},
["Unified Lumumbist Party"] = {abbrev = "", color = "#b22222", shortname = "",},
["Unified Progressive Party"] = {abbrev = "", color = "#663399", shortname = "Unified Progressive",},
["Unified Socialist Party (Burkina Faso)"] = {abbrev = "", color = "red", shortname = "",},
["Unified Socialist Party (France)"] = {abbrev = "", color = "#e7471e", shortname = "Unified Socialist",},
["Unified Socialist Party (Italy)"] = {abbrev = "", color = "#E52F63", shortname = "Unified Socialist",},
["Unified Socialist Party (Morocco)"] = {abbrev = "", color = "#03377A", shortname = "",},
["Unified Socialist Party of Catalonia"] = {abbrev = "PSUC", color = "#00A58F", shortname = "",},
["Unified Socialist Party of Mexico"] = {abbrev = "PSUM", color = "red", shortname = "",},
["Unió Calvianera"] = {abbrev = "", color = "#215E02", shortname = "",},
["Unió Campanera"] = {abbrev = "", color = "#197E36", shortname = "",},
["Unió Mollera Pollencina"] = {abbrev = "", color = "#10A9B7", shortname = "",},
["Unió Pollencina Independent"] = {abbrev = "", color = "#41B7FD", shortname = "",},
["Union 55+"] = {abbrev = "U55+", color = "#C373B1", shortname = "",},
["Union for a Better Future of BiH"] = {abbrev = "SBB", color = "#213381", shortname = "",},
["Union for a Popular Movement"] = {abbrev = "UMP", color = "#0051AE", shortname = "",},
["Union for Almería"] = {abbrev = "", color = "#F4787C", shortname = "",},
["Union for Cambre"] = {abbrev = "", color = "#007B6B", shortname = "",},
["Union for Capdepera"] = {abbrev = "", color = "#528646", shortname = "",},
["Union for Central African Renewal"] = {abbrev = "", color = "#013157", shortname = "",},
["Union for Change Party"] = {abbrev = "", color = "#FFFF78", shortname = "",},
["Union for Change"] = {abbrev = "", color = "#006600", shortname = "",},
["Union for Córdoba"] = {abbrev = "", color = "#19bc9d", shortname = "",},
["Union for Democracy and Freedom"] = {abbrev = "UDL", color = "", shortname = "",},
["Union for Democracy and Peace in Ivory Coast"] = {abbrev = "UDPCI", color = "#01a0e2", shortname = "",},
["Union for Democracy and Progress"] = {abbrev = "UDP", color = "#0FAF05", shortname = "",},
["Union for Democracy and Social Integration"] = {abbrev = "UDIS", color = "#ECDA30", shortname = "",},
["Union for Democracy and Social Progress (Democratic Republic of the Congo)"] = {abbrev = "UDPS", color = "#CF1020", shortname = "",},
["Union for Democracy and the Republic (Niger)"] = {abbrev = "", color = "#D80000", shortname = "",},
["Union for Development"] = {abbrev = "UPD", color = "#FF4500", shortname = "",},
["Union for Economic Defence"] = {abbrev = "UDE", color = "#53002C", shortname = "",},
["Union for Elda Progress"] = {abbrev = "", color = "#207524", shortname = "",},
["Union for Europe"] = {abbrev = "UFE", color = "#4F6BA2", shortname = "",},
["Union for Europe of the Nations"] = {abbrev = "UEN", color = "#4F6BA2", shortname = "",},
["Union for France"] = {abbrev = "UPF", color = "", shortname = "",},
["Union for France (2022)"] = {abbrev = "UPF", color = "#0087CD", shortname = "",},
["Union for French Democracy"] = {abbrev = "UDF", color = "#00CCCC", shortname = "",},
["Union for Homeland"] = {abbrev = "UFH", color = "#1E4D2B", shortname = "",},
["Union for Hope"] = {abbrev = "", color = "#FF4500", shortname = "",},
["Union for Ivory Coast"] = {abbrev = "UPCI", color = "#ff8080", shortname = "",},
["Union for Leganés"] = {abbrev = "", color = "#528263", shortname = "",},
["Union for Liberty"] = {abbrev = "", color = "#73288B", shortname = "",},
["Union for National Progress"] = {abbrev = "UPRONA", color = "#FF0000", shortname = "",},
["Union for National Salvation"] = {abbrev = "USN", color = "#EE5C29", shortname = "",},
["Union for National Self-Determination"] = {abbrev = "UNSD", color = "black", shortname = "",},
["Union for Ordes"] = {abbrev = "", color = "#006B33", shortname = "",},
["Union for Peace and Development Party"] = {abbrev = "UPD", color = "#008000", shortname = "",},
["Union for Peru"] = {abbrev = "UPP", color = "#D8242A", shortname = "",},
["Union for Peace and Progress–Kilusang Bagong Lipunan"] = {abbrev = "UPP–KBL", color = "#FE0000", shortname = "",},
["Union for Progress and Development"] = {abbrev = "UPD", color = "#FF5A36", shortname = "",},
["Union for Progress and Reform"] = {abbrev = "", color = "#008800", shortname = "",},
["Union for Progress and Renewal (Guinea)"] = {abbrev = "", color = "#0070C0", shortname = "",},
["Union for Promoting Progress"] = {abbrev = "UNIPRO", color = "#183B7D", shortname = "",},
["Union for Rebirth / Sankarist Party"] = {abbrev = "UNIR/PS", color = "#DE144A", shortname = "",},
["Union for Renewal and Democracy"] = {abbrev = "", color = "#ff0000", shortname = "",},
["Union for the Congolese Nation"] = {abbrev = "", color = "red", shortname = "",},
["Union for the Homeland"] = {abbrev = "UP", color = "#00BEFF", shortname = "",},
["Union for the Homeland and the People"] = {abbrev = "EPAL", color = "#2200ff", shortname = "",},
["Union for the New Republic (Gabon)"] = {abbrev = "UPNR", color = "#1b429e", shortname = "",},
["Union for the New Republic"] = {abbrev = "UNR", color = "#0000C8", shortname = "",},
["Union for the Presidential Majority (Djibouti)"] = {abbrev = "UMP", color = "#5FB989", shortname = "",},
["Union for the Progress of Cantabria"] = {abbrev = "UPCA", color = "#00B0A0", shortname = "",},
["Union for the Progress of Guinea"] = {abbrev = "UPG", color = "#FFA500", shortname = "",},
["Union for the Republic (Mauritania)"] = {abbrev = "UPR", color = "#327adc", shortname = "",},
["Union for the Republic (Togo)"] = {abbrev = "UNIR", color = "#38a8e6", shortname = "",},
["Union for the Republic and Democracy"] = {abbrev = "URD", color = "#14B53A", shortname = "",},
["Union for Trentino"] = {abbrev = "", color = "#89CFF0", shortname = "",},
["Union for Victory Coalition"] = {abbrev = "BF", color = "#1F40DD", shortname = "",},
["Union Karen League"] = {abbrev = "", color = "#F7CF15", shortname = "",},
["Union Labor Party"] = {abbrev = "", color = "#6633CC", shortname = "Union Labor",},
["Union Makes the Nation"] = {abbrev = "", color = "#DA6201", shortname = "",},
["Union Monégasque"] = {abbrev = "", color = "#DD0000", shortname = "",},
["Union Movement"] = {abbrev = "", color = "#2F4F4F", shortname = "",},
["Union nationale"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Union of Armenians of Romania"] = {abbrev = "RHM", color = "black", shortname = "",},
["Union of Centrists"] = {abbrev = "EK", color = "#FF7F50", shortname = "",},
["Union of Chiefs and Peoples of the North"] = {abbrev = "", color = "#6495ED", shortname = "",},
["Union of Christian Families"] = {abbrev = "ZChR", color = "#0087BD", shortname = "",},
["Union of Citizens of Badalona"] = {abbrev = "", color = "#8AA8D5", shortname = "",},
["Union of Citizens of Georgia"] = {abbrev = "SMK", color = "#231577", shortname = "",},
["Union of Communist Parties – Communist Party of the Soviet Union"] = {abbrev = "", color = "#DE0300", shortname = "",},
["Union of Communists in Bulgaria"] = {abbrev = "", color = "red", shortname = "",},
["Union of Communists of Slovakia"] = {abbrev = "ZKS", color = "red", shortname = "",},
["Union of Croats of Romania"] = {abbrev = "ZHR", color = "#004B80", shortname = "",},
["Union of Democratic and Social Forces"] = {abbrev = "UFDS", color = "", shortname = "",},
["Union of Democratic Forces (Bulgaria)"] = {abbrev = "SDS", color = "#0A459F", shortname = "",},
["Union of Democratic Forces (Mauritania)"] = {abbrev = "UFD-EN", color = "black", shortname = "",},
["Union of Democratic Forces of Guinea"] = {abbrev = "UFDG", color = "#406626", shortname = "",},
["Union of Democrats and Ecologists"] = {abbrev = "", color = "#088A43", shortname = "",},
["Union of Democrats and Independents"] = {abbrev = "UDI", color = "#35A2EF", shortname = "",},
["Union of Democrats for Citizenship and Development"] = {abbrev = "", color = "black", shortname = "",},
["Union of Democrats for Europe"] = {abbrev = "UDEUR", color = "#FF7F00", shortname = "",},
["Union of Democrats for the Republic"] = {abbrev = "UDR", color = "#0000C8", shortname = "",},
["Union of Development"] = {abbrev = "UPD", color = "yellow", shortname = "",},
["Union of European Democrats"] = {abbrev = "", color = "#FFD403", shortname = "",},
["Union of European Federalists"] = {abbrev = "", color = "#007B3A", shortname = "",},
["Union of Everyone"] = {abbrev = "", color = "#95DC5B", shortname = "",},
["Union of Forces for Change"] = {abbrev = "UFC", color = "#FFCC00", shortname = "",},
["Union des Francophones"] = {abbrev = "UF", color = "#00a0af", shortname = "",},
["Union of Free Democrats"] = {abbrev = "", color = "blue", shortname = "",},
["Union of Georgian Traditionalists"] = {abbrev = "UGT", color = "#740144", shortname = "",},
["Union of Greens and Farmers"] = {abbrev = "ZZS", color = "#02723A", shortname = "",},
["Union of Greens of Russia"] = {abbrev = "", color = "#0B8413", shortname = "",},
["Union of Humanist Democrats-Yuki"] = {abbrev = "UDH-YUKI", color = "#36b4ff", shortname = "",},
["Union of Independent Citizens"] = {abbrev = "", color = "#119246", shortname = "",},
["Union of Independent Nigeriens"] = {abbrev = "", color = "#C0C0C0", shortname = "",},
["Union of Independent Viguese"] = {abbrev = "", color = "#AD0100", shortname = "",},
["Union of Independents of Artà"] = {abbrev = "", color = "#68A2B6", shortname = "",},
["Union of Independents of Sant Cugat"] = {abbrev = "", color = "#FFF004", shortname = "",},
["Union of Kazakhstan's Youth"] = {abbrev = "", color = "#D28095", shortname = "Union of Youth",},
["Union of Latin American Parties"] = {abbrev = "", color = "#137BC1", shortname = "",},
["Union of Liberals and Leftists"] = {abbrev = "", color = "#3FFF00", shortname = "Liberals & Leftists",},
["Union of Mobutuist Democrats"] = {abbrev = "", color = "#3AB500", shortname = "",},
["Union of Moderate Parties"] = {abbrev = "UMP", color = "#02A0E9", shortname = "",},
["Union of Myanmar Federation of National Politics"] = {abbrev = "UMFNP", color = "#FFFFFF", shortname = "",},
["Union of Nigerien Independents and Sympathisers"] = {abbrev = "", color = "blue", shortname = "",},
["Union of October 17"] = {abbrev = "", color = "#00529C", shortname = "Octobrist",},
["Union of Patriotic Forces and Militaries of the Reserve Defense"] = {abbrev = "", color = "darkgreen", shortname = "",},
["Union of People's Parties"] = {abbrev = "", color = "#007FFF", shortname = "",},
["Union of Persecutees of the Nazi Regime"] = {abbrev = "", color = "#e3001a", shortname = "",},
["Union of Poles of Romania"] = {abbrev = "", color = "#D4213D", shortname = "Dom Polski",},
["Union of Pro Patria and Res Publica"] = {abbrev = "", color = "#00AEEF", shortname = "Pro Patria and Res Publica",},
["Union of Progressive Political Forces"] = {abbrev = "SPPS", color = "#67C4CE", shortname = "",},
["Union of Puerto Rico"] = {abbrev = "", color = "#FFBBFF", shortname = "Union",},
["Union of Radicals, Centrists, Independents and Democrats"] = {abbrev = "", color = "#E2725B", shortname = "",},
["Union of Reform Forces of Yugoslavia"] = {abbrev = "SRSJ", color = "lightcoral", shortname = "",},
["Union of Republican Forces"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Union of Right Forces"] = {abbrev = "SPS", color = "#1042A5", shortname = "",},
["Union of Right-Wing Parties"] = {abbrev = "", color = "#8CC74B", shortname = "",},
["Union of Serbs of Romania"] = {abbrev = "USR", color = "#7D2124", shortname = "",},
["Union of Social Democrats of Bosnia and Herzegovina"] = {abbrev = "", color = "red", shortname = "",},
["Union of Socialist Movements"] = {abbrev = "UMS", color = "#3F3991", shortname = "",},
["Union of Talavera and Region"] = {abbrev = "", color = "#F38512", shortname = "",},
["Union of the Catalan Left"] = {abbrev = "", color = "#86A837", shortname = "",},
["Union of the Centre (1993)"] = {abbrev = "UdC", color = "#659EC7", shortname = "",},
["Union of the Centre (2002)"] = {abbrev = "UDC", color = "#87CEFA", shortname = "",},
["Union of the Centre and Christian Democracy of Catalonia"] = {abbrev = "", color = "#F8471B", shortname = "",},
["Union of the Centre of Catalonia"] = {abbrev = "", color = "#03317E", shortname = "",},
["Union of the Centrist Center"] = {abbrev = "", color = "#B22222", shortname = "",},
["Union of the Democratic Centre (Argentina)"] = {abbrev = "UCEDE", color = "#6495ED", shortname = "Union of the Democratic Centre",},
["Union of the Democratic Centre (Greece)"] = {abbrev = "EDIK", color = "#FF7F50", shortname = "Union of the Democratic Centre",},
["Union of the Democratic Centre (Spain)"] = {abbrev = "UCD", color = "#197E36", shortname = "",},
["Union of the Democratic Forces"] = {abbrev = "", color = "#DE3163", shortname = "",},
["Union of the Forces of Change (Guinea)"] = {abbrev = "", color = "#8DA15A", shortname = "",},
["Union of the Forces of Progress"] = {abbrev = "UFP", color = "#FF7F00", shortname = "",},
["Union of the Gabonese People"] = {abbrev = "UPG", color = "blue", shortname = "",},
["Union of the Left (France)"] = {abbrev = "", color = "#FFD1DC", shortname = "Union of the Left",},
["Union of the National Right"] = {abbrev = "", color = "#4A07C8", shortname = "",},
["Union of the Peoples of Cameroon"] = {abbrev = "UPC", color = "#E50101", shortname = "",},
["Union of the Peoples of Murcia"] = {abbrev = "", color = "#0D4E8E", shortname = "",},
["Union of the Right and Centre"] = {abbrev = "UDC", color = "#71BBDE", shortname = "",},
["Union of the Salamancan People"] = {abbrev = "", color = "#00009F", shortname = "",},
["Union of the Ukrainians of Romania"] = {abbrev = "SUR", color = "#0057b7", shortname = "",},
["Union of the Workers of Slovakia"] = {abbrev = "ZRS", color = "#8B0000", shortname = "",},
["Union Party (Faroe Islands)"] = {abbrev = "", color = "#006CB4", shortname = "Union",},
["Union Party (Lebanon)"] = {abbrev = "", color = "#8B8589", shortname = "Union Party",},
["Union Party (US)"] = {abbrev = "", color = "#7F3300", shortname = "Union",},
["Union Party for the People"] = {abbrev = "", color = "#FF8C00", shortname = "Party of the U",},
["Unión por San Luis"] = {abbrev = "", color = "#00ADEE", shortname = "",},
["Unión Portuense"] = {abbrev = "", color = "#6DAB3C", shortname = "",},
["Union Progressive Party (Illinois)"] = {abbrev = "", color = "#7F3300", shortname = "Union Progressive",},
["Union Solidarity and Development Party"] = {abbrev = "USDP", color = "#006B31", shortname = "",},
["Union, Progress and Democracy"] = {abbrev = "UPyD", color = "#E9008C", shortname = "",},
["Unionist Democratic Union"] = {abbrev = "UDU", color = "Maroon", shortname = "",},
["Unionist Party (Guatemala)"] = {abbrev = "", color = "#273284", shortname = "Unionist",},
["Unionist Party (Punjab)"] = {abbrev = "", color = "#0000FF", shortname = "Unionist",},
["Unionist Party (Scotland)"] = {abbrev = "", color = "#5555FF", shortname = "Unionist",},
["Unionist Party (South Africa)"] = {abbrev = "", color = "#9ACD32", shortname = "Unionist",},
["Unionist Party (UK)"] = {abbrev = "", color = "#0087DC", shortname = "Unionist",},
["Unionist Party (US)"] = {abbrev = "", color = "#FFAADD", shortname = "Unionist",},
["Unionist Party of Northern Ireland"] = {abbrev = "", color = "#ffa07a", shortname = "Unionist Party NI",},
["Unique Gorani Party"] = {abbrev = "JGP", color = "#FFCF40", shortname = "",},
["UNIR Constitutional Nationalist Party"] = {abbrev = "PNC–UNIR", color = "#004298", shortname = "UNIR Party",},
["Unir Movement"] = {abbrev = "", color = "#D60B51", shortname = "",},
["UNITA"] = {abbrev = "", color = "#006600", shortname = "",},
["Unitarian Candidacy of Workers"] = {abbrev = "", color = "#117D25", shortname = "",},
["Unitarian Socialist Party"] = {abbrev = "", color = "#8B1C62", shortname = "Unitarian Socialists",},
["Unitary Candidacy of Estella"] = {abbrev = "", color = "#C56E8B", shortname = "",},
["Unitary Democratic Coalition (2022)"] = {abbrev = "CDU", color = "#84AD15", shortname = "",},
["Unitary Democratic Coalition"] = {abbrev = "CDU", color = "#FF0000", shortname = "",},
["Unitary National Liberation Front"] = {abbrev = "JNOF", color = "#DD0000", shortname = "",},
["Unitary Party"] = {abbrev = "", color = "#ADD8E6", shortname = "",},
["Unitary Party for the Construction of Mauritania"] = {abbrev = "PUCM", color = "#F7941D", shortname = "",},
["Unitary Socialist Party (Italy, 1922)"] = {abbrev = "", color = "#E35A5A", shortname = "Unitary Socialist Party",},
["Unitary Socialist Party–Socialist Agreement"] = {abbrev = "PSU–IS", color = "#DB341E", shortname = "",},
["Unitat pel Canvi Sabadell"] = {abbrev = "", color = "#5E305B", shortname = "",},
["Unite por la Libertad y la Dignidad"] = {abbrev = "UNITE", color = "#6bc1e4", shortname = "",},
["Unite Principality"] = {abbrev = "SMP", color = "#011A5D", shortname = "",},
["United (Canarian electoral alliance)"] = {abbrev = "", color = "#26348C", shortname = "",},
["United Abkhazia"] = {abbrev = "", color = "#C92D25", shortname = "",},
["United African National Council"] = {abbrev = "UANC", color = "#808000", shortname = "",},
["United Algeciran Youth"] = {abbrev = "", color = "#34C4F9", shortname = "",},
["United Alliance Sabah"] = {abbrev = "", color = "#0AD9EF", shortname = "",},
["United and Alternative Left"] = {abbrev = "EUiA", color = "#D21145", shortname = "",},
["United and Republican Left"] = {abbrev = "", color = "#D63231", shortname = "",},
["United Ants"] = {abbrev = "", color = "#000000", shortname = "",},
["United Arab List (1977)"] = {abbrev = "", color = "#C61318", shortname = "United Arab List",},
["United Arab List"] = {abbrev = "", color = "#15793D", shortname = "Ra'am",},
["United Armenia Party (Armenia)"] = {abbrev = "", color = "#F7A921", shortname = "",},
["United Australia Party"] = {abbrev = "", color = "#00008B", shortname = "United Australia",},
["United Australia Party (2013)"] = {abbrev = "UAP", color = "#FFED00", shortname = "United Australia",},
["United Australia Party (Australian Capital Territory)"] = {abbrev = "UAP", color = "#FFED00", shortname = "United Australia"},
["United Australia Party (New South Wales)"] = {abbrev = "UAP", color = "#FFED00", shortname = "United Australia"},
["United Australia Party (Northern Territory)"] = {abbrev = "UAP", color = "#FFED00", shortname = "United Australia"},
["United Australia Party (Queensland)"] = {abbrev = "UAP", color = "#FFED00", shortname = "United Australia"},
["United Australia Party (South Australia)"] = {abbrev = "UAP", color = "#FFED00", shortname = "United Australia"},
["United Australia Party (Tasmania)"] = {abbrev = "UAP", color = "#FFED00", shortname = "United Australia"},
["United Australia Party (Victoria)"] = {abbrev = "UAP", color = "#FFED00", shortname = "United Australia"},
["United Australia Party (Western Australia)"] = {abbrev = "UAP", color = "#FFED00", shortname = "United Australia"},
["United Bahamian Party"] = {abbrev = "", color = "#02006c", shortname = "",},
["United Bangsamoro Justice Party"] = {abbrev = "UBJP", color = "#026701", shortname = "",},
["United Bermuda Party"] = {abbrev = "UBP", color = "#3366cc", shortname = "",},
["United Black Association for Development"] = {abbrev = "UBAD", color = "#000000", shortname = "",},
["United Bumiputera Heritage Party"] = {abbrev = "", color = "#F0E98B", shortname = "",},
["United Can Picafort"] = {abbrev = "", color = "#567297", shortname = "",},
["United Canarian People"] = {abbrev = "", color = "#F73431", shortname = "",},
["United Cantabrian Left Group"] = {abbrev = "", color = "#E71839", shortname = "",},
["United Centre (Chile)"] = {abbrev = "", color = "#037E3B", shortname = "",},
["United Centre"] = {abbrev = "", color = "#FFE200", shortname = "",},
["United Ceuta"] = {abbrev = "", color = "#4A4542", shortname = "",},
["United Christian Democratic Party"] = {abbrev = "", color = "#78a22c", shortname = "",},
["United Christian Democrats"] = {abbrev = "CDU", color = "lightblue", shortname = "",},
["United Christian Party (Hungary)"] = {abbrev = "", color = "#006857", shortname = "United Christian",},
["United Citizen Party"] = {abbrev = "", color = "#04B486", shortname = "",},
["United Citizens"] = {abbrev = "", color = "#B8BFFE", shortname = "",},
["United Citizens Party"] = {abbrev = "", color = "#778899", shortname = "United Citizens",},
["United Civic Alliance Party"] = {abbrev = "", color = "#253F9E", shortname = "",},
["United Civic Party"] = {abbrev = "AGP", color = "#EA1C1C", shortname = "",},
["United Civil Front"] = {abbrev = "OGF", color = "#134EA2", shortname = "",},
["United Coalition"] = {abbrev = "", color = "#1863DC", shortname = "",},
["United Communist League of Bangladesh"] = {abbrev = "UCL", color = "#EC435A", shortname = "",},
["United Communist Party of Armenia"] = {abbrev = "HMKK", color = "red", shortname = "",},
["United Communist Party of India"] = {abbrev = "UCPI", color = "red", shortname = "",},
["United Congress (South Africa)"] = {abbrev = "", color = "#50C878", shortname = "",},
["United Conservative Party (Chile)"] = {abbrev = "", color = "#0000FF", shortname = "",},
["United Conservative Party"] = {abbrev = "", color = "#0000FF", shortname = "",},
["United Cyprus Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["United Democrat Party"] = {abbrev = "", color = "black", shortname = "United Democrat",},
["United Democratic Alliance (Kenya)"] = {abbrev = "UDA", color = "#F4CB23", shortname = "",},
["United Democratic Alliance (Nagaland)"] = {abbrev = "UDA", color = "#800000", shortname = "",},
["United Democratic Alliance (Zambia)"] = {abbrev = "UDA", color = "yellow", shortname = "",},
["United Democratic Centre (El Salvador)"] = {abbrev = "CDU", color = "#FFFF00", shortname = "",},
["United Democratic Electoral Commission"] = {abbrev = "CEUD", color = "red", shortname = "",},
["United Democratic Forces"] = {abbrev = "ODS", color = "#0C4BAC", shortname = "",},
["United Democratic Forces of Belarus"] = {abbrev = "ADSB", color = "#FF0000", shortname = "",},
["United Democratic Forum Party"] = {abbrev = "UDF", color = "#FFF100", shortname = "",},
["United Democratic Front (Arunachal Pradesh)"] = {abbrev = "", color = "#800000", shortname = "",},
["United Democratic Front (India)"] = {abbrev = "UDF", color = "skyblue", shortname = "",},
["United Democratic Front (Kerala)"] = {abbrev = "UDF", color = "#0078FF", shortname = "",},
["United Democratic Front (Malawi)"] = {abbrev = "UDF", color = "#FFFF00", shortname = "",},
["United Democratic Front (Nagaland)"] = {abbrev = "", color = "#800000", shortname = "",},
["United Democratic Front (Namibia)"] = {abbrev = "UDF", color = "#314BB2", shortname = "",},
["United Democratic Front (Thailand)"] = {abbrev = "", color = "#CFECEC", shortname = "United Democratic",},
["United Democratic Front"] = {abbrev = "UDF", color = "#add8e6", shortname = "",},
["United Democratic Left"] = {abbrev = "EDA", color = "lightblue", shortname = "",},
["United Democratic Movement"] = {abbrev = "UDM", color = "#FFB300", shortname = "",},
["United Democratic Movement (Kenya)"] = {abbrev = "UDM", color = "#F6FC4F", shortname = "",},
["United Democratic Party (Belize)"] = {abbrev = "UDP", color = "#CE1126", shortname = "",},
["United Democratic Party (Malaysia)"] = {abbrev = "UDP", color = "#FF0000", shortname = "",},
["United Democratic Party (Meghalaya)"] = {abbrev = "UDP", color = "#FE0002", shortname = "",},
["United Democratic Party (Solomon Islands)"] = {abbrev = "UDP", color = "#F0E68C", shortname = "United Democratic",},
["United Democratic Party (South Korea, 1995)"] = {abbrev = "UDP", color = "red", shortname = "United Democratic",},
["United Democratic Party (South Korea, 2008)"] = {abbrev = "UDP", color = "#419639", shortname = "United Democratic",},
["United Democratic Party (Tanzania)"] = {abbrev = "UDP", color = "#437806", shortname = "",},
["United Democratic Party (The Gambia)"] = {abbrev = "UDP", color = "#FEE119", shortname = "",},
["United Democratic Sabah People's Power Party"] = {abbrev = "SETIA", color = "", shortname = "",},
["United Democratic Serbia"] = {abbrev = "", color = "#FDB515", shortname = "",},
["United Democrats (Sint Maarten)"] = {abbrev = "UD", color = "#3BB54C", shortname = "",},
["United Democrats of Hong Kong"] = {abbrev = "UDHK", color = "#136C56", shortname = "United Democrats",},
["United Democrats"] = {abbrev = "EDI", color = "#FFD700", shortname = "",},
["United Development Party"] = {abbrev = "PPP", color = "#00A100", shortname = "",},
["United Ecuadorian"] = {abbrev = "", color = "#382983", shortname = "",},
["United Ethiopian Democratic Forces"] = {abbrev = "", color = "#04A507", shortname = "",},
["United Extremadura"] = {abbrev = "EU", color = "#085500", shortname = "",},
["United Federal Party"] = {abbrev = "", color = "#0087DC", shortname = "United Party",},
["United for a New Alternative"] = {abbrev = "", color = "#3C3C3C", shortname = "",},
["United for Change"] = {abbrev = "", color = "#000000", shortname = "",},
["United for Chiclana"] = {abbrev = "", color = "#9E1831", shortname = "",},
["United for Gran Canaria"] = {abbrev = "UxGC", color = "#26348C", shortname = "",},
["United for Human Rights"] = {abbrev = "", color = "#F79CD0", shortname = "",},
["United for Justice"] = {abbrev = "UZP", color = "#749C75", shortname = "",},
["United for Lanzarote"] = {abbrev = "", color = "#0196BB", shortname = "",},
["United for Latvia"] = {abbrev = "", color = "#C7057F", shortname = "",},
["United for Macedonia"] = {abbrev = "", color = "#F7C317", shortname = "",},
["United for Paracuellos"] = {abbrev = "", color = "#4B8642", shortname = "",},
["United for the Future (Spain)"] = {abbrev = "", color = "#6E0374", shortname = "",},
["United for the Victory of Serbia"] = {abbrev = "UZPS", color = "#2578CC", shortname = "",},
["United for Valencia"] = {abbrev = "", color = "#084D84", shortname = "",},
["United Free Citizens"] = {abbrev = "", color = "#B11C05", shortname = "",},
["United Front (Ceylon)"] = {abbrev = "", color = "#0000FF", shortname = "",},
["United Front (PRC)"] = {abbrev = "", color = "#BC0101", shortname = "United Front",},
["United Front (Trinidad and Tobago)"] = {abbrev = "", color = "#faf333", shortname = "",},
["United Front for the Service of the People"] = {abbrev = "UFSP", color = "#000000", shortname = "",},
["United Front of Nagaland"] = {abbrev = "UDF", color = "#40FF40", shortname = "",},
["United Front Party (Ghana)"] = {abbrev = "", color = "black", shortname = "",},
["United Future Party"] = {abbrev = "", color = "#EF426F", shortname = "United Future",},
["United Future"] = {abbrev = "", color = "#501557", shortname = "",},
["United Galicia"] = {abbrev = "", color = "#93E4FF", shortname = "",},
["United Gipuzkoa"] = {abbrev = "", color = "#4A4961", shortname = "",},
["United Goans Democratic Party"] = {abbrev = "UGDP", color = "#5bb30e", shortname = "",},
["United Goans Party"] = {abbrev = "", color = "#CA8642", shortname = "",},
["United Guadeloupe, Socialism and Realities"] = {abbrev = "GUSR", color = "#FD3F92", shortname = "",},
["United Guadeloupe, Solidary and Responsible"] = {abbrev = "", color = "#263E7E", shortname = "",},
["United Hearts Movement"] = {abbrev = "", color = "#0B72C6", shortname = "",},
["United Homeland Party"] = {abbrev = "", color = "#203763", shortname = "",},
["United in Europe"] = {abbrev = "UiE", color = "#000080", shortname = "",},
["United in Hope"] = {abbrev = "BBY", color = "#7A4D30", shortname = "",},
["United Independent Democratic Front"] = {abbrev = "FDUI", color = "darkred", shortname = "",},
["United Independent Front"] = {abbrev = "", color = "#000000", shortname = "",},
["United Independent Movement"] = {abbrev = "", color = "silver", shortname = "",},
["United Independent Party"] = {abbrev = "", color = "#11426D", shortname = "United Independent",},
["United Independents (Chile)"] = {abbrev = "", color = "#274470", shortname = "United Independents",},
["United Independents"] = {abbrev = "", color = "#9966CC", shortname = "",},
["United Irish League"] = {abbrev = "UIL", color = "#90EE90", shortname = "United Irish League",},
["United Kingdom First Party"] = {abbrev = "", color = "#00009C", shortname = "UK First",},
["United Kyrgyzstan"] = {abbrev = "BK", color = "#DF2D13", shortname = "Butun Kyrgyzstan",},
["United Korea Party (1962)"] = {abbrev = "UK", color = "#312F2A", shortname = "United Korea",},
["United La Coruña"] = {abbrev = "", color = "#4B4A46", shortname = "",},
["United Labour Front"] = {abbrev = "ULF", color = "#aaa9ad", shortname = "",},
["United Labour Party (Armenia)"] = {abbrev = "", color = "#2A5E41", shortname = "",},
["United Labour Party (New Zealand)"] = {abbrev = "", color = "#FF4040", shortname = "United Labour",},
["United Labour Party (Northern Ireland)"] = {abbrev = "", color = "#ff0000", shortname = "United Labour",},
["United Labour Party (Papua New Guinea)"] = {abbrev = "ULP", color = "#F79122", shortname = "",},
["United Left (Bolivia)"] = {abbrev = "IU", color = "#FFE44A", shortname = "",},
["United Left (Ireland)"] = {abbrev = "UL", color = "#FF5555", shortname = "United Left",},
["United Left (Peru)"] = {abbrev = "", color = "#800000", shortname = "United Left",},
["United Left (Poland)"] = {abbrev = "", color = "#EC1C24", shortname = "",},
["United Left (San Marino)"] = {abbrev = "SU", color = "#BE1824", shortname = "",},
["United Left (Slovenia)"] = {abbrev = "ZL", color = "#ff3732", shortname = "",},
["United Left (Spain)"] = {abbrev = "IU", color = "#732021", shortname = "",},
["United Left Alliance"] = {abbrev = "", color = "#FF3300", shortname = "",},
["United Left of the Valencian Country (1978)"] = {abbrev = "", color = "#E34234", shortname = "",},
["United Left–Greens"] = {abbrev = "EB–B", color = "#D46459", shortname = "",},
["United Left–Valencian People's Union"] = {abbrev = "", color = "#FF787F", shortname = "",},
["United Left/The Greens–Assembly for Andalusia"] = {abbrev = "IULV–CA", color = "#009150", shortname = "",},
["United Liberal Democrats"] = {abbrev = "", color = "#009035", shortname = "United Liberal Democrats",},
["United Liberal Party (Chile)"] = {abbrev = "", color = "gold", shortname = "United Liberal",},
["United Liberal Party (Zambia)"] = {abbrev = "", color = "yellow", shortname = "",},
["United Linares Independent Citizens"] = {abbrev = "", color = "#8D2E23", shortname = "",},
["United List (Latvia)"] = {abbrev = "AS", color = "#FFAC01", shortname = "",},
["United Malays National Organisation"] = {abbrev = "UMNO", color = "#C00000", shortname = "",},
["United Montenegro"] = {abbrev = "UCG", color = "#2598D4", shortname = "",},
["United Motherland"] = {abbrev = "", color = "#E31E24", shortname = "United Motherland",},
["United National Congress"] = {abbrev = "UNC", color = "#FCCC08", shortname = "",},
["United National Federal Party"] = {abbrev = "", color = "#FFFF33", shortname = "",},
["United National Front (Afghanistan)"] = {abbrev = "", color = "black", shortname = "United National Front",},
["United National Front (Singapore)"] = {abbrev = "UNF", color = "", shortname = "",},
["United National Front (Sri Lanka)"] = {abbrev = "UNF", color = "#008000", shortname = "United National Front",},
["United National Front for Good Governance"] = {abbrev = "UNFGG", color = "#1CAE05", shortname = "",},
["United National Independence Party"] = {abbrev = "UNIP", color = "#177618", shortname = "",},
["United National Initiative (Armenia)"] = {abbrev = "", color = "#202C56", shortname = "",},
["United National Loktantrik Party"] = {abbrev = "UNLP", color = "#9A2EFE", shortname = "",},
["United National Movement (Georgia)"] = {abbrev = "UNM", color = "#BC0000", shortname = "",},
["United National Movement (Saint Kitts-Nevis-Anguilla)"] = {abbrev = "", color = "#4197d1", shortname = "",},
["United National Party"] = {abbrev = "UNP", color = "#1CAE05", shortname = "",},
["United National Progressive Alliance"] = {abbrev = "TF", color = "red", shortname = "",},
["United National Workers' Party"] = {abbrev = "PUNT", color = "#989898", shortname = "",},
["United Nationalist Alliance"] = {abbrev = "UNA", color = "#FE4D00", shortname = "",},
["United Nationalist Democratic Organization"] = {abbrev = "UNIDO", color = "#FFFF00", shortname = "",},
["United Nationalist Movement"] = {abbrev = "ENEK", color = "black", shortname = "",},
["United Neighbors"] = {abbrev = "", color = "#2A7F9E", shortname = "",},
["United New Zealand"] = {abbrev = "", color = "#663377", shortname = "United NZ",},
["United for Hungary"] = {abbrev = "", color = "#4CB5A2", shortname = "",},
["United Opposition (Philippines)"] = {abbrev = "UNO", color = "#0000FF", shortname = "",},
["United Opposition of Serbia"] = {abbrev = "", color = "#1982C3", shortname = "",},
["United Ossetia"] = {abbrev = "", color = "#3498DB", shortname = "",},
["United Parties"] = {abbrev = "", color = "#800080", shortname = "",},
["United Party (Gambia)"] = {abbrev = "", color = "black", shortname = "",},
["United Party (Ghana)"] = {abbrev = "", color = "#008000", shortname = "",},
["United Party (Indonesia)"] = {abbrev = "PP", color = "#00923F", shortname = "",},
["United Party (New Zealand)"] = {abbrev = "", color = "#BBFFFF", shortname = "United",},
["United Party (Papua New Guinea)"] = {abbrev = "", color = "#D25A52", shortname = "United Party",},
["United Party (South Africa)"] = {abbrev = "", color = "#318CE7", shortname = "United",},
["United Party for Development and Democracy"] = {abbrev = "PUDD", color = "#FFD700", shortname = "",},
["United Party for National Development"] = {abbrev = "UPND", color = "#D23438", shortname = "",},
["United Pasok Momogun Organisation"] = {abbrev = "UPMO", color = "blue", shortname = "",},
["United Pasok Nunukragang National Organisation"] = {abbrev = "PASOK", color = "indigo", shortname = "",},
["United Pasokmomogun Kadazan Organisation"] = {abbrev = "UPKO", color = "#ABCDFF", shortname = "",},
["United Pasokmomogun Kadazandusun Murut Organisation"] = {abbrev = "", color = "#ABCDFF", shortname = "",},
["United Pasokmomogun Kadazandusun Organisation"] = {abbrev = "", color = "#00008B", shortname = "",},
["United Patriots"] = {abbrev = "OP", color = "#009B75", shortname = "",},
["United Peasant Party"] = {abbrev = "USS", color = "#50C878", shortname = "",},
["United People (Chile)"] = {abbrev = "", color = "#E4040F", shortname = "",},
["United People (Costa Rica)"] = {abbrev = "PU", color = "#AD0430", shortname = "",},
["United People Alliance"] = {abbrev = "APU", color = "#EB3D43", shortname = "",},
["United People for Social Renovation"] = {abbrev = "", color = "#8B4513", shortname = "",},
["United People's Coalition"] = {abbrev = "", color = "#00A86B", shortname = "",},
["United People's Freedom Alliance"] = {abbrev = "UPFA", color = "#1609F7", shortname = "",},
["United People's Front"] = {abbrev = "FPU", color = "#CAB24F", shortname = "",},
["United People's Front of Nepal"] = {abbrev = "", color = "darkred", shortname = "",},
["United People's Movement (Colombia)"] = {abbrev = "", color = "#483674", shortname = "",},
["United People's Movement (Namibia)"] = {abbrev = "UPM", color = "#00A064", shortname = "",},
["United People's Party (Bulgaria)"] = {abbrev = "", color = "#0060AA", shortname = "",},
["United People's Party (Liberia)"] = {abbrev = "UPP", color = "#ff0000", shortname = "",},
["United People's Party (Poland)"] = {abbrev = "ZSL", color = "#899A41", shortname = "",},
["United People's Party (Singapore)"] = {abbrev = "UPP", color = "#0055FE", shortname = "",},
["United People's Party (Sint Maarten)"] = {abbrev = "", color = "#94D60A", shortname = "",},
["United People's Party (South Korea)"] = {abbrev = "", color = "#229875", shortname = "",},
["United People's Party (UK)"] = {abbrev = "", color = "#339900", shortname = "United People's Party",},
["United People's Party (Zimbabwe)"] = {abbrev = "UPP", color = "#40E0D0", shortname = "",},
["United People's Party Liberal"] = {abbrev = "UPPL", color = "#FAED09", shortname = "",},
["United People's Party"] = {abbrev = "", color = "#A3B847", shortname = "",},
["United People's Progressive Party"] = {abbrev = "ONPP", color = "#B87333", shortname = "",},
["United People"] = {abbrev = "", color = "#0066ff", shortname = "",},
["United Peoples Party (Fiji)"] = {abbrev = "UPP", color = "#32CD32", shortname = "",},
["United Peoples' Democratic Party"] = {abbrev = "UDUB", color = "#008000", shortname = "",},
["United Peoples' Party (Bangladesh)"] = {abbrev = "UPP", color = "#00DACA", shortname = "",},
["United Poland"] = {abbrev = "", color = "#19224e", shortname = "",},
["United Pontevedra"] = {abbrev = "", color = "#0099C6", shortname = "",},
["United Popular Front (Iraq)"] = {abbrev = "UPF", color = "yellow", shortname = "",},
["United Popular Front"] = {abbrev = "EPAM", color = "#17479D", shortname = "",},
["United Progressive Alliance (Sri Lanka)"] = {abbrev = "", color = "#FF8C00", shortname = "",},
["United Progressive Alliance"] = {abbrev = "UPA", color = "#00BFFF", shortname = "",},
["United Progressive Kinabalu Organisation"] = {abbrev = "UPKO", color = "#ABCDFF", shortname = "",},
["United Progressive Party (Antigua and Barbuda)"] = {abbrev = "UPP", color = "#010F71", shortname = "",},
["United Progressive Party (Barbados)"] = {abbrev = "UPP", color = "#F59324", shortname = "",},
["United Progressive Party (Ghana)"] = {abbrev = "", color = "blue", shortname = "",},
["United Progressive Party (Nigeria)"] = {abbrev = "", color = "#05643a", shortname = "",},
["United Progressive Party (Saint Vincent and the Grenadines)"] = {abbrev = "", color = "#0083FF", shortname = "",},
["United Reform Action"] = {abbrev = "URA", color = "#00cc55", shortname = "",},
["United Regional Front"] = {abbrev = "", color = "#EC2125", shortname = "",},
["United Regions of Serbia"] = {abbrev = "URS", color = "#3BB9FF", shortname = "",},
["United Religious Front"] = {abbrev = "", color = "#172d81", shortname = "",},
["United Republic"] = {abbrev = "RS", color = "#687CD5", shortname = "",},
["United Republican Party (Guyana)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["United Republican Party (Kenya)"] = {abbrev = "URP", color = "#FFD32C", shortname = "",},
["United Republicans"] = {abbrev = "", color = "#651F7A", shortname = "",},
["United Resources Party"] = {abbrev = "URP", color = "#F0E91A", shortname = "",},
["United Revolutionary Nationalist Movement"] = {abbrev = "MNRU", color = "#EB23BC", shortname = "",},
["United Rhodesia Party"] = {abbrev = "", color = "#0087DC", shortname = "United",},
["United Right (Poland)"] = {abbrev = "ZP", color = "#263778", shortname = "",},
["United Right Party"] = {abbrev = "", color = "#1B49DD", shortname = "",},
["United Roma Party of Kosovo"] = {abbrev = "", color = "#009933", shortname = "",},
["United Romania Party"] = {abbrev = "", color = "#213C93", shortname = "",},
["United Rotenians"] = {abbrev = "", color = "#00572E", shortname = "",},
["United Russia"] = {abbrev = "", color = "#2E4EA4", shortname = "",},
["United Sabah Alliance"] = {abbrev = "", color = "#1A1A1A", shortname = "",},
["United Sabah Assembly Party"] = {abbrev = "PUSAKA", color = "", shortname = "",},
["United Sabah National Organisation"] = {abbrev = "USNO", color = "#008000", shortname = "",},
["United Sabah National Organisation (New)"] = {abbrev = "USNO (Baru)", color = "#678F43", shortname = "",},
["United Sabah Party"] = {abbrev = "PBS", color = "#ADD8E6", shortname = "",},
["United Sarawak Party"] = {abbrev = "", color = "#FBFF94", shortname = "",},
["United Serbia"] = {abbrev = "JS", color = "#800000", shortname = "",},
["United Serbia (coalition)"] = {abbrev = "UZPS", color = "#2578CC", shortname = "",},
["United Seychelles"] = {abbrev = "", color = "#FF0D13", shortname = "",},
["United Social Democratic Party"] = {abbrev = "", color = "green", shortname = "",},
["United Socialist Alliance"] = {abbrev = "", color = "#FF0000", shortname = "",},
["United Socialist Party (Bolivia)"] = {abbrev = "", color = "#FF4500", shortname = "",},
["United Socialist Party (Sri Lanka)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["United Socialist Party (UK)"] = {abbrev = "", color = "#E32636", shortname = "United Socialist",},
["United Socialist Party of Venezuela"] = {abbrev = "PSUV", color = "#F0001C", shortname = "",},
["United Socialist Workers' Party"] = {abbrev = "PSTU", color = "#C4122D", shortname = "",},
["United Somali Congress"] = {abbrev = "USC", color = "#39944A", shortname = "",},
["United Srpska"] = {abbrev = "US", color = "#00008B", shortname = "",},
["United St. Maarten Party"] = {abbrev = "USP", color = "#71b7ff", shortname = "",},
["United States Pirate Party"] ={abbrev = "USPP", color = "#9258B0", shortname = "Pirate Party",},
["United Taxpayers Party"] = {abbrev = "", color = "#228B22", shortname = "United Taxpayers",},
["United Thai Nation Party"] = {abbrev = "UTN", color = "#273082", shortname = "United Thai Nation",},
["United Thai People's Party"] = {abbrev = "UTPP", color = "#FF0800", shortname = "",},
["United to Advance"] = {abbrev = "", color = "#F46E6E", shortname = "",},
["United to Renew"] = {abbrev = "", color = "#0E8543", shortname = "",},
["United Torah Judaism"] = {abbrev = "UTJ", color = "#003366", shortname = "",},
["United Trade Unions of Serbia Sloga"] = {abbrev = "Sloga", color = "#940F0F", shortname = "",},
["United Traditional Bumiputera Party"] = {abbrev = "", color = "#E30007", shortname = "",},
["United Transformation Movement"] = {abbrev = "UTM", color = "#D7222B", shortname = "",},
["United Tres Cantos"] = {abbrev = "", color = "#D8C018", shortname = "",},
["United Ulster Unionist Party"] = {abbrev = "UUUP", color = "#ff8c00", shortname = "",},
["United Unionist Coalition"] = {abbrev = "", color = "#888888", shortname = "",},
["United Utah Party"] = {abbrev = "", color = "#80151F", shortname = "United Utah",},
["United Valencia"] = {abbrev = "", color = "#01ADD4", shortname = "",},
["United We Can"] = {abbrev = "UP", color = "#800080", shortname = "",},
["United with Arona"] = {abbrev = "", color = "#C2116B", shortname = "",},
["United Women Front"] = {abbrev = "UWF", color = "#E1F5A9", shortname = "",},
["United Workers Party (Saint Lucia)"] = {abbrev = "UWP", color = "#FFC90E", shortname = "",},
["United Workers' Party (Dominica)"] = {abbrev = "UWP", color = "#0F52BA", shortname = "",},
["United Zamora"] = {abbrev = "", color = "#A5A6BD", shortname = "",},
["United–Reform Coalition"] = {abbrev = "", color = "#5EDDBF", shortname = "United/Reform",},
["Uniting Australia Party"] = {abbrev = "", color = "#00B2B2", shortname = "",},
["Unity (Hungary)"] = {abbrev = "", color = "#C71585", shortname = "Unity",},
["Unity (Kyrgyz political party)"] = {abbrev = "", color = "#0083BA", shortname = "Birimdik",},
["Unity (Latvia)"] = {abbrev = "", color = "#85B821", shortname = "Unity",},
["Unity (Northern Ireland)"] = {abbrev = "", color = "olive", shortname = "Unity",},
["Unity (Russian political party)"] = {abbrev = "", color = "#227FCF", shortname = "Unity",},
["Unity (Swedish political party)"] = {abbrev = "", color = "#088332", shortname = "Unity",},
["Unity (Uzbekistan)"] = {abbrev = "", color = "#3385D9", shortname = "",},
["Unity and Democracy Party of Kachin State"] = {abbrev = "", color = "#118D35", shortname = "",},
["Unity and Democracy Party"] = {abbrev = "", color = "#FBF0DC", shortname = "",},
["Unity and Liberty Party"] = {abbrev = "PUL", color = "#861F80", shortname = "",},
["Unity and Peace Party"] = {abbrev = "UPP", color = "#FFFFFF", shortname = "",},
["Unity and Progress Party"] = {abbrev = "PUP", color = "#45D35D", shortname = "",},
["Unity Centre of Communist Revolutionaries of India (Marxist-Leninist) (D.V. Rao)"] = {abbrev = "UCCRI(M-L)", color = "red", shortname = "",},
["Unity Coalition"] = {abbrev = "CU", color = "#2C93FB", shortname = "",},
["Unity Fiji Party"] = {abbrev = "", color = "#20B2AA", shortname = "",},
["Unity for Algeciras"] = {abbrev = "", color = "#0474B6", shortname = "",},
["Unity for Alguazas"] = {abbrev = "", color = "#E47747", shortname = "",},
["Unity for Change"] = {abbrev = "", color = "#3BA926", shortname = "",},
["Unity for Chile"] = {abbrev = "", color = "#F25C5D", shortname = "",},
["Unity for Human Rights Party"] = {abbrev = "PBDNJ", color = "#1D70B8", shortname = "",},
["Unity for La Línea"] = {abbrev = "", color = "#3F3BC6", shortname = "",},
["Unity for Narón"] = {abbrev = "", color = "#149511", shortname = "",},
["Unity for Peace and Socialism"] = {abbrev = "", color = "red", shortname = "",},
["Unity for the Future of Macau"] = {abbrev = "UFM", color = "blue", shortname = "",},
["Unity for the Isles"] = {abbrev = "", color = "#EEC657", shortname = "",},
["Unity Labour Party"] = {abbrev = "", color = "#e2231a", shortname = "Unity Labour",},
["Unity Movement"] = {abbrev = "", color = "#2699E4", shortname = "",},
["Unity of Aran"] = {abbrev = "", color = "#EC2923", shortname = "",},
["Unity of Oleksandr Omelchenko"] = {abbrev = "", color = "#249751", shortname = "",},
["Unity of San Hui"] = {abbrev = "", color = "#EE8487", shortname = "",},
["Unity of the People (South Ossetia)"] = {abbrev = "", color = "#C0392B", shortname = "Unity of the People",},
["Unity of the People (Trinidad and Tobago)"] = {abbrev = "UTP", color = "#8743e3", shortname = "",},
["Unity of the People"] = {abbrev = "", color = "#DB0000", shortname = "",},
["Unity Party (Australia)"] = {abbrev = "", color = "#CD5700", shortname = "Unity",},
["Unity Party (Azerbaijan)"] = {abbrev = "", color = "#B48B1F", shortname = "",},
["Unity Party (China)"] = {abbrev = "", color = "#DE2119", shortname = "Unity",},
["Unity Party (Hungary)"] = {abbrev = "", color = "#FFDB52", shortname = "Unity",},
["Unity Party (Hungary, 2009)"] = {abbrev = "ÖP", color = "#80BB3D", shortname = "",},
["Unity Party (Japan)"] = {abbrev = "", color = "#0542A0", shortname = "",},
["Unity Party (Liberia)"] = {abbrev = "UP", color = "#026536", shortname = "",},
["Unity Party (South Ossetia)"] = {abbrev = "", color = "#1C408A", shortname = "Unity Party",},
["Unity Party (Turkey)"] = {abbrev = "TBP", color = "#A91101", shortname = "",},
["Unity Party of America"] = {abbrev = "", color = "#ADD8E6", shortname = "Unity",},
["Unity Party of Kenya"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Unity Party of Nigeria"] = {abbrev = "", color = "#D82628", shortname = "",},
["Unrepresented Peoples Party"] = {abbrev = "UPP", color = "#283048", shortname = "",},
["Up-Country People's Front"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Uplands Party"] = {abbrev = "", color = "#FFFFFF", shortname = "Uplands",},
["Upper Aragon in Common"] = {abbrev = "", color = "#B222EB", shortname = "",},
["Uri Party"] = {abbrev = "", color = "#FFD700", shortname = "Uri",},
["Urquijists"] = {abbrev = "", color = "#3AA8C1", shortname = "Urquijist",},
["Uruguay Assembly"] = {abbrev = "", color = "#24397C", shortname = "",},
["Urza.cz"] = {abbrev = "", color = "#F2E500", shortname = "",},
["US Liberty Party"] = {abbrev = "", color = "#ca0008", shortname = "",},
["Us Moderates"] = {abbrev = "", color = "#2149a7", shortname = "",},
["Us of the Centre"] = {abbrev = "", color = "#0576BD", shortname = "",},
["Us with Italy"] = {abbrev = "", color = "#236186", shortname = "",},
["Us with Salvini"] = {abbrev = "", color = "#0F52BA", shortname = "",},
["USR PLUS"] = {abbrev = "", color = "#00A6FF", shortname = "",},
["Utkal Congress"] = {abbrev = "", color = "#FCEE23", shortname = "",},
["Utreran Party"] = {abbrev = "", color = "#F7DE21", shortname = "",},
["Uttama Prajaakeeya Party"] = {abbrev = "UPP", color = "#E3889D", shortname = "",},
["Uttar Pradesh Revolutionary Socialist Party"] = {abbrev = "", color = "red", shortname = "",},
["Uttar Pradesh United Democratic Front"] = {abbrev = "UPUDF", color = "#58ACFA", shortname = "",},
["Uttarakhand Kranti Dal"] = {abbrev = "UKD", color = "#336666", shortname = "",},
["UW"] = {abbrev = "", color = "blue", shortname = "",},
["Uzbekistan Liberal Democratic Party"] = {abbrev = "OʻzLiDeP", color = "#009EE3", shortname = "",},
["Uzbekistan National Revival Democratic Party"] = {abbrev = "", color = "#005AA0", shortname = "Milliy Tiklanish",},
["Uzhaippali Makkal Katchi"] = {abbrev = "UMK", color = "yellowgreen", shortname = "",},
["Uzhavar Uzhaippalar Katchi"] = {abbrev = "UUK", color = "green", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
46e1d2eaaff4939586c6b914f76c42f62efacd93
Template:Legend0
10
239
471
470
2023-12-24T02:13:45Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Legend0]]
wikitext
text/x-wiki
<span style="margin:0px; font-size:90%;"><span style="border:{{{border|none}}}; background-color:{{{1|none}}}; color:{{{1|none}}};"> </span> {{{2|}}}</span><noinclude>
{{Documentation}}
</noinclude>
203acdf585fd4adebf1c9cc5e3456b8ff52b182c
Module:Political party/G
828
240
473
472
2023-12-24T02:13:45Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Political_party/G]]
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["GABRIELA Women's Party"] = "Gabriela Women's Party",
["Galician National-Popular Bloc"] = "Galician Nationalist Bloc",
["Galician Nationalist Convergence"] = "Galician Coalition",
["Galician Progressive Coalition"] = "Galician Coalition",
["Galician Workers' Party"] = "Galician Left",
["Ganatantra Parishad"] = "All India Ganatantra Parishad",
["Génération.s, le mouvement"] = "Génération.s",
["Genzei Nippon"] = "Tax Cuts Japan",
["Georgia Republican Party"] = "Republican Party (United States)",
["German Centre"] = "Centre Party (Germany)",
["German Minority (political party)"] = "German Minority Electoral Committee",
["German Minority"] = "German Minority Electoral Committee",
["German Pirate Party"] = "Pirate Party Germany",
["German Reich Party"] = "Free Conservative Party",
["Girondin"] = "Girondins",
["Girondist"] = "Girondins",
["Go Peru"] = "Let’s Go Peru",
["Golongan Karya"] = "Golkar",
["Good Choice"] = "Good Choice and Moderates",
["Good Choice (Slovakia)"] = "Good Choice and Moderates",
["Good Party"] = "İYİ Party",
["Government by the People Green Party"] = "Green Party of South Africa",
["Grand Alliance (Bangladesh)"] = "Awami League",
["Grassroots-Legalize Cannabis Party"] = "Grassroots—Legalize Cannabis Party",
["Grassroots–Legalize Cannabis Party"] = "Grassroots—Legalize Cannabis Party", -- dash difference
["Grassroots Party (US)"] = "Grassroots Party",
["Great Indonesia Movement Party"] = "Gerindra Party",
["Great Union Party"] = "Great Unity Party",
["Greek politics/party colours/Panhellenic Sociali"] = "PASOK",
["Green (political party)"] = "Groen (political party)",
["Green Alliance"] = "Green Party (Ireland)",
["Green Alliance (Ireland)"] = "Green Party (Ireland)",
["Green Alternative Alliance"] = "The Greens (Luxembourg)",
["Green Alternative Party"] = "The Greens (Luxembourg)",
["Green List (Spain)"] = "Confederation of the Greens",
["Green Mountain Peace and Justice"] = "Green Mountain Peace and Justice Party",
["Green Movement (Israel)"] = "Green Party (Israel)",
["Green Party - Save Our Green Space"] = "Green Party of England and Wales",
["Green Party (Colombia)"] = "Green Alliance (Colombia)",
["Green Party (Poland)"] = "The Greens (Poland)",
["Green Party (United States)"] = "Green Party (US)",
["Green Party in Northern Ireland"] = "Green Party Northern Ireland",
["Green Party of Alaska"] = "Green Party (US)",
["Green Party of Arkansas"] = "Green Party (US)",
["Green Party of California"] = "Green Party (US)",
["Green Party of Colorado"] = "Green Party (US)",
["Green Party of Connecticut"] = "Green Party (US)",
["Green Party of Hawaii"] = "Green Party (US)",
["Green Party of Michigan"] = "Green Party (US)",
["Green Party of Minnesota"] = "Green Party (US)",
["Green Party of Montana"] = "Green Party (US)",
["Green Party of New York"] = "Green Party (US)",
["Green Party of Northern Ireland"] = "Green Party Northern Ireland",
["Green Party of Ohio"] = "Green Party (US)",
["Green Party of Pennsylvania"] = "Green Party (US)",
["Green Party of Texas"] = "Green Party (US)",
["Green Party (Arizona)"] = "Green Party (US)",
["Green Party (Arkansas)"] = "Green Party (US)",
["Green Party (California)"] = "Green Party (US)",
["Green Party (Colorado)"] = "Green Party (US)",
["Green Party (Connecticut)"] = "Green Party (US)",
["Green Party (Hawaii)"] = "Green Party (US)",
["Green Party (Iowa)"] = "Green Party (US)",
["Green Party (Michigan)"] = "Green Party (US)",
["Green Party (New York)"] = "Green Party (US)",
["Green Party of the United States"] = "Green Party (US)",
["Green!"] = "Groen (political party)",
["Greenback Party (United States)"] = "Greenback Party",
["GreenLeft"] = "GroenLinks",
["Greens 2004"] = "The Greens (Poland)",
["Greens-European Free Alliance"] = "Greens–European Free Alliance",
["Gregor Virant's Civic List"] = "Civic List (Slovenia)",
["Groen!"] = "Groen (political party)",
["Group of Independent Citizens"] = "Independent Solution",
["Group of the Alliance of Liberals and Democrats for Europe"] = "Alliance of Liberals and Democrats for Europe group",
["GSD"] = "Gibraltar Social Democrats",
["GSLP"] = "Gibraltar Socialist Labour Party",
["Guanyar Alacant"] = "Acord Ciutadà",
["Guanyar Alcoi"] = "Acord Ciutadà",
["Guanyem Sant Josep de sa Talaia"] = "Guanyem Eivissa",
["Guanyem Santa Eulària des Riu"] = "Guanyem Eivissa",
["Guatemalan Republican Front"] = "Institutional Republican Party",
["Gwlad - The Welsh Independence Party"] = "Gwlad",
}
local full = {
["G17 Plus"] = {abbrev = "G17+", color = "#545AA7", shortname = "",},
["G99"] = {abbrev = "", color = "red", shortname = "",},
["Gabonese Democratic and Social Union"] = {abbrev = "", color = "red", shortname = "",},
["Gabonese Democratic Bloc"] = {abbrev = "", color = "#008800", shortname = "",},
["Gabonese Democratic Party"] = {abbrev = "PDG", color = "#006533", shortname = "",},
["Gabonese Progress Party"] = {abbrev = "PGP", color = "red", shortname = "",},
["Gabonese Socialist Party"] = {abbrev = "", color = "red", shortname = "",},
["Gabonese Socialist Union"] = {abbrev = "", color = "red", shortname = "",},
["Gabriela Women's Party"] = {abbrev = "", color = "#800080", shortname = "Gabriela",},
["Gabungan Parti Sarawak"] = {abbrev = "GPS", color = "#FF6060", shortname = "",},
["Gabungan Rakyat Sabah"] = {abbrev = "GRS", color = "#4682B4", shortname = "",},
["Gagasan Rakyat"] = {abbrev = "GR", color = "#ADD8E6", shortname = "",},
["Gagasan Sejahtera"] = {abbrev = "", color = "#008800", shortname = "",},
["Gahal"] = {abbrev = "", color = "#143997", shortname = "",},
["Galeusca–Peoples of Europe"] = {abbrev = "", color = "#2C3294", shortname = "Galeusca",},
["Galicia en Común"] = {abbrev = "", color = "#5D2C75", shortname = "Podemos–EU–Anova",},
["Galicia New Way"] = {abbrev = "", color = "#6FA7B6", shortname = "",},
["Galicia Sempre"] = {abbrev = "", color = "#8EC81E", shortname = "",},
["Galician Alternative"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Galician Coalition"] = {abbrev = "CG", color = "#002C9C", shortname = "",},
["Galician Convergence"] = {abbrev = "", color = "#087608", shortname = "",},
["Galician Democracy"] = {abbrev = "", color = "#81DAF5", shortname = "",},
["Galician Democratic Candidacy"] = {abbrev = "", color = "#15EAEA", shortname = "",},
["Galician Democratic Party"] = {abbrev = "", color = "#20ACE1", shortname = "",},
["Galician Identity"] = {abbrev = "", color = "#0579FC", shortname = "",},
["Galician Initiative"] = {abbrev = "", color = "#D54D13", shortname = "",},
["Galician Left Alternative"] = {abbrev = "AGE", color = "#62A3CA", shortname = "",},
["Galician Left"] = {abbrev = "EG", color = "#522998", shortname = "",},
["Galician Movement for Socialism"] = {abbrev = "", color = "#003F77", shortname = "",},
["Galician Nationalist Bloc"] = {abbrev = "BNG", color = "#ADCFEF", shortname = "",},
["Galician Nationalist Group of Narón"] = {abbrev = "", color = "#AA4CAA", shortname = "",},
["Galician Nationalist Party–Galicianist Party"] = {abbrev = "", color = "#639E00", shortname = "",},
["Galician Party of the Country"] = {abbrev = "", color = "#66BB66", shortname = "",},
["Galician People's Front"] = {abbrev = "", color = "#3920DE", shortname = "",},
["Galician People's Union"] = {abbrev = "", color = "#CF1B15", shortname = "",},
["Galician Progressive Democracy"] = {abbrev = "", color = "#C66900", shortname = "",},
["Galician Socialist Party (1963)"] = {abbrev = "", color = "#D73D2A", shortname = "",},
["Galician Socialist Party–Galician Left"] = {abbrev = "PSG–EG", color = "#2AAC24", shortname = "",},
["Galician Socialist Space"] = {abbrev = "", color = "#28AC90", shortname = "",},
["Galician Socialist Unity"] = {abbrev = "", color = "#FF3300", shortname = "",},
["Galician Unity"] = {abbrev = "", color = "#00CCF1", shortname = "",},
["Galician Workers' Front"] = {abbrev = "", color = "#3B96BB", shortname = "",},
["Galicianist Party (1931)"] = {abbrev = "", color = "#57ABB3", shortname = "",},
["Galicianist Party (1978)"] = {abbrev = "", color = "#E46D2B", shortname = "",},
["Galicianist Party–Centrists of Orense"] = {abbrev = "", color = "#986968", shortname = "",},
["Galicianist Party–Convergence of Independents of Galicia"] = {abbrev = "", color = "#726887", shortname = "",},
["Galiza Ceibe"] = {abbrev = "", color = "#29AEEF", shortname = "",},
["Gamacists"] = {abbrev = "", color = "#599F25", shortname = "Gamacist",},
["Gambela People's Democratic Movement"] = {abbrev = "", color = "#AC1538", shortname = "",},
["Gambia Democratic Congress"] = {abbrev = "GDC", color = "#771C7C", shortname = "",},
["Gambia Party for Democracy and Progress"] = {abbrev = "", color = "#FB7F00", shortname = "",},
["Gamonie i Krasnoludki"] = {abbrev = "", color = "orange", shortname = "",},
["Gana Fuerteventura"] = {abbrev = "", color = "#FFC000", shortname = "",},
["Gana Suraksha Party"] = {abbrev = "", color = "#E74C3C", shortname = "",},
["Gana Zamora"] = {abbrev = "", color = "#146612", shortname = "",},
["Ganar Alcorcón"] = {abbrev = "", color = "#B507A6", shortname = "",},
["Ganar Cádiz en Común"] = {abbrev = "", color = "#187669", shortname = "",},
["Ganar Fuenlabrada"] = {abbrev = "", color = "#C63903", shortname = "",},
["Ganar Humanes"] = {abbrev = "", color = "#8A64A5", shortname = "",},
["Ganar la Región de Murcia"] = {abbrev = "", color = "#BB0017", shortname = "",},
["Ganar Móstoles"] = {abbrev = "", color = "#AAB93C", shortname = "",},
["Ganar Teruel"] = {abbrev = "", color = "#A91C30", shortname = "",},
["Ganar Torrejón"] = {abbrev = "", color = "#930B71", shortname = "",},
["Gandhi Kamaraj National Congress"] = {abbrev = "", color = "#187669", shortname = "GKC",},
["Ganatantri Dal"] = {abbrev = "", color = "blue", shortname = "",},
["Ganatantri Party"] = {abbrev = "", color = "#6a9a62", shortname = "",},
["Ganemos (2015)"] = {abbrev = "", color = "#3EADB9", shortname = "",},
["Ganemos (2019)"] = {abbrev = "", color = "#C2272D", shortname = "",},
["Ganemos al Fracking"] = {abbrev = "", color = "#D3CA23", shortname = "",},
["Ganemos Albacete"] = {abbrev = "", color = "#A30A40", shortname = "",},
["Ganemos Almería Sí Se Puede"] = {abbrev = "", color = "#D7C01A", shortname = "",},
["Ganemos Avilés en Común"] = {abbrev = "", color = "#FB0000", shortname = "",},
["Ganemos Cambre"] = {abbrev = "", color = "#02460B", shortname = "",},
["Ganemos Cantabria"] = {abbrev = "", color = "#A91515", shortname = "",},
["Ganemos Castilla–La Mancha"] = {abbrev = "", color = "#CC1A4E", shortname = "",},
["Ganemos Chiclana"] = {abbrev = "", color = "#7B0C2C", shortname = "",},
["Ganemos Ciudad Real"] = {abbrev = "", color = "#AB0D14", shortname = "",},
["Ganemos Córdoba"] = {abbrev = "", color = "#18A383", shortname = "",},
["Ganemos Culleredo"] = {abbrev = "", color = "#DD2E44", shortname = "",},
["Ganemos Elche"] = {abbrev = "", color = "#CD00A3", shortname = "",},
["Ganemos Euskadi"] = {abbrev = "", color = "#BA1652", shortname = "",},
["Gañemos Galicia"] = {abbrev = "", color = "#009ACF", shortname = "",},
["Ganemos Jerez"] = {abbrev = "", color = "#00BEB1", shortname = "",},
["Ganemos Madrid"] = {abbrev = "", color = "#009DBC", shortname = "",},
["Ganemos Orihuela"] = {abbrev = "", color = "#D83927", shortname = "",},
["Ganemos País Valencià"] = {abbrev = "", color = "#613041", shortname = "",},
["Ganemos Palencia"] = {abbrev = "", color = "#795EAC", shortname = "",},
["Ganemos Pinto"] = {abbrev = "", color = "#69388A", shortname = "",},
["Ganemos Ronda"] = {abbrev = "", color = "#8D1F20", shortname = "",},
["Ganemos Salamanca"] = {abbrev = "", color = "#9F3122", shortname = "",},
["Ganemos Santander Sí Puede"] = {abbrev = "", color = "#7F286D", shortname = "",},
["Ganemos Sevilla"] = {abbrev = "", color = "#0C7C18", shortname = "",},
["Ganemos Talavera"] = {abbrev = "", color = "#00679C", shortname = "",},
["Ganemos Toledo"] = {abbrev = "", color = "#32A59A", shortname = "",},
["Gañemos Vigo"] = {abbrev = "", color = "#D3122C", shortname = "",},
["Gano Azadi League"] = {abbrev = "GAL", color = "#BFAC00", shortname = "",},
["Gano Forum"] = {abbrev = "", color = "#47C187", shortname = "",},
["Gano Front"] = {abbrev = "", color = "#64a470", shortname = "",},
["Garforth and Swillington Independents"] = {abbrev = "", color = "#52F72E", shortname = "",},
["Garib Raj Party"] = {abbrev = "GRP", color = "#e7d18b", shortname = "",},
["Garo National Council"] = {abbrev = "", color = "#d492b9", shortname = "",},
["Garuda Party"] = {abbrev = "", color = "#B3282B", shortname = "",},
["Gassetists"] = {abbrev = "", color = "#548D54", shortname = "Gassetist",},
["Gastoria VG"] = {abbrev = "", color = "#F29301", shortname = "",},
["Gather Sustainable Canaries"] = {abbrev = "", color = "#0DC0E0", shortname = "",},
["Gaullist"] = {abbrev = "", color = "#0066CC", shortname = "",},
["Gaumee Itthihaad"] = {abbrev = "GIP", color = "#00A651", shortname = "",},
["Gay Party"] = {abbrev = "", color = "#562E75", shortname = "",},
["Gazankulu Liberation Congress"] = {abbrev = "", color = "#E9F294", shortname = "",},
["General Elderly Alliance"] = {abbrev = "AOV", color = "#972C95", shortname = "",},
["General Electoral League"] = {abbrev = "", color = "#00529C", shortname = "Electoral League",},
["General League of Roman Catholic Caucuses"] = {abbrev = "ABRKK", color = "#000000", shortname = "",},
["General Liberation and Development Party"] = {abbrev = "", color = "#F1C40F", shortname = "",},
["General People's Congress (Yemen)"] = {abbrev = "GPC", color = "#FFCD00", shortname = "",},
["General Popular Radical Union"] = {abbrev = "GLRE", color = "grey", shortname = "",},
["General Union for the Good of Macau"] = {abbrev = "UBM", color = "#800080", shortname = "",},
["General Union of Neighbourhood Associations of Macau"] = {abbrev = "", color = "#183B7D", shortname = "",},
["General Union Party"] = {abbrev = "PUGEN", color = "#DAA520", shortname = "",},
["General Water Board Party"] = {abbrev = "AWP", color = "#021373", shortname = "",},
["General Zionists"] = {abbrev = "", color = "#00ADCC", shortname = "",},
["Generation Citizens"] = {abbrev = "", color = "#312883", shortname = "",},
["Generation for a National Encounter"] = {abbrev = "", color = "#E9242B", shortname = "",},
["Generation of Independence Party (Armenia)"] = {abbrev = "", color = "#FFCB00", shortname = "",},
["Génération.s"] = {abbrev = "G.s", color = "#CC1E54", shortname = "",},
["Geneva Citizens' Movement"] = {abbrev = "", color = "#CE9D24", shortname = "Geneva Citizens'",},
["Gent de Canals"] = {abbrev = "", color = "#514D30", shortname = "",},
["Gent de Dénia"] = {abbrev = "", color = "#3CA48D", shortname = "",},
["Gent de Gramenet"] = {abbrev = "", color = "#D9951C", shortname = "",},
["Gent per Ciutadella"] = {abbrev = "", color = "#C50D1E", shortname = "",},
["Gent per Eivissa"] = {abbrev = "", color = "#04877D", shortname = "",},
["Gent per Formentera"] = {abbrev = "", color = "#96104E", shortname = "",},
["Gent per Santa María"] = {abbrev = "", color = "#FFF509", shortname = "",},
["Gente del Pueblo"] = {abbrev = "", color = "#6EA4B9", shortname = "",},
["Gente"] = {abbrev = "", color = "#B48EDB", shortname = "",},
["Genuine Opposition"] = {abbrev = "GO", color = "#ffa500", shortname = "",},
["Genuine Republican Party"] = {abbrev = "", color = "#FFA500", shortname = "",},
["George's Day Movement"] = {abbrev = "", color = "#EEB600", shortname = "",},
["Georgian Dream"] = {abbrev = "", color = "#27509C", shortname = "",},
["Georgian Labour Party"] = {abbrev = "SLP", color = "#346FAB", shortname = "",},
["Georgian Socialist-Federalist Revolutionary Party"] = {abbrev = "SSPSP", color = "#483D8B", shortname = "",},
["Georgian Troupe"] = {abbrev = "", color = "red", shortname = "",},
["Georgios Papandreou Party"] = {abbrev = "KGP", color = "khaki", shortname = "",},
["Gerakan Tanah Air"] = {abbrev = "GTA", color = "black", shortname = "",},
["Gerindra Party"] = {abbrev = "", color = "#342B29", shortname = "Gerindra",},
["GERB"] = {abbrev = "", color = "#0054A6", shortname = "",},
["GERB—SDS"] = {abbrev = "", color = "#226ABA", shortname = "",},
["German Agrarian League"] = {abbrev = "", color = "#008B45", shortname = "",},
["German Christian Social People's Party"] = {abbrev = "DCVP", color = "#AA98A9", shortname = "",},
["German Communist Party"] = {abbrev = "DKP", color = "#ED1C24", shortname = "",},
["German Conservative Party"] = {abbrev = "DKP", color = "#0781E5", shortname = "",},
["German Democratic Party"] = {abbrev = "DDP", color = "#DCCA4A", shortname = "",},
["German Electoral Coalition"] = {abbrev = "", color = "#00693E", shortname = "German Coalition",},
["German Farmers' Party"] = {abbrev = "", color = "#007A00", shortname = "",},
["German Free-minded Party"] = {abbrev = "DFP", color = "#FFD800", shortname = "",},
["German Minority Electoral Committee"] = {abbrev = "KWMN", color = "#237FC2", shortname = "",},
["German National People's Party"] = {abbrev = "DNVP", color = "#3F7BC1", shortname = "",},
["German National Party"] = {abbrev = "DNP", color = "#00008B", shortname = "",},
["German National Socialist Workers' Party"] = {abbrev = "DNSAP", color = "#8A3324", shortname = "",},
["German National Socialist Workers' Party (Czechoslovakia)"] = {abbrev = "DNSAP", color = "#8A3324", shortname = "",},
["German Party (1947)"] = {abbrev = "DP", color = "#66B67F", shortname = "",},
["German Party (Romania)"] = {abbrev = "DPR", color = "black", shortname = "",},
["German Party"] = {abbrev = "", color = "#63B8FF", shortname = "",},
["German People's Party (1868)"] = {abbrev = "", color = "#FFAB00", shortname = "",},
["German People's Party (Austria)"] = {abbrev = "DVP", color = "#63C3D0", shortname = "",},
["German People's Party"] = {abbrev = "DVP", color = "#D5AC27", shortname = "",},
["German People's Union"] = {abbrev = "DVU", color = "#AA4422", shortname = "",},
["German Progress Party (Austria)"] = {abbrev = "DSP", color = "#EEEEEE", shortname = "",},
["German Progress Party"] = {abbrev = "DFP", color = "#FFD700", shortname = "",},
["German Right Party"] = {abbrev = "DRP", color = "#85553D", shortname = "",},
["German Social Democratic Workers' Party in the Czechoslovak Republic"] = {abbrev = "DSAP", color = "#FA5A42", shortname = "",},
["German Social Party (Weimar Republic)"] = {abbrev = "", color = "#A46A44", shortname = "",},
["German Social Union (East Germany)"] = {abbrev = "DSU", color = "#6495ED", shortname = "",},
["German State Party"] = {abbrev = "DStP", color = "#DBC94B", shortname = "",},
["German Völkisch Freedom Party"] = {abbrev = "", color = "black", shortname = "",},
["German Workers' Party"] = {abbrev = "DAP", color = "#096300", shortname = "",},
["German Workers' Party (Austria-Hungary)"] = {abbrev = "DAP", color = "#6495ED", shortname = "",},
["German-Hanoverian Party"] = {abbrev = "DHP", color = "#C5DC74", shortname = "",},
["German-National Party"] = {abbrev = "DNP", color = "#63B8FF", shortname = "",},
["Geroa Bai"] = {abbrev = "GBai", color = "#F75E42", shortname = "",},
["Geroa Socialverdes"] = {abbrev = "", color = "#6B8F36", shortname = "",},
["Gesher (2019 political party)"] = {abbrev = "", color = "#ED0963", shortname = "",},
["Gesher"] = {abbrev = "", color = "#252CAE", shortname = "",},
["Getxoko Udal Kandidatura"] = {abbrev = "", color = "#622D63", shortname = "",},
["Ghana Freedom Party"] = {abbrev = "", color = "#094715", shortname = "",},
["Ghana Union Movement"] = {abbrev = "", color = "#8B0021", shortname = "",},
["Għarb First"] = {abbrev = "GĦ1", color = "black", shortname = "Għarb First",},
["Ghibellines"] = {abbrev = "", color = "#E34234", shortname = "",},
["Gibraltar National Party"] = {abbrev = "", color = "#DF424D", shortname = "National",},
["Gibraltar Social Democrats"] = {abbrev = "", color = "#043967", shortname = "Social Democrats",},
["Gibraltar Socialist Labour Party"] = {abbrev = "", color = "#F5053C", shortname = "Socialist Labour",},
["Gijonese Unity"] = {abbrev = "", color = "#8D6E63", shortname = "",},
["Girchi - More Freedom"] = {abbrev = "", color = "#359239", shortname = "",},
["Girondins"] = {abbrev = "", color = "#6082B6", shortname = "",},
["Glasgow First"] = {abbrev = "", color = "#ff0000", shortname = "",},
["Go on Country – Social Integration Party"] = {abbrev = "", color = "#E62171", shortname = "Go on Country",},
["Go on Country"] = {abbrev = "", color = "#E62171", shortname = "",},
["Goa Forward Party"] = {abbrev = "GFP", color = "#353982", shortname = "",},
["Goa Rajiv Congress Party"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Goa Suraksha Manch"] = {abbrev = "", color = "#E1A95F", shortname = "",},
["Goa Vikas Party"] = {abbrev = "", color = "orange", shortname = "",},
["Goazen Bilbao"] = {abbrev = "", color = "#B90DBB", shortname = "",},
["Golden Dawn (Greece)"] = {abbrev = "ΧΑ", color = "#00022D", shortname = "",},
["Golden Dawn"] = {abbrev = "", color = "black", shortname = "",},
["Golden India Party"] = {abbrev = "", color = "#330000", shortname = "",},
["Golfitenean Action Party"] = {abbrev = "PAGOL", color = "#7DC9FF", shortname = "",},
["Golkar"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Gomera Group of Independents"] = {abbrev = "", color = "#0C1C94", shortname = "",},
["Gomera Socialist Group"] = {abbrev = "ASG", color = "#B61414", shortname = "",},
["Gondwana Ganatantra Party"] = {abbrev = "GGP", color = "purple", shortname = "",},
["Good (political party)"] = {abbrev = "", color = "#F36900", shortname = "Good",},
["Good Choice and Moderates"] = {abbrev = "", color = "#FF002B", shortname = "",},
["Good Governance Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Good Morning Serbia"] = {abbrev = "DJS", color = "#C4B34E", shortname = "",},
["Good Movement"] = {abbrev = "DR", color = "#F6B331", shortname = "",},
["Good Old Democratic Party"] = {abbrev = "", color = "#365476", shortname = "",},
["Good Right"] = {abbrev = "BD", color = "#2C6DB3", shortname = "",},
["Good State (Slovenia)"] = {abbrev = "", color = "#015F9C", shortname = "",},
["Gorkha Janmukti Morcha (G)"] = {abbrev = "", color = "#FF6600", shortname = "",},
["Gorkha Janmukti Morcha (T)"] = {abbrev = "", color = "#FF2561", shortname = "",},
["Gorkha Janmukti Morcha"] = {abbrev = "GJM", color = "#049747", shortname = "",},
["Gorkha National Liberation Front"] = {abbrev = "GNLF", color = "#347C17", shortname = "",},
["Gorkha Rashtriya Congress"] = {abbrev = "GRC", color = "#FF0130", shortname = "",},
["Gorkhaland Rajya Nirman Morcha"] = {abbrev = "", color = "#FF0274", shortname = "",},
["Gorran Movement"] = {abbrev = "", color = "#1F1C50", shortname = "Gorran",},
["Government Disciplined Services General Union"] = {abbrev = "", color = "#0000CC", shortname = "",},
["Government of South Korea"] = {abbrev = "", color = "#003865", shortname = "",},
["Government"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Governors of British Ceylon"] = {abbrev = "", color = "#000000", shortname = "",},
["Granada Truth and Democracy"] = {abbrev = "", color = "#E5349E", shortname = "",},
["Grand Alliance for Democracy"] = {abbrev = "GAD", color = "#4169E1", shortname = "",},
["Grand Alliance for National Unity"] = {abbrev = "GANA", color = "#F28900", shortname = "",},
["Grand Democratic Alliance"] = {abbrev = "GDA", color = "#199153", shortname = "",},
["Grand Dream Development Party"] = {abbrev = "", color = "#113673", shortname = "",},
["Grand National Alliance (Dominican Republic)"] = {abbrev = "", color = "#F88379", shortname = "",},
["Grand National Alliance (Guatemala)"] = {abbrev = "GANA", color = "#0047AB", shortname = "",},
["Grand National Party"] = {abbrev = "", color = "#0994DC", shortname = "Grand National",},
["Grand National Party (1997)"] = {abbrev = "", color = "#0000A8", shortname = "Grand National",},
["Grand National Union of Kenya"] = {abbrev = "GNU", color = "Orange", shortname = "",},
["Grand Slam"] = {abbrev = "", color = "#f3e6d7", shortname = "",},
["Grand Unified Democratic New Party"] = {abbrev = "", color = "#FF8200", shortname = "New Democratic",},
["Grassroots Democratic Party (Cambodia)"] = {abbrev = "GDP", color = "#269721", shortname = "",},
["Grassroots Democratic Party of Germany"] = {abbrev = "", color = "#4AA79D", shortname = "dieBasis",},
["Grassroots—Legalize Cannabis Party"] = {abbrev = "", color = "#50C878", shortname = "Grassroots—LC",},
["Grassroots Party"] = {abbrev = "", color = "#50C878", shortname = "Grassroots",},
["Grau Unit"] = {abbrev = "", color = "#078930", shortname = "",},
["Great Azerbaijan Party"] = {abbrev = "BAP", color = "#C72127", shortname = "",},
["Great Consolidated Popular Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Great Fatherland Party"] = {abbrev = "", color = "#B00000", shortname = "Great Fatherland",},
["Great Indonesia Unity Party"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Great Nigeria People's Party"] = {abbrev = "", color = "yellow", shortname = "",},
["Great North"] = {abbrev = "", color = "#0045AA", shortname = "",},
["Great Order Party"] = {abbrev = "BQP", color = "#ff101a", shortname = "",},
["Great Patriotic Pole"] = {abbrev = "GPP", color = "#F0001C", shortname = "",},
["Great Renewed National Alliance"] = {abbrev = "", color = "orange", shortname = "",},
["Great Unity Party"] = {abbrev = "", color = "#CC5252", shortname = "Büyük Birlik",},
["Greater Dunedin"] = {abbrev = "", color = "#2690C4", shortname = "",},
["Greater German People's Party"] = {abbrev = "GDVP", color = "#0E428E", shortname = "",},
["Greater Moldova Party"] = {abbrev = "", color = "purple", shortname = "",},
["Greater Romania Party"] = {abbrev = "PRM", color = "#0258A4", shortname = "",},
["Greek Ecologists"] = {abbrev = "EO", color = "aquamarine", shortname = "",},
["Greek Radical Movement"] = {abbrev = "", color = "#1E90FF", shortname = "",},
["Greek Rally"] = {abbrev = "", color = "#1935D0", shortname = "",},
["Greek Socialist Party"] = {abbrev = "ESK", color = "#007D44", shortname = "",},
["Greek Solution"] = {abbrev = "EL", color = "#3576CC", shortname = "",},
["Greeks for the Fatherland"] = {abbrev = "", color = "#124285", shortname = "",},
["Green Actions"] = {abbrev = "", color = "#4A7729", shortname = "",},
["Green Algeria Alliance"] = {abbrev = "", color = "#009900", shortname = "Green Alliance",},
["Green Alliance (Colombia)"] = {abbrev = "", color = "#07d400", shortname = "Green Alliance",},
["Green Alliance (Russia)"] = {abbrev = "", color = "#64A20C", shortname = "",},
["Green Alliance (Spain)"] = {abbrev = "", color = "#57AC48", shortname = "",},
["Green Alliance (Switzerland)"] = {abbrev = "", color = "#11BB44", shortname = "Green Alliance",},
["Green Alternative (Hungary)"] = {abbrev = "ZA", color = "#00FF7F", shortname = "",},
["Green Alternative (Russia)"] = {abbrev = "", color = "#00A200", shortname = "",},
["Green Alternative–Ecologist Movement of Catalonia"] = {abbrev = "", color = "#009966", shortname = "",},
["Green Alternative - Sustainable Development of Croatia"] = {abbrev = "ORaH", color = "#869B20", shortname = "",},
["Green and Independent group (Braintree)"] = {abbrev = "G&I", color = "#B2D58F", shortname = "",},
["Green and Liberal Alliance"] = {abbrev = "", color = "#99FF66", shortname = "",},
["Green and Red Canaries"] = {abbrev = "", color = "#CADC0B", shortname = "",},
["Green Animalist Party"] = {abbrev = "", color = "#3B9945", shortname = "Green Animalist",},
["Green Assembly"] = {abbrev = "", color = "#008000", shortname = "",},
["Green Breeze Party"] = {abbrev = "", color = "#008000", shortname = "",},
["Green Coalition"] = {abbrev = "", color = "#18BF89", shortname = "",},
["Green Coalition–Citizen Europe"] = {abbrev = "", color = "#099E40", shortname = "",},
["Green Confederation"] = {abbrev = "", color = "#61BC5F", shortname = "",},
["Green Ecologist Party (Chile)"] = {abbrev = "", color = "#03BF00", shortname = "Green",},
["Green Europe"] = {abbrev = "", color = "#54C160", shortname = "",},
["Green Humane City"] = {abbrev = "", color = "#059948", shortname = "",},
["Green independents"] = {abbrev = "", color = "#10C25B", shortname = "Ind. Green",},
["Green League"] = {abbrev = "VIHR", color = "#006845", shortname = "",},
["Green Left (Catalonia)"] = {abbrev = "EV", color = "#6DB152", shortname = "",},
["Green Left (Denmark)"] = {abbrev = "", color = "#eb94d1", shortname = "Green Left",},
["Green–Left Front"] = {abbrev = "ZLF", color = "#015E50", shortname = "",},
["Green Left Party"] = {abbrev = "YSP", color = "#388537", shortname = "",},
["Green Left Party (Morocco)"] = {abbrev = "", color = "green", shortname = "",},
["Green Left–Initiative for the Valencian Country"] = {abbrev = "", color = "#00A354", shortname = "",},
["Green Liberal Party of Switzerland"] = {abbrev = "", color = "#b4dc00", shortname = "Green Liberals",},
["Green List"] = {abbrev = "", color = "green", shortname = "",},
["Green List Ecological Initiative"] = {abbrev = "", color = "#8DB600", shortname = "",},
["Green Melilla Platform"] = {abbrev = "", color = "#9CFE67", shortname = "",},
["Green Mountain Peace and Justice Party"] = {abbrev = "", color = "#D6FF33", shortname = "Green Mountain Peace and Justice",},
["Green Movement (Bulgaria)"] = {abbrev = "", color = "#63A83D", shortname = "Green Movement",},
["Green North Regional Force"] = {abbrev = "", color = "#32A12A", shortname = "",},
["Green Party (Brazil)"] = {abbrev = "PV", color = "#006600", shortname = "",},
["Green Party (Czech Republic)"] = {abbrev = "SZ", color = "#60B44C", shortname = "",},
["Green Party (Dominican Republic)"] = {abbrev = "", color = "#008000", shortname = "",},
["Green Party (Ireland)"] = {abbrev = "GP", color = "#22AC6F", shortname = "Green",},
["Green Party (Israel)"] = {abbrev = "", color = "#59E059", shortname = "",},
["Green Party (Norway)"] = {abbrev = "", color = "#6A9325", shortname = "Green",},
["Green Party (Romania)"] = {abbrev = "", color = "#198A3A", shortname = "",},
["Green Party (Serbia)"] = {abbrev = "", color = "#016830", shortname = "",},
["Green Party (Slovakia)"] = {abbrev = "SZ", color = "#00FF00", shortname = "",},
["Green Party (Sweden)"] = {abbrev = "MP", color = "#2B912C", shortname = "Green",},
["Green Party (Thailand)"] = {abbrev = "", color = "#309B4B", shortname = "Green",},
["Green Party (Trinidad and Tobago)"] = {abbrev = "", color = "#377D22", shortname = "Green",},
["Green Party (Turkey)"] = {abbrev = "", color = "#009245", shortname = "",},
["Green Party (UK)"] = {abbrev = "GPUK", color = "#528D6B", shortname = "Green",},
["Green Party (US)"] = {abbrev = "G", color = "#17aa5c", shortname = "Green",},
["Green Party for Progress"] = {abbrev = "", color = "#8CD901", shortname = "",},
["Green Party Korea"] = {abbrev = "", color = "#59B224", shortname = "Green",},
["Green Party Northern Ireland"] = {abbrev = "", color = "#8dc63f", shortname = "Green (NI)",},
["Green Party of Albania"] = {abbrev = "", color = "green", shortname = "",},
["Green Party of Aotearoa New Zealand"] = {abbrev = "", color = "#098137", shortname = "Green",},
["Green Party of Bolivia"] = {abbrev = "PVB", color = "#027E42", shortname = "",},
["Green Party of Bulgaria"] = {abbrev = "", color = "#337E2C", shortname = "",},
["Green Party of Canada"] = {abbrev = "", color = "#99C955", shortname = "Green",},
["Green Party of England and Wales"] = {abbrev = "", color = "#02A95B", shortname = "Green",},
["Green Party of Hong Kong"] = {abbrev = "", color = "#64aa4b", shortname = "Green",},
["Green Party of Hungary"] = {abbrev = "MZP", color = "#58AB27", shortname = "",},
["Green Party of South Africa"] = {abbrev = "", color = "green", shortname = "Green Party",},
["Green Party of Switzerland"] = {abbrev = "", color = "#84B414", shortname = "Greens",},
["Green Party of Timor"] = {abbrev = "", color = "#02A75B", shortname = "Os Verdes",},
["Green Party Solomon Islands"] = {abbrev = "", color = "#00AA4D", shortname = "",},
["Green Party Taiwan"] = {abbrev = "", color = "#3AB483", shortname = "Green",},
["Green Progressive Accord"] = {abbrev = "GPA", color = "#76EE00", shortname = "",},
["Green Regionalist Coalition"] = {abbrev = "", color = "#008000", shortname = "",},
["Green Socialist Party"] = {abbrev = "", color = "green", shortname = "",},
["Green Society"] = {abbrev = "", color = "#74B249", shortname = "",},
["Green Tunisia Party"] = {abbrev = "", color = "green", shortname = "",},
["Green Wind"] = {abbrev = "", color = "green", shortname = "",},
["Green-Rainbow Party"] = {abbrev = "", color = "#17aa5c", shortname = "Green-Rainbow",},
["Green–Left Coalition"] = {abbrev = "", color = "#B31224", shortname = "",},
["Green"] = {abbrev = "", color = "#99CC33", shortname = "Greens",},
["Greenback Party"] = {abbrev = "GB", color = "#0BDA51", shortname = "Greenback",},
["Greens – Solidarity"] = {abbrev = "", color = "#32cd32", shortname = "Greens",},
["Greens (South Tyrol)"] = {abbrev = "", color = "#6B8E23", shortname = "Greens",},
["Greens (Ukraine)"] = {abbrev = "", color = "#228B22", shortname = "Greens",},
["Greens and Castilians"] = {abbrev = "", color = "#5A9C30", shortname = "",},
["Greens and Eco-pacifists"] = {abbrev = "", color = "#36A119", shortname = "",},
["Greens and Left Alliance"] = {abbrev = "", color = "#BE3457", shortname = "Greens and Left",},
["Greens Equo of the Valencian Country"] = {abbrev = "", color = "#36A119", shortname = "",},
["Greens Equo"] = {abbrev = "", color = "#46922B", shortname = "",},
["Greens Greens"] = {abbrev = "", color = "green", shortname = "",},
["Greens Japan"] = {abbrev = "", color = "#52af45", shortname = "Greens",},
["Greens New South Wales"] = {abbrev = "", color = "#10C25B", shortname = "Greens",},
["Greens of Andorra"] = {abbrev = "Vd'A", color = "#ADFF2F", shortname = "",},
["Greens of Bosnia and Herzegovina"] = {abbrev = "", color = "green", shortname = "",},
["Greens of Burkina"] = {abbrev = "", color = "green", shortname = "",},
["Greens of Serbia"] = {abbrev = "ZS", color = "#059649", shortname = "",},
["Greens of Slovenia"] = {abbrev = "", color = "green", shortname = "",},
["Greens on Åland"] = {abbrev = "", color = "#008000", shortname = "",},
["Greens Party of Georgia"] = {abbrev = "", color = "#26884A", shortname = "Greens",},
["Greens Party of Mozambique"] = {abbrev = "", color = "#64BC44", shortname = "",},
["Greens South Australia"] = {abbrev = "", color = "#00a651", shortname = "Greens",},
["Greens Western Australia"] = {abbrev = "", color = "#00a651", shortname = "Greens",},
["Greens–European Free Alliance"] = {abbrev = "", color = "#57B45F", shortname = "Greens/EFA",},
["Grenada National Party"] = {abbrev = "", color = "green", shortname = "",},
["Grenada Renaissance Party"] = {abbrev = "", color = "#4BACC6", shortname = "",},
["Grenada United Labour Party"] = {abbrev = "", color = "#D50000", shortname = "",},
["Groen (political party)"] = {abbrev = "", color = "#01796F", shortname = "Groen",},
["GroenLinks"] = {abbrev = "GL", color = "#5BC422", shortname = "",},
["GroenLinks–PvdA"] = {abbrev = "GL/PvdA", color = "#DC1F26", shortname = "",},
["Group and Union for the Progress of Almeria"] = {abbrev = "", color = "#005121", shortname = "",},
["Group for La Laguna"] = {abbrev = "", color = "#9F2362", shortname = "",},
["Group of 89"] = {abbrev = "", color = "#0d3b68", shortname = "",},
["Group of Independents of Marratxí"] = {abbrev = "", color = "#6E7096", shortname = "",},
["Group of Independents, Progressives and Nationalists"] = {abbrev = "", color = "#F8C902", shortname = "",},
["Group of Transylvanian Saxons"] = {abbrev = "GST", color = "black", shortname = "",},
["Group Otten"] = {abbrev = "GO", color = "#FAE704", shortname = "",},
["Grouped Independent Neighbors"] = {abbrev = "", color = "#ECD060", shortname = "",},
["Grouped Independents of Ponferrada"] = {abbrev = "", color = "#F78513", shortname = "",},
["Grouped Rural Citizens"] = {abbrev = "", color = "#52CA6B", shortname = "",},
["Grouping to the Service of the Republic"] = {abbrev = "", color = "#6B1F7C", shortname = "",},
["Grup Independent de Son Carrió"] = {abbrev = "", color = "#E46668", shortname = "",},
["Grupo Común da Esquerda"] = {abbrev = "", color = "#6D52C1", shortname = "",},
["Grütli Union"] = {abbrev = "", color = "#FA1360", shortname = "",},
["GSLP–Liberal Alliance"] = {abbrev = "", color = "#D20D13", shortname = "Alliance",},
["Guadeloupe Communist Party"] = {abbrev = "", color = "#DD0000", shortname = "",},
["Guanyant Torrent"] = {abbrev = "", color = "#9A297E", shortname = "",},
["Guanyem Badalona–Badalona En Comú"] = {abbrev = "", color = "#D51D50", shortname = "",},
["Guanyem Catalunya (2020)"] = {abbrev = "", color = "#ED174B", shortname = "",},
["Guanyem Catalunya"] = {abbrev = "", color = "#9F1B3F", shortname = "",},
["Guanyem Eivissa"] = {abbrev = "", color = "#940000", shortname = "",},
["Guanyem Gandia"] = {abbrev = "", color = "#EE1F25", shortname = "",},
["Guanyem Girona"] = {abbrev = "", color = "#B41062", shortname = "",},
["Guanyem L'Hospitalet"] = {abbrev = "", color = "#7B0012", shortname = "",},
["Guanyem les Illes Balears"] = {abbrev = "", color = "#BD0E15", shortname = "",},
["Guanyem Sabadell"] = {abbrev = "", color = "#91030F", shortname = "",},
["Guanyem Tarragona"] = {abbrev = "", color = "#F93620", shortname = "",},
["Guanyem–L'Esquerra Unitària"] = {abbrev = "", color = "#D42B15", shortname = "",},
["Guasú Front"] = {abbrev = "", color = "#BA55D3", shortname = "",},
["Guatemalan Christian Democracy"] = {abbrev = "DCG", color = "#046637", shortname = "",},
["Guatemalan National Revolutionary Unity"] = {abbrev = "URNG", color = "#D79E2D", shortname = "",},
["Guatemalan People's Party"] = {abbrev = "PPG", color = "#2b65af", shortname = "People's Party",},
["Guatemalan Party of Labour"] = {abbrev = "", color = "#DD0000", shortname = "",},
["Guelphs"] = {abbrev = "", color = "#000000", shortname = "",},
["Guianese Socialist Party"] = {abbrev = "PSG", color = "#EA8B9B", shortname = "",},
["Guildford Greenbelt Group"] = {abbrev = "GGG", color = "#006633", shortname = "",},
["Guinea for All"] = {abbrev = "", color = "#299D58", shortname = "",},
["Guinean Patriotic Union"] = {abbrev = "", color = "#2C2F74", shortname = "",},
["Guinean Workers' Party"] = {abbrev = "PTG", color = "#C4272A", shortname = "",},
["Gujarat Parivartan Party"] = {abbrev = "GPP", color = "#FADA5E", shortname = "",},
["Guldborgsundlisten"] = {abbrev = "", color = "#00ffff", shortname = "",},
["Gure Aukera"] = {abbrev = "", color = "#DB005F", shortname = "",},
["Guxo"] = {abbrev = "", color = "#14B0A7", shortname = "",},
["Guyana Action Party"] = {abbrev = "", color = "red", shortname = "",},
["Gwlad Gwlad"] = {abbrev = "", color = "#FF8000", shortname = "",},
["Gwlad"] = {abbrev = "", color = "#FF8000", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
8c0976c05e137559a18430d084f63a60b0852df6
Template:Template link general
10
241
475
474
2023-12-24T02:13:46Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Template_link_general]]
wikitext
text/x-wiki
{{{{{|safesubst:}}}#Invoke:Template link general|main}}<noinclude>
{{Documentation}}
</noinclude>
9871d2f490eaedd832a0ae8016adbf807ddf7b71
Template:Tlg
10
242
477
476
2023-12-24T02:13:47Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Tlg]]
wikitext
text/x-wiki
#REDIRECT [[Template:Template link general]]
{{Redirect category shell|
{{R from move}}
}}
707ce913a3ffa8193c9377c3ded7db7b72407500
Module:Political party/M
828
243
479
478
2023-12-24T02:13:48Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Political_party/M]]
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["Macau Business Int"] = "Macau Union of Employers Interests",
["Macau Business Interest Union"] = "Macau Union of Employers Interests",
["Macau professional Interest Union"] = "Macau Union of Professional Interests",
["Madhya Pradesh Congress Committee"] = "Indian National Congress",
["Madrilenian Socialist Federation"] = "Spanish Socialist Workers' Party",
["Magdalo para sa Pilipino"] = "Magdalo Party-List",
["Maghrebin Liberal Party"] = "Maghrebi Republican Party",
["Majorité pour l'autre Europe"] = "Movement for France",
["Makabayang Koalisyon ng Mamamayan"] = "Makabayan",
["Makkal Manadu Katchi"] = "Tamizhaga Murpokku Makkal Katchi",
["Malaysia United People's Party"] = "Malaysian United People's Party",
["Malaysian Workers Party"] = "National Trust Party (Malaysia)",
["Mana Motuhake (political party)"] = "Mana Motuhake",
["Mana Party (New Zealand)"] = "Mana Movement",
["Manipur People's Party"] = "Manipur Peoples Party",
["Maori Party"] = "Te Pāti Māori",
["Māori Party"] = "Te Pāti Māori",
["Marek Hilšer"] = "Marek Hilšer to Senate",
["Marijuana Party (United States)"] = "Marijuana Party (US)",
["Marxist-Leninist Party of Germany"] = "Marxist–Leninist Party of Germany",
["Maryland Democratic Party"] = "Democratic Party (United States)",
["Maryland Green Party"] = "Green Party (US)",
["Maryland Republican Party"] = "Republican Party (United States)",
["Massachusetts Democratic Party"] = "Democratic Party (United States)",
["Maurist Conservatives"] = "Maurist Party",
["Meghalaya Democratic Alliance"] = "Meghalaya Democratic Alliance (2018)",
["MEMO"] = "Solution Movement",
["MFG – Austria People – Freedom – Fundamental Rights"] = "MFG Austria – People Freedom Fundamental Rights",
["Mouvement Militant Mauricien"] = "Mauritian Militant Movement",
["Mauritian Social Democrat Party"] = "Parti Mauricien Social-Démocrate",
["Mexican Laborist Party"] = "Laborist Party (Mexico)",
["Michigan Democratic Party"] = "Democratic Party (United States)",
["Michigan Republican Party"] = "Republican Party (United States)",
["Milan Bandić 365 - The Party of Labour and Solidarity"] = "Bandić Milan 365 – Labour and Solidarity Party",
["Mouvement Socialiste Militant"] = "Militant Socialist Movement",
["Military Rule"] = "Military rule",
["Military"] = "Military rule",
["Mineiro Republican Party"] = "Minas Republican Party",
["Minjoo Party of Korea"] = "Democratic Party of Korea",
["Minnesota Democratic Party"] = "Democratic Party (United States)",
["Minnesota Democratic-Farmer-Labor Party"] = "Minnesota Democratic–Farmer–Labor Party",
["Minnesota Progressive Party"] = "Progressive Party (US)",
["Miscellaneous far left"] = "Far-left",
["Miscellaneous far right"] = "Far-right",
["Miscellaneous Left"] = "Miscellaneous left",
["Miscellaneous Right"] = "Miscellaneous right",
["Missouri Democratic Party"] = "Democratic Party (United States)",
["Missouri Republican Party"] = "Republican Party (United States)",
["MMA"] = "Muttahida Majlis-e-Amal",
["MN"] = "German Minority Electoral Committee",
["Mochrena"] = "Christian Movement for a New Haiti",
["Moderate (Estonia)"] = "Social Democratic Party (Estonia)",
["Moderate Party (Rhode Island)"] = "Moderate Party of Rhode Island",
["Moderate People's Party"] = "Social Democratic Party (Estonia)",
["Moderates (Estonia)"] = "Social Democratic Party (Estonia)",
["Modern"] = "Modern (political party)",
["Mongolian People's Revolutionary Party (old)"] = "Mongolian People's Party",
["Mongolian People's Revolutionary Party"] = "Mongolian People's Party",
["Mongolian Traditionally United Party"] = "Mongolian Traditional United Party",
["Montana Democratic Party"] = "Democratic Party (United States)",
["Montana Republican Party"] = "Republican Party (United States)",
["Montana Libertarian Party"] = "Libertarian Party (US)",
["Moramo (political coalition)"] = "We Must (Serbia)",
["Morena"] = "Morena (political party)",
["Morley Borough Independent"] = "Morley Borough Independents",
["Most-Híd"] = "Most–Híd",
["Motherland (Latvia)"] = "New Harmony (Latvia)",
["Motherland People's Party"] = "Sinhalaye Mahasammatha Bhoomiputra Pakshaya",
["Mouvement Réformateur"] = "Reformist Movement",
["Mouvement Rodriguais"] = "Rodrigues Movement",
["Movement for a People's Party"] = "People's Party (US, 2017)",
["Movement for Autonomies"] = "Movement for Autonomy",
["Movement for Change"] = "Gorran Movement",
["Movement for Democratic Change - Tsvangirai"] = "Movement for Democratic Change – Tsvangirai",
["Movement for Democratic Change (pre-2005)"] = "Movement for Democratic Change (1999–2005)",
["Movement for Democratic Change-Tsvangirai"] = "Movement for Democratic Change – Tsvangirai",
["Movement for Justice"] = "Pakistan Tehreek-e-Insaf",
["Movement for Liberty - European Georgia"] = "European Georgia — Movement for Liberty",
["Movement for Multiparty Democracy"] = "Movement for Multi-Party Democracy",
["Movement for the Development of Mayotte"] = "Miscellaneous right",
["Movement for the Future"] = "Movement for the Future of Curaçao",
["Movement for the Liberation of São Tomé and Príncipe/Social Democratic Party"] = "Movement for the Liberation of São Tomé and Príncipe – Social Democratic Party",
["Movement of Citizens"] = "Citizen and Republican Movement",
["Movement of Democratic Socialists (Greece)"] = "Movement of Democratic Socialists",
["Movement of Ecologists - Citizens' Cooperation"] = "Movement of Ecologists – Citizens' Cooperation",
["Movement of Ecologists — Citizens' Cooperation"] = "Movement of Ecologists – Citizens' Cooperation", -- em dash
["Movement of Radicals of the Left"] = "Radical Party of the Left",
["Movementu 21"] = "Movement 21 (Bonaire)",
["Murcian Socialist Federation"] = "Spanish Socialist Workers' Party",
["Muslim League (Opposition)"] = "All-India Muslim League",
["Muslim National Unity Alliance"] = "National Unity Alliance",
["Muttahida Qaumi Movement-Pakistan"] = "Muttahida Qaumi Movement – Pakistan",
["Muttahida Qaumi Movement–Pakistan"] = "Muttahida Qaumi Movement – Pakistan", -- dash difference
}
local full = {
["M10 (political party)"] = {abbrev = "", color = "#232575", shortname = "",},
["Macao Civic Power"] = {abbrev = "", color = "#FF007F", shortname = "Cívico",},
["Macau Union of Employers Interests"] = {abbrev = "", color = "#EDC2FD", shortname = "",},
["Macau Union of Medical Professional Interests"] = {abbrev = "", color = "#2CADC7", shortname = "",},
["Macau Union of Professional Interests"] = {abbrev = "", color = "#FBCBC7", shortname = "",},
["Macau United Citizens Association"] = {abbrev = "ACUM", color = "#DC143C", shortname = "",},
["Macau-Guangdong Union"] = {abbrev = "UGM", color = "#ED6C10", shortname = "",},
["Macedonian Alliance for European Integration"] = {abbrev = "", color = "red", shortname = "",},
["Machrouu Tounes"] = {abbrev = "", color = "#000000", shortname = "",},
["Madem G15"] = {abbrev = "", color = "#01A35A", shortname = "",},
["Madheshi Jana Adhikar Forum, Nepal"] = {abbrev = "MJF-N", color = "orangered", shortname = "",},
["Madheshi Jana Adhikar Forum, Nepal (Loktantrik)"] = {abbrev = "MJAF(L)", color = "lightgreen", shortname = "",},
["Madrid En Pie"] = {abbrev = "", color = "#86073A", shortname = "",},
["Madrilenian Independent Regional Party"] = {abbrev = "", color = "#FA641B", shortname = "",},
["Maendeleo Chap Chap Party"] = {abbrev = "MCC", color = "#632F91", shortname = "",},
["Maendeleo Democratic Party"] = {abbrev = "MDP", color = "#03F601", shortname = "",},
["Magdalo Party-List"] = {abbrev = "", color = "#DC143C", shortname = "Magdalo",},
["Maghrebi Republican Party"] = {abbrev = "", color = "#2B5D29", shortname = "",},
["Magtymguly Youth Organisation of Turkmenistan"] = {abbrev = "TMÃ G", color = "#367A00", shortname = "",},
["Magyar Party (Romania)"] = {abbrev = "PM", color = "#2e502d", shortname = "",},
["Maha Vikas Aghadi"] = {abbrev = "MVA", color = "#1C89B7", shortname = "",},
["Mahachon Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Mahagathbandhan (Bihar)"] = {abbrev = "MGB", color = "#1E6914", shortname = "",},
["Mahagujarat Janta Party"] = {abbrev = "MJP", color = "#FFFFF5", shortname = "",},
["Mahajana Eksath Peramuna (1956)"] = {abbrev = "MEP", color = "#0000FF", shortname = "Mahajana Eksath Peramuna",},
["Mahajana Eksath Peramuna"] = {abbrev = "MEP", color = "#FF0000", shortname = "",},
["Mahajana Socialist Party"] = {abbrev = "", color = "blue", shortname = "",},
["Mahajot (Assam)"] = {abbrev = "UOF", color = "#52FFCC", shortname = "",},
["Mahan Dal"] = {abbrev = "MD", color = "#330066", shortname = "",},
["Maharashtra Ekikaran Samiti"] = {abbrev = "MES", color = "#FF9933", shortname = "",},
["Maharashtra Navnirman Sena"] = {abbrev = "MNS", color = "#5F2301", shortname = "",},
["Maharashtra Parivartan Sena (T)"] = {abbrev = "", color = "#FF9933", shortname = "",},
["Maharashtra Rajiv Congress"] = {abbrev = "", color = "#9966CC", shortname = "",},
["Maharashtra Swabhiman Paksha"] = {abbrev = "MSHP", color = "#FFA500", shortname = "",},
["Maharashtrawadi Gomantak Party"] = {abbrev = "MGP", color = "#AF7050", shortname = "",},
["Maharlika People's Party"] = {abbrev = "MPP", color = "#000040", shortname = "",},
["Máis Galiza"] = {abbrev = "", color = "#2F9A26", shortname = "",},
["Majadahonda Centrists"] = {abbrev = "", color = "#146F4C", shortname = "",},
["Majd Movement"] = {abbrev = "", color = "#00529F", shortname = "",},
["Majdoor Kisan Union Party"] = {abbrev = "MKUP", color = "#81BEF7", shortname = "",},
["Majlis Bachao Tahreek"] = {abbrev = "", color = "#9900CC", shortname = "",},
["Majlis Wahdat-e-Muslimeen"] = {abbrev = "MWM", color = "#008000", shortname = "",},
["Majorcan Union"] = {abbrev = "UM", color = "#333583", shortname = "",},
["Majorera Assembly"] = {abbrev = "AM", color = "#284BAF", shortname = "",},
["Majorero Progressive Party"] = {abbrev = "", color = "#3C6C06", shortname = "",},
["Makabayan"] = {abbrev = "", color = "#29176E", shortname = "",},
["Makatizens United Party"] = {abbrev = "MKTZNU", color = "#1F51FF", shortname = "",},
["Make Politicians History"] = {abbrev = "", color = "#FFC0CB", shortname = "",},
["Maki (historical political party)"] = {abbrev = "", color = "#FF524D", shortname = "Maki",},
["Maki (political party)"] = {abbrev = "", color = "#cb1a1d", shortname = "Maki",},
["Makkal Needhi Maiam"] = {abbrev = "MNM", color = "#900C3F", shortname = "",},
["Makkal Sevai Katchi"] = {abbrev = "", color = "#006060", shortname = "",},
["Makkal Tamil Desam Katchi"] = {abbrev = "MTD", color = "#006060", shortname = "",},
["Málaga Ahora"] = {abbrev = "", color = "#3EA9A7", shortname = "",},
["Málaga for Yes"] = {abbrev = "", color = "#0087BF", shortname = "",},
["Malagasy Revolutionary Party"] = {abbrev = "AREMA", color = "#BB0102", shortname = "",},
["Malawi Congress Party"] = {abbrev = "MCP", color = "#FF0000", shortname = "",},
["Malayan Chinese Association"] = {abbrev = "MCA", color = "#EFCC00", shortname = "",},
["Malayan Party"] = {abbrev = "", color = "black", shortname = "",},
["Malayan Peoples' Socialist Front"] = {abbrev = "", color = "#C00000", shortname = "Socialist Front",},
["Malayang Kilusan ng Mamamayang Zambaleño"] = {abbrev = "", color = "#3344FF", shortname = "MAKIMAZA",},
["Malaysia Makkal Sakti Party"] = {abbrev = "MMSP", color = "orange", shortname = "",},
["Malaysia National Alliance Party"] = {abbrev = "", color = "#CD2122", shortname = "",},
["Malaysian Chinese Association"] = {abbrev = "MCA", color = "#102a7e", shortname = "",},
["Malaysian Democratic Party"] = {abbrev = "MDP", color = "#0000FF", shortname = "",},
["Malaysian Indian Congress"] = {abbrev = "MIC", color = "#00A988", shortname = "",},
["Malaysian Indian Muslim Congress"] = {abbrev = "", color = "#FFCC00", shortname = "",},
["Malaysian Indian United Party"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Malaysian Islamic Party"] = {abbrev = "", color = "#009000", shortname = "",},
["Malaysian Nationalist Party"] = {abbrev = "NASMA", color = "", shortname = "",},
["Malaysian Social Justice Party"] = {abbrev = "PEKEMAS", color = "#C00000", shortname = "",},
["Malaysian United Democratic Alliance"] = {abbrev = "MUDA", color = "#000000", shortname = "",},
["Malaysian United Indigenous Party"] = {abbrev = "", color = "#E62020", shortname = "",},
["Malaysian United Party"] = {abbrev = "", color = "#F617D4", shortname = "",},
["Malaysian United People's Party"] = {abbrev = "MUPP", color = "#F2D8D8", shortname = "",},
["Maldives Development Alliance"] = {abbrev = "MDA", color = "#DB5702", shortname = "",},
["Maldivian Democratic Party"] = {abbrev = "MDP", color = "#ffcc33", shortname = "",},
["Maldon and District Independent Democratic Alliance"] = {abbrev = "MDIDA", color = "MediumOrchid", shortname = "",},
["Maldon District Independent Group"] = {abbrev = "MDIG", color = "#985FF0", shortname = "Maldon Independents",},
["Malian Union for the African Democratic Rally"] = {abbrev = "", color = "#000000", shortname = "",},
["Malta Workers Party"] = {abbrev = "", color = "#B87333", shortname = "Workers",},
["Maltese Political Union"] = {abbrev = "", color = "#00AD06", shortname = "",},
["Mana Māori Movement"] = {abbrev = "", color = "#964B00", shortname = "Mana Māori",},
["Mana Motuhake"] = {abbrev = "", color = "#C32148", shortname = "",},
["Mana Movement"] = {abbrev = "", color = "#770808", shortname = "Mana",},
["Mana Party"] = {abbrev = "", color = "#7C0808", shortname = "",},
["Mana Wahine Te Ira Tangata"] = {abbrev = "", color = "#964B00", shortname = "Mana Wahine",},
["Manav Kalyan Sangh Dal"] = {abbrev = "MKSD", color = "#333300", shortname = "",},
["Manav Samaj Party"] = {abbrev = "MSP", color = "#F2F2F2", shortname = "",},
["Manchegan Regionalist Party"] = {abbrev = "", color = "#DC143C", shortname = "",},
["Manipur Hills Union"] = {abbrev = "", color = "#400080", shortname = "",},
["Manipur Peoples Party"] = {abbrev = "MPP", color = "#99CC99", shortname = "",},
["Manipur State Congress Party"] = {abbrev = "MSCP", color = "#99CC99", shortname = "",},
["Manithaneya Makkal Katchi"] = {abbrev = "MNMK", color = "lime", shortname = "",},
["Manko Taxawu Sénégal"] = {abbrev = "MTS", color = "#FF8040", shortname = "",},
["Mansfield Independent Forum"] = {abbrev = "MIF", color = "#DDDDDD", shortname = "Mansfield Independent",},
["Mantra Bhakta Party"] = {abbrev = "MBP", color = "#FAAC58", shortname = "",},
["Manx Labour Party"] = {abbrev = "", color = "#DC241f", shortname = "Manx Labour",},
["Mapai"] = {abbrev = "", color = "#AD0101", shortname = "",},
["Mapam"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Marada Movement"] = {abbrev = "", color = "#02CB00", shortname = "",},
["Maraland Democratic Front"] = {abbrev = "", color = "#FF8822", shortname = "",},
["March 14 Alliance"] = {abbrev = "M14th", color = "#d61a21", shortname = "M14th",},
["March 26 Movement"] = {abbrev = "", color = "#E34234", shortname = "",},
["March 8 Alliance"] = {abbrev = "44263", color = "#FF6000", shortname = "",},
["Marcus Garvey People's Political Party"] = {abbrev = "MGPPP", color = "black", shortname = "",},
["Marea Ártabra"] = {abbrev = "", color = "#009AA5", shortname = "",},
["Marea Atlántica"] = {abbrev = "", color = "#009FE3", shortname = "",},
["Marea de Ferrol"] = {abbrev = "", color = "#4EA602", shortname = "",},
["Marea de Vigo"] = {abbrev = "", color = "#C53374", shortname = "",},
["Marea Galeguista"] = {abbrev = "", color = "#205C78", shortname = "",},
["Marea Pontevedra"] = {abbrev = "", color = "#0085BE", shortname = "",},
["Marematlou Freedom Party"] = {abbrev = "MFP", color = "#1bb5a4", shortname = "",},
["Marek Hilšer to Senate"] = {abbrev = "MHS", color = "#87CEFA", shortname = "",},
["Marijuana Party (US)"] = {abbrev = "", color = "#50C878", shortname = "Marijuana",},
["Marijuana Party"] = {abbrev = "", color = "#50C878", shortname = "",},
["Marijuana Reform Party"] = {abbrev = "", color = "#50C878", shortname = "Marijuana Reform",},
["Martinican Communist Party"] = {abbrev = "", color = "#DD0000", shortname = "",},
["Martinican Democratic Rally"] = {abbrev = "RDM", color = "#FFD1DC", shortname = "",},
["Martinican Independence Movement"] = {abbrev = "MIM", color = "#d53736", shortname = "",},
["Martinican Progressive Party"] = {abbrev = "PPM", color = "#ef4836", shortname = "",},
["Martinican Regionalist Party"] = {abbrev = "", color = "#FFCC33", shortname = "",},
["Martists"] = {abbrev = "", color = "#5BAF50", shortname = "Martist",},
["Marumalarchi Dravida Munnetra Kazhagam"] = {abbrev = "MDMK", color = "#FC0000", shortname = "",},
["Marxist Co-ordination Committee"] = {abbrev = "MCC", color = "#c24e4e", shortname = "",},
["Marxist Co-Ordination"] = {abbrev = "", color = "#B22222", shortname = "",},
["Marxist Communist Party of India (S.S. Srivastava)"] = {abbrev = "MCPI(S)", color = "#990099", shortname = "",},
["Marxist Communist Party of India (United)"] = {abbrev = "", color = "red", shortname = "",},
["Marxist Forward Bloc"] = {abbrev = "MFB", color = "red", shortname = "",},
["Marxist Party of Armenia"] = {abbrev = "", color = "red", shortname = "",},
["Marxist–Leninist Communist Party of Greece"] = {abbrev = "M-L KKE", color = "#D71920", shortname = "",},
["Marxist–Leninist Communist Party of Venezuela"] = {abbrev = "", color = "Red", shortname = "",},
["Marxist–Leninist Party of Austria"] = {abbrev = "MLPÖ", color = "red", shortname = "",},
["Marxist–Leninist Party of Germany"] = {abbrev = "MLPD", color = "#FF0000", shortname = "",},
["Marxist–Leninist Popular Action Movement"] = {abbrev = "", color = "red", shortname = "",},
["Más Andalucía"] = {abbrev = "", color = "#445A1A", shortname = "",},
["Más Costa Tropical"] = {abbrev = "", color = "#095B2D", shortname = "",},
["Más Eivissa"] = {abbrev = "", color = "#D60014", shortname = "",},
["Más Granada"] = {abbrev = "", color = "#9D3B23", shortname = "",},
["Más Madrid"] = {abbrev = "", color = "#45BB89", shortname = "",},
["Más País"] = {abbrev = "", color = "#0FDEC4", shortname = "",},
["Más para Entre Ríos"] = {abbrev = "", color = "#A31212", shortname = "",},
["Más Ponferrada"] = {abbrev = "", color = "#B55B8B", shortname = "",},
["MAS Region"] = {abbrev = "", color = "crimson", shortname = "",},
["Mass Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Massachusetts Republican Party"] = {abbrev = "", color = "#ff3300", shortname = "Republican",},
["Masyumi Party"] = {abbrev = "", color = "#000000", shortname = "Masyumi",},
["Matubhum Party"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Mauri Pacific"] = {abbrev = "", color = "#003153", shortname = "",},
["Maurin Kiribati Party"] = {abbrev = "MKP", color = "#48D1CC", shortname = "",},
["Maurist Party"] = {abbrev = "", color = "#0063B6", shortname = "Maurist",},
["Maurists–Ciervists"] = {abbrev = "", color = "#1959AA", shortname = "",},
["Mauritian Militant Movement"] = {abbrev = "MMM", color = "#800080", shortname = "",},
["Mauritanian Party for Renewal"] = {abbrev = "PMR", color = "#6DC2F9", shortname = "",},
["Mauritanian Party of Union and Change"] = {abbrev = "HATEM", color = "#4BB9F2", shortname = "",},
["Mauritanian People's Party"] = {abbrev = "", color = "#006233", shortname = "",},
["Mauritanian Popular Front"] = {abbrev = "", color = "#FDD003", shortname = "",},
["Mauritanian Regroupment Party"] = {abbrev = "", color = "#009F6B", shortname = "",},
["Mauritian Militant Socialist Movement"] = {abbrev = "", color = "red", shortname = "",},
["Mauritian Party of Xavier-Luc Duval"] = {abbrev = "", color = "#0000CD", shortname = "",},
["Mauritian Solidarity Front"] = {abbrev = "", color = "green", shortname = "",},
["Mavambo/Kusile/Dawn"] = {abbrev = "", color = "yellow", shortname = "",},
["Mayor 4 Stoke"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Mayors and Independents"] = {abbrev = "STAN", color = "#5BC5F2", shortname = "",},
["Mayors for the Liberec Region"] = {abbrev = "SLK", color = "#804e96", shortname = "",},
["Mazingira Green Party of Kenya"] = {abbrev = "", color = "#009926", shortname = "",},
["McGillicuddy Serious Party"] = {abbrev = "", color = "#FFC0CB", shortname = "McGillicuddy Serious",},
["Mebyon Kernow"] = {abbrev = "", color = "#d5c229", shortname = "",},
["Medrek"] = {abbrev = "", color = "#503335", shortname = "",},
["Meeting Point"] = {abbrev = "", color = "#04770a", shortname = "",},
["Meghalaya Democratic Alliance (2018)"] = {abbrev = "MDA", color = "#006081", shortname = "",},
["Meimad"] = {abbrev = "", color = "#3BABA3", shortname = "",},
["Mejor Vargas Lleras"] = {abbrev = "", color = "#2E3191", shortname = "",},
["Mekenchil"] = {abbrev = "", color = "#1F4B99", shortname = "",},
["Mekenim Kyrgyzstan"] = {abbrev = "", color = "#FFCF06", shortname = "",},
["Melanesian Alliance Party"] = {abbrev = "MAP", color = "#C78919", shortname = "",},
["Melanesian Liberal Party"] = {abbrev = "MLP", color = "#326D93", shortname = "",},
["Melanesian Progressive Party"] = {abbrev = "MPP", color = "#DE3938", shortname = "Melanesian Progressive",},
["Melanesian Progressive Union"] = {abbrev = "UPM", color = "#CC3300", shortname = "",},
["Melillan People's Union"] = {abbrev = "", color = "#0A1555", shortname = "",},
["MELS Movement of Botswana"] = {abbrev = "", color = "red", shortname = "",},
["Menorcan Independent Candidacy"] = {abbrev = "", color = "#B0B0B0", shortname = "",},
["Menorcan Party"] = {abbrev = "", color = "#00D1D1", shortname = "",},
["Menorcan Union"] = {abbrev = "", color = "#10308D", shortname = "",},
["Mensch Im Mittelpunkt"] = {abbrev = "MIM", color = "#9B2A58", shortname = "",},
["Menschliche Welt"] = {abbrev = "", color = "#ee6600", shortname = "",},
["Menshevik"] = {abbrev = "", color = "#ED1B34", shortname = "",},
["MeRA25"] = {abbrev = "", color = "#EF3F24", shortname = "",},
["Merab Kostava Society"] = {abbrev = "", color = "#751133", shortname = "",},
["Mercian Nationalist Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Meretz"] = {abbrev = "", color = "#40AE49", shortname = "",},
["Meretz (2022)"] = {abbrev = "", color = "#23E164", shortname = "",},
["Meri (political party)"] = {abbrev = "", color = "#FF3A3A", shortname = "Meri",},
["Mérida Participa"] = {abbrev = "", color = "#5D225A", shortname = "",},
["Merindades of Castile Initiative"] = {abbrev = "", color = "#335DA3", shortname = "",},
["Merit and Society Movement"] = {abbrev = "", color = "#00B4C8", shortname = "",},
["Merton Park Ward Residents Association"] = {abbrev = "", color = "#9f0fc8", shortname = "Merton Park Residents",},
["Més Compromís"] = {abbrev = "", color = "#DA5C31", shortname = "",},
["Més Esquerra"] = {abbrev = "", color = "#DACE5D", shortname = "",},
["Més Gandia"] = {abbrev = "", color = "#D6502B", shortname = "",},
["Més per Mallorca"] = {abbrev = "Més", color = "#D8DE40", shortname = "",},
["Més per Menorca"] = {abbrev = "MpM", color = "#BCD500", shortname = "",},
["Més–Compromís"] = {abbrev = "", color = "#FF6600", shortname = "",},
["Metapolitical Unitary Movement"] = {abbrev = "", color = "#FC0FC0", shortname = "",},
["Mexborough First"] = {abbrev = "", color = "#000000", shortname = "",},
["Mexican Communist Party"] = {abbrev = "PCM", color = "Red", shortname = "",},
["Mexican Democratic Party"] = {abbrev = "PDM", color = "#CC0000", shortname = "",},
["Mexican Liberal Party"] = {abbrev = "", color = "#CE1126", shortname = "",},
["Mexican Liberal Party (2003)"] = {abbrev = "PLM", color = "#d48a49", shortname = "",},
["MFG Austria – People Freedom Fundamental Rights"] = {abbrev = "MFG", color = "#4E4E4E", shortname = "",},
["MGR Anna Dravida Munnetra Kazhagam"] = {abbrev = "MADMK", color = "maroon", shortname = "",},
["MGR Thonderkal Katchi"] = {abbrev = "", color = "slategray", shortname = "MGR Thonderkal",},
["Mi Pais (political party)"] = {abbrev = "", color = "#00A5DD", shortname = "",},
["Middle Class Party"] = {abbrev = "", color = "#FFFF66", shortname = "",},
["Middle Class Party (Belgium)"] = {abbrev = "", color = "#0000A0", shortname = "Middle Class",},
["Middle Class Union"] = {abbrev = "", color = "#70147A", shortname = "",},
["Middle European Class"] = {abbrev = "", color = "#2E239D", shortname = "",},
["Middleton Independents Party"] = {abbrev = "", color = "#ffcc00", shortname = "Middleton Ind."},
["Middlewich First"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Midroad-Populist Party"] = {abbrev = "", color = "#CCFFCC", shortname = "Midroad-Populist",},
["MIGATO"] = {abbrev = "", color = "#1DA1F2", shortname = "",},
["Mighty Fatherland"] = {abbrev = "", color = "black", shortname = "",},
["Mijas Neighborhood Movement"] = {abbrev = "", color = "#5AD181", shortname = "",},
["Militant (Trotskyist group)"] = {abbrev = "", color = "#ED1941", shortname = "Militant Labour",},
["Militant Elvis Anti-Tesco Popular Front"] = {abbrev = "", color = "#FF00FF", shortname = "",},
["Militant Labour"] = {abbrev = "", color = "#ED1941", shortname = "",},
["Militant Left (Ireland)"] = {abbrev = "", color = "#DC241F", shortname = "Militant Left",},
["Militant Socialist Movement"] = {abbrev = "MSM", color = "#FF8C00", shortname = "",},
["Military (Brazil)"] = {abbrev = "", color = "#808000", shortname = "Military",},
["Military (Italy)"] = {abbrev = "", color = "#C3B091", shortname = "",},
["Military (Japan)"] = {abbrev = "", color = "#808080", shortname = "",},
["Military of Guinea-Bissau"] = {abbrev = "FARP", color = "#C3B091", shortname = "",},
["Military of São Tomé and Príncipe"] = {abbrev = "", color = "#C3B091", shortname = "",},
["Military rule"] = {abbrev = "", color = "#C3B091", shortname = "Military",},
["Millat Party"] = {abbrev = "MP", color = "red", shortname = "",},
["Millennium Democratic Party"] = {abbrev = "", color = "#00AA7B", shortname = "Millennium Democratic",},
["Minas Republican Party"] = {abbrev = "", color = "#ED1C24", shortname = "PR Mineiro",},
["Mindanao Alliance"] = {abbrev = "", color = "#008000", shortname = "",},
["Mindoro Bago Sarili"] = {abbrev = "MBS", color = "#F09042", shortname = "",},
["Ministerialist"] = {abbrev = "", color = "darkblue", shortname = "",},
["Minjoo Party (2014)"] = {abbrev = "", color = "#FFCA08", shortname = "",},
["Minjung Party"] = {abbrev = "", color = "#f26522", shortname = "Minjung",},
["Minkuotang"] = {abbrev = "", color = "#FCC800", shortname = "",},
["Minnesota Democratic–Farmer–Labor Party"] = {abbrev = "", color = "#0055AA", shortname = "Democratic (DFL)",},
["Minnesota Farmer–Labor Party"] = {abbrev = "", color = "#66FF99", shortname = "Farmer–Labor",},
["Minnesota Open Progressive Party"] = {abbrev = "", color = "#CCFF33", shortname = "",},
["Minnesota Pirate Party"] = {abbrev = "", color = "#572b85", shortname = "",},
["Minor Sea Independent Party"] = {abbrev = "", color = "#808040", shortname = "",},
["Minorities' Party"] = {abbrev = "", color = "#000000", shortname = "",},
["Minority Front"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Minority Party (Denmark)"] = {abbrev = "", color = "#FF0800", shortname = "",},
["Minsaeng Party"] = {abbrev = "", color = "#00A85F", shortname = "Minsaeng",},
["Mintō (liberal parties)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Mirae Party"] = {abbrev = "", color = "#2E3192", shortname = "Mirae",},
["Mișcarea Politică Unirea"] = {abbrev = "", color = "#8CD7F6", shortname = "",},
["Miscellaneous centre"] = {abbrev = "DVC", color = "#fcdaa8", shortname = "",},
["Miscellaneous"] = {abbrev = "DIV", color = "#CECECE", shortname = "",},
["Miscellaneous Green"] = {abbrev = "ECO", color = "#8FBC8F", shortname = "",},
["Miscellaneous left"] = {abbrev = "DVG", color = "#FFC0C0", shortname = "",},
["Miscellaneous right"] = {abbrev = "DVD", color = "#ADC1FD", shortname = "",},
["Mission Party"] = {abbrev = "", color = "#17C307", shortname = "Mission",},
["Mississippi Democratic Party"] = {abbrev = "", color = "#3333FF", shortname = "Democratic",},
["Mississippi Freedom Democratic Party"] = {abbrev = "", color = "#3333FF", shortname = "Mississippi Freedom Democratic",},
["Mississippi Republican Party"] = {abbrev = "", color = "#E81B23", shortname = "Republican",},
["Mixed Group"] = {abbrev = "GM", color = "#C0C0C0", shortname = "",},
["Mizo National Front"] = {abbrev = "MNF", color = "#2E5694", shortname = "",},
["Mizo Union"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Mizoram People's Conference"] = {abbrev = "MPC", color = "#FD7793", shortname = "",},
["Mizrachi (political party)"] = {abbrev = "", color = "#37658C", shortname = "Mizrachi",},
["Moderate (London)"] = {abbrev = "", color = "#0087DC", shortname = "Moderate",},
["Moderate Coalition for Åland"] = {abbrev = "", color = "#0095DA", shortname = "Moderate Coalition",},
["Moderate Liberal Party"] = {abbrev = "", color = "#BAE666", shortname = "Moderate Liberal",},
["Moderate Opposition"] = {abbrev = "", color = "#b070ad", shortname = "Moderate",},
["Moderate Party (Brazil)"] = {abbrev = "", color = "#E9FFDB", shortname = "Moderate",},
["Moderate Party (Illinois)"] = {abbrev = "", color = "#66023C", shortname = "Moderate",},
["Moderate Party (Italy)"] = {abbrev = "", color = "#1E87B2", shortname = "",},
["Moderate Party (Spain)"] = {abbrev = "", color = "#1060AF", shortname = "Moderate",},
["Moderate Party of Rhode Island"] = {abbrev = "", color = "#9CCECF", shortname = "Moderate",},
["Moderate Party"] = {abbrev = "M", color = "#019CDB", shortname = "Moderate",},
["Moderate Republicans (France, 1848–1870)"] = {abbrev = "", color = "#FF7F50", shortname = "Republican",},
["Moderate Venstre (Denmark)"] = {abbrev = "", color = "#3333A2", shortname = "Moderate Venstre",},
["Moderates (Denmark)"] = {abbrev = "", color = "#B48CD2", shortname = "Moderates",},
["Moderates (Italy)"] = {abbrev = "", color = "#008ECE", shortname = "Moderates",},
["Moderates (Scotland)"] = {abbrev = "", color = "#5555FF", shortname = "Moderates",},
["Moderates of Åland"] = {abbrev = "", color = "#72cced", shortname = "Moderates",},
["Moderation and Development Party"] = {abbrev = "MDP", color = "#B666D2", shortname = "",},
["Modern (political party)"] = {abbrev = ".N", color = "#005CA9", shortname = "",},
["Modern Centre Party"] = {abbrev = "", color = "#000099", shortname = "",},
["Modern Christian-Democratic Union"] = {abbrev = "MKD", color = "#FF9E23", shortname = "",},
["Modern Egypt Party"] = {abbrev = "", color = "#EB264D", shortname = "",},
["Modern Equality Party"] = {abbrev = "", color = "#eee8aa", shortname = "",},
["Modern Hungary Movement"] = {abbrev = "MoMa", color = "#007DC0", shortname = "",},
["Modern Left"] = {abbrev = "LGM", color = "#A83578", shortname = "",},
["Modern People's Party"] = {abbrev = "MPP", color = "#FFFFFF", shortname = "",},
["Modern Revolutionary Party"] = {abbrev = "", color = "#00416A", shortname = "",},
["Modern Whig Party"] = {abbrev = "", color = "#FF7F00", shortname = "Modern Whig",},
["Modrí, Most – Híd"] = {abbrev = "", color = "#002E74", shortname = "",},
["Moked"] = {abbrev = "", color = "#DC241F", shortname = "",},
["Moledet"] = {abbrev = "", color = "#000080", shortname = "",},
["Momentum (organisation)"] = {abbrev = "", color = "#CC0000", shortname = "Labour (Momentum)",},
["Momentum Movement"] = {abbrev = "", color = "#8E6FCE", shortname = "Momentum",},
["Mon National Party"] = {abbrev = "MNP", color = "#ED2124", shortname = "",},
["Mon Unity Party"] = {abbrev = "MUP", color = "#C13830", shortname = "",},
["Monarchiens"] = {abbrev = "", color = "#1C39BB", shortname = "",},
["Monarchist Action League"] = {abbrev = "", color = "#266F91", shortname = "",},
["Monarchist Coalition (Spain)"] = {abbrev = "", color = "#003E70", shortname = "",},
["Monarchist Democratic Party"] = {abbrev = "", color = "#4FA937", shortname = "Democratic",},
["Monarchist National Party"] = {abbrev = "", color = "#4B61D1", shortname = "",},
["Monarchy of Cambodia"] = {abbrev = "", color = "#FFDF00", shortname = "",},
["Monegasque National Union"] = {abbrev = "UNM", color = "#D21116", shortname = "",},
["Monetary Reform Party"] = {abbrev = "MRP", color = "#777777", shortname = "Monetary Reform",},
["Money Reform Party"] = {abbrev = "", color = "#997A8D", shortname = "Money Reform",},
["Mongol National Organisation"] = {abbrev = "", color = "#008080", shortname = "",},
["Mongolian Democratic Party (1990)"] = {abbrev = "", color = "#074da9", shortname = "",},
["Mongolian Green Party"] = {abbrev = "", color = "green", shortname = "",},
["Mongolian National Progress Party"] = {abbrev = "", color = "#006994", shortname = "",},
["Mongolian People's Party"] = {abbrev = "MPP", color = "#ED1B34", shortname = "",},
["Mongolian People's Revolutionary Party (2010)"] = {abbrev = "MPRP", color = "#FE001A", shortname = "",},
["Mongolian Republican Party"] = {abbrev = "", color = "#800080", shortname = "",},
["Mongolian Social Democratic Party"] = {abbrev = "MSDP", color = "#1C5CAC", shortname = "",},
["Mongolian Traditional United Party"] = {abbrev = "", color = "#085CB6", shortname = "",},
["Monise Laafai"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Monitor Action Group"] = {abbrev = "", color = "blue", shortname = "",},
["Monster Raving Loony William Hill Party"] = {abbrev = "", color = "hotpink", shortname = "Monster Raving Loony",},
["Montenegrin Federalist Party"] = {abbrev = "", color = "darkgreen", shortname = "",},
["Montenegrin Party"] = {abbrev = "CP", color = "#E31E25", shortname = "",},
["Montserrat Labour Party"] = {abbrev = "", color = "red", shortname = "",},
["Moovendar Munnetra Kazhagam"] = {abbrev = "", color = "Pink", shortname = "",},
["Moral Vanguard of the Fatherland"] = {abbrev = "VMP", color = "yellow", shortname = "",},
["Morality, Initiative and Patriotism"] = {abbrev = "MIP", color = "#009168", shortname = "",},
["Moravané"] = {abbrev = "", color = "#FFE101", shortname = "",},
["Moravian Democratic Party"] = {abbrev = "MDS", color = "#00ffff", shortname = "",},
["Moravian Land Movement"] = {abbrev = "", color = "#FFDF10", shortname = "",},
["More Europe"] = {abbrev = "", color = "gold", shortname = "",},
["More for Telde"] = {abbrev = "", color = "#08669A", shortname = "",},
["More Galicia"] = {abbrev = "", color = "#0191C6", shortname = "",},
["More Than One Citizen Platform of Guadalajara"] = {abbrev = "", color = "#99CF16", shortname = "",},
["Morecambe Bay Independents"] = {abbrev = "", color = "#000000", shortname = "MB Independent",},
["Morena (political party)"] = {abbrev = "", color = "#C0311A", shortname = "MORENA",},
["Morley Borough Independents"] = {abbrev = "", color = "#006600", shortname = "",},
["Moroccan Communist Party"] = {abbrev = "", color = "red", shortname = "Communist",},
["Moroccan Liberal Party"] = {abbrev = "", color = "#C58E34", shortname = "",},
["Moroccan Union for Democracy"] = {abbrev = "", color = "#CD1237", shortname = "",},
["Moroccan Workers' Union"] = {abbrev = "", color = "#0160B2", shortname = "",},
["Most–Híd"] = {abbrev = "", color = "#F58120", shortname = "Most-Híd",},
["Mostolenian Socialism"] = {abbrev = "", color = "#962016", shortname = "",},
["Motherland Defenders Party"] = {abbrev = "PZV", color = "#E30B5C", shortname = "",},
["Motherland Party (Azerbaijan)"] = {abbrev = "", color = "#022F56", shortname = "Motherland",},
["Motherland Party (Mongolia)"] = {abbrev = "", color = "yellow", shortname = "",},
["Motherland Party (Turkey)"] = {abbrev = "ANAP", color = "#FFD300", shortname = "",},
["Motril Dice"] = {abbrev = "", color = "#21A199", shortname = "",},
["Mountain Party"] = {abbrev = "", color = "#004b24", shortname = "Mountain",},
["Mouvement Action Socialiste"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Mouvement Authentique Mauricien"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Mouvement des Citoyens pour le Changement"] = {abbrev = "", color = "#0897A7", shortname = "",},
["Mouvement Franciste"] = {abbrev = "", color = "darkblue", shortname = "",},
["Mouvement Libérateur"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Mouvement Mauricien Sociale Démocrate"] = {abbrev = "", color = "#00BFFF", shortname = "",},
["Mouvement National Congolais"] = {abbrev = "", color = "#0047AB", shortname = "",},
["Move Forward Party"] = {abbrev = "", color = "#FF7F2A", shortname = "Move Forward",},
["Movem Reus"] = {abbrev = "", color = "#71B223", shortname = "",},
["Movement 21"] = {abbrev = "D21", color = "#824D99", shortname = "",},
["Movement 21 (Bonaire)"] = {abbrev = "M21", color = "#FF808B", shortname = "",},
["Movement 88"] = {abbrev = "", color = "#AA0088", shortname = "",},
["Movement Against Illegal Immigration"] = {abbrev = "DPNI", color = "#A2070F", shortname = "",},
["Movement for a Democratic Slovakia"] = {abbrev = "HZDS", color = "#00CCFF", shortname = "",},
["Movement for a Europe of Liberties and Democracy"] = {abbrev = "MELD", color = "#007A89", shortname = "",},
["Movement for a Europe of Nations and Freedom"] = {abbrev = "", color = "#26428B", shortname = "",},
["Movement for an Equal Public Model"] = {abbrev = "", color = "#2a4b98", shortname = "",},
["Movement for Autonomous Democracy–Party for Moravia and Silesia"] = {abbrev = "HSD–SMS", color = "#FF9999", shortname = "",},
["Movement for Autonomy"] = {abbrev = "", color = "#00CCCC", shortname = "",},
["Movement for Benalmádena"] = {abbrev = "", color = "#18A6B1", shortname = "",},
["Movement for Change (Greece)"] = {abbrev = "KINAL", color = "#179045", shortname = "",},
["Movement for Change and Prosperity"] = {abbrev = "MCAP", color = "#FFFF01", shortname = "",},
["Movement for Changes"] = {abbrev = "PzP", color = "#0D70B1", shortname = "",},
["Movement for Constitutional Freedoms"] = {abbrev = "MLS", color = "#FFFF00", shortname = "",},
["Movement for Democracy (Cape Verde)"] = {abbrev = "MpD", color = "#01C700", shortname = "",},
["Movement for Democracy (Slovakia)"] = {abbrev = "HZD", color = "#79B6D7", shortname = "",},
["Movement for Democracy and Development (Central African Republic)"] = {abbrev = "", color = "#191970", shortname = "",},
["Movement for Democracy and Progress (Comoros)"] = {abbrev = "MDP", color = "", shortname = "",},
["Movement for Democracy and Progress (Niger)"] = {abbrev = "MDP-Alkawali", color = "green", shortname = "",},
["Movement for Democracy and Reconstruction"] = {abbrev = "MDR", color = "#71A1D1", shortname = "",},
["Movement for Democratic Change – Mutambara"] = {abbrev = "MDC-M", color = "#FF7F00", shortname = "",},
["Movement for Democratic Change – Ncube"] = {abbrev = "MDC–N", color = "#1EDD1E", shortname = "",},
["Movement for Democratic Change – Tsvangirai"] = {abbrev = "MDC–T", color = "#DC241f", shortname = "",},
["Movement for Democratic Change (1999–2005)"] = {abbrev = "MDC", color = "#DC241f", shortname = "",},
["Movement for Democratic Change (prior to 2005)"] = {abbrev = "MDC", color = "#DC241f", shortname = "",},
["Movement for Democratic Change Alliance"] = {abbrev = "", color = "#ed1c24", shortname = "",},
["Movement for Democratic Change"] = {abbrev = "", color = "#DC241f", shortname = "",},
["Movement for Democratic Renewal and Development"] = {abbrev = "", color = "#333399", shortname = "",},
["Movement for Dignity and Citizenship"] = {abbrev = "MDyC", color = "#2D2D2D", shortname = "",},
["Movement for Dignity and Independence"] = {abbrev = "", color = "#FFEF00", shortname = "",},
["Movement for Economic Change"] = {abbrev = "MEC", color = "#1F4398", shortname = "",},
["Movement for Economic Empowerment"] = {abbrev = "MOVEE", color = "", shortname = "",},
["Movement for European Reform"] = {abbrev = "MER", color = "#30455e", shortname = "",},
["Movement for France"] = {abbrev = "MPF", color = "#8040C0", shortname = "",},
["Movement for Grassroots Democracy"] = {abbrev = "MGD", color = "#FFFDD0", shortname = "",},
["Movement for Humanist Socialism"] = {abbrev = "", color = "#FFEA3F", shortname = "",},
["Movement for Multi-Party Democracy"] = {abbrev = "MMD", color = "#0064FF", shortname = "",},
["Movement for National Development (Trinidad and Tobago)"] = {abbrev = "MND", color = "#2A60AA", shortname = "",},
["Movement for National Development"] = {abbrev = "", color = "#2D276C", shortname = "",},
["Movement for National Reform"] = {abbrev = "MRN", color = "#C1CC6F", shortname = "",},
["Movement for People's Unity–Republicans"] = {abbrev = "", color = "#DA251C", shortname = "",},
["Movement for Piedmontese Regional Autonomy"] = {abbrev = "MARP", color = "#6578DC", shortname = "",},
["Movement for Prague 11"] = {abbrev = "HPP11", color = "#FECC00", shortname = "",},
["Movement for Progressive Change"] = {abbrev = "", color = "#008000", shortname = "",},
["Movement for Reconstruction of Poland"] = {abbrev = "ROP", color = "#BD0934", shortname = "",},
["Movement for Reversal"] = {abbrev = "PZP", color = "#F7801D", shortname = "",},
["Movement for Rights and Freedoms"] = {abbrev = "DPS", color = "#0066B7", shortname = "",},
["Movement for Social Democracy"] = {abbrev = "EDEK", color = "#164f46", shortname = "",},
["Movement for Social Justice"] = {abbrev = "MSJ", color = "#27AAE1", shortname = "",},
["Movement for Socialism (Bolivia)"] = {abbrev = "MAS-IPSP", color = "#143A83", shortname = "",},
["Movement for Socialism (Venezuela)"] = {abbrev = "", color = "DarkOrange", shortname = "Movement for Socialism",},
["Movement for Sovereignty"] = {abbrev = "", color = "#1B63AB", shortname = "",},
["Movement for the Defence of the Republic"] = {abbrev = "MDR", color = "#BEE4E5", shortname = "",},
["Movement for the Future of Curaçao"] = {abbrev = "MFK", color = "#01A7FF", shortname = "",},
["Movement for the Independence of Sicily"] = {abbrev = "MIS", color = "#FFEB3B", shortname = "",},
["Movement for the Liberation of Peoples"] = {abbrev = "MLP", color = "#EC0408", shortname = "",},
["Movement for the Liberation of São Tomé and Príncipe – Social Democratic Party"] = {abbrev = "MLSTP–PSD", color = "#00AD06", shortname = "",},
["Movement for the Liberation of the Central African People"] = {abbrev = "MLPC", color = "#15A247", shortname = "",},
["Movement for the Liberation of the Congo"] = {abbrev = "MLC", color = "blue", shortname = "",},
["Movement for the Progress of Madagascar"] = {abbrev = "", color = "red", shortname = "",},
["Movement for the Renewal of Social Zionism"] = {abbrev = "", color = "#1C2969", shortname = "",},
["Movement for the Restoration of the Kingdom of Serbia"] = {abbrev = "POKS", color = "#4169E1", shortname = "",},
["Movement for the Social Evolution of Black Africa"] = {abbrev = "MESAN", color = "black", shortname = "",},
["Movement for the Unity of the Canarian People"] = {abbrev = "", color = "#60B16B", shortname = "",},
["Movement for Tolerance and Progress"] = {abbrev = "", color = "red", shortname = "",},
["Movement For!"] = {abbrev = "", color = "#FFF200", shortname = "",},
["Movement in Support of the Army"] = {abbrev = "DPA", color = "#7C273A", shortname = "",},
["Movement Now"] = {abbrev = "Liik", color = "#ae2375", shortname = "",},
["Movement of Action in Solidarity"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Movement of Centrist Republicans"] = {abbrev = "", color = "#133366", shortname = "",},
["Movement of Democratic Action"] = {abbrev = "PDA", color = "#8fbc8f", shortname = "",},
["Movement of Democratic Integration"] = {abbrev = "", color = "#FF9000", shortname = "",},
["Movement of Democratic Socialists"] = {abbrev = "", color = "#E70C21", shortname = "",},
["Movement of Ecologists – Citizens' Cooperation"] = {abbrev = "KOSP", color = "#0A9748", shortname = "",},
["Movement of Free Citizens (Algeria)"] = {abbrev = "MCL", color = "", shortname = "",},
["Movement of Free Citizens (Serbia)"] = {abbrev = "PSG", color = "#63C3D0", shortname = "",},
["Movement of Growth Objectors"] = {abbrev = "", color = "#BB0000", shortname = "",},
["Movement of Independent Citizens of São Tomé and Príncipe"] = {abbrev = "", color = "black", shortname = "",},
["Movement of Independents for the Harmonious Development of Municipalities and Cities"] = {abbrev = "HNHRM", color = "pink", shortname = "",},
["Movement of Militant Muslims"] = {abbrev = "MMM", color = "#FFE4E1", shortname = "",},
["Movement of National Solidarity"] = {abbrev = "MSN", color = "lightgreen", shortname = "",},
["Movement of National Understanding"] = {abbrev = "MEN", color = "#006b00", shortname = "",},
["Movement of New Forces"] = {abbrev = "RNS", color = "#0068ae", shortname = "",},
["Movement of Popular Participation"] = {abbrev = "", color = "#E34234", shortname = "",},
["Movement of Progressives"] = {abbrev = "MDP", color = "#9C005E", shortname = "",},
["Movement of Socialist Democrats"] = {abbrev = "", color = "SeaGreen", shortname = "",},
["Movement of Socialists"] = {abbrev = "PS", color = "#E62020", shortname = "",},
["Movement of Society for Peace"] = {abbrev = "MSP", color = "#009900", shortname = "",},
["Movement of the First"] = {abbrev = "", color = "#FD4F4A", shortname = "",},
["Movement of Unity"] = {abbrev = "MU", color = "#90BF43", shortname = "",},
["Movement Party (France)"] = {abbrev = "", color = "#FB607F", shortname = "",},
["Movement to Defend the Pancasila"] = {abbrev = "GPPS", color = "#FFA500", shortname = "",},
["Movement We Are Venezuela"] = {abbrev = "", color = "#621E7B", shortname = "",},
["Movemento pola Base"] = {abbrev = "", color = "#1B9EE4", shortname = "",},
["Movementu Kousa Promé"] = {abbrev = "", color = "#C24483", shortname = "",},
["Movementu Progresivo"] = {abbrev = "", color = "#D4306B", shortname = "",},
["MOVER (political party)"] = {abbrev = "", color = "#438b44", shortname = "MOVER",},
["Mover Parla"] = {abbrev = "", color = "#9BBB59", shortname = "",},
["Moviment Patrijotti Maltin"] = {abbrev = "", color = "#FF4000", shortname = "",},
["Movimiento al Socialismo (Argentina)"] = {abbrev = "MAS", color = "#FE3A3B", shortname = "Movement for Socialism",},
["Movimiento Construye"] = {abbrev = "", color = "#000080", shortname = "Construye",},
["Movimiento Nacional"] = {abbrev = "", color = "#708090", shortname = "National Movement",},
["Movimiento Unión Soberanista"] = {abbrev = "", color = "#66CCCC", shortname = "",},
["Movimiento Victoria Ciudadana"] = {abbrev = "MVC", color = "#E0A230", shortname = "Citizens' Victory",},
["MPLA"] = {abbrev = "", color = "#CE0921", shortname = "",},
["Mudiraj Rashtriya Samithi"] = {abbrev = "", color = "#996666", shortname = "",},
["Muhajir Qaumi Movement (Haqiqi)"] = {abbrev = "MQM-H", color = "red", shortname = "",},
["Muintir na hÉireann"] = {abbrev = "", color = "#8032CC", shortname = "",},
["Mukt Bharat"] = {abbrev = "", color = "#00FF33", shortname = "",},
["Municipal Assemblies of Fuerteventura"] = {abbrev = "", color = "#0806AF", shortname = "",},
["Municipal Independent Platform of Villalbilla"] = {abbrev = "", color = "#FBED06", shortname = "",},
["Municipal Reform Party"] = {abbrev = "", color = "#0087DC", shortname = "Municipal Reform",},
["Municipal Unity 9"] = {abbrev = "", color = "#FF5F00", shortname = "",},
["Municipalists for Change"] = {abbrev = "", color = "#73969B", shortname = "",},
["Murba Party"] = {abbrev = "", color = "#ffe5e5", shortname = "Murba",},
["Murcian Regionalist Party"] = {abbrev = "", color = "#CE9A00", shortname = "",},
["Mureran Democratic Convergence"] = {abbrev = "", color = "#033780", shortname = "",},
["Musavat"] = {abbrev = "", color = "#3BB9FF", shortname = "",},
["Muslim Bosniak Organisation"] = {abbrev = "", color = "green", shortname = "",},
["Muslim Brotherhood in Egypt"] = {abbrev = "", color = "#009900", shortname = "",},
["Muslim Brotherhood of Syria"] = {abbrev = "", color = "#009900", shortname = "",},
["Muslim Brotherhood"] = {abbrev = "", color = "#009900", shortname = "",},
["Muslim Committee of Action"] = {abbrev = "", color = "green", shortname = "",},
["Muslim League (Qayyum)"] = {abbrev = "", color = "green", shortname = "",},
["Muslim League Kerala State Committee"] = {abbrev = "MUL", color = "green", shortname = "",},
["Muslim League"] = {abbrev = "", color = "#00CCCC", shortname = "",},
["Muslim People's Party of Malaysia"] = {abbrev = "HAMIM", color = "", shortname = "",},
["Muslim People's Republican Party"] = {abbrev = "MPRP", color = "#A7E3A3", shortname = "",},
["Muslim Union Party"] = {abbrev = "MUP", color = "#32CD32", shortname = "",},
["Mustaqbil Pakistan"] = {abbrev = "", color = "blue", shortname = "",},
["Mutahida Deeni Mahaz"] = {abbrev = "MDM", color = "#FFFFFF", shortname = "",},
["Muttahida Majlis-e-Amal"] = {abbrev = "MMA", color = "#004000", shortname = "",},
["Muttahida Qabail Party"] = {abbrev = "MQP", color = "#40E0D0", shortname = "",},
["Muttahida Qaumi Movement – London"] = {abbrev = "MQM", color = "#C80000", shortname = "",},
["Muttahida Qaumi Movement – Pakistan"] = {abbrev = "MQM-P", color = "#be1212", shortname = "",},
["Muttahida Qaumi Movement"] = {abbrev = "MQM", color = "#C80000", shortname = "",},
["Muttahidoon"] = {abbrev = "", color = "#0D4E76", shortname = "",},
["Muungano Party"] = {abbrev = "MP", color = "#254306", shortname = "",},
["My Family"] = {abbrev = "MF", color = "#00ec03", shortname = "",},
["My Homeland Kyrgyzstan"] = {abbrev = "", color = "", shortname = "Mekenim Kyrgyzstan",},
["My Step Alliance"] = {abbrev = "", color = "#ED1A24", shortname = "",},
["My Vote Counts!"] = {abbrev = "", color = "#CD5C5C", shortname = "",},
["Myanmar Farmers Development Party"] = {abbrev = "", color = "#F01A26", shortname = "",},
["Myanmar National Congress"] = {abbrev = "MNC", color = "#ED1E24", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
a0d567eafa4c4f92f55a7259d1b21cbe25b44d0c
Template:UF-hcal
10
244
481
480
2023-12-24T02:13:54Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:UF-hcal]]
wikitext
text/x-wiki
{{Microformat message
| format = hCalendar
| data = event details
| subtemplates =
{{#if:{{{hide_subtemplates}}} |<noinclude>}}
Dates will only be included if you use {{tl|start date}} (for single dates) or {{tl|end date}}. Do not, however, use these templates [[Wikipedia:WikiProject Microformats/dates|if a date before 1583 CE is involved]].
To include URLs, use {{tl|URL}}.
{{#if:{{{hide_subtemplates}}} |</noinclude>}}
|attendee |contact |description |dtend |dtstart |location |organiser |summary |url |vevent
| nocollapse = on
}}<includeonly>{{#ifeq:{{SUBPAGENAME}}|doc | |{{#ifeq:{{SUBPAGENAME}}|sandbox | |[[Category:Templates generating hCalendars|{{PAGENAME}}]]}} }}</includeonly><noinclude>
{{Documentation |content={{Microformat message templates}}}}
[[Category:Microformat (uF) message templates]]
</noinclude>
f453b47f676a5c474e14155f7013b69b4716748b
Template:Infobox election/doc
10
245
483
482
2023-12-24T02:14:01Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Infobox_election/doc]]
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{High-use}}
{{ombox|type=style|text=This is not for [[referendums]]; use '''{{Tlg|Infobox referendum}}''' instead.}}
{{Lua|Module:Infobox|Module:InfoboxImage|Module:String|Module:Check for unknown parameters}}
This infobox describes a presidential, primary, legislative or parliamentary election.
For legislative elections with many parties, consider using {{tl|Infobox legislative election}} instead.
== Usage ==
Remove fields for different types of elections.
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox election
| election_name =
| country =
| flag_year =
| flag_image =
| type = <!-- presidential, parliamentary, legislative, primary, or by-election --><!-- MANDATORY, and limited to the preceding five types -->
| vote_type = Popular <!-- default -->
| ongoing =
| party_colour =
| party_name =
| alliance_name =
| previous_election =
| previous_year =
| outgoing_members =
| election_date = <!-- {{Start date|YYYY|MM|DD}} -->
| elected_members =
| next_election = <!--page title, will be linked if it exists-->
| next_year =
| votes_for_election=
| needed_votes =
| seats_for_election=
| majority_seats =
| opinion_polls =
| registered =
| turnout =
| votes_counted = <!-- Use ONE out of votes_counted, reporting or declared, do not include percentage (%) sign-->
| reporting = <!-- Use ONE out of votes_counted, reporting or declared, do not include percentage (%) sign-->
| declared = <!-- Use ONE out of votes_counted, reporting or declared, do not include percentage (%) sign-->
| last_update =
| time_zone =
| image_upright =
| filler = <!-- (fills whitespace to the left of image1 with filler text, such as "Political selections")-->
<!-- person 1 -->
| image1 =
| image1_size =
| image1_upright =
| colour1 =
| nominee1 = <!-- when appropriate, candidate1 can be used instead -->
| candidate1 = <!-- any type of election -->
| leader1 = <!-- legislative or parliamentary only-->
| party1 =
| alliance1 =
<!-- presidential -->
| home_state1 =
| running_mate1 =
| electoral_vote1 =
| delegate_count1 =
| states_carried1 =
| districts_won1 =
<!-- legislative or parliamentary -->
| leader_since1 =
| leaders_seat1 =
| last_election1 =
| seats_before1 =
| seats_needed1 =
| seats1 =
| seats_after1 =
| seat_change1 =
<!-- any -->
| popular_vote1 =
| percentage1 =
| swing1 = <!-- legislative or parliamentary only-->
<!-- person 2 -->
| image2 =
| image2_size =
| image2_upright =
| colour2 =
| nominee2 = <!-- presidential only, when appropriate, candidate2 can be used instead -->
| candidate2 = <!-- any type of election -->
| leader2 = <!-- legislative or parliamentary only-->
| party2 =
| alliance2 =
<!-- presidential -->
| home_state2 =
| running_mate2 =
| electoral_vote2 =
| delegate_count2 =
| states_carried2 =
| districts_won2 =
<!-- legislative or parliamentary -->
| leader_since2 =
| leaders_seat2 =
| last_election2 =
| seats_before2 =
| seats_needed2 =
| seats2 =
| seats_after2 =
| seat_change2 =
<!-- any -->
| popular_vote2 =
| percentage2 =
| swing2 = <!-- legislative or parliamentary only-->
<!-- polls -->
| poll1_date =
| poll1_source =
| poll1_nominee1 = <!-- presidential only, when appropriate, poll1_candidate1 can be used instead -->
| poll1_party1 = <!-- legislative or parliamentary only-->
| poll1_nominee2 = <!-- presidential only, when appropriate, poll1_candidate2 can be used instead -->
| poll1_party2 = <!-- legislative or parliamentary only-->
| poll2_date =
| poll2_source =
| poll2_nominee1 = <!-- presidential only, when appropriate, poll2_candidate1 can be used instead -->
| poll2_party1 = <!-- legislative or parliamentary only-->
| poll2_nominee2 = <!-- presidential only, when appropriate, poll2_candidate2 can be used instead -->
| poll2_party2 = <!-- legislative or parliamentary only-->
<!-- auxiliary rows -->
| 1blank =
| 1data1 =
| 1data2 =
| 2blank =
| 2data1 =
| 2data2 =
<!-- map -->
| map_image =
| map_size =
| map_alt =
| map =
| map_caption =
<!-- bottom -->
| title =
| before_election =
| before_party =
| posttitle =
| after_election =
| after_party =
}}
</syntaxhighlight>
: *Non-optional fields.
: † only displayed if the election is yet to take place.
: ‡ only displayed if the election has finished.
{| class="wikitable"
! Field !! Type !! Description
|-
| '''election_name'''
|*
| Name given to the election. If this field is left empty the page name is displayed
|-
| '''country'''
|
| Country where the election took place.
|-
| '''flag_year'''
|
| For historical elections when an older flag design was in effect, enter the year the flag came into effect (not the election year). Default is to use the current flag.
|-
| '''flag_image'''
|
| For non-country elections, specify the full name of the flag, coat-of-arms, or seal image to display.
|-
| '''type'''
|*
| The type of election. Must be one of five: presidential, legislative, parliamentary, primary, or by-election. Legislative after the election will display majority and minority party, rather than first and second party.
|-
| '''vote_type'''
|
| The type of votes recorded at popular_vote''n''. Defaults to "Popular".
|-
| '''ongoing'''
|*
| Must be either yes or no, whether the election is yet to take place, or completed. Fields marked with a † are only displayed if the election is yet to take place. Fields marked with a ‡ are only displayed if the election has finished. (Default no.)
|-
| '''party_colour'''
|
| Also spelled '''party_color'''. To turn off the party colours enter 'no'.
|-
| '''party_name'''
|
| To turn off linking to the parties enter 'no'.
|-
| '''alliance_name'''
|
| To turn off linking to the alliances enter 'no'.
|-
| '''previous_election'''
|
| The page name of the last election of this type.
|-
| '''previous_year'''
|
| The year the last election of this type took place.
|-
| '''previous_mps''' (DEPRECATED)
| ''legislative''<br/>''parliamentary''
| Also spelled '''previous_MPs''' or '''previous_members''', page name for the members elected in the last election.
|-
| '''outgoing_members'''
| ''legislative''<br/>''parliamentary''
| The page name of the legislative term (typically including a list of members) serving between the previous election and this election.<br />(Can either be a page title or a wiki link.)
|-
| '''election_date'''
|
| Date of election - use {{tl|Start date}}
|-
| '''elected_mps''' (DEPRECATED)
| ''legislative''<br/>''parliamentary''
| Wikilink to the MPs elected in this election.
|-
| '''elected_members'''
| ''legislative''<br/>''parliamentary''
| The page name of the legislative term (typically including a list of members) serving between this election and the next election.<br />(Can either be a page title or a wiki link.)
|-
| '''next_election'''
|
| The page name of the next election of this type. If red link (it doesn't exist), then it will appear unlinked.
|-
| '''next_year'''
|
| The year the next election of this type took place.
|-
| '''<del>next_mps</del>''' (DEPRECATED, REMOVED)
| <del>''legislative''<br/>''parliamentary''</del>
| <del>Also spelled '''next_MPs''' or '''next_members''', page name for the members elected in the next election.</del>
|-
| '''votes_for_election'''
| ''presidential''
| The number of votes for election and the system of voting (e.g. Electoral College).
|-
| '''needed_votes'''
| ''presidential''
| The number of votes required to win. If there is an even number of votes, use the number that is said by the media.
|-
| '''seats_for_election'''
| ''legislative''<br/>''parliamentary''<br/>''by-election''
| The number of seats for election and the house or chamber the seats are for.
|-
| '''majority_seats'''
| ''legislative''<br/>''parliamentary''
| The number of seats required for a [[majority government]]. If there is an even number of seats in the house or chamber, use the number that is said by the media.
|-
| '''opinion_polls'''
|
| Pagename or section anchor of [[opinion poll]]s.
|-
| '''registered'''
|
| Number of [[Voter registration|registered voters]] for this election.
|-
| '''turnout'''
|
| [[Voter turnout]] for this election.
|-
| '''votes_counted'''
| rowspan="3"|
| rowspan="3"|The number of votes or the number of constituencies, in %, that have been counted after polls have closed. '''Do not include''' the percentage sign (%) after number. It is advisable to remove this information soon after the counting process has finished and all the results have been declared. Use '''votes_counted''', '''reporting''' or '''declared''' according to whichever term best suits the specific election and counting procedure
|-
| '''reporting'''
|-
| '''declared'''
|-
| '''last_update'''
|
| The time at which the latest update on results and the number of votes were updated on the infobox
|-
| '''time_zone'''
|
| Time zone of the time given in the ''last_update'' field. Must be linked as normal similar to an article (e.g. <nowiki>[[Greenwich mean time|GMT]])</nowiki>
|-
| '''image_upright'''
|
| Upright for all {{para|image<var>n</var>}}. See [[WP:UPRIGHT]]. Can be overridden by the corresponding {{para|image<var>n</var>_upright}}.
|-
| '''filler'''
|
| Set filler = (text) to include optional filler text, such as "Political selections", to the left of image1.
|-
| '''image1'''
|
| Image of Nominee, head of Party list or Party Leader. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time. In order to work, colour1 or party1 must be entered.
|-
| '''image1_upright'''
|
| Upright for {{para|image1}}. See [[WP:UPRIGHT]]. Overrides {{para|image_upright}}.
|-
| '''colour1'''
|
| Also spelt '''color1'''. Enter a hex colour code (without the <nowiki>#</nowiki>) to override the border colour of image1. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time.
|-
| '''nominee1'''
| ''presidential''<br/>''by-election''
| Name of Nominee. When appropriate, candidate1 can be used instead. The number can be changed up to nine to display different Nominees or Candidates at the same time.
|-
| '''candidate1'''
|
| Name of Candidate. The number can be changed up to nine to display different Candidates at the same time.
|-
| '''leader1'''
| ''legislative''<br/>''parliamentary''
| Name of head of Party list or Party Leader. The number can be changed up to nine to display different Parties at the same time.
|-
| '''party1'''
|
| Political Party using [[:Category:Political party shortname templates|Political party shortname templates]]. The number can be changed up to nine to display different Parties at the same time.
|-
| '''alliance1'''
|
| Political alliance in elections where coalition politics is common.
|-
| '''home_state1'''
| ''presidential''
| The state the Nominee or Candidate represents. The number can be changed up to nine to display different Nominees at the same time.
|-
| '''running_mate1'''
| ''presidential''
| The Nominee's [[Running mate]]. The number can be changed up to nine to display different Nominees at the same time.
|-
| '''electoral_vote1'''
| ''presidential''<br/>‡
| The [[electoral vote]]s obtained by the Nominee. The number can be changed up to nine to display different Nominees at the same time.
|-
| '''projected_vote1'''
| ''presidential''<br/>‡
| The [[electoral vote]]s projected for the Nominee.
|-
| '''delegate_count1'''
| ''presidential''
| The aggregate number of [[Delegate (American politics)|delegate]]s obtained by the candidate. The number can be changed up to nine to display different candidates at the same time. Intended for use in pre-election processes such as selection of delegates to [[United States presidential nominating convention]]s. Intended to be used instead of electoral_vote1 for these cases.
|-
| '''states_carried1'''
| ''presidential''<br/>‡
| The states carried or won by the Nominee. The number can be changed up to nine to display different Nominees at the same time.
|-
| '''districts_won1'''
| ''presidential''<br/>‡
| The number of districts won by the Nominee. The number can be changed up to nine to display different Nominees at the same time.
|-
| '''leader_since1'''
| ''legislative''<br/>''parliamentary''
| The date the Leader took office. The number can be changed up to nine to display different Parties at the same time. Only to be used when the information is in the article body.
|-
| '''leaders_seat1'''
| ''legislative''<br/>''parliamentary''
| The seat the Leader represents. The number can be changed up to nine to display different Parties at the same time. Only to be used when the information is in the article body.
|-
| '''last_election1'''
| ''legislative''<br/>''parliamentary''
| The seat count and percentage of the vote received at the previous election. The number can be changed up to nine to display different Parties at the same time.
|-
| '''seats_before1'''
| ''legislative''<br/>''parliamentary''
| The seat count before the election, labeled 'current seats' if the election is yet to take place. The number can be changed up to nine to display different Parties at the same time.
|-
| '''seats_needed1'''
| ''legislative''<br/>''parliamentary''<br/>†
| The seats required to gain an overall majority. The number can be changed up to nine to display different Parties at the same time.
|-
| '''seats1'''
| ''legislative''<br/>''parliamentary''<br/>‡
| The seats won at the election. The number can be changed up to nine to display different Parties at the same time.
|-
| '''seats_after1'''
| ''legislative''<br/>''parliamentary''<br/>‡
| The seat count after the election. The number can be changed up to nine to display different Parties at the same time.
|-
| '''seat_change1'''
| ''legislative''<br/>''parliamentary''<br/>‡
| The change in the number of seats won at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.
|-
| '''popular_vote1'''
| ‡
| The number of votes obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.
|-
| '''percentage1'''
| ‡
| The percentage of the popular vote obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.
|-
| '''swing1'''
| ''legislative''<br/>''parliamentary''<br/>‡
| The [[Swing (politics)|swing]] or change in popular vote at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.
|-
| '''poll1_date'''
| †
| The date of an opinion poll. The number can be changed up to five to display different polls at the same time.
|-
| '''poll1_source'''
| †
| The source or URL of the opinion poll. The number can be changed up to five to display different polls at the same time.
poll1_nominee1
|-
| '''poll1_nominee1'''
| ''presidential''<br/>†
| The percentage poll 1 gave to nominee 1. When appropriate, '''poll1_candidate1''' can be used instead. The poll number can be changed up to five to display different polls at the same time. The nominee or candidate number can be changed up to nine to display different Nominees or Candidates at the same time.
|-
| '''poll1_party1'''
| ''legislative''<br/>''parliamentary''<br/>†
| The percentage poll 1 gave to party 1. The poll number can be changed up to five to display different polls at the same time. The party number can be changed up to nine to display different Nominees at the same time.
|-
| '''1blank'''
|
| Title of an auxiliary row. The number can be changed up to six to display six extra rows.
|-
| '''1data1'''
|
| Data 1 for nominee or party 1. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.
|-
| '''map_image'''
|
| Page name for the election map file.
|-
| '''map_size'''
|
| Size of image of the election map to be displayed. (Default 300px).
|-
| '''map_alt'''
|
| [[WP:Alternative text for images|Alt text]] for the election map.
|-
| '''map'''
|
| A freeform replacement for the above, which can be used to insert [[mw:extension:ImageMap|extension:ImageMap]]s or templates instead of images.
|-
| '''map_caption'''
|
| Caption on image of the election map to be displayed.
|-
| '''title'''
|
| Title of the leader before the election. (President, Speaker, Government, Prime Minister...)
|-
| '''before_election'''
|
| The leader in power before the election, labeled [[incumbent]] if the election is yet to take place.
|-
| '''before_party'''
|
| The party in power before the election. This can be set to "Acting (law)" (which will display as "[[Acting (law)|Acting]]") if necessary.
|-
| '''posttitle'''
| ‡
| Title of the victor of the election (President-elect, Prime Minister-designate...), only if different than before.
|-
| '''after_election'''
| ‡
| The leader in power as a result of the election. In case of an ongoing primary, this field may contain the name of the presumptive nominee. If an election is decided by a country's Constitutional/Supreme Court, the leader and the party in power are both listed in this field and a link to the court decision is listed one line below the leader in power. If an election is annulled, the term "Election results annulled" or similar is listed here and a note is listed one line below that.
|-
| '''after_party'''
| ‡
| The party in power as a result of the election.
|}
== Notes ==
The template can display up to nine parties or nominees at the same time, three per row. If exactly four are needed, use the first two on the top and bottom lines. This is done by only using the numbers 1, 2, 4 and 5 on the fields that require a number.
All the fields that work for Legislative will also work for Parliamentary. The only difference between the two is the titles above the images.
The template uses the party fields to display the party colour in the background of the images and some text. To turn this function off, input:
| party_colour = no
To override the calling of the party short name templates, input:
| party_name = no
To override the calling of the alliance short name templates, input:
| alliance_name = no
To override the colour for party1 or nominee1, input:
| colour1 = [HEX OF COLOUR, MINUS #]
The hex number must be entered without the hash for the field to work. The number (colour'''1''') can be changed up to nine for different parties or Nominees. The fields work with both spellings of the word 'color'.
In 2013, the Request for Comment (RFC) process established a consensus that third party candidates must poll over 5% to be included in an infobox, at least for elections in the United States. This was re-affirmed in 2017. RFCs on whether the 5% threshold is necessary for second-place finishers to be included in the infobox have been mixed. (See [[Wikipedia:Five percent rule]])
=== Which leader to use ===
The parties are shown in the infobox in the order they came in the election. The "leader" of each party is the person leading the party through that election.
== Examples ==
=== Presidential ===
{{Infobox election
| election_name = 2004 United States presidential election
| country = United States
| type = presidential
| previous_election = 2000 United States presidential election
| previous_year = 2000
| election_date = {{Start date|2004|11|02}}
| next_election = 2008 United States presidential election
| next_year = 2008
| votes_for_election= All [[List of United States presidential electors, 2004|538 electoral votes]] of the [[Electoral College (United States)|Electoral College]]
| needed_votes = 270 electoral
| image_size = 160x180px
| filler = Political selections
<!-- George W. Bush -->
| image1 = George-W-Bush.jpeg
| nominee1 = [[George W. Bush]]
| party1 = Republican Party (US)
| home_state1 = [[Texas]]
| running_mate1 = [[Dick Cheney|Richard B. Cheney]]
| electoral_vote1 = 286
| states_carried1 = 31
| popular_vote1 = 62,040,610
| percentage1 = 50.7%
<!-- John Kerry -->
| image2 = John Kerry headshot with US flag.jpg
| nominee2 = [[John Kerry]]
| party2 = Democratic Party (US)
| home_state2 = [[Massachusetts]]
| running_mate2 = [[John Edwards]]
| electoral_vote2 = 251
| states_carried2 = 19 + [[Washington, D.C.|DC]]
| popular_vote2 = 59,028,444
| percentage2 = 48.3%
<!-- map -->
| map_image = ElectoralCollege2004.svg
| map_size = 270px
| map_caption = Presidential election results map
<!-- bottom -->
| title = President
| before_election = [[George W. Bush]]
| before_party = Republican Party (US)
| after_election = [[George W. Bush]]
| after_party = Republican Party (US)
}}
<syntaxhighlight lang="wikitext" style="overflow: auto">
{{Infobox election
| election_name = 2004 United States presidential election
| country = United States
| type = presidential
| previous_election = 2000 United States presidential election
| previous_year = 2000
| election_date = {{Start date|2004|11|02}}
| next_election = 2008 United States presidential election
| next_year = 2008
| votes_for_election= All [[List of United States presidential electors, 2004|538 electoral votes]] of the [[Electoral College (United States)|Electoral College]]
| needed_votes = 270 electoral
| image_size = 160x180px
| filler = Political selections
<!-- George W. Bush -->
| image1 = George-W-Bush.jpeg
| nominee1 = [[George W. Bush]]
| party1 = Republican Party (US)
| home_state1 = [[Texas]]
| running_mate1 = [[Dick Cheney|Richard B. Cheney]]
| electoral_vote1 = 286
| states_carried1 = 31
| popular_vote1 = 62,040,610
| percentage1 = 50.7%
<!-- John Kerry -->
| image2 = John Kerry headshot with US flag.jpg
| nominee2 = [[John Kerry]]
| party2 = Democratic Party (US)
| home_state2 = [[Massachusetts]]
| running_mate2 = [[John Edwards]]
| electoral_vote2 = 251
| states_carried2 = 19 + [[Washington, D.C.|DC]]
| popular_vote2 = 59,028,444
| percentage2 = 48.3%
<!-- map -->
| map_image = ElectoralCollege2004.svg
| map_size = 270px
| map_caption = Presidential election results map
<!-- bottom -->
| title = President
| before_election = [[George W. Bush]]
| before_party = Republican Party (US)
| after_election = [[George W. Bush]]
| after_party = Republican Party (US)
}}</syntaxhighlight>
{{-}}
=== Presidential primary ===
{{Infobox election
| election_name = [[Republican Party presidential primaries, 2016]]
| country = United States
| type = primary
| ongoing = yes
| previous_election = 2012 Republican Party presidential primaries
| previous_year = 2012
| next_election = 2020 Republican Party presidential primaries
| next_year = ''2020''
| election_date = February 1 – June 7, 2016
| votes_for_election = 2,472 delegates to the [[2016 Republican National Convention|Republican National Convention]]
| needed_votes = 1,237 delegate
| party_name = no
| image_size = 160x180px
<!-- Donald Trump -->
| image1 = Donald August 19 (cropped).jpg
| candidate1 = '''[[Donald Trump]]'''
| color1 = 283681
| home_state1 = [[New York (state)|New York]]
| states_carried1 = '''28'''
| popular_vote1 = '''10,713,526'''
| percentage1 = '''40.2%'''
| delegate_count1 = '''1,014'''
<!-- Ted Cruz-->
| image2 = Ted Cruz, official portrait, 113th Congress (cropped 2).jpg
| candidate2 = [[Ted Cruz]]
| color2 = DAA520
| home_state2 = [[Texas]]
| states_carried2 = 11
| popular_vote2 = 7,321,878
| percentage2 = 27.5%
| delegate_count2 = 546
<!-- Marco Rubio -->
| image4 = Marco Rubio, Official Portrait, 112th Congress.jpg
| candidate4 = [[Marco Rubio]]
| color4 = C60E3B
| home_state4 = [[Florida]]
| states_carried4 = 3
| popular_vote4 = 3,497,828
| percentage4 = 13.1%
| delegate_count4 = 173
<!-- John Kasich -->
| image5 = Governor John Kasich (cropped2).jpg
| candidate5 = [[John Kasich]]
| color5 = 29AB87
| home_state5 = [[Ohio]]
| states_carried5 = 1
| popular_vote5 = 3,762,367
| percentage5 = 14.1%
| delegate_count5 = 154
| map_image = Republican Party presidential primaries results, 2016.svg
| map_size = 308px
| map_caption = '''First place by first-instance vote'''
{{{!}} style="font-size:110%; margin:0 auto;"
{{!}} {{Legend0|#283681|Donald Trump}} {{!}}{{!}} {{Legend0|#DAA520|Ted Cruz}}
{{!}}-
{{!}} {{Legend0|#C60E3B|Marco Rubio}} {{!}}{{!}} {{Legend0|#29AB87|John Kasich}}
{{!}}-
{{!}} {{Legend0|#000000|Uncommitted}} {{!}}{{!}}
{{!}}}
| title = Republican nominee
| before_election = [[Mitt Romney]]
| after_election = [[Donald Trump]]
| template_name = 2016 Republican Party presidential primaries
}}
<syntaxhighlight lang="wikitext" style="overflow: auto">
{{Infobox election
| election_name = [[Republican Party presidential primaries, 2016]]
| country = United States
| type = primary
| ongoing = yes
| previous_election = 2012 Republican Party presidential primaries
| previous_year = 2012
| next_election = 2020 Republican Party presidential primaries
| next_year = ''2020''
| election_date = February 1 – June 7, 2016
| votes_for_election = 2,472 delegates to the [[2016 Republican National Convention|Republican National Convention]]
| needed_votes = 1,237 delegate
| party_name = no
| image_size = 160x180px
<!-- Donald Trump -->
| image1 = Donald August 19 (cropped).jpg
| candidate1 = '''[[Donald Trump]]'''
| color1 = 283681
| home_state1 = [[New York (state)|New York]]
| states_carried1 = '''28'''
| popular_vote1 = '''10,713,526'''
| percentage1 = '''30.2%'''
| delegate_count1 = '''1,014'''
<!-- Ted Cruz-->
| image2 = Ted Cruz, official portrait, 113th Congress (cropped 2).jpg
| candidate2 = [[Ted Cruz]]
| color2 = DAA520
| home_state2 = [[Texas]]
| states_carried2 = 11
| popular_vote2 = 7,321,878
| percentage2 = 37.5%
| delegate_count2 = 546
<!-- Marco Rubio -->
| image4 = Marco Rubio, Official Portrait, 112th Congress.jpg
| candidate4 = [[Marco Rubio]]
| color4 = C60E3B
| home_state4 = [[Florida]]
| states_carried4 = 3
| popular_vote4 = 3,497,828
| percentage4 = 13.1%
| delegate_count4 = 173
<!-- John Kasich -->
| image5 = Governor John Kasich (cropped2).jpg
| candidate5 = [[John Kasich]]
| color5 = 29AB87
| home_state5 = [[Ohio]]
| states_carried5 = 1
| popular_vote5 = 3,762,367
| percentage5 = 14.1%
| delegate_count5 = 154
| map_image = Republican Party presidential primaries results, 2016.svg
| map_size = 308px
| map_caption = '''First place by first-instance vote'''
{{{!}} style="font-size:110%; margin:0 auto;"
{{!}} {{Legend0|#283681|Donald Trump}} {{!}}{{!}} {{Legend0|#DAA520|Ted Cruz}}
{{!}}-
{{!}} {{Legend0|#C60E3B|Marco Rubio}} {{!}}{{!}} {{Legend0|#29AB87|John Kasich}}
{{!}}-
{{!}} {{Legend0|#000000|Uncommitted}} {{!}}{{!}}
{{!}}}
| title = Republican nominee
| before_election = [[Mitt Romney]]
| after_election = [[Donald Trump]]
| template_name = 2016 Republican Party presidential primaries
}}
</syntaxhighlight>
{{-}}
=== Legislative or parliamentary ===
{{Infobox election
| election_name = 2005 United Kingdom general election
| country = United Kingdom
| type = parliamentary
| previous_election = 2001 United Kingdom general election
| previous_year = 2001
| outgoing_members = List of MPs elected in the United Kingdom general election, 2001
| election_date = {{Start date|2005|05|05}}
| elected_members = List of MPs elected in the United Kingdom general election, 2005
| next_election = 2010 United Kingdom general election
| next_year = 2010
| seats_for_election= All [[List of United Kingdom Parliament constituencies 2005–2010|646 seats]] to the [[House of Commons of the United Kingdom|House of Commons]]
| majority_seats = 324
| opinion_polls = #Opinion polls
| turnout = 61.4%
| image_size = 160x180px
<!-- Labour -->
| image1 = TonyBlairBasra.JPG
| leader1 = [[Tony Blair]]
| party1 = Labour Party (UK)
| leader_since1 = 21 July 1994
| last_election1 = 413 seats, 40.7%
| seats_before1 = 403
| seats1 = 355
| seat_change1 = −48
| popular_vote1 = 9,552,436
| percentage1 = 35.2%
| swing1 = −5.5%
<!-- Labour -->
| image4 = Official_portrait_of_Jeremy_Corbyn_2020_(cropped).jpg
| leader4 = [[Jeremy Corbyn]]
| party4 = Labour Party (UK)
| leader_since4 = 12 September 2015
| last_election4 = 7 seats, 27.1%
| seats_before4 = 7
| seats4 = 10
| seat_change4 = +3
| popular_vote4 = 511,838
| percentage4 = 18.6%
| swing4 = −8.5%
<!-- Conservative -->
| image2 = Boris_Johnson_election_infobox.jpg
| leader2 = [[Boris Johnson]]
| party2 = Conservative Party (UK)
| leader_since2 = 23 July 2019
| last_election2 = 13, 28.6%
| seats_before2 = 13
| seats2 = 14
| seat_change2 = +1
| popular_vote2 = 692,939
| percentage2 = 25.1%
| swing2 = -3.5%
<!-- Liberal Democrats -->
| image5 =Official_portrait_of_Jo_Swinson_crop_4.jpg
| leader5 = [[Jo Swinson]]
| party5 = Liberal Democrats (UK)
| leader_since5 = 22 July 2019
| last_election5 = 4 seats, 6.8%
| seats_before5 = 4
| seats5 = 5
| seat_change5 = +1
| popular_vote5 = 263,417
| percentage5 = 9.5%
| swing5 = +2.7%
<!-- map -->
| map_image =
| map_size = 250px
| map_caption = Map of United Kingdom showing constituencies won
}}
<syntaxhighlight lang="wikitext" style="overflow: auto">
{{Infobox election
| election_name = 2005 United Kingdom general election
| country = United Kingdom
| type = parliamentary
| previous_election = 2001 United Kingdom general election
| previous_year = 2001
| outgoing_members = List of MPs elected in the United Kingdom general election, 2001
| election_date = {{Start date|2005|05|05}}
| elected_members = List of MPs elected in the United Kingdom general election, 2005
| next_election = 2010 United Kingdom general election
| next_year = 2010
| seats_for_election= All [[List of United Kingdom Parliament constituencies 2005–2010|646 seats]] to the [[House of Commons of the United Kingdom|House of Commons]]
| majority_seats = 324
| opinion_polls = #Opinion polls
| turnout = 61.4%
| image_size = 160x180px
<!-- Labour -->
| image1 = TonyBlairBasra.JPG
| leader1 = [[Tony Blair]]
| party1 = Labour Party (UK)
| leader_since1 = 21 July 1994
| leaders_seat1 = [[Sedgefield (UK Parliament constituency)|Sedgefield]]
| last_election1 = 40.7%, 413 seats
| seats_before1 = 403
| seats1 = 355
| seat_change1 = −58
| popular_vote1 = 9,552,436
| percentage1 = 35.2%
| swing1 = −5.5%
<!-- Conservative -->
| image2 = Michael Howard 1099 cropped.jpg
| leader2 = [[Michael Howard]]
| party2 = Conservative Party (UK)
| leader_since2 = 6 November 2003
| leaders_seat2 = [[Folkestone and Hythe (UK Parliament constituency)|Folkestone & Hythe]]
| last_election2 = 31.7%, 166 seats
| seats_before2 = 165
| seats2 = 198
| seat_change2 = +32
| popular_vote2 = 8,784,915
| percentage2 = 32.4%
| swing2 = +0.7%
<!-- Liberal Democrats -->
| image3 = Charles Kennedy.jpg
| leader3 = [[Charles Kennedy]]
| party3 = Liberal Democrats
| leader_since3 = 9 August 1999
| leaders_seat3 = [[Ross, Skye and Lochaber (UK Parliament constituency)|Ross, Skye, & Lochaber]]
| last_election3 = 18.3%, 52 seats
| seats_before3 = 51
| seats3 = 62
| seat_change3 = +10
| popular_vote3 = 5,985,454
| percentage3 = 22.0%
| swing3 = +3.7%
<!-- map -->
| map_image = 2005UKElectionMap.svg
| map_size = 250px
| map_caption = Map of United Kingdom showing constituencies won
<!-- bottom -->
| title = Prime Minister
| before_election = [[Tony Blair]]
| before_party = Labour Party (UK)
| after_election = [[Tony Blair]]
| after_party = Labour Party (UK)
}}</syntaxhighlight>
{{-}}
=== By-election ===
{{Infobox election
| election_name = 2012 Bradford West by-election
| type = By-election
| country = United Kingdom
| seats_for_election = The [[Bradford West (UK Parliament constituency)|Bradford West]] seat in the [[House of Commons of the United Kingdom|House of Commons]].<br />Election by simple majority using [[first past the post]].<br />Triggered by resignation of incumbent
| votes_for_election =
| ongoing = no
| previous_election = 2010 United Kingdom general election
| previous_year = 2010
| next_election =
| next_year =
| election_date = {{Start date|2012|03|29|df= y}}
| candidate1 = [[George Galloway]]
| image1 = George Galloway 2007-02-24.jpg
| party1 = Respect Party
| last_election1 = 1,245
| popular_vote1 = 18,341
| percentage1 = 55.9
| candidate2 = Imran Hussain
| image2 =
| party2 = Labour Party (UK)
| last_election2 = 18,401
| popular_vote2 = 8,201
| percentage2 = 25.0
| candidate3 = Jackie Whiteley
| image3 =
| party3 = Conservative Party (UK)
| last_election3 = 12,638
| popular_vote3 = 2,746
| percentage3 = 8.4
| candidate4 = Jeanette Sunderland
| image4 =
| party4 = Liberal Democrats (UK)
| last_election4 = 4,732
| popular_vote4 = 1,505
| percentage4 = 4.6
| candidate5 = Sonja McNally
| image5 =
| party5 = UK Independence Party
| last_election5 = 812
| popular_vote5 = 1,085
| percentage5 = 3.3
| candidate6 = Dawud Islam
| image6 =
| party6 = Green Party of England and Wales
| last_election6 = 940
| popular_vote6 = 481
| percentage6 = 1.5
| title = MP
| posttitle = Subsequent MP
| before_election = [[Marsha Singh]]
| before_party = Labour Party (UK)
| after_election = [[George Galloway]]
| after_party = Respect Party
| map_image = BradfordWest2007Constituency.svg
| map_size = 200px
| map_alt = A map of West Yorkshire with black lines dividing the area into irregular shapes
| map =
| map_caption = Boundary of Bradford West in [[West Yorkshire]].
}}
<syntaxhighlight lang="wikitext" style= "overflow: auto">
{{Infobox election
| election_name = 2012 Bradford West by-election
| type = By-election
| country = United Kingdom
| seats_for_election = The [[Bradford West (UK Parliament constituency)|Bradford West]] seat in the [[House of Commons of the United Kingdom|House of Commons]].<br />Elected by simple majority using [[first past the post]].<br />Triggered by resignation of incumbent
| ongoing = no
| previous_election = 2010 United Kingdom general election
| previous_year = 2010
| next_election =
| next_year =
| election_date = {{Start date|2012|03|29|df= y}}
| candidate1 = [[George Galloway]]
| image1 = George Galloway 2007-02-24.jpg
| party1 = Respect Party
| last_election1 = 1,245
| popular_vote1 = 18,341
| percentage1 = 55.9
| candidate2 = Imran Hussain
| image2 =
| party2 = Labour Party (UK)
| last_election2 = 18,401
| popular_vote2 = 8,201
| percentage2 = 25.0
| candidate3 = Jackie Whiteley
| image3 =
| party3 = Conservative Party (UK)
| last_election3 = 12,638
| popular_vote3 = 2,746
| percentage3 = 8.4
| candidate4 = Jeanette Sunderland
| image4 =
| party4 = Liberal Democrats
| last_election4 = 4,732
| popular_vote4 = 1,505
| percentage4 = 4.6
| candidate5 = Sonja McNally
| image5 =
| party5 = UK Independence Party
| last_election5 = 812
| popular_vote5 = 1,085
| percentage5 = 3.3
| candidate6 = Dawud Islam
| image6 =
| party6 = Green Party of England and Wales
| last_election6 = 940
| popular_vote6 = 481
| percentage6 = 1.5
| title = MP
| posttitle = Subsequent MP
| before_election = [[Marsha Singh]]
| before_party = Labour Party (UK)
| after_election = [[George Galloway]]
| after_party = Respect Party
| map_image = BradfordWest2007Constituency.svg
| map_size = 200px
| map_alt = A map of West Yorkshire with black lines dividing the area into irregular shapes
| map =
| map_caption = Boundary of Bradford West in [[West Yorkshire]].
}}
</syntaxhighlight>
{{-}}
===Annulled election===
{{Infobox election
| election_name = 2019 Bolivian general election
| country = Bolivia
| type = presidential
| previous_election = 2014 Bolivian general election
| previous_year = 2014
| next_election = 2020 Bolivian general election
| next_year = 2020
| election_date = 20 October 2019
| ongoing = no
| turnout = 88.31% ({{increase}} 0.41[[Percentage point|pp]])
<!-- Evo Morales -->| image1 = Evo Morales 2017.jpg
| image1_size = 150x150px
| nominee1 = [[Evo Morales]]
| party1 = Movement for Socialism (Bolivia)
| running_mate1 = [[Álvaro García Linera]]
| popular_vote1 = '''2,889,359'''
| percentage1 = '''47.08%'''
<!-- Carlos Mesa -->| image2 = Carlos Mesa, ex-President of Bolivia (cropped 2).jpg
| image2_size = 150x150px
| nominee2 = [[Carlos Mesa]]
| party2 = [[Civic Community]]
| colour2 = F26524
| running_mate2 = Gustavo Pedraza
| popular_vote2 = 2,240,920
| percentage2 = 36.51%
<!-- Chi Hyun Chung -->| image3 = Chi Hyun Ching (cropped).png
| image3_size = 150x150px
| nominee3 = [[Chi Hyun Chung]]
| party3 = Christian Democratic Party (Bolivia)
| running_mate3 = Paola Barriga
| popular_vote3 = 539,081
| percentage3 = 8.78%
<!-- map -->| map_image = 2019 Bolivian elections map.png
| map_size = 300px
| map_caption =
| title = President
| before_election = [[Evo Morales]]
| before_party = Movement for Socialism (Bolivia)
| after_election = [[2019 Bolivian political crisis|Election results annulled]] <br>[[Jeanine Áñez]] ([[Democrat Social Movement]]) becomes acting president
| after_party =
}}
<syntaxhighlight lang="wikitext" style= "overflow: auto">
{{Infobox election
| election_name = 2019 Bolivian general election
| country = Bolivia
| type = presidential
| previous_election = 2014 Bolivian general election
| previous_year = 2014
| next_election = 2020 Bolivian general election
| next_year = 2020
| election_date = 20 October 2019
| ongoing = no
| turnout = 88.31% ({{increase}} 0.41[[Percentage point|pp]])
<!-- Evo Morales -->| image1 = Evo Morales 2017.jpg
| image1_size = 150x150px
| nominee1 = [[Evo Morales]]
| party1 = Movement for Socialism (Bolivia)
| running_mate1 = [[Álvaro García Linera]]
| popular_vote1 = '''2,889,359'''
| percentage1 = '''47.08%'''
<!-- Carlos Mesa -->| image2 = Carlos Mesa, ex-President of Bolivia (cropped 2).jpg
| image2_size = 150x150px
| nominee2 = [[Carlos Mesa]]
| party2 = [[Civic Community]]
| colour2 = F26524
| running_mate2 = Gustavo Pedraza
| popular_vote2 = 2,240,920
| percentage2 = 36.51%
<!-- Chi Hyun Chung -->| image3 = Chi Hyun Ching (cropped).png
| image3_size = 150x150px
| nominee3 = [[Chi Hyun Chung]]
| party3 = Christian Democratic Party (Bolivia)
| running_mate3 = Paola Barriga
| popular_vote3 = 539,081
| percentage3 = 8.78%
<!-- map -->| map_image = 2019 Bolivian elections map.png
| map_size = 300px
| map_caption =
| title = President
| before_election = [[Evo Morales]]
| before_party = Movement for Socialism (Bolivia)
| after_election = [[2019 Bolivian political crisis|Election results annulled]] <br>[[Jeanine Áñez]] ([[Democrat Social Movement]]) becomes acting president
| after_party =
}}
</syntaxhighlight>
{{-}}
== Microformat ==
{{UF-hcal}}
Note: If no date is entered, then the microformat is not emitted.
== Tracking category ==
* {{clc|Pages using infobox election with unknown parameters}}
== TemplateData ==
{{TemplateData header}}
<templatedata>
{
"description": "An infobox for elections.",
"format": "block",
"params": {
"election_name": {
"label": "Name",
"description": "Name given to the election.",
"type": "string",
"required": false,
"example": "2012 United States Senate election in Nevada",
"autovalue": "{{subst:PAGENAME}}"
},
"country": {
"label": "Country",
"description": "Country where the election took place.",
"type": "string",
"required": false
},
"flag_year": {
"label": "Flag year",
"description": "For historical elections when an older flag design was in effect, enter the year the flag came into effect (not the election year).",
"type": "string",
"default": "current flag",
"required": false
},
"flag_image": {
"label": "Flag image",
"description": "For non-country elections, specify the full name of the flag, coat-of-arms, or seal image to display.",
"type": "string",
"required": false
},
"type": {
"label": "Type",
"description": "The type of election. Must be one of five: presidential, primary, legislative, parliamentary or by-election. The type \"Presidential\" lists nominee's names; legislative will not. Legislative after the election will display majority and minority party, rather than first and second party.",
"type": "string",
"required": false,
"example": "'presidential', 'primary', 'legislative', 'parliamentary', 'by-election'",
"autovalue": "presidential"
},
"vote_type": {
"label": "Vote type",
"description": "The type of votes recorded at popular_voten",
"type": "string",
"default": "popular",
"required": false
},
"ongoing": {
"label": "Ongoing?",
"description": "Must be either 'yes' or 'no', whether the election is yet to take place, or completed. 'no' means the election has concluded and results have been declared; 'yes' means the election has yet to occur and be called.",
"type": "string",
"default": "no",
"example": "'no', 'yes'",
"required": false
},
"party_colour": {
"label": "Show party colours?",
"description": "To turn off the party colours enter 'no'.",
"type": "string",
"required": false,
"aliases": [
"party_color"
],
"example": "no"
},
"party_name": {
"label": "Link to parties?",
"description": "To turn off linking to the parties, enter 'no'.",
"type": "string",
"required": false,
"example": "no"
},
"alliance_name": {
"label": "Link to alliances?",
"description": "To turn off linking to the alliances, enter 'no'.",
"type": "string",
"required": false,
"example": "no"
},
"previous_election": {
"label": "Previous election",
"description": "The page name of the last election of this type.",
"type": "wiki-page-name",
"required": false,
"example": "2000 United States presidential election"
},
"previous_year": {
"label": "Previous year",
"description": "The year the last election of this type took place.",
"type": "number",
"required": false,
"example": "2000"
},
"outgoing_members": {
"label": "Outgoing members",
"description": "The page name of the legislative term (typically including a list of members) serving between the previous election and this election. Can either be a page title or a wiki link.",
"type": "string",
"required": false
},
"election_date": {
"label": "Election date",
"description": "Date of election - use {{Start date|YYYY|mm|dd}}.",
"type": "wiki-template-name",
"example": "{{Start date|2020|11|03}}",
"required": false,
"suggested": true
},
"elected_members": {
"label": "Elected members",
"description": "The page name of the legislative term (typically including a list of members) serving between this election and the next election. Can either be a page title or a wiki link.",
"type": "string",
"required": false
},
"next_election": {
"label": "Next election",
"description": "The page name of the next election of this type. If red link (it doesn't exist), then it will appear unlinked.",
"type": "wiki-page-name",
"required": false,
"example": "2008 United States presidential election"
},
"next_year": {
"label": "Next year",
"description": "The year the next election of this type took place.",
"type": "number",
"required": false,
"example": "2008"
},
"votes_for_election": {
"label": "Votes for election",
"description": "The number of votes for election and the system of voting (eg. Electoral College).",
"type": "content",
"required": false,
"example": "All [[List of United States presidential electors, 2004|538 electoral votes]] of the [[Electoral College (United States)|Electoral College]]"
},
"needed_votes": {
"label": "Needed votes",
"description": "The number of votes required to win. If there is an even number of votes, use the number that is said by the media.",
"type": "string",
"required": false,
"example": "270 electoral"
},
"seats_for_election": {
"label": "Seats for election",
"description": "The number of seats for election and the house or chamber the seats are for.",
"type": "number",
"required": false
},
"majority_seats": {
"label": "Majority seats",
"description": "The number of seats required for a majority government. If there is an even number of seats in the house or chamber, use the number that is said by the media.",
"type": "number",
"required": false
},
"opinion_polls": {
"label": "Opinion polls",
"description": "Pagename or section anchor of opinion polls.",
"type": "string",
"required": false
},
"registered": {},
"turnout": {
"label": "Turnout",
"description": "Voter turnout for this election.",
"type": "string",
"required": false
},
"votes_counted": {
"label": "Percent of votes counted",
"type": "line",
"description": "Use ONE out of votes_counted, reporting, or declared. Do not include percentage (%) sign."
},
"reporting": {
"label": "Percent reporting",
"type": "line",
"description": "Use ONE out of votes_counted, reporting, or declared. Do not include percentage (%) sign."
},
"declared": {
"label": "Percent votes declared",
"type": "line",
"description": "Use ONE out of votes_counted, reporting, or declared. Do not include percentage (%) sign."
},
"college_voted": {},
"last_update": {
"label": "Last update",
"type": "date"
},
"time_zone": {
"label": "Time zone",
"type": "line",
"description": "Time zone of the time given in the ''last_update'' field. Must be linked as normal similar to an article [[Greenwich mean time|GMT]](e.g. )",
"example": "[[Greenwich mean time|GMT]]"
},
"image_size": {
"label": "Image size",
"type": "line",
"example": "x200px",
"description": "Size for images. Can be overridden by image(n)_size",
"required": false
},
"image_upright": {
"label": "Image upright",
"description": "Upright for imagen. See WP:UPRIGHT. Can be overridden by imagen_upright",
"type": "string",
"required": false
},
"previous_mps": {
"type": "string",
"deprecated": true
},
"elected_mps": {
"type": "string",
"deprecated": true
},
"image1": {
"label": "Image 1",
"description": "Image of Nominee, head of Party list or Party Leader. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time. In order to work, colour1 or party1 must be entered.",
"type": "wiki-page-name",
"required": false
},
"image1_size": {
"label": "Image 1 size",
"type": "line",
"example": "x200px",
"description": "Size for image 1. Overrides image_size",
"required": false
},
"image1_upright": {
"label": "Image 1 upright",
"description": "Upright for image1. See WP:UPRIGHT. Overrides image_upright",
"type": "string",
"required": false
},
"colour1": {
"label": "Colour 1",
"description": "Enter a hex colour code (without the #) to override the border colour of image1. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time.",
"type": "string",
"required": false,
"aliases": [
"color1"
]
},
"nominee1": {
"label": "Nominee 1",
"description": "Name of Nominee. When appropriate, candidate1 can be used instead. The number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string",
"required": false
},
"candidate1": {
"label": "Candidate 1",
"description": "Name of Candidate. The number can be changed up to nine to display different Candidates at the same time.",
"type": "string",
"required": false
},
"leader1": {
"label": "Leader 1",
"description": "Name of head of Party list or Party Leader. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"party1": {
"label": "Party 1",
"description": "Political Party using Political party shortname templates. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"alliance1": {
"label": "Alliance 1",
"description": "Political alliance in elections where coalition politics is common.",
"type": "string",
"required": false
},
"home_state1": {
"label": "Home state 1",
"description": "The state the Nominee or Candidate represents. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Texas]]"
},
"running_mate1": {
"label": "Running mate 1",
"description": "The Nominee's Running mate. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Dick Cheney|Richard B. Cheney]]"
},
"electoral_vote1": {
"label": "Electoral vote 1",
"description": "The electoral votes obtained by the Nominee. The number can be changed up to nine to display different Nominees at the same time.",
"type": "string",
"required": false
},
"projected_vote1": {
"label": "Projected electoral vote 1",
"description": "The electoral votes projected for the Nominee.",
"type": "string",
"required": false
},
"delegate_count1": {
"label": "Delegate count 1",
"description": "The aggregate number of delegates obtained by the candidate. The number can be changed up to nine to display different candidates at the same time. Intended for use in pre-election processes such as selection of delegates to United States presidential nominating conventions. Intended to be used instead of electoral_vote1 for these cases.",
"type": "string",
"required": false
},
"states_carried1": {
"label": "States carried 1",
"description": "The states carried or won by the Nominee. The number can be changed up to nine to display different Nominees at the same time.",
"type": "string",
"required": false
},
"districts_won1": {
"label": "Districts won 1",
"description": "The number of districts won by the Nominee. The number can be changed up to nine to display different Nominees at the same time.",
"type": "string",
"required": false
},
"counties_threshold1": {},
"counties_won1": {},
"leader_since1": {
"label": "Leader since 1",
"description": "The date the Leader took office. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"leaders_seat1": {
"label": "Leaders seat 1",
"description": "The seat the Leader represents. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"last_election1": {
"label": "Last election 1",
"description": "The seat count and percentage of the vote received at the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_before1": {
"label": "Seats before 1",
"description": "The seat count before the election, labeled 'current seats' if the election is yet to take place. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_needed1": {
"label": "Seats needed 1",
"description": "The seats required to gain an overall majority. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats1": {
"label": "Seats 1",
"description": "The seats won at the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_after1": {
"label": "Seats after 1",
"description": "The seat count after the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seat_change1": {
"label": "Seat change 1",
"description": "The change in the number of seats won at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"swing1": {
"label": "Swing 1",
"description": "The swing or change in popular vote at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"popular_vote1": {
"label": "Popular vote 1",
"description": "The number of votes obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"percentage1": {
"label": "Percentage 1",
"description": "The percentage of the popular vote obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "line",
"required": false,
"example": "50.7%"
},
"image2": {
"label": "Image 2",
"description": "Image of Nominee, head of Party list or Party Leader. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time. In order to work, colour1 or party1 must be entered.",
"type": "wiki-page-name",
"required": false
},
"image2_size": {
"label": "Image 2 size",
"type": "line",
"example": "x200px",
"description": "Size for image 2. Overrides image_size",
"required": false
},
"image2_upright": {
"label": "Image 2 upright",
"description": "Upright for image2. See WP:UPRIGHT. Overrides image_upright",
"type": "string",
"required": false
},
"colour2": {
"label": "Colour 2",
"description": "Enter a hex colour code (without the #) to override the border colour of image2. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time.",
"type": "string",
"required": false,
"aliases": [
"color2"
]
},
"nominee2": {
"label": "Nominee 2",
"description": "Name of Nominee. When appropriate, candidate1 can be used instead. The number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string",
"required": false
},
"candidate2": {
"label": "Candidate 2",
"description": "Name of Candidate. The number can be changed up to nine to display different Candidates at the same time.",
"type": "string",
"required": false
},
"leader2": {
"label": "Leader 2",
"description": "Name of head of Party list or Party Leader. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"party2": {
"label": "Party 2",
"description": "Political Party using Political party shortname templates. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"alliance2": {
"label": "Alliance 2",
"description": "Political alliance in elections where coalition politics is common.",
"type": "string",
"required": false
},
"home_state2": {
"label": "Home state 2",
"description": "The state the Nominee or Candidate represents. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Massachusetts]]"
},
"running_mate2": {
"label": "Running mate 2",
"description": "The Nominee's Running mate. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[John Edwards]]"
},
"electoral_vote2": {
"label": "Electoral vote 2",
"description": "The electoral votes obtained by the Nominee. The number can be changed up to nine to display different Nominees at the same time.",
"type": "string",
"required": false
},
"projected_vote2": {
"label": "Projected electoral vote 2",
"description": "The electoral votes projected for the Nominee.",
"type": "string",
"required": false
},
"delegate_count2": {
"label": "Delegate count 2",
"description": "The aggregate number of delegates obtained by the candidate. The number can be changed up to nine to display different candidates at the same time. Intended for use in pre-election processes such as selection of delegates to United States presidential nominating conventions. Intended to be used instead of electoral_vote1 for these cases.",
"type": "string",
"required": false
},
"states_carried2": {
"label": "States carried 2",
"description": "The states carried or won by the Nominee. The number can be changed up to nine to display different Nominees at the same time.",
"type": "string",
"required": false
},
"districts_won2": {
"label": "Districts won 2",
"description": "The number of districts won by the Nominee. The number can be changed up to nine to display different Nominees at the same time.",
"type": "string",
"required": false
},
"counties_threshold2": {},
"counties_won2": {},
"leader_since2": {
"label": "Leader since 2",
"description": "The date the Leader took office. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"leaders_seat2": {
"label": "Leaders seat 2",
"description": "The seat the Leader represents. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"last_election2": {
"label": "Last election 2",
"description": "The seat count and percentage of the vote received at the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_before2": {
"label": "Seats before 2",
"description": "The seat count before the election, labeled 'current seats' if the election is yet to take place. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_needed2": {
"label": "Seats needed 2",
"description": "The seats required to gain an overall majority. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats2": {
"label": "Seats 2",
"description": "The seats won at the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_after2": {
"label": "Seats after 2",
"description": "The seat count after the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seat_change2": {
"label": "Seat change 2",
"description": "The change in the number of seats won at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"popular_vote2": {
"label": "Popular vote 2",
"description": "The number of votes obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"percentage2": {
"label": "Percentage 2",
"description": "The percentage of the popular vote obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "line",
"required": false,
"example": "48.3%"
},
"swing2": {
"label": "Swing 2",
"description": "The swing or change in popular vote at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"poll1_date": {
"label": "Poll 1 date",
"description": "The date of an opinion poll. The number can be changed up to five to display different polls at the same time.",
"type": "string",
"required": false
},
"poll1_source": {
"label": "Poll 1 source",
"description": "The source or URL of the opinion poll. The number can be changed up to five to display different polls at the same time.",
"type": "string",
"required": false
},
"poll1_nominee1": {
"label": "Poll 1 nominee 1",
"description": "The percentage poll 1 gave to nominee 1. When appropriate, poll1_candidate1 can be used instead. The poll number can be changed up to five to display different polls at the same time. The nominee or candidate number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string",
"required": false
},
"poll1_nominee2": {
"label": "Poll 1 nominee 2",
"description": "The percentage poll 1 gave to nominee 2. When appropriate, poll1_candidate2 can be used instead. The poll number can be changed up to five to display different polls at the same time. The nominee or candidate number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string"
},
"poll1_party1": {
"label": "Poll 1 party 1",
"description": "The percentage poll 1 gave to party 1. The poll number can be changed up to five to display different polls at the same time. The party number can be changed up to nine to display different Nominees at the same time.",
"type": "string",
"required": false
},
"poll1_party2": {
"label": "Poll 1 party 2",
"description": "The percentage poll 1 gave to party 2. The poll number can be changed up to five to display different polls at the same time. The party number can be changed up to nine to display different Nominees at the same time.",
"type": "string"
},
"1blank": {
"label": "1 blank",
"description": "Title of an auxiliary row. The number can be changed up to six to display six extra rows.",
"type": "string",
"required": false
},
"1data1": {
"label": "1 data 1",
"description": "Data 1 for nominee or party 1. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"1data2": {
"label": "1 data 2",
"description": "Data 1 for nominee or party 2. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"2blank": {
"label": "2 blank",
"description": "Title of an auxiliary row. The number can be changed up to six to display six extra rows.",
"type": "string",
"required": false
},
"2data1": {
"label": "2 data 1",
"description": "Data 2 for nominee or party 1. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"2data2": {
"label": "2 data 2",
"description": "Data 2 for nominee or party 2. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"3blank": {
"label": "3 blank",
"description": "Title of an auxiliary row. The number can be changed up to six to display six extra rows.",
"type": "string",
"required": false
},
"3data1": {
"label": "3 data 1",
"description": "Data 3 for nominee or party 1. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"3data2": {
"label": "3 data 2",
"description": "Data 3 for nominee or party 2. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"map_image": {
"label": "Map image",
"description": "Page name for the election map file.",
"type": "wiki-page-name",
"required": false
},
"map_size": {
"label": "Map size",
"description": "Size of image of the election map to be displayed.",
"type": "line",
"default": "300px",
"required": false
},
"map_alt": {
"label": "Map alt",
"description": "Alt text for the election map.",
"type": "string",
"required": false
},
"map": {
"label": "Map",
"description": "A freeform replacement for the above, which can be used to insert extension:ImageMaps or templates instead of images.",
"type": "content",
"required": false
},
"map_caption": {
"label": "Map caption",
"description": "Caption on image of the election map to be displayed.",
"type": "string",
"required": false
},
"map2_image": {
"label": "Map 2 image",
"description": "Page name for the election map 2 file.",
"type": "wiki-page-name",
"required": false
},
"map2_size": {
"label": "Map 2 size",
"description": "Size of image of the election map 2 to be displayed.",
"type": "line",
"default": "300px",
"required": false
},
"map2_alt": {
"label": "Map 2 alt",
"description": "Alt text for the election map.",
"type": "string",
"required": false
},
"map2": {
"label": "Map 2",
"description": "A freeform replacement for the above, which can be used to insert extension:ImageMaps or templates instead of images.",
"type": "content",
"required": false
},
"map2_caption": {
"label": "Map 2 caption",
"description": "Caption on image of the election map 2 to be displayed.",
"type": "string",
"required": false
},
"map3_image": {
"label": "Map 3 image",
"description": "Page name for the election map 3 file.",
"type": "wiki-page-name",
"required": false
},
"map3_size": {
"label": "Map 3 size",
"description": "Size of image of the election map 3 to be displayed.",
"type": "line",
"default": "300px",
"required": false
},
"map3_alt": {
"label": "Map 3 alt",
"description": "Alt text for the election map.",
"type": "string",
"required": false
},
"map3": {
"label": "Map 3",
"description": "A freeform replacement for the above, which can be used to insert extension:ImageMaps or templates instead of images.",
"type": "content",
"required": false
},
"map3_caption": {
"label": "Map 3 caption",
"description": "Caption on image of the election map 3 to be displayed.",
"type": "string",
"required": false
},
"map4_image": {
"label": "Map 4 image",
"description": "Page name for the election map 4 file.",
"type": "wiki-page-name",
"required": false
},
"map4_size": {
"label": "Map 4 size",
"description": "Size of image of the election map 4 to be displayed.",
"type": "line",
"default": "300px",
"required": false
},
"map4_alt": {
"label": "Map 4 alt",
"description": "Alt text for the election map.",
"type": "string",
"required": false
},
"map4": {
"label": "Map 4",
"description": "A freeform replacement for the above, which can be used to insert extension:ImageMaps or templates instead of images.",
"type": "content",
"required": false
},
"map4_caption": {
"label": "Map 4 caption",
"description": "Caption on image of the election map 4 to be displayed.",
"type": "string",
"required": false
},
"title": {
"label": "Title",
"description": "Title of the leader before the election. (President, Speaker, Government, Prime Minister).",
"type": "string",
"required": false
},
"before_election": {
"label": "Before election",
"description": "The leader in power before the election, labeled incumbent if the election is yet to take place.",
"type": "string",
"required": false
},
"before_party": {
"label": "Before party",
"description": "The party in power before the election. This can be set to 'Acting (law)' (which will display as 'Acting') if necessary.",
"type": "string",
"required": false
},
"posttitle": {
"label": "Post-title",
"description": "Title of the victor of the election (President-elect, Prime Minister-designate), only if different than before.",
"type": "string",
"required": false
},
"after_election": {
"label": "After election",
"description": "The leader in power as a result of the election. If an election is annulled, it should be noted Election results annulled or other equivalent and the acting office holder should be denoted in small text on the line below it.",
"type": "string",
"required": false
},
"after_party": {
"label": "After party",
"description": "The party in power as a result of the election.",
"type": "string",
"required": false
},
"image3": {
"label": "Image 3",
"description": "Image of Nominee, head of Party list or Party Leader. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time. In order to work, colour3 or party3 must be entered.",
"type": "wiki-page-name",
"required": false
},
"image3_size": {
"label": "Image 3 size",
"type": "line",
"example": "x200px",
"description": "Size for image 3. Overrides image_size",
"required": false
},
"image3_upright": {
"label": "Image 3 upright",
"description": "Upright for image3. See WP:UPRIGHT. Overrides image_upright",
"type": "string",
"required": false
},
"colour3": {
"label": "Colour 3",
"description": "Enter a hex colour code (without the #) to override the border colour of image3. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time.",
"type": "string",
"required": false,
"aliases": [
"color3"
]
},
"nominee3": {
"label": "Nominee 3",
"description": "Name of Nominee. When appropriate, candidate3 can be used instead. The number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string",
"required": false
},
"candidate3": {
"label": "Candidate 3",
"description": "Name of Candidate. The number can be changed up to nine to display different Candidates at the same time.",
"type": "string",
"required": false
},
"leader3": {
"label": "Leader 3",
"description": "Name of head of Party list or Party Leader. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"party3": {
"label": "Party 3",
"description": "Political Party using Political party shortname templates. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"alliance3": {
"label": "Alliance 3",
"description": "Political alliance in elections where coalition politics is common.",
"type": "string",
"required": false
},
"home_state3": {
"label": "Home state 3",
"description": "The state the Nominee or Candidate represents. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Texas]]"
},
"running_mate3": {
"label": "Running mate 3",
"description": "The Nominee's Running mate. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Dick Cheney|Richard B. Cheney]]"
},
"last_election3": {
"label": "Last election 3",
"description": "The seat count and percentage of the vote received at the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_before3": {
"label": "Seats before 3",
"description": "The seat count before the election, labeled 'current seats' if the election is yet to take place. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_needed3": {
"label": "Seats needed 3",
"description": "The seats required to gain an overall majority. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats3": {
"label": "Seats 3",
"description": "The seats won at the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_after3": {
"label": "Seats after 3",
"description": "The seat count after the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seat_change3": {
"label": "Seat change 3",
"description": "The change in the number of seats won at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"popular_vote3": {
"label": "Popular vote 3",
"description": "The number of votes obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"percentage3": {
"label": "Percentage 3",
"description": "The percentage of the popular vote obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "line",
"required": false,
"example": "48.3%"
},
"swing3": {
"label": "Swing 3",
"description": "The swing or change in popular vote at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"image4_size": {
"label": "Image 4 size",
"type": "line",
"example": "x200px",
"description": "Size for image 4. Overrides image_size",
"required": false
},
"image4": {
"label": "Image 4",
"description": "Image of Nominee, head of Party list or Party Leader. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time. In order to work, colour4 or party4 must be entered.",
"type": "wiki-page-name",
"required": false
},
"image4_upright": {
"label": "Image 4 upright",
"description": "Upright for image4. See WP:UPRIGHT. Overrides image_upright",
"type": "string",
"required": false
},
"colour4": {
"label": "Colour 4",
"description": "Enter a hex colour code (without the #) to override the border colour of image4. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time.",
"type": "string",
"required": false,
"aliases": [
"color4"
]
},
"nominee4": {
"label": "Nominee 4",
"description": "Name of Nominee. When appropriate, candidate4 can be used instead. The number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string",
"required": false
},
"candidate4": {
"label": "Candidate 4",
"description": "Name of Candidate. The number can be changed up to nine to display different Candidates at the same time.",
"type": "string",
"required": false
},
"leader4": {
"label": "Leader 4",
"description": "Name of head of Party list or Party Leader. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"party4": {
"label": "Party 4",
"description": "Political Party using Political party shortname templates. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"alliance4": {
"label": "Alliance 4",
"description": "Political alliance in elections where coalition politics is common.",
"type": "string",
"required": false
},
"home_state4": {
"label": "Home state 4",
"description": "The state the Nominee or Candidate represents. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Texas]]"
},
"running_mate4": {
"label": "Running mate 4",
"description": "The Nominee's Running mate. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Dick Cheney|Richard B. Cheney]]"
},
"last_election4": {
"label": "Last election 4",
"description": "The seat count and percentage of the vote received at the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_before4": {
"label": "Seats before 4",
"description": "The seat count before the election, labeled 'current seats' if the election is yet to take place. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_needed4": {
"label": "Seats needed 4",
"description": "The seats required to gain an overall majority. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats4": {
"label": "Seats 4",
"description": "The seats won at the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_after4": {
"label": "Seats after 4",
"description": "The seat count after the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seat_change4": {
"label": "Seat change 4",
"description": "The change in the number of seats won at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"popular_vote4": {
"label": "Popular vote 4",
"description": "The number of votes obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"percentage4": {
"label": "Percentage 4",
"description": "The percentage of the popular vote obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "line",
"required": false,
"example": "48.3%"
},
"swing4": {
"label": "Swing 4",
"description": "The swing or change in popular vote at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"image5": {
"label": "Image 5",
"description": "Image of Nominee, head of Party list or Party Leader. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time. In order to work, colour5 or party5 must be entered.",
"type": "wiki-page-name",
"required": false
},
"image5_size": {
"label": "Image 5 size",
"type": "line",
"example": "x200px",
"description": "Size for image 5. Overrides image_size",
"required": false
},
"image5_upright": {
"label": "Image 5 upright",
"description": "Upright for image5. See WP:UPRIGHT. Overrides image_upright",
"type": "string",
"required": false
},
"colour5": {
"label": "Colour 5",
"description": "Enter a hex colour code (without the #) to override the border colour of image5. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time.",
"type": "string",
"required": false,
"aliases": [
"color5"
]
},
"nominee5": {
"label": "Nominee 5",
"description": "Name of Nominee. When appropriate, candidate5 can be used instead. The number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string",
"required": false
},
"candidate5": {
"label": "Candidate 5",
"description": "Name of Candidate. The number can be changed up to nine to display different Candidates at the same time.",
"type": "string",
"required": false
},
"leader5": {
"label": "Leader 5",
"description": "Name of head of Party list or Party Leader. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"party5": {
"label": "Party 5",
"description": "Political Party using Political party shortname templates. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"alliance5": {
"label": "Alliance 5",
"description": "Political alliance in elections where coalition politics is common.",
"type": "string",
"required": false
},
"home_state5": {
"label": "Home state 5",
"description": "The state the Nominee or Candidate represents. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Texas]]"
},
"running_mate5": {
"label": "Running mate 5",
"description": "The Nominee's Running mate. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Dick Cheney|Richard B. Cheney]]"
},
"last_election5": {
"label": "Last election 5",
"description": "The seat count and percentage of the vote received at the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_before5": {
"label": "Seats before 5",
"description": "The seat count before the election, labeled 'current seats' if the election is yet to take place. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_needed5": {
"label": "Seats needed 5",
"description": "The seats required to gain an overall majority. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats5": {
"label": "Seats 5",
"description": "The seats won at the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_after5": {
"label": "Seats after 5",
"description": "The seat count after the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seat_change5": {
"label": "Seat change 5",
"description": "The change in the number of seats won at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"popular_vote5": {
"label": "Popular vote 5",
"description": "The number of votes obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"percentage5": {
"label": "Percentage 5",
"description": "The percentage of the popular vote obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "line",
"required": false,
"example": "48.3%"
},
"swing5": {
"label": "Swing 5",
"description": "The swing or change in popular vote at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"image6": {
"label": "Image 6",
"description": "Image of Nominee, head of Party list or Party Leader. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time. In order to work, colour6 or party6 must be entered.",
"type": "wiki-page-name",
"required": false
},
"image6_size": {
"label": "Image 6 size",
"type": "line",
"example": "x200px",
"description": "Size for image 6. Overrides image_size",
"required": false
},
"image6_upright": {
"label": "Image 6 upright",
"description": "Upright for image6. See WP:UPRIGHT. Overrides image_upright",
"type": "string",
"required": false
},
"colour6": {
"label": "Colour 6",
"description": "Enter a hex colour code (without the #) to override the border colour of image6. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time.",
"type": "string",
"required": false,
"aliases": [
"color6"
]
},
"nominee6": {
"label": "Nominee 6",
"description": "Name of Nominee. When appropriate, candidate6 can be used instead. The number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string",
"required": false
},
"candidate6": {
"label": "Candidate 6",
"description": "Name of Candidate. The number can be changed up to nine to display different Candidates at the same time.",
"type": "string",
"required": false
},
"leader6": {
"label": "Leader 6",
"description": "Name of head of Party list or Party Leader. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"party6": {
"label": "Party 6",
"description": "Political Party using Political party shortname templates. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"alliance6": {
"label": "Alliance 6",
"description": "Political alliance in elections where coalition politics is common.",
"type": "string",
"required": false
},
"home_state6": {
"label": "Home state 6",
"description": "The state the Nominee or Candidate represents. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Texas]]"
},
"running_mate6": {
"label": "Running mate 6",
"description": "The Nominee's Running mate. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Dick Cheney|Richard B. Cheney]]"
},
"last_election6": {
"label": "Last election 6",
"description": "The seat count and percentage of the vote received at the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_before6": {
"label": "Seats before 6",
"description": "The seat count before the election, labeled 'current seats' if the election is yet to take place. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_needed6": {
"label": "Seats needed 6",
"description": "The seats required to gain an overall majority. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats6": {
"label": "Seats 6",
"description": "The seats won at the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_after6": {
"label": "Seats after 6",
"description": "The seat count after the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seat_change6": {
"label": "Seat change 6",
"description": "The change in the number of seats won at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"popular_vote6": {
"label": "Popular vote 6",
"description": "The number of votes obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"percentage6": {
"label": "Percentage 6",
"description": "The percentage of the popular vote obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "line",
"required": false,
"example": "48.3%"
},
"swing6": {
"label": "Swing 6",
"description": "The swing or change in popular vote at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"image7": {
"label": "Image 7",
"description": "Image of Nominee, head of Party list or Party Leader. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time. In order to work, colour7 or party7 must be entered.",
"type": "wiki-page-name",
"required": false
},
"image7_size": {
"label": "Image 7 size",
"type": "line",
"example": "x200px",
"description": "Size for image 7. Overrides image_size",
"required": false
},
"image7_upright": {
"label": "Image 7 upright",
"description": "Upright for image7. See WP:UPRIGHT. Overrides image_upright",
"type": "string",
"required": false
},
"colour7": {
"label": "Colour 7",
"description": "Enter a hex colour code (without the #) to override the border colour of image7. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time.",
"type": "string",
"required": false,
"aliases": [
"color7"
]
},
"nominee7": {
"label": "Nominee 7",
"description": "Name of Nominee. When appropriate, candidate7 can be used instead. The number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string",
"required": false
},
"candidate7": {
"label": "Candidate 7",
"description": "Name of Candidate. The number can be changed up to nine to display different Candidates at the same time.",
"type": "string",
"required": false
},
"leader7": {
"label": "Leader 7",
"description": "Name of head of Party list or Party Leader. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"party7": {
"label": "Party 7",
"description": "Political Party using Political party shortname templates. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"alliance7": {
"label": "Alliance 7",
"description": "Political alliance in elections where coalition politics is common.",
"type": "string",
"required": false
},
"home_state7": {
"label": "Home state 7",
"description": "The state the Nominee or Candidate represents. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Texas]]"
},
"running_mate7": {
"label": "Running mate 7",
"description": "The Nominee's Running mate. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Dick Cheney|Richard B. Cheney]]"
},
"last_election7": {
"label": "Last election 7",
"description": "The seat count and percentage of the vote received at the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_before7": {
"label": "Seats before 7",
"description": "The seat count before the election, labeled 'current seats' if the election is yet to take place. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_needed7": {
"label": "Seats needed 7",
"description": "The seats required to gain an overall majority. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats7": {
"label": "Seats 7",
"description": "The seats won at the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_after7": {
"label": "Seats after 7",
"description": "The seat count after the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seat_change7": {
"label": "Seat change 7",
"description": "The change in the number of seats won at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"popular_vote7": {
"label": "Popular vote 7",
"description": "The number of votes obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"percentage7": {
"label": "Percentage 7",
"description": "The percentage of the popular vote obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "line",
"required": false,
"example": "48.3%"
},
"swing7": {
"label": "Swing 7",
"description": "The swing or change in popular vote at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"image8": {
"label": "Image 8",
"description": "Image of Nominee, head of Party list or Party Leader. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time. In order to work, colour8 or party8 must be entered.",
"type": "wiki-page-name",
"required": false
},
"image8_size": {
"label": "Image 8 size",
"type": "line",
"example": "x200px",
"description": "Size for image 8. Overrides image_size",
"required": false
},
"image8_upright": {
"label": "Image 8 upright",
"description": "Upright for image8. See WP:UPRIGHT. Overrides image_upright",
"type": "string",
"required": false
},
"colour8": {
"label": "Colour 8",
"description": "Enter a hex colour code (without the #) to override the border colour of image8. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time.",
"type": "string",
"required": false,
"aliases": [
"color8"
]
},
"nominee8": {
"label": "Nominee 8",
"description": "Name of Nominee. When appropriate, candidate8 can be used instead. The number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string",
"required": false
},
"candidate8": {
"label": "Candidate 8",
"description": "Name of Candidate. The number can be changed up to nine to display different Candidates at the same time.",
"type": "string",
"required": false
},
"leader8": {
"label": "Leader 8",
"description": "Name of head of Party list or Party Leader. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"party8": {
"label": "Party 8",
"description": "Political Party using Political party shortname templates. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"alliance8": {
"label": "Alliance 8",
"description": "Political alliance in elections where coalition politics is common.",
"type": "string",
"required": false
},
"home_state8": {
"label": "Home state 8",
"description": "The state the Nominee or Candidate represents. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Texas]]"
},
"running_mate8": {
"label": "Running mate 8",
"description": "The Nominee's Running mate. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Dick Cheney|Richard B. Cheney]]"
},
"last_election8": {
"label": "Last election 8",
"description": "The seat count and percentage of the vote received at the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_before8": {
"label": "Seats before 8",
"description": "The seat count before the election, labeled 'current seats' if the election is yet to take place. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_needed8": {
"label": "Seats needed 8",
"description": "The seats required to gain an overall majority. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats8": {
"label": "Seats 8",
"description": "The seats won at the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_after8": {
"label": "Seats after 8",
"description": "The seat count after the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seat_change8": {
"label": "Seat change 8",
"description": "The change in the number of seats won at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"popular_vote8": {
"label": "Popular vote 8",
"description": "The number of votes obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"percentage8": {
"label": "Percentage 8",
"description": "The percentage of the popular vote obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "line",
"required": false,
"example": "48.3%"
},
"swing8": {
"label": "Swing 8",
"description": "The swing or change in popular vote at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"image9": {
"label": "Image 9",
"description": "Image of Nominee, head of Party list or Party Leader. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time. In order to work, colour9 or party9 must be entered.",
"type": "wiki-page-name",
"required": false
},
"image9_size": {
"label": "Image 9 size",
"type": "line",
"example": "x200px",
"description": "Size for image 9. Overrides image_size",
"required": false
},
"image9_upright": {
"label": "Image 9 upright",
"description": "Upright for image9. See WP:UPRIGHT. Overrides image_upright",
"type": "string",
"required": false
},
"colour9": {
"label": "Colour 9",
"description": "Enter a hex colour code (without the #) to override the border colour of image9. The number can be changed up to nine to display different Nominees, heads of Party list or Leaders at the same time.",
"type": "string",
"required": false,
"aliases": [
"color9"
]
},
"nominee9": {
"label": "Nominee 9",
"description": "Name of Nominee. When appropriate, candidate9 can be used instead. The number can be changed up to nine to display different Nominees or Candidates at the same time.",
"type": "string",
"required": false
},
"candidate9": {
"label": "Candidate 9",
"description": "Name of Candidate. The number can be changed up to nine to display different Candidates at the same time.",
"type": "string",
"required": false
},
"leader9": {
"label": "Leader 9",
"description": "Name of head of Party list or Party Leader. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"party9": {
"label": "Party 9",
"description": "Political Party using Political party shortname templates. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"alliance9": {
"label": "Alliance 9",
"description": "Political alliance in elections where coalition politics is common.",
"type": "string",
"required": false
},
"home_state9": {
"label": "Home state 9",
"description": "The state the Nominee or Candidate represents. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Texas]]"
},
"running_mate9": {
"label": "Running mate 9",
"description": "The Nominee's Running mate. The number can be changed up to nine to display different Nominees at the same time.",
"type": "line",
"required": false,
"example": "[[Dick Cheney|Richard B. Cheney]]"
},
"last_election9": {
"label": "Last election 9",
"description": "The seat count and percentage of the vote received at the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_before9": {
"label": "Seats before 9",
"description": "The seat count before the election, labeled 'current seats' if the election is yet to take place. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_needed9": {
"label": "Seats needed 9",
"description": "The seats required to gain an overall majority. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats9": {
"label": "Seats 9",
"description": "The seats won at the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seats_after9": {
"label": "Seats after 9",
"description": "The seat count after the election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"seat_change9": {
"label": "Seat change 9",
"description": "The change in the number of seats won at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"popular_vote9": {
"label": "Popular vote 9",
"description": "The number of votes obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"percentage9": {
"label": "Percentage 9",
"description": "The percentage of the popular vote obtained by the Nominee or Party. The number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "line",
"required": false,
"example": "48.3%"
},
"swing9": {
"label": "Swing 9",
"description": "The swing or change in popular vote at the election compared to the previous election. The number can be changed up to nine to display different Parties at the same time.",
"type": "string",
"required": false
},
"4blank": {
"label": "4 blank",
"description": "Title of an auxiliary row. The number can be changed up to six to display six extra rows.",
"type": "string",
"required": false
},
"4data1": {
"label": "4 data 1",
"description": "Data 4 for nominee or party 1. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"4data2": {
"label": "4 data 2",
"description": "Data 4 for nominee or party 2. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"5blank": {
"label": "5 blank",
"description": "Title of an auxiliary row. The number can be changed up to six to display six extra rows.",
"type": "string",
"required": false
},
"5data1": {
"label": "5 data 1",
"description": "Data 5 for nominee or party 1. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"5data2": {
"label": "5 data 2",
"description": "Data 5 for nominee or party 2. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"6blank": {
"label": "6 blank",
"description": "Title of an auxiliary row. The number can be changed up to six to display six extra rows.",
"type": "string",
"required": false
},
"6data1": {
"label": "6 data 1",
"description": "Data 6 for nominee or party 1. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"6data2": {
"label": "6 data 2",
"description": "Data 6 for nominee or party 2. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"1data3": {
"label": "1 data 3",
"description": "Data 1 for nominee or party 3. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"1data4": {
"label": "1 data 4",
"description": "Data 4 for nominee or party 4. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"1data5": {
"label": "1 data 5",
"description": "Data 1 for nominee or party 5. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"1data6": {
"label": "1 data 6",
"description": "Data 6 for nominee or party 6. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"1data7": {
"label": "1 data 7",
"description": "Data 1 for nominee or party 7. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"1data8": {
"label": "1 data 8",
"description": "Data 1 for nominee or party 8. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"1data9": {
"label": "1 data 9",
"description": "Data 1 for nominee or party 9. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"2data3": {
"label": "2 data 3",
"description": "Data 2 for nominee or party 3. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"2data4": {
"label": "2 data 4",
"description": "Data 4 for nominee or party 4. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"2data5": {
"label": "2 data 5",
"description": "Data 2 for nominee or party 5. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"2data6": {
"label": "2 data 6",
"description": "Data 6 for nominee or party 6. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"2data7": {
"label": "2 data 7",
"description": "Data 2 for nominee or party 7. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"2data8": {
"label": "2 data 8",
"description": "Data 2 for nominee or party 8. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"2data9": {
"label": "2 data 9",
"description": "Data 2 for nominee or party 9. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"3data3": {
"label": "3 data 3",
"description": "Data 3 for nominee or party 3. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"3data4": {
"label": "3 data 4",
"description": "Data 4 for nominee or party 4. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"3data5": {
"label": "3 data 5",
"description": "Data 3 for nominee or party 5. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"3data6": {
"label": "3 data 6",
"description": "Data 6 for nominee or party 6. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"3data7": {
"label": "3 data 7",
"description": "Data 3 for nominee or party 7. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"3data8": {
"label": "3 data 8",
"description": "Data 3 for nominee or party 8. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"3data9": {
"label": "3 data 9",
"description": "Data 3 for nominee or party 9. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"4data3": {
"label": "4 data 3",
"description": "Data 4 for nominee or party 3. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"4data4": {
"label": "4 data 4",
"description": "Data 4 for nominee or party 4. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"4data5": {
"label": "4 data 5",
"description": "Data 4 for nominee or party 5. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"4data6": {
"label": "4 data 6",
"description": "Data 6 for nominee or party 6. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"4data7": {
"label": "4 data 7",
"description": "Data 4 for nominee or party 7. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"4data8": {
"label": "4 data 8",
"description": "Data 4 for nominee or party 8. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"4data9": {
"label": "4 data 9",
"description": "Data 4 for nominee or party 9. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"5data3": {
"label": "5 data 3",
"description": "Data 5 for nominee or party 3. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"5data4": {
"label": "5 data 4",
"description": "Data 4 for nominee or party 4. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"5data5": {
"label": "5 data 5",
"description": "Data 5 for nominee or party 5. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"5data6": {
"label": "5 data 6",
"description": "Data 6 for nominee or party 6. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"5data7": {
"label": "5 data 7",
"description": "Data 5 for nominee or party 7. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"5data8": {
"label": "5 data 8",
"description": "Data 5 for nominee or party 8. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"5data9": {
"label": "5 data 9",
"description": "Data 5 for nominee or party 9. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"6data3": {
"label": "6 data 3",
"description": "Data 6 for nominee or party 3. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"6data4": {
"label": "6 data 4",
"description": "Data 4 for nominee or party 4. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"6data5": {
"label": "6 data 5",
"description": "Data 6 for nominee or party 5. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"6data6": {
"label": "6 data 6",
"description": "Data 6 for nominee or party 6. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"6data7": {
"label": "6 data 7",
"description": "Data 6 for nominee or party 7. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"6data8": {
"label": "6 data 8",
"description": "Data 6 for nominee or party 8. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"6data9": {
"label": "6 data 9",
"description": "Data 6 for nominee or party 9. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"7data3": {
"label": "7 data 3",
"description": "Data 7 for nominee or party 3. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"7data4": {
"label": "7 data 4",
"description": "Data 4 for nominee or party 4. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"7data5": {
"label": "7 data 5",
"description": "Data 7 for nominee or party 5. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"7data6": {
"label": "7 data 6",
"description": "Data 6 for nominee or party 6. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"7data7": {
"label": "7 data 7",
"description": "Data 7 for nominee or party 7. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"7data8": {
"label": "7 data 8",
"description": "Data 7 for nominee or party 8. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"7data9": {
"label": "7 data 9",
"description": "Data 7 for nominee or party 9. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"8data3": {
"label": "8 data 3",
"description": "Data 8 for nominee or party 3. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"8data4": {
"label": "8 data 4",
"description": "Data 4 for nominee or party 4. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"8data5": {
"label": "8 data 5",
"description": "Data 8 for nominee or party 5. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"8data6": {
"label": "8 data 6",
"description": "Data 6 for nominee or party 6. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"8data7": {
"label": "8 data 7",
"description": "Data 8 for nominee or party 7. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"8data8": {
"label": "8 data 8",
"description": "Data 8 for nominee or party 8. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"8data9": {
"label": "8 data 9",
"description": "Data 8 for nominee or party 9. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"9data3": {
"label": "9 data 3",
"description": "Data 9 for nominee or party 3. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"9data4": {
"label": "9 data 4",
"description": "Data 4 for nominee or party 4. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"9data5": {
"label": "9 data 5",
"description": "Data 9 for nominee or party 5. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"9data6": {
"label": "9 data 6",
"description": "Data 6 for nominee or party 6. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"9data7": {
"label": "9 data 7",
"description": "Data 9 for nominee or party 7. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string",
"required": false
},
"9data8": {
"label": "9 data 8",
"description": "Data 9 for nominee or party 8. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"9data9": {
"label": "9 data 9",
"description": "Data 9 for nominee or party 9. The first number can be changed up to six to display six extra rows. The second number can be changed up to nine to display different Nominees or Parties at the same time.",
"type": "string"
},
"counties_threshold3": {},
"counties_threshold4": {},
"counties_threshold5": {},
"counties_threshold6": {},
"counties_threshold7": {},
"counties_threshold8": {},
"counties_threshold9": {},
"counties_won3": {},
"counties_won4": {},
"counties_won5": {},
"counties_won6": {},
"counties_won7": {},
"counties_won8": {},
"counties_won9": {},
"states_carried3": {},
"states_carried4": {},
"states_carried5": {},
"states_carried6": {},
"states_carried7": {},
"states_carried8": {},
"states_carried9": {},
"delegate_count3": {},
"delegate_count4": {},
"delegate_count5": {},
"delegate_count6": {},
"delegate_count7": {},
"delegate_count8": {},
"delegate_count9": {},
"electoral_vote3": {},
"electoral_vote4": {},
"electoral_vote5": {},
"electoral_vote6": {},
"electoral_vote7": {},
"electoral_vote8": {},
"electoral_vote9": {},
"leader_since3": {},
"leader_since4": {},
"leader_since5": {},
"leader_since6": {},
"leader_since7": {},
"leader_since8": {},
"leader_since9": {},
"leaders_seat3": {},
"leaders_seat4": {},
"leaders_seat5": {},
"leaders_seat6": {},
"leaders_seat7": {},
"leaders_seat8": {},
"leaders_seat9": {},
"poll1_candidate1": {},
"poll1_candidate2": {},
"poll1_candidate3": {},
"poll1_candidate4": {},
"poll1_candidate5": {},
"poll1_candidate6": {},
"poll1_candidate7": {},
"poll1_candidate8": {},
"poll1_candidate9": {},
"poll1_date1": {},
"poll1_date2": {},
"poll1_date3": {},
"poll1_nominee3": {},
"poll1_nominee4": {},
"poll1_nominee5": {},
"poll1_nominee6": {},
"poll1_nominee7": {},
"poll1_nominee8": {},
"poll1_nominee9": {},
"poll1_party3": {},
"poll1_party4": {},
"poll1_party5": {},
"poll1_party6": {},
"poll1_party7": {},
"poll1_party8": {},
"poll1_party9": {},
"poll1_source1": {},
"poll1_source2": {},
"poll1_source3": {},
"poll2_candidate1": {},
"poll2_candidate2": {},
"poll2_candidate3": {},
"poll2_candidate4": {},
"poll2_candidate5": {},
"poll2_candidate6": {},
"poll2_candidate7": {},
"poll2_candidate8": {},
"poll2_candidate9": {},
"poll2_date": {},
"poll2_date1": {},
"poll2_date2": {},
"poll2_date3": {},
"poll2_nominee1": {},
"poll2_nominee2": {},
"poll2_nominee3": {},
"poll2_nominee4": {},
"poll2_nominee5": {},
"poll2_nominee6": {},
"poll2_nominee7": {},
"poll2_nominee8": {},
"poll2_nominee9": {},
"poll2_party1": {},
"poll2_party2": {},
"poll2_party3": {},
"poll2_party4": {},
"poll2_party5": {},
"poll2_party6": {},
"poll2_party7": {},
"poll2_party8": {},
"poll2_party9": {},
"poll2_source": {},
"poll2_source1": {},
"poll2_source2": {},
"poll2_source3": {},
"poll3_candidate1": {},
"poll3_candidate2": {},
"poll3_candidate3": {},
"poll3_candidate4": {},
"poll3_candidate5": {},
"poll3_candidate6": {},
"poll3_candidate7": {},
"poll3_candidate8": {},
"poll3_candidate9": {},
"poll3_date": {},
"poll3_date1": {},
"poll3_date2": {},
"poll3_date3": {},
"poll3_nominee1": {},
"poll3_nominee2": {},
"poll3_nominee3": {},
"poll3_nominee4": {},
"poll3_nominee5": {},
"poll3_nominee6": {},
"poll3_nominee7": {},
"poll3_nominee8": {},
"poll3_nominee9": {},
"poll3_party1": {},
"poll3_party2": {},
"poll3_party3": {},
"poll3_party4": {},
"poll3_party5": {},
"poll3_party6": {},
"poll3_party7": {},
"poll3_party8": {},
"poll3_party9": {},
"poll3_source": {},
"poll3_source1": {},
"poll3_source2": {},
"poll3_source3": {},
"poll4_candidate1": {},
"poll4_candidate2": {},
"poll4_candidate3": {},
"poll4_candidate4": {},
"poll4_candidate5": {},
"poll4_candidate6": {},
"poll4_candidate7": {},
"poll4_candidate8": {},
"poll4_candidate9": {},
"poll4_date": {},
"poll4_date1": {},
"poll4_date2": {},
"poll4_date3": {},
"poll4_nominee1": {},
"poll4_nominee2": {},
"poll4_nominee3": {},
"poll4_nominee4": {},
"poll4_nominee5": {},
"poll4_nominee6": {},
"poll4_nominee7": {},
"poll4_nominee8": {},
"poll4_nominee9": {},
"poll4_party1": {},
"poll4_party2": {},
"poll4_party3": {},
"poll4_party4": {},
"poll4_party5": {},
"poll4_party6": {},
"poll4_party7": {},
"poll4_party8": {},
"poll4_party9": {},
"poll4_source": {},
"poll4_source1": {},
"poll4_source2": {},
"poll4_source3": {},
"poll5_candidate1": {},
"poll5_candidate2": {},
"poll5_candidate3": {},
"poll5_candidate4": {},
"poll5_candidate5": {},
"poll5_candidate6": {},
"poll5_candidate7": {},
"poll5_candidate8": {},
"poll5_candidate9": {},
"poll5_date": {},
"poll5_date1": {},
"poll5_date2": {},
"poll5_date3": {},
"poll5_nominee1": {},
"poll5_nominee2": {},
"poll5_nominee3": {},
"poll5_nominee4": {},
"poll5_nominee5": {},
"poll5_nominee6": {},
"poll5_nominee7": {},
"poll5_nominee8": {},
"poll5_nominee9": {},
"poll5_party1": {},
"poll5_party2": {},
"poll5_party3": {},
"poll5_party4": {},
"poll5_party5": {},
"poll5_party6": {},
"poll5_party7": {},
"poll5_party8": {},
"poll5_party9": {},
"poll5_source": {},
"poll5_source1": {},
"poll5_source2": {},
"poll5_source3": {}
}
}
</templatedata>
<includeonly>{{Sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Politics and government infobox templates|Election]]
[[Category:Infobox templates with module parameter|Election]]
[[Category:Embeddable templates]]
[[Category:Election and referendum infobox templates]]
[[Category:Templates that add a tracking category]]
}}</includeonly>
de40db6d60687d06bd532bca2d4dd9e1dd831acb
Template:Infobox high court
10
246
485
484
2023-12-24T02:16:32Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Infobox_high_court]]
wikitext
text/x-wiki
#REDIRECT [[Template:Infobox court]]
{{R with history}}
06b1a159db599c59ddbd7b29ac962f43a87349a9
Template:Redirect template
10
247
487
486
2023-12-24T02:16:33Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Redirect_template]]
wikitext
text/x-wiki
{{#invoke:Redirect template|main}}<noinclude>
{{Documentation}}</noinclude>
0b8db63883716ef3a4d3a9492f8571ae96028547
Module:Redirect template
828
248
489
488
2023-12-24T02:16:34Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Redirect_template]]
Scribunto
text/plain
require('strict')
local p = {}
-- key is beginning of arg name. value is table with namespace number and link
-- alternatively, a function taking the namespace number and returning a validity
-- can be used
local namespaceCategories = {
all = { function() return true end },
main = { 0, '[[wp:mainspace|main]]' },
help = { 12, '[[wp:help namespace|help]]' },
portal = { 100, '[[wp:portal|portal]]' },
talk = { function(n) return n > 0 and n%2 == 1 end, '[[Help:Talk pages|talk]]' },
template = { 10, '[[wp:template namespace|template]]' },
wikipedia = { 4, '[[wp:project namespace|Wikipedia project]]' },
category = { 14, '[[wp:categorization|category]]' },
user = { 2, '[[wp:user pages|user]]' },
}
-- remove whitespaces from beginning and end of args
local function valueFunc(key, val)
if type(val) == 'string' then
val = val:match('^%s*(.-)%s*$')
if val == '' then
return nil
end
end
return val
end
local function getPrettyName(args)
for k in pairs(namespaceCategories) do
if args[k .. ' category'] then
return string.format("'''[[:Category:%s|%s]]''': ", args[k .. ' category'], args.name)
end
end
return string.format("'''%s''': ", args.name)
end
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:Redirect template', valueFunc = valueFunc})
local namespace = mw.title.getCurrentTitle().namespace
--- XXX: this is a HORRIBLE HACK. kill it with fire as soon as https://bugzilla.wikimedia.org/show_bug.cgi?id=12974 is fixed
local beCompatibleWithBug12974 = args.info and (args.info:find('^[:;#*]', 1) == 1 or args.info:find('{|', 1, true) == 1) and '\n' or ' '
local content = string.format('\n<div class="rcat %s">\n*%sThis is a redirect%s%s.%s%s\n</div>',
args.id and ('rcat-' .. string.gsub(args.id, ' ', '_')) or '',
args.name and getPrettyName(args) or '',
args.from and (' from ' .. args.from) or '',
args.to and (' to ' .. args.to) or '',
args.info and beCompatibleWithBug12974 or '',
args.info or ''
)
for k,v in pairs(namespaceCategories) do
if args[k .. ' category'] then
if type(v[1]) == 'function' and v[1](namespace) or v[1] == namespace then
if args.sortkey then
content = content .. string.format('[[Category:%s|%s]]', args[k .. ' category'], args.sortkey)
else
content = content .. string.format('[[Category:%s]]', args[k .. ' category'])
end
elseif args['other category'] then
if args.sortkey then
content = content .. string.format('[[Category:%s|%s]]', args['other category'], args.sortkey)
else
content = content .. string.format('[[Category:%s]]', args['other category'])
end
else
content = content .. frame:expandTemplate{title = 'Incorrect redirect template', args = {v[2]}}
end
end
end
if namespace == 0 then
local yesno = require('Module:Yesno')
if yesno(args.printworthy) == true then
return content .. '[[Category:Printworthy redirects]]'
elseif yesno(args.printworthy) == false then
return content .. '[[Category:Unprintworthy redirects]]'
end
end
return content
end
return p
bcc2d5353cffbfcb00be2d9a7c2f9f276613e488
Template:R with history
10
249
491
490
2023-12-24T02:16:35Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:R_with_history]]
wikitext
text/x-wiki
<noinclude>
{{This is a redirect/rcat}}
</noinclude>{{Redirect template
|id=R with history
|name=With history
|from=a page containing <span class="editlink plainlinks">[{{fullurl:{{FULLPAGENAMEE}}|action=history}} '''substantive page history''']</span>
|info=This page is kept as a redirect to preserve its former content and attributions. Please ''do not'' remove the tag that generates this text (unless the need to recreate content on this page has been demonstrated), nor delete this page.
** This template should <u>not</u> be used for redirects having some edit history but no meaningful content in their previous versions, nor for redirects created as a result of a [[Wikipedia:Merging|page merge]] (use {{tl|R from merge}} instead), nor for redirects from a title that forms a historic part of Wikipedia (use {{tl|R with old history}} instead).
|all category=Redirects with history
}}<noinclude>
<!-- Place categories on /doc subpage; interwikis go to Wikidata. -->
{{documentation}}
</noinclude>
07dccadc962922bd14bb65378f2f42f521b2ce8e
Template:Infobox court
10
250
493
492
2023-12-24T02:21:15Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Infobox_court]]
wikitext
text/x-wiki
{{Infobox
| above = {{if empty|{{{court_name|}}}|<includeonly>{{PAGENAME}}</includeonly>}}
| abovestyle = background-color: #Ededed;
| subheader = {{{native_name|}}}
| imagestyle = padding-bottom:0.4em; border-bottom:solid 1px #aaa;
| image = {{#invoke:InfoboxImage|InfoboxImage |image={{if empty|{{{image|}}} }}|size={{{imagesize|}}} |upright={{if empty|{{{image_upright|}}}|1}} |alt={{{alt|}}}}}
| caption = {{{caption|}}}
| image2 = {{#invoke:InfoboxImage|InfoboxImage |image={{if empty|{{{image2|}}}}}|size={{{imagesize2|}}} |upright={{if empty|{{{image_upright2|}}}|1}} |alt={{{alt2|}}}}}
| caption2 = {{{caption2|}}}
| image3 = {{#invoke:Infobox mapframe|auto|mapframe-marker=|mapframe-marker-color=|mapframe-zoom=13|mapframe-frame-width=250|onByDefault={{#if:{{{map|}}}{{{map_image|}}}|no|yes}}}}
| caption3 = {{#invoke:Infobox mapframe|autocaption|onByDefault={{#if:{{{map|}}}{{{map_image|}}}|no|yes}}}}
| data1 = {{#if:{{{coordinates|}}}
|{{#invoke:Coordinates|coordinsert|{{{coordinates}}}|type:landmark|{{#if:{{{country|}}}|region:{{Country abbreviation|{{{country}}}}}}}}} |}}
| headerstyle = background-color: #Ededed;
| label2 = Established
| data2 = {{{established|}}}
| label3 = Dissolved
| data3 = {{{dissolved|}}}
| label4 = Jurisdiction
| data4 = {{{jurisdiction|}}}
| label5 = Location
| data5 = {{{location|}}}
| label6 = [[Geographic coordinate system|Coordinates]]
| data6 = {{{coordinates|}}}
| label7 = Motto
| data7 = {{{motto|}}}
| label8 = Composition method
| data8 = {{{type|}}}
| label9 = {{{at|Authorized}}} by
| data9 = {{{authority|}}}
| label10 = [[Appellate court|Appeals to]]
| data10 = {{{appealsto|{{{appeals|}}}}}}
| label11 = {{nowrap|[[Appeal|Appeals from]]}}
| data11 = {{{appealsfrom|}}}
| label12 = Judge term length
| data12 = {{{terms|}}}
| label13 = Number of positions
| data13 = {{{positions|}}}
| label14 = Annual budget
| data14 = {{{budget|}}}
| label15 = Language
| data15 = {{{language|}}}
| label16 = Type of tribunal
| data16 = {{{tribunal-type|}}}
| label17 = Website
| data17 = {{{website|}}}
| header18 = {{{chiefjudgetitle|}}}
| label19 = Currently
| data19 = {{{chiefjudgename|}}}
| label20 = Since
| data20 = {{{termstart|}}}
| label21 = Lead position ends
| data21 = {{{termend|}}}
| label22 = Jurist term ends
| data22 = {{{termend2|}}}
| header23 = {{{chiefjudgetitle2|}}}
| label24 = Currently
| data24 = {{{chiefjudgename2|}}}
| label25 = Since
| data25 = {{{termstart2|}}}
| label26 = Lead position ends
| data26 = {{{termend3|}}}
| label27 = Jurist term ends
| data27 = {{{termend4|}}}
| header28 = {{{chiefjudgetitle3|}}}
| label29 = Currently
| data29 = {{{chiefjudgename3|}}}
| label30 = Since
| data30 = {{{termstart3|}}}
| label31 = Lead position ends
| data31 = {{{termend5|}}}
| label32 = Jurist term ends
| data32 = {{{termend6|}}}
| header33 = {{#if:{{{division_map|}}}|Division map}}
| data34 = {{#invoke:InfoboxImage|InfoboxImage|image={{{division_map|}}}|size={{{division_map_size|}}}|alt={{{division_map_alt|}}}}}
| data35 = {{#if:{{{division_map|}}}|{{{division_caption|}}}}}
}}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox court with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox court]] with unknown parameter "_VALUE_"|ignoreblank=y| court_name | native_name | image | imagesize | alt | caption | image2 | imagesize2 | image_upright | image_upright2 | alt2 | caption2 | established | dissolved | jurisdiction | location | coordinates | motto | type | authority | appealsto | appealsfrom | terms | positions | budget | language | tribunal-type | website | chiefjudgetitle | chiefjudgename | termstart | termend | termend2 | chiefjudgetitle2 | chiefjudgename2 | termstart2 | termend3 | termend4 | chiefjudgetitle3 | chiefjudgename3 | termstart3 | termend5 | termend6 | division_map | division_map_size | division_map_alt | division_caption }}<noinclude>
{{Documentation}}<!-- Add categories to the /doc subpage, interwikis to Wikidata, not here -->
</noinclude>
6dfb165045bb97a739b09f6097b522f4621ff0a3
Template:Post-nominals
10
251
495
494
2023-12-24T02:21:23Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Post-nominals]]
wikitext
text/x-wiki
<span class="noexcerpt nowraplinks" style="font-size:{{{size|85%}}}; font-weight:normal;"><!--
-->{{if empty|{{{unlinked|}}}|{{{list|}}}|{{{post-noms|}}}|{{for loop|{{#if:{{{sep|}}}{{{commas|}}}|<span style="font-size:14px;>,</span>}} |call=post-nominals/{{{country|CAN}}}|{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|{{{7|}}}|{{{8|}}}|{{{9|}}}|{{{10|}}}|{{{11|}}}|{{{12|}}}|{{{13|}}}|{{{14|}}}|{{{15|}}}|{{{16|}}}|{{{17|}}}|{{{18|}}}|{{{19|}}}|{{{20|}}}|skipBlanks=yes}}}}<!--
--></span><!--
-->{{#if:{{{country|{{{unlinked|{{{list|{{{post-noms|<noinclude>1</noinclude>}}}}}}}}}}}}||[[Category:Pages using Template:Post-nominals with missing parameters]]}}<!--
-->{{#if:{{{unlinked|{{{list|{{{post-noms|}}}}}}}}}|[[Category:Pages using Template:Post-nominals with customized linking]]
}}<noinclude>{{Documentation}}</noinclude>
2b89288bd9d53136ad548b8a601c1bf4f69e8daf
Module:Infobox mapframe
828
252
497
496
2023-12-24T02:21:24Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Infobox_mapframe]]
Scribunto
text/plain
local mf = require('Module:Mapframe')
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local infoboxImage = require('Module:InfoboxImage').InfoboxImage
-- Defaults
local DEFAULT_FRAME_WIDTH = "270"
local DEFAULT_FRAME_HEIGHT = "200"
local DEFAULT_ZOOM = 10
local DEFAULT_GEOMASK_STROKE_WIDTH = "1"
local DEFAULT_GEOMASK_STROKE_COLOR = "#777777"
local DEFAULT_GEOMASK_FILL = "#888888"
local DEFAULT_GEOMASK_FILL_OPACITY = "0.5"
local DEFAULT_SHAPE_STROKE_WIDTH = "3"
local DEFAULT_SHAPE_STROKE_COLOR = "#FF0000"
local DEFAULT_SHAPE_FILL = "#606060"
local DEFAULT_SHAPE_FILL_OPACITY = "0.5"
local DEFAULT_LINE_STROKE_WIDTH = "5"
local DEFAULT_LINE_STROKE_COLOR = "#FF0000"
local DEFAULT_MARKER_COLOR = "#5E74F3"
-- Trim whitespace from args, and remove empty args
function trimArgs(argsTable)
local cleanArgs = {}
for key, val in pairs(argsTable) do
if type(val) == 'string' then
val = val:match('^%s*(.-)%s*$')
if val ~= '' then
cleanArgs[key] = val
end
else
cleanArgs[key] = val
end
end
return cleanArgs
end
function getBestStatement(item_id, property_id)
if not(item_id) or not(mw.wikibase.isValidEntityId(item_id)) or not(mw.wikibase.entityExists(item_id)) then
return false
end
local statements = mw.wikibase.getBestStatements(item_id, property_id)
if not statements or #statements == 0 then
return false
end
local hasNoValue = ( statements[1].mainsnak and statements[1].mainsnak.snaktype == 'novalue' )
if hasNoValue then
return false
end
return statements[1]
end
function hasWikidataProperty(item_id, property_id)
return getBestStatement(item_id, property_id) and true or false
end
function getStatementValue(statement)
return statement and statement.mainsnak and statement.mainsnak.datavalue and statement.mainsnak.datavalue.value or nil
end
function relatedEntity(item_id, property_id)
local value = getStatementValue( getBestStatement(item_id, property_id) )
return value and value.id or false
end
function idType(id)
if not id then
return nil
elseif mw.ustring.match(id, "[Pp]%d+") then
return "property"
elseif mw.ustring.match(id, "[Qq]%d+") then
return "item"
else
return nil
end
end
function getZoom(value, unit)
local length_km
if unit == 'km' then
length_km = tonumber(value)
elseif unit == 'mi' then
length_km = tonumber(value)*1.609344
elseif unit == 'km2' then
length_km = math.sqrt(tonumber(value))
elseif unit == 'mi2' then
length_km = math.sqrt(tonumber(value))*1.609344
end
-- max for zoom 2 is 6400km, for zoom 3 is 3200km, for zoom 4 is 1600km, etc
local zoom = math.floor(8 - (math.log10(length_km) - 2)/(math.log10(2)))
-- limit to values below 17
zoom = math.min(17, zoom)
-- take off 1 when calculated from area, to account for unusual shapes
if unit == 'km2' or unit == 'mi2' then
zoom = zoom - 1
end
-- minimum value is 1
return math.max(1, zoom)
end
function shouldAutoRun(frame)
-- Check if should be running
local explicitlyOn = yesno(mw.text.trim(frame.getParent(frame).args.mapframe or "")) -- true of false or nil
local onByDefault = (explicitlyOn == nil) and yesno(mw.text.trim(frame.args.onByDefault or ""), false) -- true or false
return explicitlyOn or onByDefault
end
function argsFromAuto(frame)
-- Get args from the frame (invoke call) and the parent (template call).
-- Frame arguments are default values which are overridden by parent values
-- when both are present
local args = getArgs(frame, {parentFirst = true})
-- Discard args not prefixed with "mapframe-", remove that prefix from those that remain
local fixedArgs = {}
for name, val in pairs(args) do
local fixedName = string.match(name, "^mapframe%-(.+)$" )
if fixedName then
fixedArgs[fixedName] = val
-- allow coord, coordinates, etc to be unprefixed
elseif name == "coordinates" or name == "coord" or name == "coordinate" and not fixedArgs.coord then
fixedArgs.coord = val
-- allow id, qid to be unprefixed, map to id (if not already present)
elseif name == "id" or name == "qid" and not fixedArgs.id then
fixedArgs.id = val
end
end
return fixedArgs
end
local p = {}
p.autocaption = function(frame)
if not shouldAutoRun(frame) then return "" end
local args = argsFromAuto(frame)
if args.caption then
return args.caption
elseif args.switcher then
return ""
end
local maskItem
local maskType = idType(args.geomask)
if maskType == 'item' then
maskItem = args.geomask
elseif maskType == "property" then
maskItem = relatedEntity(args.id or mw.wikibase.getEntityIdForCurrentPage(), args.geomask)
end
local maskItemLabel = maskItem and mw.wikibase.getLabel( maskItem )
return maskItemLabel and "Location in "..maskItemLabel or ""
end
function parseCustomWikitext(customWikitext)
-- infoboxImage will format an image if given wikitext containing an
-- image, or else pass through the wikitext unmodified
return infoboxImage({
args = {
image = customWikitext
}
})
end
p.auto = function(frame)
if not shouldAutoRun(frame) then return "" end
local args = argsFromAuto(frame)
if args.custom then
return frame:preprocess(parseCustomWikitext(args.custom))
end
local mapframe = p._main(args)
return frame:preprocess(mapframe)
end
p.main = function(frame)
local parent = frame.getParent(frame)
local parentArgs = parent.args
local mapframe = p._main(parentArgs)
return frame:preprocess(mapframe)
end
p._main = function(_config)
-- `config` is the args passed to this module
local config = trimArgs(_config)
-- Require wikidata item, or specified coords
local wikidataId = config.id or mw.wikibase.getEntityIdForCurrentPage()
if not(wikidataId) and not(config.coord) then
return ''
end
-- Require coords (specified or from wikidata), so that map will be centred somewhere
-- (P625 = coordinate location)
local hasCoordinates = hasWikidataProperty(wikidataId, 'P625') or config.coordinates or config.coord
if not hasCoordinates then
return ''
end
-- `args` is the arguments which will be passed to the mapframe module
local args = {}
-- Some defaults/overrides for infobox presentation
args.display = "inline"
args.frame = "yes"
args.plain = "yes"
args["frame-width"] = config["frame-width"] or config.width or DEFAULT_FRAME_WIDTH
args["frame-height"] = config["frame-height"] or config.height or DEFAULT_FRAME_HEIGHT
args["frame-align"] = "center"
args["frame-coord"] = config["frame-coordinates"] or config["frame-coord"] or ""
-- Note: config["coordinates"] or config["coord"] should not be used for the alignment of the frame;
-- see talk page ( https://en.wikipedia.org/wiki/Special:Diff/876492931 )
-- deprecated lat and long parameters
args["frame-lat"] = config["frame-lat"] or config["frame-latitude"] or ""
args["frame-long"] = config["frame-long"] or config["frame-longitude"] or ""
-- Calculate zoom from length or area (converted to km or km2)
if config.length_km then
args.zoom = getZoom(config.length_km, 'km')
elseif config.length_mi then
args.zoom = getZoom(config.length_mi, 'mi')
elseif config.area_km2 then
args.zoom = getZoom(config.area_km2, 'km2')
elseif config.area_mi2 then
args.zoom = getZoom(config.area_mi2, 'mi2')
else
args.zoom = config.zoom or DEFAULT_ZOOM
end
-- Conditionals: whether point, geomask should be shown
local hasOsmRelationId = hasWikidataProperty(wikidataId, 'P402') -- P402 is OSM relation ID
local shouldShowPointMarker;
if config.point == "on" then
shouldShowPointMarker = true
elseif config.point == "none" then
shouldShowPointMarker = false
else
shouldShowPointMarker = not(hasOsmRelationId) or (config.marker and config.marker ~= 'none') or (config.coordinates or config.coord)
end
local shouldShowShape = config.shape ~= 'none'
local shapeType = config.shape == 'inverse' and 'shape-inverse' or 'shape'
local shouldShowLine = config.line ~= 'none'
local maskItem
local useWikidata = wikidataId and true or false -- Use shapes/lines based on wikidata id, if there is one
-- But do not use wikidata when local coords are specified (and not turned off), unless explicitly set
if useWikidata and config.coord and shouldShowPointMarker then
useWikidata = config.wikidata and true or false
end
-- Switcher
if config.switcher == "zooms" then
-- switching between zoom levels
local maxZoom = math.max(tonumber(args.zoom), 3) -- what zoom would have otherwise been (if 3 or more, otherwise 3)
local minZoom = 1 -- completely zoomed out
local midZoom = math.floor((maxZoom + minZoom)/2) -- midway between maxn and min
args.switch = "zoomed in, zoomed midway, zoomed out"
args.zoom = string.format("SWITCH:%d,%d,%d", maxZoom, midZoom, minZoom)
elseif config.switcher == "auto" then
-- switching between P276 and P131 areas with recursive lookup, e.g. item's city,
-- that city's state, and that state's country
args.zoom = nil -- let kartographer determine the zoom
local maskLabels = {}
local maskItems = {}
local maskItemId = relatedEntity(wikidataId, "P276") or relatedEntity(wikidataId, "P131")
local maskLabel = mw.wikibase.getLabel(maskItemId)
while maskItemId and maskLabel and mw.text.trim(maskLabel) ~= "" do
table.insert(maskLabels, maskLabel)
table.insert(maskItems, maskItemId)
maskItemId = maskItemId and relatedEntity(maskItemId, "P131")
maskLabel = maskItemId and mw.wikibase.getLabel(maskItemId)
end
if #maskLabels > 1 then
args.switch = table.concat(maskLabels, "###")
maskItem = "SWITCH:" .. table.concat(maskItems, ",")
elseif #maskLabels == 1 then
maskItem = maskItemId[1]
end
elseif config.switcher == "geomasks" and config.geomask then
-- switching between items in geomask parameter
args.zoom = nil -- let kartographer determine the zoom
local separator = (mw.ustring.find(config.geomask, "###", 0, true ) and "###") or
(mw.ustring.find(config.geomask, ";", 0, true ) and ";") or ","
local pattern = "%s*"..separator.."%s*"
local maskItems = mw.text.split(mw.ustring.gsub(config.geomask, "SWITCH:", ""), pattern)
local maskLabels = {}
if #maskItems > 1 then
for i, item in ipairs(maskItems) do
table.insert(maskLabels, mw.wikibase.getLabel(item))
end
args.switch = table.concat(maskLabels, "###")
maskItem = "SWITCH:" .. table.concat(maskItems, ",")
end
end
-- resolve geomask item id (if not using geomask switcher)
if not maskItem then --
local maskType = idType(config.geomask)
if maskType == 'item' then
maskItem = config.geomask
elseif maskType == "property" then
maskItem = relatedEntity(wikidataId, config.geomask)
end
end
-- Keep track of arg numbering
local argNumber = ''
local function incrementArgNumber()
if argNumber == '' then
argNumber = 2
else
argNumber = argNumber + 1
end
end
-- Geomask
if maskItem then
args["type"..argNumber] = "shape-inverse"
args["id"..argNumber] = maskItem
args["stroke-width"..argNumber] = config["geomask-stroke-width"] or DEFAULT_GEOMASK_STROKE_WIDTH
args["stroke-color"..argNumber] = config["geomask-stroke-color"] or config["geomask-stroke-colour"] or DEFAULT_GEOMASK_STROKE_COLOR
args["fill"..argNumber] = config["geomask-fill"] or DEFAULT_GEOMASK_FILL
args["fill-opacity"..argNumber] = config["geomask-fill-opacity"] or DEFAULT_SHAPE_FILL_OPACITY
-- Let kartographer determine zoom and position, unless it is explicitly set in config
if not config.zoom and not config.switcher then
args.zoom = nil
args["frame-coord"] = nil
args["frame-lat"] = nil
args["frame-long"] = nil
local maskArea = getStatementValue( getBestStatement(maskItem, 'P2046') )
end
incrementArgNumber()
-- Hack to fix phab:T255932
if not args.zoom then
args["type"..argNumber] = "line"
args["id"..argNumber] = maskItem
args["stroke-width"..argNumber] = 0
incrementArgNumber()
end
end
-- Shape (or shape-inverse)
if useWikidata and shouldShowShape then
args["type"..argNumber] = shapeType
if config.id then args["id"..argNumber] = config.id end
args["stroke-width"..argNumber] = config["shape-stroke-width"] or config["stroke-width"] or DEFAULT_SHAPE_STROKE_WIDTH
args["stroke-color"..argNumber] = config["shape-stroke-color"] or config["shape-stroke-colour"] or config["stroke-color"] or config["stroke-colour"] or DEFAULT_SHAPE_STROKE_COLOR
args["fill"..argNumber] = config["shape-fill"] or DEFAULT_SHAPE_FILL
args["fill-opacity"..argNumber] = config["shape-fill-opacity"] or DEFAULT_SHAPE_FILL_OPACITY
incrementArgNumber()
end
-- Line
if useWikidata and shouldShowLine then
args["type"..argNumber] = "line"
if config.id then args["id"..argNumber] = config.id end
args["stroke-width"..argNumber] = config["line-stroke-width"] or config["stroke-width"] or DEFAULT_LINE_STROKE_WIDTH
args["stroke-color"..argNumber] = config["line-stroke-color"] or config["line-stroke-colour"] or config["stroke-color"] or config["stroke-colour"] or DEFAULT_LINE_STROKE_COLOR
incrementArgNumber()
end
-- Point
if shouldShowPointMarker then
args["type"..argNumber] = "point"
if config.id then args["id"..argNumber] = config.id end
if config.coord then args["coord"..argNumber] = config.coord end
if config.marker then args["marker"..argNumber] = config.marker end
args["marker-color"..argNumber] = config["marker-color"] or config["marker-colour"] or DEFAULT_MARKER_COLOR
incrementArgNumber()
end
local mapframe = args.switch and mf.multi(args) or mf._main(args)
local tracking = hasOsmRelationId and '' or '[[Category:Infobox mapframe without OSM relation ID on Wikidata]]'
return mapframe .. tracking
end
return p
d17ee86b24e6e7a955ec94561da65fe2a215b5a4
Module:Mapframe
828
253
499
498
2023-12-24T02:21:24Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Mapframe]]
Scribunto
text/plain
-- Note: Originally written on English Wikipedia at https://en.wikipedia.org/wiki/Module:Mapframe
--[[----------------------------------------------------------------------------
##### Localisation (L10n) settings #####
Replace values in quotes ("") with localised values
----------------------------------------------------------------------------]]--
local L10n = {}
-- Modue dependencies
local transcluder -- local copy of https://www.mediawiki.org/wiki/Module:Transcluder loaded lazily
-- "strict" should not be used, at least until all other modules which require this module are not using globals.
-- Template parameter names (unnumbered versions only)
-- Specify each as either a single string, or a table of strings (aliases)
-- Aliases are checked left-to-right, i.e. `{ "one", "two" }` is equivalent to using `{{{one| {{{two|}}} }}}` in a template
L10n.para = {
display = "display",
type = "type",
id = { "id", "ids" },
from = "from",
raw = "raw",
title = "title",
description = "description",
strokeColor = { "stroke-color", "stroke-colour" },
strokeWidth = "stroke-width",
strokeOpacity = "stroke-opacity",
fill = "fill",
fillOpacity = "fill-opacity",
coord = "coord",
marker = "marker",
markerColor = { "marker-color", "marker-colour" },
markerSize = "marker-size",
radius = { "radius", "radius_m" },
radiusKm = "radius_km",
radiusFt = "radius_ft",
radiusMi = "radius_mi",
edges = "edges",
text = "text",
icon = "icon",
zoom = "zoom",
frame = "frame",
plain = "plain",
frameWidth = "frame-width",
frameHeight = "frame-height",
frameCoordinates = { "frame-coordinates", "frame-coord" },
frameLatitude = { "frame-lat", "frame-latitude" },
frameLongitude = { "frame-long", "frame-longitude" },
frameAlign = "frame-align",
switch = "switch",
overlay = "overlay",
overlayBorder = "overlay-border",
overlayHorizontalAlignment = "overlay-horizontal-alignment",
overlayVerticalAlignment = "overlay-vertical-alignment",
overlayHorizontalOffset = "overlay-horizontal-offset",
overlayVerticalOffset = "overlay-vertical-offset"
}
-- Names of other templates this module can extract coordinates from
L10n.template = {
coord = { -- The coord template, as well as templates with output that contains {{coord}}
"Coord", "Coord/sandbox",
"NRHP row", "NRHP row/sandbox",
"WikidataCoord", "WikidataCoord/sandbox", "Wikidatacoord", "Wikidata coord"
}
}
-- Error messages
L10n.error = {
badDisplayPara = "Invalid display parameter",
noCoords = "Coordinates must be specified on Wikidata or in |" .. ( type(L10n.para.coord)== 'table' and L10n.para.coord[1] or L10n.para.coord ) .. "=",
wikidataCoords = "Coordinates not found on Wikidata",
noCircleCoords = "Circle centre coordinates must be specified, or available via Wikidata",
negativeRadius = "Circle radius must be a positive number",
noRadius = "Circle radius must be specified",
negativeEdges = "Circle edges must be a positive number",
noSwitchPara = "Found only one switch value in |" .. ( type(L10n.para.switch)== 'table' and L10n.para.switch[1] or L10n.para.switch ) .. "=",
oneSwitchLabel = "Found only one label in |" .. ( type(L10n.para.switch)== 'table' and L10n.para.switch[1] or L10n.para.switch ) .. "=",
noSwitchLists = "At least one parameter must have a SWITCH: list",
switchMismatches = "All SWITCH: lists must have the same number of values",
-- "%s" and "%d" tokens will be replaced with strings and numbers when used
oneSwitchValue = "Found only one switch value in |%s=",
fewerSwitchLabels = "Found %d switch values but only %d labels in |" .. ( type(L10n.para.switch)== 'table' and L10n.para.switch[1] or L10n.para.switch ) .. "=",
noNamedCoords = "No named coordinates found in %s"
}
-- Other strings
L10n.str = {
-- valid values for display parameter, e.g. (|display=inline) or (|display=title) or (|display=inline,title) or (|display=title,inline)
inline = "inline",
title = "title",
dsep = ",", -- separator between inline and title (comma in the example above)
-- valid values for type paramter
line = "line", -- geoline feature (e.g. a road)
shape = "shape", -- geoshape feature (e.g. a state or province)
shapeInverse = "shape-inverse", -- geomask feature (the inverse of a geoshape)
data = "data", -- geoJSON data page on Commons
point = "point", -- single point feature (coordinates)
circle = "circle", -- circular area around a point
named = "named", -- all named coordinates in an article or section
-- Keyword to indicate a switch list. Must NOT use the special characters ^$()%.[]*+-?
switch = "SWITCH",
-- valid values for icon, frame, and plain parameters
affirmedWords = ' '..table.concat({
"add",
"added",
"affirm",
"affirmed",
"include",
"included",
"on",
"true",
"yes",
"y"
}, ' ')..' ',
declinedWords = ' '..table.concat({
"decline",
"declined",
"exclude",
"excluded",
"false",
"none",
"not",
"no",
"n",
"off",
"omit",
"omitted",
"remove",
"removed"
}, ' ')..' '
}
-- Default values for parameters
L10n.defaults = {
display = L10n.str.inline,
text = "Map",
frameWidth = "300",
frameHeight = "200",
frameAlign = "right",
markerColor = "5E74F3",
markerSize = nil,
strokeColor = "#ff0000",
strokeWidth = 6,
edges = 32, -- number of edges used to approximate a circle
overlayBorder = "1px solid white",
overlayHorizontalAlignment = "right",
overlayHorizontalOffset = "0",
overlayVerticalAlignment = "bottom",
overlayVerticalOffset = "0"
}
-- #### End of L10n settings ####
--[[----------------------------------------------------------------------------
Utility methods
----------------------------------------------------------------------------]]--
local util = {}
--[[
Looks up a parameter value based on the id (a key from the L10n.para table) and
optionally a suffix, for parameters that can be suffixed (e.g. type2 is type
with suffix 2).
@param {table} args key-value pairs of parameter names and their values
@param {string} param_id id for parameter name (key from the L10n.para table)
@param {string} [suffix] suffix for parameter name
@returns {string|nil} parameter value if found, or nil if not found
]]--
function util.getParameterValue(args, param_id, suffix)
suffix = suffix or ''
if type( L10n.para[param_id] ) ~= 'table' then
return args[L10n.para[param_id]..suffix]
end
for _i, paramAlias in ipairs(L10n.para[param_id]) do
if args[paramAlias..suffix] then
return args[paramAlias..suffix]
end
end
return nil
end
--[[
Trim whitespace from args, and remove empty args. Also fix control characters.
@param {table} argsTable
@returns {table} trimmed args table
]]--
function util.trimArgs(argsTable)
local cleanArgs = {}
for key, val in pairs(argsTable) do
if type(key) == 'string' and type(val) == 'string' then
val = val:match('^%s*(.-)%s*$')
if val ~= '' then
-- control characters inside json need to be escaped, but stripping them is simpler
-- See also T214984
-- However, *don't* strip control characters from wikitext (text or description parameters) or you'll break strip markers
-- Alternatively it might be better to only strip control char from raw parameter content
if util.matchesParam('text', key) or util.matchesParam('description', key, key:gsub('^%D+(%d+)$', '%1') ) then
cleanArgs[key] = val
else
cleanArgs[key] = val:gsub('%c',' ')
end
end
else
cleanArgs[key] = val
end
end
return cleanArgs
end
--[[
Check if a parameter name matches an unlocalized parameter key
@param {string} key - the unlocalized parameter name to search through
@param {string} name - the localized parameter name to check
@param {string|nil} - an optional suffix to apply to the value(s) from the localization key
@returns {boolean} true if the name matches the parameter, false otherwise
]]--
function util.matchesParam(key, name, suffix)
local param = L10n.para[key]
suffix = suffix or ''
if type(param) == 'table' then
for _, v in pairs(param) do
if (v .. suffix) == name then return true end
end
return false
end
return ((param .. suffix) == name)
end
--[[
Check if a value is affirmed (one of the values in L10n.str.affirmedWords)
@param {string} val Value to be checked
@returns {boolean} true if affirmed, false otherwise
]]--
function util.isAffirmed(val)
if not(val) then return false end
return string.find(L10n.str.affirmedWords, ' '..val..' ', 1, true ) and true or false
end
--[[
Check if a value is declined (one of the values in L10n.str.declinedWords)
@param {string} val Value to be checked
@returns {boolean} true if declined, false otherwise
]]--
function util.isDeclined(val)
if not(val) then return false end
return string.find(L10n.str.declinedWords , ' '..val..' ', 1, true ) and true or false
end
--[[
Check if the name of a template matches the known coord templates or wrappers
(in L10n.template.coord). The name is normalised when checked, so e.g. the names
"Coord", "coord", and " Coord" all return true.
@param {string} name
@returns {boolean} true if it is a coord template or wrapper, false otherwise
]]--
function util.isCoordTemplateOrWrapper(name)
name = mw.text.trim(name)
local inputTitle = mw.title.new(name, 'Template')
if not inputTitle then
return false
end
-- Create (or reuse) mw.title objects for each known coord template/wrapper.
-- Stored in L10n.template.title so that they don't need to be recreated
-- each time this function is called
if not L10n.template.titles then
L10n.template.titles = {}
for _, v in pairs(L10n.template.coord) do
table.insert(L10n.template.titles, mw.title.new(v, 'Template'))
end
end
for _, templateTitle in pairs(L10n.template.titles) do
if mw.title.equals(inputTitle, templateTitle) then
return true
end
end
return false
end
--[[
Recursively extract coord templates which have a name parameter.
@param {string} wikitext
@returns {table} table sequence of coord templates
]]--
function util.extractCoordTemplates(wikitext)
local output = {}
local templates = mw.ustring.gmatch(wikitext, '{%b{}}')
local subtemplates = {}
for template in templates do
local templateName = mw.ustring.match(template, '{{([^}|]+)')
local nameParam = mw.ustring.match(template, "|%s*name%s*=%s*[^}|]+")
if util.isCoordTemplateOrWrapper(templateName) then
if nameParam then table.insert(output, template) end
elseif mw.ustring.find(mw.ustring.sub(template, 2), "{{") then
local subOutput = util.extractCoordTemplates(mw.ustring.sub(template, 2))
for _, t in pairs(subOutput) do
table.insert(output, t)
end
end
end
-- ensure coords are not using title display
for k, v in pairs(output) do
output[k] = mw.ustring.gsub(v, "|%s*display%s*=[^|}]+", "|display=inline")
end
return output
end
--[[
Gets all named coordiates from a page or a section of a page.
@param {string|nil} page Page name, or name#section, to get named coordinates
from. If the name is omitted, i.e. #section or nil or empty string, then
the current page will be used.
@returns {table} sequence of {coord, name, description} tables where coord is
the coordinates in a format suitable for #util.parseCoords, name is a string,
and description is a string (coordinates in a format suitable for displaying
to the reader). If for some reason the name can't be found, the description
is nil and the name contains display-format coordinates.
@throws {L10n.error.noNamedCoords} if no named coordinates are found.
]]--
function util.getNamedCoords(page)
if transcluder == nil then
-- load [[Module:Transcluder]] lazily so it is only transcluded on pages that
-- actually use named coordinates
transcluder = require("Module:Transcluder")
end
local parts = mw.text.split(page or "", "#", true)
local name = parts[1] == "" and mw.title.getCurrentTitle().prefixedText or parts[1]
local section = parts[2]
local pageWikitext = transcluder.get(section and name.."#"..section or name)
local coordTemplates = util.extractCoordTemplates(pageWikitext)
if #coordTemplates == 0 then error(string.format(L10n.error.noNamedCoords, page or name), 0) end
local frame = mw.getCurrentFrame()
local sep = "________"
local expandedContent = frame:preprocess(table.concat(coordTemplates, sep))
local expandedTemplates = mw.text.split(expandedContent, sep)
local namedCoords = {}
for _, expandedTemplate in pairs(expandedTemplates) do
local coord = mw.ustring.match(expandedTemplate, "<span class=\"geo%-dec\".->(.-)</span>")
if coord then
local name = (
-- name specified by a wrapper template, e.g [[Article|Name]]
mw.ustring.match(expandedTemplate, "<span class=\"mapframe%-coord%-name\">(.-)</span>") or
-- name passed into coord template
mw.ustring.match(expandedTemplate, "<span class=\"fn org\">(.-)</span>") or
-- default to the coordinates if the name can't be retrieved
coord
)
local description = name ~= coord and coord
local coord = mw.ustring.gsub(coord, "[° ]", "_")
table.insert(namedCoords, {coord=coord, name=name, description=description})
end
end
if #namedCoords == 0 then error(string.format(L10n.error.noNamedCoords, page or name), 0) end
return namedCoords
end
--[[
Parse coordinate values from the params passed in a GeoHack url (such as
//tools.wmflabs.org/geohack/geohack.php?pagename=Example¶ms=1_2_N_3_4_W_ or
//tools.wmflabs.org/geohack/geohack.php?pagename=Example¶ms=1.23_S_4.56_E_ )
or non-url string in the same format (such as `1_2_N_3_4_W_` or `1.23_S_4.56_E_`)
@param {string} coords string containing coordinates
@returns {number, number} latitude, longitude
]]--
function util.parseCoords(coords)
local coordsPatt
if mw.ustring.find(coords, "params=", 1, true) then
-- prevent false matches from page name, e.g. ?pagename=Lorem_S._Ipsum
coordsPatt = 'params=([_%.%d]+[NS][_%.%d]+[EW])'
else
-- not actually a geohack url, just the same format
coordsPatt = '[_%.%d]+[NS][_%.%d]+[EW]'
end
local parts = mw.text.split((mw.ustring.match(coords, coordsPatt) or ''), '_')
local lat_d = tonumber(parts[1])
local lat_m = tonumber(parts[2]) -- nil if coords are in decimal format
local lat_s = lat_m and tonumber(parts[3]) -- nil if coords are either in decimal format or degrees and minutes only
local lat = lat_d + (lat_m or 0)/60 + (lat_s or 0)/3600
if parts[#parts/2] == 'S' then
lat = lat * -1
end
local long_d = tonumber(parts[1+#parts/2])
local long_m = tonumber(parts[2+#parts/2]) -- nil if coords are in decimal format
local long_s = long_m and tonumber(parts[3+#parts/2]) -- nil if coords are either in decimal format or degrees and minutes only
local long = long_d + (long_m or 0)/60 + (long_s or 0)/3600
if parts[#parts] == 'W' then
long = long * -1
end
return lat, long
end
--[[
Get coordinates from a Wikidata item
@param {string} item_id Wikidata item id (Q number)
@returns {number, number} latitude, longitude
@throws {L10n.error.noCoords} if item_id is invalid or the item does not exist
@throws {L10n.error.wikidataCoords} if the the item does not have a P625
statement (coordinates), or it is set to "no value"
]]--
function util.wikidataCoords(item_id)
if not (item_id and mw.wikibase.isValidEntityId(item_id) and mw.wikibase.entityExists(item_id)) then
error(L10n.error.noCoords, 0)
end
local coordStatements = mw.wikibase.getBestStatements(item_id, 'P625')
if not coordStatements or #coordStatements == 0 then
error(L10n.error.wikidataCoords, 0)
end
local hasNoValue = ( coordStatements[1].mainsnak and (coordStatements[1].mainsnak.snaktype == 'novalue' or coordStatements[1].mainsnak.snaktype == 'somevalue') )
if hasNoValue then
error(L10n.error.wikidataCoords, 0)
end
local wdCoords = coordStatements[1]['mainsnak']['datavalue']['value']
return tonumber(wdCoords['latitude']), tonumber(wdCoords['longitude'])
end
--[[
Creates a polygon that approximates a circle
@param {number} lat Latitude
@param {number} long Longitude
@param {number} radius Radius in metres
@param {number} n Number of edges for the polygon
@returns {table} sequence of {latitude, longitude} table sequences, where
latitude and longitude are both numbers
]]--
function util.circleToPolygon(lat, long, radius, n) -- n is number of edges
-- Based on https://github.com/gabzim/circle-to-polygon, ISC licence
local function offset(cLat, cLon, distance, bearing)
local lat1 = math.rad(cLat)
local lon1 = math.rad(cLon)
local dByR = distance / 6378137 -- distance divided by 6378137 (radius of the earth) wgs84
local lat = math.asin(
math.sin(lat1) * math.cos(dByR) +
math.cos(lat1) * math.sin(dByR) * math.cos(bearing)
)
local lon = lon1 + math.atan2(
math.sin(bearing) * math.sin(dByR) * math.cos(lat1),
math.cos(dByR) - math.sin(lat1) * math.sin(lat)
)
return {math.deg(lon), math.deg(lat)}
end
local coordinates = {};
local i = 0;
while i < n do
table.insert(coordinates,
offset(lat, long, radius, (2*math.pi*i*-1)/n)
)
i = i + 1
end
table.insert(coordinates, offset(lat, long, radius, 0))
return coordinates
end
--[[
Get the number of key-value pairs in a table, which might not be a sequence.
@param {table} t
@returns {number} count of key-value pairs
]]--
function util.tableCount(t)
local count = 0
for k, v in pairs(t) do
count = count + 1
end
return count
end
--[[
For a table where the values are all tables, returns either the util.tableCount
of the subtables if they are all the same, or nil if they are not all the same.
@param {table} t
@returns {number|nil} count of key-value pairs of subtable, or nil if subtables
have different counts
]]--
function util.subTablesCount(t)
local count = nil
for k, v in pairs(t) do
if count == nil then
count = util.tableCount(v)
elseif count ~= util.tableCount(v) then
return nil
end
end
return count
end
--[[
Splits a list into a table sequence. The items in the list may be separated by
commas, or by semicolons (if items may contain commas), or by "###" (if items
may contain semicolons).
@param {string} listString
@returns {table} sequence of list items
]]--
function util.tableFromList(listString)
if type(listString) ~= "string" or listString == "" then return nil end
local separator = (mw.ustring.find(listString, "###", 0, true ) and "###") or
(mw.ustring.find(listString, ";", 0, true ) and ";") or ","
local pattern = "%s*"..separator.."%s*"
return mw.text.split(listString, pattern)
end
-- Boolean in outer scope indicating if Kartographer should be able to
-- automatically calculate coordinates (see phab:T227402)
local coordsDerivedFromFeatures = false;
--[[----------------------------------------------------------------------------
Make methods: These take in a table of arguments, and return either a string
or a table to be used in the eventual output.
----------------------------------------------------------------------------]]--
local make = {}
--[[
Makes content to go inside the maplink or mapframe tag.
@param {table} args
@returns {string} tag content
]]--
function make.content(args)
if util.getParameterValue(args, 'raw') then
coordsDerivedFromFeatures = true -- Kartographer should be able to automatically calculate coords from raw geoJSON
return util.getParameterValue(args, 'raw')
end
local content = {}
local argsExpanded = {}
for k, v in pairs(args) do
local index = string.match( k, '^[^0-9]+([0-9]*)$' )
if index ~= nil then
local indexNumber = ''
if index ~= '' then
indexNumber = tonumber(index)
else
indexNumber = 1
end
if argsExpanded[indexNumber] == nil then
argsExpanded[indexNumber] = {}
end
argsExpanded[indexNumber][ string.gsub(k, index, '') ] = v
end
end
for contentIndex, contentArgs in pairs(argsExpanded) do
local argType = util.getParameterValue(contentArgs, "type")
-- Kartographer automatically calculates coords if geolines/shapes are used (T227402)
if not coordsDerivedFromFeatures then
coordsDerivedFromFeatures = ( argType == L10n.str.line or argType == L10n.str.shape ) and true or false
end
if argType == L10n.str.named then
local namedCoords = util.getNamedCoords(util.getParameterValue(contentArgs, "from"))
local typeKey = type(L10n.para.type) == "table" and L10n.para.type[1] or L10n.para.type
local coordKey = type(L10n.para.coord) == "table" and L10n.para.coord[1] or L10n.para.coord
local titleKey = type(L10n.para.title) == "table" and L10n.para.title[1] or L10n.para.title
local descKey = type(L10n.para.description) == "table" and L10n.para.description[1] or L10n.para.description
for _, namedCoord in pairs(namedCoords) do
contentArgs[typeKey] = "point"
contentArgs[coordKey] = namedCoord.coord
contentArgs[titleKey] = namedCoord.name
contentArgs[descKey] = namedCoord.description
content[#content+1] = make.contentJson(contentArgs)
end
else
content[#content + 1] = make.contentJson(contentArgs)
end
end
--Single item, no array needed
if #content==1 then return content[1] end
--Multiple items get placed in a FeatureCollection
local contentArray = '[\n' .. table.concat( content, ',\n') .. '\n]'
return contentArray
end
--[[
Make coordinates from the coord arg, or the id arg, or the current page's
Wikidata item.
@param {table} args
@param {boolean} [plainOutput]
@returns {Mixed} Either:
{number, number} latitude, longitude if plainOutput is true; or
{table} table sequence of longitude, then latitude (gives the required format
for GeoJSON when encoded)
]]--
function make.coords(args, plainOutput)
local coords, lat, long
local frame = mw.getCurrentFrame()
if util.getParameterValue(args, 'coord') then
coords = frame:preprocess( util.getParameterValue(args, 'coord') )
lat, long = util.parseCoords(coords)
else
lat, long = util.wikidataCoords(util.getParameterValue(args, 'id') or mw.wikibase.getEntityIdForCurrentPage())
end
if plainOutput then
return lat, long
end
return {[0] = long, [1] = lat}
end
--[[
Makes a table of coordinates that approximate a circle.
@param {table} args
@returns {table} sequence of {latitude, longitude} table sequences, where
latitude and longitude are both numbers
@throws {L10n.error.noCircleCoords} if centre coordinates are not specified
@throws {L10n.error.noRadius} if radius is not specified
@throws {L10n.error.negativeRadius} if radius is negative or zero
@throws {L10n.error.negativeEdges} if edges is negative or zero
]]--
function make.circleCoords(args)
local lat, long = make.coords(args, true)
local radius = util.getParameterValue(args, 'radius')
if not radius then
radius = util.getParameterValue(args, 'radiusKm') and tonumber(util.getParameterValue(args, 'radiusKm'))*1000
if not radius then
radius = util.getParameterValue(args, 'radiusMi') and tonumber(util.getParameterValue(args, 'radiusMi'))*1609.344
if not radius then
radius = util.getParameterValue(args, 'radiusFt') and tonumber(util.getParameterValue(args, 'radiusFt'))*0.3048
end
end
end
local edges = util.getParameterValue(args, 'edges') or L10n.defaults.edges
if not lat or not long then
error(L10n.error.noCircleCoords, 0)
elseif not radius then
error(L10n.error.noRadius, 0)
elseif tonumber(radius) <= 0 then
error(L10n.error.negativeRadius, 0)
elseif tonumber(edges) <= 0 then
error(L10n.error.negativeEdges, 0)
end
return util.circleToPolygon(lat, long, radius, tonumber(edges))
end
--[[
Makes JSON data for a feature
@param contentArgs args for this feature. Keys must be the non-suffixed version
of the parameter names, i.e. use type, stroke, fill,... rather than type3,
stroke3, fill3,...
@returns {string} JSON encoded data
]]--
function make.contentJson(contentArgs)
local data = {}
if util.getParameterValue(contentArgs, 'type') == L10n.str.point or util.getParameterValue(contentArgs, 'type') == L10n.str.circle then
local isCircle = util.getParameterValue(contentArgs, 'type') == L10n.str.circle
data.type = "Feature"
data.geometry = {
type = isCircle and "LineString" or "Point",
coordinates = isCircle and make.circleCoords(contentArgs) or make.coords(contentArgs)
}
data.properties = {
title = util.getParameterValue(contentArgs, 'title') or mw.getCurrentFrame():getParent():getTitle()
}
if isCircle then
-- TODO: This is very similar to below, should be extracted into a function
data.properties.stroke = util.getParameterValue(contentArgs, 'strokeColor') or L10n.defaults.strokeColor
data.properties["stroke-width"] = tonumber(util.getParameterValue(contentArgs, 'strokeWidth')) or L10n.defaults.strokeWidth
local strokeOpacity = util.getParameterValue(contentArgs, 'strokeOpacity')
if strokeOpacity then
data.properties['stroke-opacity'] = tonumber(strokeOpacity)
end
local fill = util.getParameterValue(contentArgs, 'fill')
if fill then
data.properties.fill = fill
local fillOpacity = util.getParameterValue(contentArgs, 'fillOpacity')
data.properties['fill-opacity'] = fillOpacity and tonumber(fillOpacity) or 0.6
end
else -- is a point
local markerSymbol = util.getParameterValue(contentArgs, 'marker') or L10n.defaults.marker
-- allow blank to be explicitly specified, for overriding infoboxes or other templates with a default value
if markerSymbol ~= "blank" then
data.properties["marker-symbol"] = markerSymbol
end
data.properties["marker-color"] = util.getParameterValue(contentArgs, 'markerColor') or L10n.defaults.markerColor
data.properties["marker-size"] = util.getParameterValue(contentArgs, 'markerSize') or L10n.defaults.markerSize
end
else
data.type = "ExternalData"
if util.getParameterValue(contentArgs, 'type') == L10n.str.data or util.getParameterValue(contentArgs, 'from') then
data.service = "page"
elseif util.getParameterValue(contentArgs, 'type') == L10n.str.line then
data.service = "geoline"
elseif util.getParameterValue(contentArgs, 'type') == L10n.str.shape then
data.service = "geoshape"
elseif util.getParameterValue(contentArgs, 'type') == L10n.str.shapeInverse then
data.service = "geomask"
end
if util.getParameterValue(contentArgs, 'id') or (not (util.getParameterValue(contentArgs, 'from')) and mw.wikibase.getEntityIdForCurrentPage()) then
data.ids = util.getParameterValue(contentArgs, 'id') or mw.wikibase.getEntityIdForCurrentPage()
else
data.title = util.getParameterValue(contentArgs, 'from')
end
data.properties = {
stroke = util.getParameterValue(contentArgs, 'strokeColor') or L10n.defaults.strokeColor,
["stroke-width"] = tonumber(util.getParameterValue(contentArgs, 'strokeWidth')) or L10n.defaults.strokeWidth
}
local strokeOpacity = util.getParameterValue(contentArgs, 'strokeOpacity')
if strokeOpacity then
data.properties['stroke-opacity'] = tonumber(strokeOpacity)
end
local fill = util.getParameterValue(contentArgs, 'fill')
if fill and (data.service == "geoshape" or data.service == "geomask") then
data.properties.fill = fill
local fillOpacity = util.getParameterValue(contentArgs, 'fillOpacity')
if fillOpacity then
data.properties['fill-opacity'] = tonumber(fillOpacity)
end
end
end
data.properties.title = util.getParameterValue(contentArgs, 'title') or mw.title.getCurrentTitle().text
if util.getParameterValue(contentArgs, 'description') then
data.properties.description = util.getParameterValue(contentArgs, 'description')
end
return mw.text.jsonEncode(data)
end
--[[
Makes attributes for the maplink or mapframe tag.
@param {table} args
@param {boolean} [isTitle] Tag is to be displayed in the title of page rather
than inline
@returns {table<string,string>} key-value pairs of attribute names and values
]]--
function make.tagAttribs(args, isTitle)
local attribs = {}
if util.getParameterValue(args, 'zoom') then
attribs.zoom = util.getParameterValue(args, 'zoom')
end
if util.isDeclined(util.getParameterValue(args, 'icon')) then
attribs.class = "no-icon"
end
if util.getParameterValue(args, 'type') == L10n.str.point and not coordsDerivedFromFeatures then
local lat, long = make.coords(args, 'plainOutput')
attribs.latitude = tostring(lat)
attribs.longitude = tostring(long)
end
if util.isAffirmed(util.getParameterValue(args, 'frame')) and not(isTitle) then
attribs.width = util.getParameterValue(args, 'frameWidth') or L10n.defaults.frameWidth
attribs.height = util.getParameterValue(args, 'frameHeight') or L10n.defaults.frameHeight
if util.getParameterValue(args, 'frameCoordinates') then
local frameLat, frameLong = util.parseCoords(util.getParameterValue(args, 'frameCoordinates'))
attribs.latitude = frameLat
attribs.longitude = frameLong
else
if util.getParameterValue(args, 'frameLatitude') then
attribs.latitude = util.getParameterValue(args, 'frameLatitude')
end
if util.getParameterValue(args, 'frameLongitude') then
attribs.longitude = util.getParameterValue(args, 'frameLongitude')
end
end
if not attribs.latitude and not attribs.longitude and not coordsDerivedFromFeatures then
local success, lat, long = pcall(util.wikidataCoords, util.getParameterValue(args, 'id') or mw.wikibase.getEntityIdForCurrentPage())
if success then
attribs.latitude = tostring(lat)
attribs.longitude = tostring(long)
end
end
if util.getParameterValue(args, 'frameAlign') then
attribs.align = util.getParameterValue(args, 'frameAlign')
end
if util.isAffirmed(util.getParameterValue(args, 'plain')) then
attribs.frameless = "1"
else
attribs.text = util.getParameterValue(args, 'text') or L10n.defaults.text
end
else
attribs.text = util.getParameterValue(args, 'text') or L10n.defaults.text
end
return attribs
end
--[[
Makes maplink wikitext that will be located in the top-right of the title of the
page (the same place where coords with |display=title are positioned).
@param {table} args
@param {string} tagContent Content for the maplink tag
@returns {string}
]]--
function make.titleOutput(args, tagContent)
local titleTag = mw.text.tag('maplink', make.tagAttribs(args, true), tagContent)
local spanAttribs = {
style = "font-size: small;",
id = "coordinates"
}
return mw.text.tag('span', spanAttribs, titleTag)
end
--[[
Makes maplink or mapframe wikitext that will be located inline.
@param {table} args
@param {string} tagContent Content for the maplink tag
@returns {string}
]]--
function make.inlineOutput(args, tagContent)
local tagName = 'maplink'
if util.getParameterValue(args, 'frame') then
tagName = 'mapframe'
end
return mw.text.tag(tagName, make.tagAttribs(args), tagContent)
end
--[[
Makes the HTML required for the swicther to work, including the templatestyles
tag.
@param {table} params table sequence of {map, label} tables
@param {string} params{}.map Wikitext for mapframe map
@param {string} params{}.label Label text for swicther option
@param {table} options
@param {string} options.alignment "left" or "center" or "right"
@param {boolean} options.isThumbnail Display in a thumbnail
@param {string} options.width Width of frame, e.g. "200"
@param {string} [options.caption] Caption wikitext for thumnail
@retruns {string} swicther HTML
]]--
function make.switcherHtml(params, options)
options = options or {}
local frame = mw.getCurrentFrame()
local styles = frame:extensionTag{
name = "templatestyles",
args = {src = "Template:Maplink/styles-multi.css"}
}
local container = mw.html.create("div")
:addClass("switcher-container")
:addClass("mapframe-multi-container")
if options.alignment == "left" or options.alignment == "right" then
container:addClass("float"..options.alignment)
else -- alignment is "center"
container:addClass("center")
end
for i = 1, #params do
container
:tag("div")
:wikitext(params[i].map)
:tag("span")
:addClass("switcher-label")
:css("display", "none")
:wikitext(mw.text.trim(params[i].label))
end
if not options.isThumbnail then
return styles .. tostring(container)
end
local classlist = container:getAttr("class")
classlist = mw.ustring.gsub(classlist, "%a*"..options.alignment, "")
container:attr("class", classlist)
local outerCountainer = mw.html.create("div")
:addClass("mapframe-multi-outer-container")
:addClass("mw-kartographer-container")
:addClass("thumb")
if options.alignment == "left" or options.alignment == "right" then
outerCountainer:addClass("t"..options.alignment)
else -- alignment is "center"
outerCountainer
:addClass("tnone")
:addClass("center")
end
outerCountainer
:tag("div")
:addClass("thumbinner")
:css("width", options.width.."px")
:node(container)
:node(options.caption and mw.html.create("div")
:addClass("thumbcaption")
:wikitext(options.caption)
)
return styles .. tostring(outerCountainer)
end
--[[
Makes the HTML required for an overlay map to work
tag.
@param {string} overlayMap wikitext for the overlay map
@param {string} baseMap wikitext for the base map
@param {table} options various styling/display options
@param {string} options.align "left" or "center" or "right"
@param {string|number} options.width Width of the base map, e.g. "300"
@param {string|number} options.width Height of the base map, e.g. "200"
@param {string} options.border Border style for the overlayed map, e.g. "1px solid white"
@param {string} options.horizontalAlignment Horizontal alignment for overlay map, "left" or "right"
@param {string|number} options.horizontalOffset Horizontal offset in pixels from the alignment edge, e.g "10"
@param {string} options.verticalAlignment Vertical alignment for overlay map, "top" or "bottom"
@param {string|number} options.verticalOffset Vertical offset in pixels from the alignment edge, e.g. is "10"
@param {boolean} options.isThumbnail Display in a thumbnail
@param {string} [options.caption] Caption wikitext for thumnail
@retruns {string} HTML for basemap with overlay
]]--
function make.overlayHtml(overlayMap, baseMap, options)
options = options or {}
local containerFloatClass = "float"..(options.align or "none")
if options.align == "center" then
containerFloatClass = "center"
end
local containerStyle = {
position = "relative",
width = options.width .. "px",
height = options.height .. "px",
overflow = "hidden" -- mobile/minerva tends to add scrollbars for a couple of pixels
}
if options.align == "center" then
containerStyle["margin-left"] = "auto"
containerStyle["margin-right"] = "auto"
end
local container = mw.html.create("div")
:addClass("mapframe-withOverlay-container")
:addClass(containerFloatClass)
:addClass("noresize")
:css(containerStyle)
local overlayStyle = {
position = "absolute",
["z-index"] = "1",
border = options.border or "1px solid white"
}
if options.horizontalAlignment == "right" then
overlayStyle.right = options.horizontalOffset .. "px"
else
overlayStyle.left = options.horizontalOffset .. "px"
end
if options.verticalAlignment == "bottom" then
overlayStyle.bottom = options.verticalOffset .. "px"
else
overlayStyle.top = options.verticalOffset .. "px"
end
local overlayDiv = mw.html.create("div")
:css(overlayStyle)
:wikitext(overlayMap)
container
:node(overlayDiv)
:wikitext(baseMap)
if not options.isThumbnail then
return tostring(container)
end
local classlist = container:getAttr("class")
classlist = mw.ustring.gsub(classlist, "%a*"..options.align, "")
container:attr("class", classlist)
local outerCountainer = mw.html.create("div")
:addClass("mapframe-withOverlay-outerContainer")
:addClass("mw-kartographer-container")
:addClass("thumb")
if options.align == "left" or options.align == "right" then
outerCountainer:addClass("t"..options.align)
else -- alignment is "center"
outerCountainer
:addClass("tnone")
:addClass("center")
end
outerCountainer
:tag("div")
:addClass("thumbinner")
:css("width", options.width.."px")
:node(container)
:node(options.caption and mw.html.create("div")
:addClass("thumbcaption")
:wikitext(options.caption)
)
return tostring(outerCountainer)
end
--[[----------------------------------------------------------------------------
Package to be exported, i.e. methods which will available to templates and
other modules.
----------------------------------------------------------------------------]]--
local p = {}
-- Entry point for templates
function p.main(frame)
local parent = frame.getParent(frame)
-- Check for overlay option
local overlay = util.getParameterValue(parent.args, 'overlay')
local hasOverlay = overlay and mw.text.trim(overlay) ~= ""
-- Check for switch option
local switch = util.getParameterValue(parent.args, 'switch')
local isMulti = switch and mw.text.trim(switch) ~= ""
-- Create output by choosing method to suit options
local output
if hasOverlay then
output = p.withOverlay(parent.args)
elseif isMulti then
output = p.multi(parent.args)
else
output = p._main(parent.args)
end
-- Preprocess output before returning it
return frame:preprocess(output)
end
-- Entry points for modules
function p._main(_args)
local args = util.trimArgs(_args)
local tagContent = make.content(args)
local display = mw.text.split(util.getParameterValue(args, 'display') or L10n.defaults.display, '%s*' .. L10n.str.dsep .. '%s*')
local displayInTitle = display[1] == L10n.str.title or display[2] == L10n.str.title
local displayInline = display[1] == L10n.str.inline or display[2] == L10n.str.inline
local output
if displayInTitle and displayInline then
output = make.titleOutput(args, tagContent) .. make.inlineOutput(args, tagContent)
elseif displayInTitle then
output = make.titleOutput(args, tagContent)
elseif displayInline then
output = make.inlineOutput(args, tagContent)
else
error(L10n.error.badDisplayPara)
end
return output
end
function p.multi(_args)
local args = util.trimArgs(_args)
if not args[L10n.para.switch] then error(L10n.error.noSwitchPara, 0) end
local switchParamValue = util.getParameterValue(args, 'switch')
local switchLabels = util.tableFromList(switchParamValue)
if #switchLabels == 1 then error(L10n.error.oneSwitchLabel, 0) end
local mapframeArgs = {}
local switchParams = {}
for name, val in pairs(args) do
-- Copy to mapframeArgs, if not the switch labels or a switch parameter
if val ~= switchParamValue and not string.match(val, "^"..L10n.str.switch..":") then
mapframeArgs[name] = val
end
-- Check if this is a param to switch. If so, store the name and switch
-- values in switchParams table.
local switchList = string.match(val, "^"..L10n.str.switch..":(.+)")
if switchList ~= nil then
local values = util.tableFromList(switchList)
if #values == 1 then
error(string.format(L10n.error.oneSwitchValue, name), 0)
end
switchParams[name] = values
end
end
if util.tableCount(switchParams) == 0 then
error(L10n.error.noSwitchLists, 0)
end
local switchCount = util.subTablesCount(switchParams)
if not switchCount then
error(L10n.error.switchMismatches, 0)
elseif switchCount > #switchLabels then
error(string.format(L10n.error.fewerSwitchLabels, switchCount, #switchLabels), 0)
end
-- Ensure a plain frame will be used (thumbnail will be built by the
-- make.switcherHtml function if required, so that switcher options are
-- inside the thumnail)
mapframeArgs.plain = "yes"
local switcher = {}
for i = 1, switchCount do
local label = switchLabels[i]
for name, values in pairs(switchParams) do
mapframeArgs[name] = values[i]
end
table.insert(switcher, {
map = p._main(mapframeArgs),
label = "Show "..label
})
end
return make.switcherHtml(switcher, {
alignment = args["frame-align"] or "right",
isThumbnail = (args.frame and not args.plain) and true or false,
width = args["frame-width"] or L10n.defaults.frameWidth,
caption = args.text
})
end
function p.withOverlay(_args)
-- Get and trim wikitext for overlay map
local overlayMap = _args.overlay
if type(overlayMap) == 'string' then
overlayMap = overlayMap:match('^%s*(.-)%s*$')
end
local isThumbnail = (util.getParameterValue(_args, "frame") and not util.getParameterValue(_args, "plain")) and true or false
-- Get base map using the _main function, as a plain map
local args = util.trimArgs(_args)
args.plain = "yes"
local basemap = p._main(args)
-- Extract overlay options from args
local overlayOptions = {
width = util.getParameterValue(args, "frameWidth") or L10n.defaults.frameWidth,
height = util.getParameterValue(args, "frameHeight") or L10n.defaults.frameHeight,
align = util.getParameterValue(args, "frameAlign") or L10n.defaults.frameAlign,
border = util.getParameterValue(args, "overlayBorder") or L10n.defaults.overlayBorder,
horizontalAlignment = util.getParameterValue(args, "overlayHorizontalAlignment") or L10n.defaults.overlayHorizontalAlignment,
horizontalOffset = util.getParameterValue(args, "overlayHorizontalOffset") or L10n.defaults.overlayHorizontalOffset,
verticalAlignment = util.getParameterValue(args, "overlayVerticalAlignment") or L10n.defaults.overlayVerticalAlignment,
verticalOffset = util.getParameterValue(args, "overlayVerticalOffset") or L10n.defaults.overlayVerticalOffset,
isThumbnail = isThumbnail,
caption = util.getParameterValue(args, "text") or L10n.defaults.text
}
-- Make the HTML for the overlaying maps
return make.overlayHtml(overlayMap, basemap, overlayOptions)
end
return p
f05a265dfd758f11fbf3c621b1711e277c8df1f0
Template:For loop
10
254
501
500
2023-12-24T02:21:30Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:For_loop]]
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:For loop|main}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
12b7b7010fe32f888e21bcdfa6a904fc8a925437
Module:For loop
828
255
503
502
2023-12-24T02:21:31Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:For_loop]]
Scribunto
text/plain
-- This module implements {{for loop}}.
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local p = {}
function p.main(frame)
local args = getArgs(frame, {
trim = false,
removeBlanks = false
})
return p._main(args)
end
function p._main(args)
local template = args['call'] or 'void'
local calltemplates = yesno(args.substall or "", true) or not mw.isSubsting()
local variableParam = args.pv
variableParam = tonumber(variableParam) or variableParam or 1 -- fix for positional parameters
local variableValPrefix = args.prefix or ''
local variableValPostfix = args.postfix or ''
local sep = args[1] or ''
local constantArgs = p.getConstants(args)
local variableVals = p.getVariableVals(args)
local result = ''
local addSeparator = false;
for _, v in ipairs(variableVals) do
v = mw.text.trim(v)
if #v > 0 or not yesno(args.skipBlanks) then
if addSeparator then
result = result .. sep
end
addSeparator = true;
local targs = constantArgs
targs[variableParam] = variableValPrefix .. v .. variableValPostfix
if calltemplates then
local output = p.callTemplate(template, targs)
if #mw.text.trim(output) == 0 then
addSeparator = false
end
result = result .. output
else
local makeTemplate = require('Module:Template invocation').invocation
result = result .. makeTemplate(template, targs)
end
end
end
return result
end
function p.getConstants(args)
local constantArgNums = p.getArgNums(args, 'pc', 'n')
local constantArgs = {}
for _, num in ipairs(constantArgNums) do
local keyArg = 'pc' .. tostring(num) .. 'n'
local valArg = 'pc' .. tostring(num) .. 'v'
local key = args[keyArg]
key = tonumber(key) or key
local value = args[valArg]
constantArgs[key] = value
end
return constantArgs
end
function p.getVariableVals(args)
local variableVals = {}
if args.start or args.stop or args.by then
if args[2] then
error("Both start/stop/by and numbered parameters specified")
end
local start = tonumber(args.start or 1)
local stop = tonumber(args.stop or 1)
local by = tonumber(args.by or 1)
for i = start, stop, by do
variableVals [#variableVals + 1] = i
end
else
for i, v in ipairs(args) do
if i ~= 1 then
variableVals[i - 1] = v
end
end
end
return variableVals
end
function p.getArgNums(args, prefix, suffix)
-- Returns a table containing the numbers of the arguments that exist
-- for the specified prefix and suffix.
local nums = {}
local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$'
for k, _ in pairs(args) do
local num = tostring(k):match(pattern)
if num then
nums[#nums + 1] = tonumber(num)
end
end
table.sort(nums)
return nums
end
function p.callTemplate(template, targs)
return mw.getCurrentFrame():expandTemplate{title = template, args = targs}
end
return p
4ed4682b1fd3fbf2bf0836b46dd19bc0363d40e2
Module:Coordinates
828
256
505
504
2023-12-24T02:21:32Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Coordinates]]
Scribunto
text/plain
--[[
This module is intended to replace the functionality of {{Coord}} and related
templates. It provides several methods, including
{{#invoke:Coordinates | coord }} : General function formatting and displaying
coordinate values.
{{#invoke:Coordinates | dec2dms }} : Simple function for converting decimal
degree values to DMS format.
{{#invoke:Coordinates | dms2dec }} : Simple function for converting DMS format
to decimal degree format.
{{#invoke:Coordinates | link }} : Export the link used to reach the tools
]]
require('strict')
local math_mod = require("Module:Math")
local coordinates = {};
local isSandbox = mw.getCurrentFrame():getTitle():find('sandbox', 1, true);
local current_page = mw.title.getCurrentTitle()
local page_name = mw.uri.encode( current_page.prefixedText, 'WIKI' );
local coord_link = 'https://geohack.toolforge.org/geohack.php?pagename=' .. page_name .. '¶ms='
--[[ Helper function, replacement for {{coord/display/title}} ]]
local function displaytitle(coords)
return mw.getCurrentFrame():extensionTag{
name = 'indicator',
args = { name = 'coordinates' },
content = '<span id="coordinates">[[Geographic coordinate system|Coordinates]]: ' .. coords .. '</span>'
}
end
--[[ Helper function, used in detecting DMS formatting ]]
local function dmsTest(first, second)
if type(first) ~= 'string' or type(second) ~= 'string' then
return nil
end
local s = (first .. second):upper()
return s:find('^[NS][EW]$') or s:find('^[EW][NS]$')
end
--[[ Wrapper function to grab args, see Module:Arguments for this function's documentation. ]]
local function makeInvokeFunc(funcName)
return function (frame)
local args = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:Coord'
})
return coordinates[funcName](args, frame)
end
end
--[[ Helper function, handle optional args. ]]
local function optionalArg(arg, supplement)
return arg and arg .. supplement or ''
end
--[[
Formats any error messages generated for display
]]
local function errorPrinter(errors)
local result = ""
for i,v in ipairs(errors) do
result = result .. '<strong class="error">Coordinates: ' .. v[2] .. '</strong><br />'
end
return result
end
--[[
Determine the required CSS class to display coordinates
Usually geo-nondefault is hidden by CSS, unless a user has overridden this for himself
default is the mode as specificied by the user when calling the {{coord}} template
mode is the display mode (dec or dms) that we will need to determine the css class for
]]
local function displayDefault(default, mode)
if default == "" then
default = "dec"
end
if default == mode then
return "geo-default"
else
return "geo-nondefault"
end
end
--[[
specPrinter
Output formatter. Takes the structure generated by either parseDec
or parseDMS and formats it for inclusion on Wikipedia.
]]
local function specPrinter(args, coordinateSpec)
local uriComponents = coordinateSpec["param"]
if uriComponents == "" then
-- RETURN error, should never be empty or nil
return "ERROR param was empty"
end
if args["name"] then
uriComponents = uriComponents .. "&title=" .. mw.uri.encode(coordinateSpec["name"])
end
local geodmshtml = '<span class="geo-dms" title="Maps, aerial photos, and other data for this location">'
.. '<span class="latitude">' .. coordinateSpec["dms-lat"] .. '</span> '
.. '<span class="longitude">' ..coordinateSpec["dms-long"] .. '</span>'
.. '</span>'
local lat = tonumber( coordinateSpec["dec-lat"] ) or 0
local geodeclat
if lat < 0 then
-- FIXME this breaks the pre-existing precision
geodeclat = tostring(coordinateSpec["dec-lat"]):sub(2) .. "°S"
else
geodeclat = (coordinateSpec["dec-lat"] or 0) .. "°N"
end
local long = tonumber( coordinateSpec["dec-long"] ) or 0
local geodeclong
if long < 0 then
-- FIXME does not handle unicode minus
geodeclong = tostring(coordinateSpec["dec-long"]):sub(2) .. "°W"
else
geodeclong = (coordinateSpec["dec-long"] or 0) .. "°E"
end
local geodechtml = '<span class="geo-dec" title="Maps, aerial photos, and other data for this location">'
.. geodeclat .. ' '
.. geodeclong
.. '</span>'
local geonumhtml = '<span class="geo">'
.. coordinateSpec["dec-lat"] .. '; '
.. coordinateSpec["dec-long"]
.. '</span>'
local inner = '<span class="' .. displayDefault(coordinateSpec["default"], "dms" ) .. '">' .. geodmshtml .. '</span>'
.. '<span class="geo-multi-punct"> / </span>'
.. '<span class="' .. displayDefault(coordinateSpec["default"], "dec" ) .. '">';
if not args["name"] then
inner = inner .. geodechtml
.. '<span style="display:none"> / ' .. geonumhtml .. '</span></span>'
else
inner = inner .. '<span class="vcard">' .. geodechtml
.. '<span style="display:none"> / ' .. geonumhtml .. '</span>'
.. '<span style="display:none"> (<span class="fn org">'
.. args["name"] .. '</span>)</span></span></span>'
end
local stylesheetLink = 'Module:Coordinates' .. ( isSandbox and '/sandbox' or '' ) .. '/styles.css'
return mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = stylesheetLink }
} .. '<span class="plainlinks nourlexpansion">[' .. coord_link .. uriComponents ..
' ' .. inner .. ']</span>'
end
--[[ Helper function, convert decimal to degrees ]]
local function convert_dec2dms_d(coordinate)
local d = math_mod._round( coordinate, 0 ) .. "°"
return d .. ""
end
--[[ Helper function, convert decimal to degrees and minutes ]]
local function convert_dec2dms_dm(coordinate)
coordinate = math_mod._round( coordinate * 60, 0 );
local m = coordinate % 60;
coordinate = math.floor( (coordinate - m) / 60 );
local d = coordinate % 360 .."°"
return d .. string.format( "%02d′", m )
end
--[[ Helper function, convert decimal to degrees, minutes, and seconds ]]
local function convert_dec2dms_dms(coordinate)
coordinate = math_mod._round( coordinate * 60 * 60, 0 );
local s = coordinate % 60
coordinate = math.floor( (coordinate - s) / 60 );
local m = coordinate % 60
coordinate = math.floor( (coordinate - m) / 60 );
local d = coordinate % 360 .."°"
return d .. string.format( "%02d′", m ) .. string.format( "%02d″", s )
end
--[[
Helper function, convert decimal latitude or longitude to
degrees, minutes, and seconds format based on the specified precision.
]]
local function convert_dec2dms(coordinate, firstPostfix, secondPostfix, precision)
local coord = tonumber(coordinate)
local postfix
if coord >= 0 then
postfix = firstPostfix
else
postfix = secondPostfix
end
precision = precision:lower();
if precision == "dms" then
return convert_dec2dms_dms( math.abs( coord ) ) .. postfix;
elseif precision == "dm" then
return convert_dec2dms_dm( math.abs( coord ) ) .. postfix;
elseif precision == "d" then
return convert_dec2dms_d( math.abs( coord ) ) .. postfix;
end
end
--[[
Convert DMS format into a N or E decimal coordinate
]]
local function convert_dms2dec(direction, degrees_str, minutes_str, seconds_str)
local degrees = tonumber(degrees_str)
local minutes = tonumber(minutes_str) or 0
local seconds = tonumber(seconds_str) or 0
local factor = 1
if direction == "S" or direction == "W" then
factor = -1
end
local precision = 0
if seconds_str then
precision = 5 + math.max( math_mod._precision(seconds_str), 0 );
elseif minutes_str and minutes_str ~= '' then
precision = 3 + math.max( math_mod._precision(minutes_str), 0 );
else
precision = math.max( math_mod._precision(degrees_str), 0 );
end
local decimal = factor * (degrees+(minutes+seconds/60)/60)
return string.format( "%." .. precision .. "f", decimal ) -- not tonumber since this whole thing is string based.
end
--[[
Checks input values to for out of range errors.
]]
local function validate( lat_d, lat_m, lat_s, long_d, long_m, long_s, source, strong )
local errors = {};
lat_d = tonumber( lat_d ) or 0;
lat_m = tonumber( lat_m ) or 0;
lat_s = tonumber( lat_s ) or 0;
long_d = tonumber( long_d ) or 0;
long_m = tonumber( long_m ) or 0;
long_s = tonumber( long_s ) or 0;
if strong then
if lat_d < 0 then
table.insert(errors, {source, "latitude degrees < 0 with hemisphere flag"})
end
if long_d < 0 then
table.insert(errors, {source, "longitude degrees < 0 with hemisphere flag"})
end
--[[
#coordinates is inconsistent about whether this is an error. If globe: is
specified, it won't error on this condition, but otherwise it will.
For not simply disable this check.
if long_d > 180 then
table.insert(errors, {source, "longitude degrees > 180 with hemisphere flag"})
end
]]
end
if lat_d > 90 then
table.insert(errors, {source, "latitude degrees > 90"})
end
if lat_d < -90 then
table.insert(errors, {source, "latitude degrees < -90"})
end
if lat_m >= 60 then
table.insert(errors, {source, "latitude minutes >= 60"})
end
if lat_m < 0 then
table.insert(errors, {source, "latitude minutes < 0"})
end
if lat_s >= 60 then
table.insert(errors, {source, "latitude seconds >= 60"})
end
if lat_s < 0 then
table.insert(errors, {source, "latitude seconds < 0"})
end
if long_d >= 360 then
table.insert(errors, {source, "longitude degrees >= 360"})
end
if long_d <= -360 then
table.insert(errors, {source, "longitude degrees <= -360"})
end
if long_m >= 60 then
table.insert(errors, {source, "longitude minutes >= 60"})
end
if long_m < 0 then
table.insert(errors, {source, "longitude minutes < 0"})
end
if long_s >= 60 then
table.insert(errors, {source, "longitude seconds >= 60"})
end
if long_s < 0 then
table.insert(errors, {source, "longitude seconds < 0"})
end
return errors;
end
--[[
parseDec
Transforms decimal format latitude and longitude into the
structure to be used in displaying coordinates
]]
local function parseDec( lat, long, format )
local coordinateSpec = {}
local errors = {}
if not long then
return nil, {{"parseDec", "Missing longitude"}}
elseif not tonumber(long) then
return nil, {{"parseDec", "Longitude could not be parsed as a number: " .. long}}
end
errors = validate( lat, nil, nil, long, nil, nil, 'parseDec', false );
coordinateSpec["dec-lat"] = lat;
coordinateSpec["dec-long"] = long;
local mode = coordinates.determineMode( lat, long );
coordinateSpec["dms-lat"] = convert_dec2dms( lat, "N", "S", mode) -- {{coord/dec2dms|{{{1}}}|N|S|{{coord/prec dec|{{{1}}}|{{{2}}}}}}}
coordinateSpec["dms-long"] = convert_dec2dms( long, "E", "W", mode) -- {{coord/dec2dms|{{{2}}}|E|W|{{coord/prec dec|{{{1}}}|{{{2}}}}}}}
if format then
coordinateSpec.default = format
else
coordinateSpec.default = "dec"
end
return coordinateSpec, errors
end
--[[
parseDMS
Transforms degrees, minutes, seconds format latitude and longitude
into the a structure to be used in displaying coordinates
]]
local function parseDMS( lat_d, lat_m, lat_s, lat_f, long_d, long_m, long_s, long_f, format )
local coordinateSpec, errors, backward = {}, {}
lat_f = lat_f:upper();
long_f = long_f:upper();
-- Check if specified backward
if lat_f == 'E' or lat_f == 'W' then
lat_d, long_d, lat_m, long_m, lat_s, long_s, lat_f, long_f, backward = long_d, lat_d, long_m, lat_m, long_s, lat_s, long_f, lat_f, true;
end
errors = validate( lat_d, lat_m, lat_s, long_d, long_m, long_s, 'parseDMS', true );
if not long_d then
return nil, {{"parseDMS", "Missing longitude" }}
elseif not tonumber(long_d) then
return nil, {{"parseDMS", "Longitude could not be parsed as a number:" .. long_d }}
end
if not lat_m and not lat_s and not long_m and not long_s and #errors == 0 then
if math_mod._precision( lat_d ) > 0 or math_mod._precision( long_d ) > 0 then
if lat_f:upper() == 'S' then
lat_d = '-' .. lat_d;
end
if long_f:upper() == 'W' then
long_d = '-' .. long_d;
end
return parseDec( lat_d, long_d, format );
end
end
coordinateSpec["dms-lat"] = lat_d.."°"..optionalArg(lat_m,"′") .. optionalArg(lat_s,"″") .. lat_f
coordinateSpec["dms-long"] = long_d.."°"..optionalArg(long_m,"′") .. optionalArg(long_s,"″") .. long_f
coordinateSpec["dec-lat"] = convert_dms2dec(lat_f, lat_d, lat_m, lat_s) -- {{coord/dms2dec|{{{4}}}|{{{1}}}|0{{{2}}}|0{{{3}}}}}
coordinateSpec["dec-long"] = convert_dms2dec(long_f, long_d, long_m, long_s) -- {{coord/dms2dec|{{{8}}}|{{{5}}}|0{{{6}}}|0{{{7}}}}}
if format then
coordinateSpec.default = format
else
coordinateSpec.default = "dms"
end
return coordinateSpec, errors, backward
end
--[[
Check the input arguments for coord to determine the kind of data being provided
and then make the necessary processing.
]]
local function formatTest(args)
local result, errors
local backward, primary = false, false
local function getParam(args, lim)
local ret = {}
for i = 1, lim do
ret[i] = args[i] or ''
end
return table.concat(ret, '_')
end
if not args[1] then
-- no lat logic
return errorPrinter( {{"formatTest", "Missing latitude"}} )
elseif not tonumber(args[1]) then
-- bad lat logic
return errorPrinter( {{"formatTest", "Unable to parse latitude as a number:" .. args[1]}} )
elseif not args[4] and not args[5] and not args[6] then
-- dec logic
result, errors = parseDec(args[1], args[2], args.format)
if not result then
return errorPrinter(errors);
end
-- formatting for geohack: geohack expects D_N_D_E notation or D;D notation
-- wikiminiatlas doesn't support D;D notation
-- #coordinates parserfunction doesn't support negative decimals with NSWE
result.param = table.concat({
math.abs(tonumber(args[1])),
((tonumber(args[1]) or 0) < 0) and 'S' or 'N',
math.abs(tonumber(args[2])),
((tonumber(args[2]) or 0) < 0) and 'W' or 'E',
args[3] or ''}, '_')
elseif dmsTest(args[4], args[8]) then
-- dms logic
result, errors, backward = parseDMS(args[1], args[2], args[3], args[4],
args[5], args[6], args[7], args[8], args.format)
if args[10] then
table.insert(errors, {'formatTest', 'Extra unexpected parameters'})
end
if not result then
return errorPrinter(errors)
end
result.param = getParam(args, 9)
elseif dmsTest(args[3], args[6]) then
-- dm logic
result, errors, backward = parseDMS(args[1], args[2], nil, args[3],
args[4], args[5], nil, args[6], args['format'])
if args[8] then
table.insert(errors, {'formatTest', 'Extra unexpected parameters'})
end
if not result then
return errorPrinter(errors)
end
result.param = getParam(args, 7)
elseif dmsTest(args[2], args[4]) then
-- d logic
result, errors, backward = parseDMS(args[1], nil, nil, args[2],
args[3], nil, nil, args[4], args.format)
if args[6] then
table.insert(errors, {'formatTest', 'Extra unexpected parameters'})
end
if not result then
return errorPrinter(errors)
end
result.param = getParam(args, 5)
else
-- Error
return errorPrinter({{"formatTest", "Unknown argument format"}}) .. '[[Category:Pages with malformed coordinate tags]]'
end
result.name = args.name
local extra_param = {'dim', 'globe', 'scale', 'region', 'source', 'type'}
for _, v in ipairs(extra_param) do
if args[v] then
table.insert(errors, {'formatTest', 'Parameter: "' .. v .. '=" should be "' .. v .. ':"' })
end
end
local ret = specPrinter(args, result)
if #errors > 0 then
ret = ret .. ' ' .. errorPrinter(errors) .. '[[Category:Pages with malformed coordinate tags]]'
end
return ret, backward
end
--[[
Generate Wikidata tracking categories.
]]
local function makeWikidataCategories(qid)
local ret
local qid = qid or mw.wikibase.getEntityIdForCurrentPage()
if mw.wikibase and current_page.namespace == 0 then
if qid and mw.wikibase.entityExists(qid) and mw.wikibase.getBestStatements(qid, "P625") and mw.wikibase.getBestStatements(qid, "P625")[1] then
local snaktype = mw.wikibase.getBestStatements(qid, "P625")[1].mainsnak.snaktype
if snaktype == 'value' then
-- coordinates exist both here and on Wikidata, and can be compared.
ret = 'Coordinates on Wikidata'
elseif snaktype == 'somevalue' then
ret = 'Coordinates on Wikidata set to unknown value'
elseif snaktype == 'novalue' then
ret = 'Coordinates on Wikidata set to no value'
end
else
-- We have to either import the coordinates to Wikidata or remove them here.
ret = 'Coordinates not on Wikidata'
end
end
if ret then
return string.format('[[Category:%s]]', ret)
else
return ''
end
end
--[[
link
Simple function to export the coordinates link for other uses.
Usage:
{{#invoke:Coordinates | link }}
]]
function coordinates.link(frame)
return coord_link;
end
--[[
dec2dms
Wrapper to allow templates to call dec2dms directly.
Usage:
{{#invoke:Coordinates | dec2dms | decimal_coordinate | positive_suffix |
negative_suffix | precision }}
decimal_coordinate is converted to DMS format. If positive, the positive_suffix
is appended (typical N or E), if negative, the negative suffix is appended. The
specified precision is one of 'D', 'DM', or 'DMS' to specify the level of detail
to use.
]]
coordinates.dec2dms = makeInvokeFunc('_dec2dms')
function coordinates._dec2dms(args)
local coordinate = args[1]
local firstPostfix = args[2] or ''
local secondPostfix = args[3] or ''
local precision = args[4] or ''
return convert_dec2dms(coordinate, firstPostfix, secondPostfix, precision)
end
--[[
Helper function to determine whether to use D, DM, or DMS
format depending on the precision of the decimal input.
]]
function coordinates.determineMode( value1, value2 )
local precision = math.max( math_mod._precision( value1 ), math_mod._precision( value2 ) );
if precision <= 0 then
return 'd'
elseif precision <= 2 then
return 'dm';
else
return 'dms';
end
end
--[[
dms2dec
Wrapper to allow templates to call dms2dec directly.
Usage:
{{#invoke:Coordinates | dms2dec | direction_flag | degrees |
minutes | seconds }}
Converts DMS values specified as degrees, minutes, seconds too decimal format.
direction_flag is one of N, S, E, W, and determines whether the output is
positive (i.e. N and E) or negative (i.e. S and W).
]]
coordinates.dms2dec = makeInvokeFunc('_dms2dec')
function coordinates._dms2dec(args)
local direction = args[1]
local degrees = args[2]
local minutes = args[3]
local seconds = args[4]
return convert_dms2dec(direction, degrees, minutes, seconds)
end
--[[
coord
Main entry point for Lua function to replace {{coord}}
Usage:
{{#invoke:Coordinates | coord }}
{{#invoke:Coordinates | coord | lat | long }}
{{#invoke:Coordinates | coord | lat | lat_flag | long | long_flag }}
...
Refer to {{coord}} documentation page for many additional parameters and
configuration options.
Note: This function provides the visual display elements of {{coord}}. In
order to load coordinates into the database, the {{#coordinates:}} parser
function must also be called, this is done automatically in the Lua
version of {{coord}}.
]]
coordinates.coord = makeInvokeFunc('_coord')
function coordinates._coord(args)
if not tonumber(args[1]) and not args[2] then
args[3] = args[1]; args[1] = nil
local entity = mw.wikibase.getEntityObject(args.qid)
if entity
and entity.claims
and entity.claims.P625
and entity.claims.P625[1].mainsnak.snaktype == 'value'
then
local precision = entity.claims.P625[1].mainsnak.datavalue.value.precision
args[1] = entity.claims.P625[1].mainsnak.datavalue.value.latitude
args[2] = entity.claims.P625[1].mainsnak.datavalue.value.longitude
if precision then
precision = -math_mod._round(math.log(precision)/math.log(10),0)
args[1] = math_mod._round(args[1],precision)
args[2] = math_mod._round(args[2],precision)
end
end
end
local contents, backward = formatTest(args)
local Notes = args.notes or ''
local Display = args.display and args.display:lower() or 'inline'
-- it and ti are short for inline,title and title,inline
local function isInline(s)
-- Finds whether coordinates are displayed inline.
return s:find('inline') ~= nil or s == 'i' or s == 'it' or s == 'ti'
end
local function isInTitle(s)
-- Finds whether coordinates are displayed in the title.
return s:find('title') ~= nil or s == 't' or s == 'it' or s == 'ti'
end
local function coord_wrapper(in_args)
-- Calls the parser function {{#coordinates:}}.
return mw.getCurrentFrame():callParserFunction('#coordinates', in_args) or ''
end
local text = ''
if isInline(Display) then
text = text .. '<span class="geo-inline">' .. contents .. Notes .. '</span>'
end
if isInTitle(Display) then
-- Add to output since indicator content is invisible to Lua later on
if not isInline(Display) then
text = text .. '<span class="geo-inline-hidden noexcerpt">' .. contents .. Notes .. '</span>'
end
text = text .. displaytitle(contents .. Notes) .. makeWikidataCategories(args.qid)
end
if not args.nosave then
local page_title, count = mw.title.getCurrentTitle(), 1
if backward then
local tmp = {}
while not string.find((args[count-1] or ''), '[EW]') do tmp[count] = (args[count] or ''); count = count+1 end
tmp.count = count; count = 2*(count-1)
while count >= tmp.count do table.insert(tmp, 1, (args[count] or '')); count = count-1 end
for i, v in ipairs(tmp) do args[i] = v end
else
while count <= 9 do args[count] = (args[count] or ''); count = count+1 end
end
if isInTitle(Display) and not page_title.isTalkPage and page_title.subpageText ~= 'doc' and page_title.subpageText ~= 'testcases' then args[10] = 'primary' end
args.notes, args.format, args.display = nil
text = text .. coord_wrapper(args)
end
return text
end
--[[
coord2text
Extracts a single value from a transclusion of {{Coord}}.
IF THE GEOHACK LINK SYNTAX CHANGES THIS FUNCTION MUST BE MODIFIED.
Usage:
{{#invoke:Coordinates | coord2text | {{Coord}} | parameter }}
Valid values for the second parameter are: lat (signed integer), long (signed integer), type, scale, dim, region, globe, source
]]
function coordinates._coord2text(coord,type)
if coord == '' or type == '' or not type then return nil end
type = mw.text.trim(type)
if type == 'lat' or type == 'long' then
local result, negative = mw.text.split((mw.ustring.match(coord,'[%.%d]+°[NS] [%.%d]+°[EW]') or ''), ' ')
if type == 'lat' then
result, negative = result[1], 'S'
else
result, negative = result[2], 'W'
end
result = mw.text.split(result, '°')
if result[2] == negative then result[1] = '-'..result[1] end
return result[1]
else
return mw.ustring.match(coord, 'params=.-_' .. type .. ':(.-)[ _]')
end
end
function coordinates.coord2text(frame)
return coordinates._coord2text(frame.args[1],frame.args[2])
end
--[[
coordinsert
Injects some text into the Geohack link of a transclusion of {{Coord}} (if that text isn't already in the transclusion). Outputs the modified transclusion of {{Coord}}.
IF THE GEOHACK LINK SYNTAX CHANGES THIS FUNCTION MUST BE MODIFIED.
Usage:
{{#invoke:Coordinates | coordinsert | {{Coord}} | parameter:value | parameter:value | … }}
Do not make Geohack unhappy by inserting something which isn't mentioned in the {{Coord}} documentation.
]]
function coordinates.coordinsert(frame)
-- for the 2nd or later integer parameter (the first is the coord template, as above)
for i, v in ipairs(frame.args) do
if i ~= 1 then
-- if we cannot find in the coord_template the i_th coordinsert parameter e.g. region
if not mw.ustring.find(frame.args[1], (mw.ustring.match(frame.args[i], '^(.-:)') or '')) then
-- find from the params= up to the first possibly-present underscore
-- and append the i_th coordinsert parameter and a space
-- IDK why we're adding a space but it does seem somewhat convenient
frame.args[1] = mw.ustring.gsub(frame.args[1], '(params=.-)_? ', '%1_'..frame.args[i]..' ')
end
end
end
if frame.args.name then
-- if we can't find the vcard class
if not mw.ustring.find(frame.args[1], '<span class="vcard">') then
-- take something that looks like a coord template and add the vcard span with class and fn org class
local namestr = frame.args.name
frame.args[1] = mw.ustring.gsub(
frame.args[1],
'(<span class="geo%-default">)(<span[^<>]*>[^<>]*</span><span[^<>]*>[^<>]*<span[^<>]*>[^<>]*</span></span>)(</span>)',
'%1<span class="vcard">%2<span style="display:none"> (<span class="fn org">' .. namestr .. '</span>)</span></span>%3'
)
-- then find anything from coordinates parameters to the 'end' and attach the title parameter
frame.args[1] = mw.ustring.gsub(
frame.args[1],
'(¶ms=[^&"<>%[%] ]*) ',
'%1&title=' .. mw.uri.encode(namestr) .. ' '
)
end
end
-- replace the existing indicator with a new indicator using the modified content
frame.args[1] = mw.ustring.gsub(
frame.args[1],
'(<span class="geo%-inline[^"]*">(.+)</span>)\127[^\127]*UNIQ%-%-indicator%-%x+%-%-?QINU[^\127]*\127',
function (inline, coord) return inline .. displaytitle(coord) end
)
return frame.args[1]
end
return coordinates
6162d7e98fcf6faab5809049e0a48bb3e67d88e3
Template:Cite Legislation AU
10
257
507
506
2023-12-24T02:21:37Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Cite_Legislation_AU]]
wikitext
text/x-wiki
{{ #switch: {{{2}}}
| act =
{{#ifeq: {{{5|0}}} | 0
| ''[https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/consol_act/{{{3}}}/ {{{4}}}]'' ({{{1}}})
| ''{{{4}}}'' ({{{1}}}) [https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/consol_act/{{{3}}}/s{{lc:{{{5}}}}}.html s {{{5}}}]
}}
| num_act =
{{#ifeq: {{{5|0}}} | 0
| ''[https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/num_act/{{{3}}}/ {{{4}}}]'' ({{{1}}})
| ''{{{4}}}'' ({{{1}}}) [https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/num_act/{{{3}}}/s{{lc:{{{5}}}}}.html s {{{5}}}]
}}
| hist_act =
{{#ifeq: {{{5|0}}} | 0
| ''[https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/hist_act/{{{3}}}.pdf {{{4}}}]'' ({{{1}}})
| ''{{{4}}}'' ({{{1}}}) [https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/hist_act/{{{3}}}.pdf s {{{5}}}]
}}
| reg =
{{#ifeq: {{{5|0}}} | 0
| ''[https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/consol_reg/{{{3}}}/ {{{4}}}]'' ({{{1}}})
| ''{{{4}}}'' ({{{1}}}) [https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/consol_reg/{{{3}}}/s{{lc:{{{5}}}}}.html r {{{5}}}]
}}
| num_reg =
{{#ifeq: {{{5|0}}} | 0
| ''[https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/num_reg/{{{3}}}/ {{{4}}}]'' ({{{1}}})
| ''{{{4}}}'' ({{{1}}}) [https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/num_reg/{{{3}}}/s{{lc:{{{5}}}}}.html r {{{5}}}]
}}
| bill = [https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/bill/{{{3}}} {{{4}}}] ({{{1}}})
| memo = [https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/bill_em/{{{3}}}/memo_{{{5|0}}}.html Explanatory Memorandum, {{{4}}}] ({{{1}}}) {{{5|}}}
| repealed_act =
{{#ifeq: {{{5|0}}} | 0
| ''[https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/repealed_act/{{{3}}}/ {{{4}}}]'' ({{{1}}})
| ''{{{4}}}'' ({{{1}}}) [https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/repealed_act/{{{3}}}/s{{lc:{{{5}}}}}.html s {{{5}}}]
}}
| repealed_reg =
{{#ifeq: {{{5|0}}} | 0
| ''[https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/repealed_reg/{{{3}}}/ {{{4}}}]'' ({{{1}}})
| ''{{{4}}}'' ({{{1}}}) [https://www.austlii.edu.au/au/legis/{{lc:{{{1}}}}}/repealed_reg/{{{3}}}/s{{lc:{{{5}}}}}.html r {{{5}}}]
}}
}}<noinclude>
{{documentation}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS -->
<templatedata>
{
"params": {
"1": {
"label": "Jurisdiction",
"description": "In all cases jurisdiction will be one of Cth (for federal legislation) or ACT, NSW, NT, Qld, SA, Tas, Vic or WA (for state and territory legislation).",
"type": "string",
"required": true
},
"2": {
"label": "Legislation type",
"description": "One of act, num_act, hist_act, reg, num_reg, bill, memo, repealed_act, repealed_reg",
"type": "string",
"required": true
},
"3": {
"label": "Short Name",
"description": "Appears in the AustLII URL",
"example": "ca1968133",
"required": true
},
"4": {
"label": "Title",
"description": "For the citation",
"example": "Copyright Act 1968",
"required": true
},
"5": {
"label": "Pinpoint reference",
"example": "41a"
}
},
"description": "This template produces links to a variety of different legislation resources located on the [[AustLII]] site. Formatting is designed to be in compliance with the [[Australian Guide to Legal Citation]].",
"paramOrder": [
"1",
"2",
"3",
"4",
"5"
]
}
</templatedata></noinclude>
b4da41f608b306c650b0314d6e46c047eb38c2c7
Template:Post-nominals/AUS
10
258
509
508
2023-12-24T02:21:38Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Post-nominals/AUS]]
wikitext
text/x-wiki
{{#switch: {{{1}}}
| AAM = [[Australian Antarctic Medal|AAM]]
| AC = [[Companion of the Order of Australia|AC]]
| ACm = [[Companion of the Order of Australia|AC (Mil)]]
| ACh = [[Honorary Companion of the Order of Australia|AC]]
| AD = [[Dame of the Order of Australia|AD]]
| ADh = [[Honorary Dame of the Order of Australia|AD]]
| AFSM = [[Australian Fire Service Medal|AFSM]]
| AIM = [[Australian Intelligence Medal|AIM]]
| AK = [[Knight of the Order of Australia|AK]]
| AKh = [[Honorary Knight of the Order of Australia|AK]]
| AM = [[Member of the Order of Australia|AM]]
| AMg = [[Member of the Order of Australia|AM (Gen)]]
| AMm = [[Member of the Order of Australia|AM (Mil)]]
| AMh = [[Honorary Member of the Order of Australia|AM]]
| AO = [[Officer of the Order of Australia|AO]]
| AOg = [[Officer of the Order of Australia|AO (Gen)]]
| AOm = [[Officer of the Order of Australia|AO (Mil)]]
| AOh = [[Honorary Officer of the Order of Australia|AO]]
| APM = [[Australian Police Medal|APM]]
| ASM = [[Ambulance Service Medal (Australia)|ASM]]
| BM = [[Bravery Medal (Australia)|BM]]
| CD = [[Canadian Forces Decoration|CD]]
| C.D. = [[Canadian Forces Decoration|C.D.]]
| CF = [[Churchill Fellow|CF]]
| CSC = [[Conspicuous Service Cross (Australia)|CSC]]
| CSC1 = [[Conspicuous Service Cross (Australia)|CSC]] & [[Medal bar|Bar]]
| CSM = [[Conspicuous Service Medal|CSM]]
| CV = [[Cross of Valour (Australia)|CV]]
| DSC = [[Distinguished Service Cross (Australia)|DSC]]
| DSCa = [[Distinguished Service Cross (Australia)|DSC]]
| DSCuk = [[Distinguished Service Cross (United Kingdom)|DSC]]
| DSC1 = [[Distinguished Service Cross (United Kingdom)|DSC]] & [[Medal bar|Bar]]
| DSC2 = [[Distinguished Service Cross (United Kingdom)|DSC]] & [[Medal bar|Two Bars]]
| DSM = [[Distinguished Service Medal (Australia)|DSM]]
| DSMuk = [[Distinguished Service Medal (United Kingdom)|DSM]]
| ESM = [[Emergency Services Medal (Australia)|ESM]]
| MG = [[Medal for Gallantry|MG]]
| MP = [[Member of parliament#Australia|MP]]
| NSC = [[Nursing Service Cross (Australia)|NSC]]
| OAM = [[Medal of the Order of Australia|OAM]]
| OAMg = [[Medal of the Order of Australia|OAM (Gen)]]
| OAMm = [[Medal of the Order of Australia|OAM (Mil)]]
| PSM = [[Public Service Medal (Australia)|PSM]]
| SC = [[Star of Courage (Australia)|SC]]
| SG = [[Star of Gallantry|SG]]
| VC = [[Victoria Cross for Australia|VC]]
| ADC = [[Aide de Camp|ADC]]
| ADC(P) = [[Personal Aide-de-Camp|ADC(P)]]
| AE = [[Air Efficiency Award|AE]]
| AFC = [[Air Force Cross (United Kingdom)|AFC]]
| AFC1 = [[Air Force Cross (United Kingdom)|AFC]] & [[Medal bar|Bar]]
| AFM = [[Air Force Medal|AFM]]
| ARRC = [[Royal Red Cross|ARRC]]
| AsstChStJ = [[Assistant Chaplin of The Most Venerable Order of the Hospital of Saint John of Jerusalem|AsstChStJ]]
| BEM = [[British Empire Medal|BEM]]
| Bart = [[Baronet|Bart]]
| Bt = [[Baronet|Bt]]
| Btss = [[Baronet|Btss]]
| CB = [[Companion of the Order of the Bath|CB]]
| CBE = [[Commander of the Order of the British Empire|CBE]]
| CBEh = [[Commander of the Order of the British Empire|CBE]]
| CChem = [[Chartered Chemist|CChem]]
| CGM = [[Conspicuous Gallantry Medal|CGM]]
| CH = [[Companion of the Order of the Companions of Honour|CH]]
| CIE = [[Companion of the Order of the Indian Empire|CIE]]
| CMG = [[Companion of the Order of St Michael and St George|CMG]]
| CNZM = [[Companion of the New Zealand Order of Merit|CNZM]]
| CPM = [[Colonial Police Medal|CPM]]
| CSI = [[Companion of the Order of the Star of India|CSI]]
| CStJ = [[Commander of the Most Venerable Order of the Hospital of Saint John of Jerusalem|CStJ]]
| ChStJ = [[Chaplain of the Most Venerable Order of the Hospital of Saint John of Jerusalem|ChStJ]]
| CVO = [[Commander of the Royal Victorian Order|CVO]]
| DBE = [[Dame Commander of the Order of the British Empire|DBE]]
| DCB = [[Dame Commander of the Order of the Bath|DCB]]
| DCIE = [[Dame Commander of the Order of the Indian Empire|DCIE]]
| DCM = [[Distinguished Conduct Medal|DCM]]
| DCM1 = [[Distinguished Conduct Medal|DCM]] & [[Medal bar|Bar]]
| DCMG = [[Dame Commander of the Order of St Michael and St George|DCMG]]
| DCVO = [[Dame Commander of the Royal Victorian Order|DCVO]]
| DFC = [[Distinguished Flying Cross (United Kingdom)|DFC]]
| DFC1 = [[Distinguished Flying Cross (United Kingdom)|DFC]] & [[Medal bar|Bar]]
| DFC2 = [[Distinguished Flying Cross (United Kingdom)|DFC]] & [[Medal bar|Two Bars]]
| DFM = [[Distinguished Flying Medal|DFM]]
| DFM1 = [[Distinguished Flying Medal|DFM]] & [[Medal bar|Bar]]
| DFM2 = [[Distinguished Flying Medal|DFM]] & [[Medal bar|Two Bars]]
| DL = [[Deputy Lieutenant|DL]]
| DSO = [[Companion of the Distinguished Service Order|DSO]]
| DSO1 = [[Companion of the Distinguished Service Order|DSO]] & [[Medal Bar|Bar]]
| DSO2 = [[Companion of the Distinguished Service Order|DSO]] & [[Medal bar|Two Bars]]
| DStJ = [[Dame of Justice of the Most Venerable Order of the Hospital of Saint John of Jerusalem|DStJ]]
| DStJg = [[Dame of Grace of the Most Venerable Order of the Hospital of Saint John of Jerusalem|DStJ]]
| ED = [[Efficiency Decoration|ED]]
| ERD = [[Emergency Reserve Decoration|ERD]]
| EsqStJ = [[Esquire of the Most Venerable Order of the Hospital of Saint John of Jerusalem|EsqStJ]]
| FAA = [[Fellow of the Australian Academy of Science|FAA]]
| FAAL = [[Australian Academy of Law#Fellows|FAAL]]
| FACE = [[Fellow of the Australian College of Educators|FACE]]
| FAHA = [[Fellow of the Australian Academy of the Humanities|FAHA]]
| FAHMS = [[Fellow of the Australian Academy of Health and Medical Sciences|FAHMS]]
| FAICD = [[Fellow of the Australian Institute of Company Directors|FAICD]]
| FASSA = [[Fellow of the Academy of the Social Sciences in Australia|FASSA]]
| FMedSci= [[Fellow of the Academy of Medical Sciences|FMedSci]]
| FRACI = [[Fellow of the Royal Australian Chemical Institute|FRACI]]
| FRACP = [[Fellow of the Royal Australasian College of Physicians|FRACP]]
| FRACS = [[Fellow of the Royal Australasian College of Surgeons|FRACS]]
| FRAeS = [[Fellow of the Royal Aeronautical Society|FRAeS]]
| FRCP = [[Fellow of the Royal College of Physicians|FRCP]]
| FRCPE = [[Fellow of the Royal College of Physicians of Edinburgh|FRCPE]]
| FRCS = [[Fellow of the Royal College of Surgeons|FRCS]]
| FRMS = [[Royal Microscopical Society|FRMS]]
| FRS = [[Fellow of the Royal Society|FRS]]
| FRSA = [[Fellow of the Royal Society of Arts|FRSA]]
| FRSN = [[Fellow of the Royal Society of New South Wales|FRSN]]
| FRSNZ = [[Fellow of the Royal Society of New Zealand|FRSNZ]]
| FRZS = [[Royal Zoological Society of New South Wales|FRZS]]
| FTSE = [[Fellow of the Australian Academy of Technological Sciences and Engineering|FTSE]]
| GBE = [[Knight Grand Cross of the Order of the British Empire|GBE]]
| GBEf = [[Dame Grand Cross of the Order of the British Empire|GBE]]
| GC = [[George Cross|GC]]
| GCB = [[Knight Grand Cross of the Order of the Bath|GCB]]
| GCBf = [[Dame Grand Cross of the Order of the Bath|GCB]]
| GCIE = [[Knight Grand Cross of the Order of the Indian Empire|GCIE]]
| GCIEf = [[Dame Grand Cross of the Order of the Indian Empire|GCIE]]
| GCMG = [[Knight Grand Cross of the Order of St Michael and St George|GCMG]]
| GCMGf = [[Dame Grand Cross of the Order of St Michael and St George|GCMG]]
| GCSI = [[Knight Grand Cross of the Order of the Star of India|GCSI]]
| GCSIf = [[Dame Grand Cross of the Order of the Star of India|GCSI]]
| GCStJ = [[Bailiff Grand Cross of the Most Venerable Order of the Hospital of Saint John of Jerusalem|GCStJ]]
| GCStJf = [[Dame Grand Cross of the Most Venerable Order of the Hospital of Saint John of Jerusalem|GCStJ]]
| GCVO = [[Knight Grand Cross of the Royal Victorian Order|GCVO]]
| GCVOf = [[Dame Grand Cross of the Royal Victorian Order|GCVO]]
| GM = [[George Medal|GM]]
| GM1 = [[George Medal|GM]] & [[Medal bar|Bar]]
| ISO = [[Imperial Service Order|ISO]]
| JP = [[Justice of the peace#Australia|JP]]
| KBE = [[Knight Commander of the Order of the British Empire|KBE]]
| KC = [[King's Counsel|KC]]
| KCB = [[Knight Commander of the Order of the Bath|KCB]]
| KCIE = [[Knight Commander of the Order of the Indian Empire|KCIE]]
| KCMG = [[Knight Commander of the Order of St Michael and St George|KCMG]]
| KCVO = [[Knight Commander of the Royal Victorian Order|KCVO]]
| KG = [[Knight of the Order of the Garter|KG]]
| KP = [[Knight of the Order of Saint Patrick|KP]]
| KCSI = [[Knight Commander of the Order of the Star of India|KCSI]]
| DCSI = [[Dame Commander of the Order of the Star of India|DCSI]]
| KStJ = [[Knight of Justice of the Most Venerable Order of the Hospital of Saint John of Jerusalem|KStJ]]
| KStJg = [[Knight of Grace of the Most Venerable Order of the Hospital of Saint John of Jerusalem|KStJ]]
| KT = [[Knight of the Order of the Thistle|KT]]
| LG = [[Lady Companion of the Order of the Garter|LG]]
| LT = [[Lady Companion of the Order of the Thistle|LT]]
| LVO = [[Lieutenant of the Royal Victorian Order|LVO]]
| MBE = [[Member of the Order of the British Empire|MBE]]
| MC = [[Military Cross|MC]]
| MC1 = [[Military Cross|MC]] & [[Medal bar|Bar]]
| MC2 = [[Military Cross|MC]] & [[Medal bar|Two Bars]]
| MM = [[Military Medal|MM]]
| MM1 = [[Military Medal|MM]] & [[Medal bar|Bar]]
| MM2 = [[Military Medal|MM]] & [[Medal bar|Two Bars]]
| MM3 = [[Military Medal|MM]] & [[Medal bar|Three Bars]]
| MVO = [[Member of the Royal Victorian Order|MVO]]
| OBE = [[Officer of the Order of the British Empire|OBE]]
| OM = [[Member of the Order of Merit|OM]]
| OStJ = [[Officer of the Most Venerable Order of the Hospital of Saint John of Jerusalem|OStJ]]
| PC = [[Her Majesty's Most Honourable Privy Council|PC]]
| QC = [[Queen's Counsel|QC]]
| QGM = [[Queen's Gallantry Medal|QGM]]
| QFSM = [[Queen's Fire Service Medal for Gallantry|QFSM]]
| QPM = [[Queen's Police Medal for Gallantry|QPM]]
| QFSMd = [[Queen's Fire Service Medal for Distinguished Service|QFSM]]
| QPMd = [[Queen's Police Medal for Distinguished Service|QPM]]
| RAN = [[Royal Australian Navy|RAN]]
| RAAF = [[Royal Australian Air Force|RAAF]]
| RANR = [[Royal Australian Naval Reserve|RANR]]
| RFD = [[Reserve Force Decoration|RFD]]
| RRC = [[Royal Red Cross|RRC]]
| RVM = [[Royal Victorian Medal|RVM]]
| SBStJ = [[Serving Brother of the Most Venerable Order of the Hospital of Saint John of Jerusalem|SBStJ]]
| SrC = [[Senior Counsel|SC]]
| SSStJ = [[Serving Sister of the Most Venerable Order of the Hospital of Saint John of Jerusalem|SSStJ]]
| Sub-ChStJ = [[Sub-Chaplain of the Most Venerable Order of the Hospital of Saint John of Jerusalem|Sub-ChStJ]]
| TD = [[Territorial Decoration|TD]]
| VCi = [[Victoria Cross|VC]]
| VD = [[Colonial Auxiliary Forces Officers' Decoration|VD]]
| * = [[Medal bar|*]]
| SSI = [[Star of the Solomon Islands|SSI]]
| GCL = [[Grand Companion of the Order of Logohu|GCL]]
| QSO = [[Companion of the Queen's Service Order|QSO]]
| CFA = [[Chartered Financial Analyst|CFA]]
| C.F.A. = [[Chartered Financial Analyst|C.F.A.]]
| AAM, = [[Australian Antarctic Medal|AAM]],
| AC, = [[Companion of the Order of Australia|AC]],
| ACh, = [[Honorary Companion of the Order of Australia|AC]],
| AD, = [[Dame of the Order of Australia|AD]],
| ADh, = [[Honorary Dame of the Order of Australia|AD]],
| AFSM, = [[Australian Fire Service Medal|AFSM]],
| AK, = [[Knight of the Order of Australia|AK]],
| AKh, = [[Honorary Knight of the Order of Australia|AK]],
| AM, = [[Member of the Order of Australia|AM]],
| AMh, = [[Honorary Member of the Order of Australia|AM]],
| AO, = [[Officer of the Order of Australia|AO]],
| AOh, = [[Honorary Officer of the Order of Australia|AO]],
| APM, = [[Australian Police Medal|APM]],
| ASM, = [[Ambulance Service Medal (Australia)|ASM]],
| BM, = [[Bravery Medal (Australia)|BM]],
| CSC, = [[Conspicuous Service Cross (Australia)|CSC]],
| CSM, = [[Conspicuous Service Medal|CSM]],
| CV, = [[Cross of Valour (Australia)|CV]],
| DSC, = [[Distinguished Service Cross (Australia)|DSC]],
| DSCa, = [[Distinguished Service Cross (Australia)|DSC]],
| DSCuk, = [[Distinguished Service Cross (United Kingdom)|DSC]],
| DSC1, = [[Distinguished Service Cross and Bar (United Kingdom)|DSC]] & [[Medal bar|Bar]],
| DSC2, = [[Distinguished Service Cross and two Bars (United Kingdom)|DSC]] & [[Medal bar|Two Bars]],
| DSM, = [[Distinguished Service Medal (Australia)|DSM]],
| DSMuk, = [[Distinguished Service Medal (United Kingdom)|DSM]],
| ESM, = [[Emergency Services Medal (Australia)|ESM]],
| MG, = [[Medal for Gallantry|MG]],
| MP, = [[Member of Parliament|MP]],
| NSC, = [[Nursing Service Cross (Australia)|NSC]],
| OAM, = [[Medal of the Order of Australia|OAM]],
| PSM, = [[Public Service Medal (Australia)|PSM]],
| SC, = [[Star of Courage (Australia)|SC]],
| SG, = [[Star of Gallantry|SG]],
| VC, = [[Victoria Cross for Australia|VC]],
| ADC, = [[Aide de Camp|ADC]],
| ADC(P),= [[Personal Aide-de-Camp|ADC(P)]],
| AE, = [[Air Efficiency Award|AE]],
| AFC, = [[Air Force Cross (United Kingdom)|AFC]],
| AFC1, = [[Air Force Cross (United Kingdom)|AFC]] & [[Medal bar|Bar]],
| AFM, = [[Air Force Medal|AFM]],
| ARRC, = [[Royal Red Cross|ARRC]],
| AsstChStJ, = [[Assistant Chaplin of The Most Venerable Order of the Hospital of Saint John of Jerusalem|AsstChStJ]],
| BEM, = [[British Empire Medal|BEM]],
| Bart, = [[Baronet|Bart]],
| Bt, = [[Baronet|Bt]],
| Btss, = [[Baronet|Btss]],
| CB, = [[Companion of the Order of the Bath|CB]],
| CBE, = [[Commander of the Order of the British Empire|CBE]],
| CBEh, = [[Commander of the Order of the British Empire|CBE]],
| CGM, = [[Conspicuous Gallantry Medal|CGM]],
| CH, = [[Companion of the Order of the Companions of Honour|CH]],
| CIE, = [[Companion of the Order of the Indian Empire|CIE]],
| CMG, = [[Companion of the Order of St Michael and St George|CMG]],
| CPM, = [[Colonial Police Medal|CPM]],
| CStJ, = [[Commander of the Most Venerable Order of the Hospital of Saint John of Jerusalem|CStJ]],
| ChStJ, = [[Chaplain of the Most Venerable Order of the Hospital of Saint John of Jerusalem|ChStJ]],
| CVO, = [[Commander of the Royal Victorian Order|CVO]],
| DBE, = [[Dame Commander of the Order of the British Empire|DBE]],
| DCB, = [[Dame Commander of the Order of the Bath|DCB]],
| DCIE, = [[Dame Commander of the Order of the Indian Empire|DCIE]],
| DCM, = [[Distinguished Conduct Medal|DCM]],
| DCMG, = [[Dame Commander of the Order of St Michael and St George|DCMG]],
| DCVO, = [[Dame Commander of the Royal Victorian Order|DCVO]],
| DFC, = [[Distinguished Flying Cross (United Kingdom)|DFC]],
| DFC1, = [[Distinguished Flying Cross (United Kingdom)|DFC]] & [[Medal bar|Bar]],
| DFC2, = [[Distinguished Flying Cross (United Kingdom)|DFC]] & [[Medal bar|Two Bars]],
| DFM, = [[Distinguished Flying Medal|DFM]],
| DFM1, = [[Distinguished Flying Medal|DFM]] & [[Medal bar|Bar]],
| DFM2, = [[Distinguished Flying Medal|DFM]] & [[Medal bar|Two Bars]],
| DL, = [[Deputy Lieutenant|DL]],
| DSO, = [[Companion of the Distinguished Service Order|DSO]],
| DSO1, = [[Companion of the Distinguished Service Order|DSO]] & [[Medal bar|Bar]],
| DSO2, = [[Companion of the Distinguished Service Order|DSO]] & [[Medal bar|Two Bars]],
| DStJ, = [[Dame of Justice of the Most Venerable Order of the Hospital of Saint John of Jerusalem|DStJ]],
| DStJg, = [[Dame of Grace of the Most Venerable Order of the Hospital of Saint John of Jerusalem|DStJ]],
| ED, = [[Efficiency Decoration|ED]],
| ERD, = [[Emergency Reserve Decoration|ERD]],
| EsqStJ,= [[Esquire of the Most Venerable Order of the Hospital of Saint John of Jerusalem|EsqStJ]],
| FAA, = [[Fellow of the Australian Academy of Science|FAA]],
| FAHMS, = [[Fellow of the Australian Academy of Health and Medical Sciences|FAHMS]],
| FAICD, = [[Fellow of the Australian Institute of Company Directors|FAICD]],
| FRACP, = [[Fellow of the Royal Australasian College of Physicians|FRACP]],
| FRCP, = [[Fellow of the Royal College of Physicians|FRCP]],
| FRCPE, = [[Fellow of the Royal College of Physicians of Edinburgh|FRCPE]],
| FRS, = [[Fellow of the Royal Society|FRS]],
| FRSN, = [[Fellow of the Royal Society of New South Wales|FRSN]],
| FRSNZ, = [[Fellow of the Royal Society of New Zealand|FRSNZ]],
| FTSE, = [[Fellow of the Australian Academy of Technological Sciences and Engineering|FTSE]],
| GBE, = [[Knight Grand Cross of the Order of the British Empire|GBE]],
| GBEf, = [[Dame Grand Cross of the Order of the British Empire|GBE]],
| GC, = [[George Cross|GC]],
| GCB, = [[Knight Grand Cross of the Order of the Bath|GCB]],
| GCBf, = [[Dame Grand Cross of the Order of the Bath|GCB]],
| GCIE, = [[Knight Grand Cross of the Order of the Indian Empire|GCIE]],
| GCIEf, = [[Dame Grand Cross of the Order of the Indian Empire|GCIE]],
| GCMG, = [[Knight Grand Cross of the Order of St Michael and St George|GCMG]],
| GCMGf, = [[Dame Grand Cross of the Order of St Michael and St George|GCMG]],
| GCStJ, = [[Bailiff Grand Cross of the Most Venerable Order of the Hospital of Saint John of Jerusalem|GCStJ]],
| GCStJf,= [[Dame Grand Cross of the Most Venerable Order of the Hospital of Saint John of Jerusalem|GCStJ]],
| GCVO, = [[Knight Grand Cross of the Royal Victorian Order|GCVO]],
| GCVOf, = [[Dame Grand Cross of the Royal Victorian Order|GCVO]],
| GM, = [[George Medal|GM]],
| JP, = [[Justice of the Peace|JP]],
| KBE, = [[Knight Commander of the Order of the British Empire|KBE]],
| KC, = [[King's Counsel|KC]],
| KCB, = [[Knight Commander of the Order of the Bath|KCB]],
| KCIE, = [[Knight Commander of the Order of the Indian Empire|KCIE]],
| KCMG, = [[Knight Commander of the Order of St Michael and St George|KCMG]],
| KCVO, = [[Knight Commander of the Royal Victorian Order|KCVO]],
| KG, = [[Knight of the Order of the Garter|KG]],
| KP, = [[Knight of the Order of Saint Patrick|KP]],
| KStJ, = [[Knight of Justice of the Most Venerable Order of the Hospital of Saint John of Jerusalem|KStJ]],
| KStJg, = [[Knight of Grace of the Most Venerable Order of the Hospital of Saint John of Jerusalem|KStJ]],
| KT, = [[Knight of the Order of the Thistle|KT]],
| LG, = [[Lady Companion of the Order of the Garter|LG]],
| LT, = [[Lady Companion of the Order of the Thistle|LT]],
| LVO, = [[Lieutenant of the Royal Victorian Order|LVO]],
| MBE, = [[Member of the Order of the British Empire|MBE]],
| MC, = [[Military Cross|MC]],
| MM, = [[Military Medal|MM]],
| MVO, = [[Member of the Royal Victorian Order|MVO]],
| OBE, = [[Officer of the Order of the British Empire|OBE]],
| OM, = [[Member of the Order of Merit|OM]],
| OStJ, = [[Officer of the Most Venerable Order of the Hospital of Saint John of Jerusalem|OStJ]],
| PC, = [[Her Majesty's Most Honourable Privy Council|PC]],
| QC, = [[Queen's Counsel|QC]],
| QGM, = [[Queen's Gallantry Medal|QGM]],
| QFSM, = [[Queen's Fire Service Medal for Gallantry|QFSM]],
| QPM, = [[Queen's Police Medal for Gallantry|QPM]],
| QFSMd, = [[Queen's Fire Service Medal for Distinguished Service|QFSM]],
| QPMd, = [[Queen's Police Medal for Distinguished Service|QPM]],
| RAN = [[Royal Australian Navy|RAN]]
| RANR = [[Royal Australian Naval Reserve|RANR]]
| RD, = [[Decoration for Officers of the Royal Naval Reserve|RD]],
| RFD, = [[Reserve Force Decoration|RFD]],
| RRC, = [[Royal Red Cross|RRC]],
| RVM, = [[Royal Victorian Medal|RVM]],
| SBStJ, = [[Serving Brother of the Most Venerable Order of the Hospital of Saint John of Jerusalem|SBStJ]],
| SSStJ, = [[Serving Sister of the Most Venerable Order of the Hospital of Saint John of Jerusalem|SSStJ]],
| Sub-ChStJ, = [[Sub-Chaplain of the Most Venerable Order of the Hospital of Saint John of Jerusalem|Sub-ChStJ]],
| TD, = [[Territorial Decoration|TD]],
| VCi, = [[Victoria Cross|VC]],
| VD, = [[Volunteer Officers' Decoration|VD]],
| *, = [[Medal bar|*]],
| SSI, = [[Star of the Solomon Islands|SSI]],
| GCL, = [[Grand Companion of the Order of Logohu|GCL]],
| QSO, = [[Companion of the Queen's Service Order|QSO]],
| OLY, = [[Competitor at the Olympic Games|OLY]]
}}<noinclude>
{{documentation}}
</noinclude>
19cc27a6404b36a86c2168793efca07cc03427a7
Template:Tlc
10
259
511
510
2023-12-24T02:21:38Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Tlc]]
wikitext
text/x-wiki
#REDIRECT [[Template:Template link code]]
{{Redirect category shell|
{{R from template shortcut}}
{{R from high-use template}}
{{R from move}}
}}
48ef4a029c0e27cccb1148a29fb8b7ccb211a4a2
Template:Infobox court/doc
10
260
513
512
2023-12-24T02:21:44Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Infobox_court/doc]]
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata -->
{{Lua|Module:Infobox|Module:InfoboxImage|Module:Check for unknown parameters}}
{{tlc|{{BASEPAGENAME}}}} can be used to provide at-a-glance information at the start of an article about a court.
== Usage ==
{{Parameter names example
| court_name
| native_name
| image
| image_upright
| imagesize
| alt
| caption
| image2
| image_upright2
| imagesize2
| alt2
| caption2
| established
| dissolved
| jurisdiction
| location
| headquarters
| coordinates
| motto
| type
| authority
| appealsto
| appealsfrom
| terms
| positions
| budget
| language
| tribunal-type
| website
| chiefjudgetitle
| chiefjudgename
| termstart
| termend
| termend2
| chiefjudgetitle2
| chiefjudgename2
| termstart2
| termend3
| termend4
| chiefjudgetitle3
| chiefjudgename3
| termstart3
| termend5
| termend6
| division_map
| division_map_upright
| division_map_size
| division_map_alt
| division_caption
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox court
| court_name =
| native_name = <!-- native name of the court, if different -->
| image =
| image_upright = <!-- [[Wikipedia:Autosizing images|image scaling factor]] for image, if applicable -->
| imagesize = Image_upright if preferred
| alt =
| caption =
| image2 =
| image_upright2 =
| imagesize2 =
| alt2 =
| caption2 =
| established = <!-- use {{start date|YYYY|MM|DD}} -->
| dissolved = <!-- use {{end date|YYYY|MM|DD}} -->
| jurisdiction = <!-- Official jurisdiction -->
| location = <!-- city, state/province, country -->
| coordinates = <!-- {{coord|45.000|-122.000|display=inline,title}} -->
| motto =
| type = <!-- partisan election/non-partisan election/legislative selection/executive selection/co-option/etc -->
| authority = <!-- constitution/statute/monarch or | at = -->
| appealsto = <!-- appeals from this court go where -->
| appealsfrom = <!-- appeals from what other courts are heard by this -->
| terms = <!-- length of court term for judges -->
| positions = <!-- number of positions/seats on court -->
| budget = <!-- amount of annual budget -->
| language =
| tribunal-type =
| website = <!-- official website. Use {{Tl|URL}} -->
| chiefjudgetitle = <!-- title of the top judge such as chief justice/senior judge -->
| chiefjudgename = <!-- current chief's name -->
| termstart = <!-- year current chief became chief -->
| termend = <!-- lead position ends -->
| termend2 = <!-- jurist term ends -->
| chiefjudgetitle2 = <!-- title of the second top judge if applicable -->
| chiefjudgename2 = <!-- current deputy chief's name -->
| termstart2 = <!-- year current deputy chief became chief -->
| termend3 = <!-- lead position ends -->
| termend4 = <!-- jurist term ends -->
| chiefjudgetitle3 = <!-- title of the second top judge if applicable -->
| chiefjudgename3 = <!-- current deputy chief's name -->
| termstart3 = <!-- year current deputy chief became chief -->
| termend5 = <!-- lead position ends -->
| termend6 = <!-- jurist term ends -->
| division_map = <!-- image for a map of division separations, if applicable -->
| division_map_upright = <!-- [[Wikipedia:Autosizing images|image scaling factor]] for map of division, if applicable -->
| division_map_size = <!-- size of division map above, if applicable -->
| division_map_alt = <!-- alt text for division map above, if applicable -->
| division_caption =
}}
</syntaxhighlight>
{{clear}}
== Example ==
{{Infobox court
| court_name = District Court of New South Wales
| image = Coat of Arms of New South Wales.svg
| alt = Coat of Arms of New South Wales
| image2 = SLNSW 479525 22 Court House Darlinghurst front view SH 571.jpg
| alt2 = Darlinghurst Courthouse, pictured in 1872, a seat of the District Court
| caption2 = [[Darlinghurst Courthouse]], pictured in 1872, a seat of the District Court
| established = 1858
| jurisdiction = [[New South Wales]]
| location = Full time sittings are held in the [[Sydney central business district|Sydney CBD]], and at [[Parramatta]], [[Penrith, New South Wales|Penrith]], [[Campbelltown, New South Wales|Campbelltown]], [[Newcastle, New South Wales|Newcastle]], [[Gosford]], [[Wollongong]] and [[Lismore, New South Wales|Lismore]]. Part time sittings are held in a range of major regional centres.
| type = [[Governor of New South Wales|Vice-regal]] appointment upon nomination by the [[Premier of New South Wales|Premier]] following the advice of the [[Attorney General of New South Wales|Attorney General]] and [[Executive Council of New South Wales|Cabinet]]<!-- partisan election/non-partisan election/legislative selection/executive selection/co-option/etc -->
| authority = [[Parliament of New South Wales|New South Wales Parliament]] via the {{Cite Legislation AU|NSW|act||District Court Act 1973}} (formerly the {{Cite Legislation AU|NSW|act||District Courts Act 1858}})<!-- constitution/statute/monarch-->
| appealsto = [[Supreme Court of New South Wales]] <!-- appeals from this court go where -->
| appealsfrom = [[Local Court of New South Wales]]<!-- appeals from what other courts are heard by this -->
| website = [http://www.lawlink.nsw.gov.au/lawlink/district_court/ll_districtcourt.nsf/pages/dc_index www.lawlink.nsw.gov.au/dc]<!-- official website -->
| chiefjudgetitle = Chief Judge<!-- title of the top judge such as chief justice/senior judge -->
| chiefjudgename = Derek Michael Price {{post-nominals|country=AUS|AM}}<!-- current chief's name -->
| termstart = 2014<!-- year current chief became chief -->
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox court
| court_name = District Court of New South Wales
| image = Coat of Arms of New South Wales.svg
| alt = Coat of Arms of New South Wales
| image2 = SLNSW 479525 22 Court House Darlinghurst front view SH 571.jpg
| alt2 = Darlinghurst Courthouse, pictured in 1872, a seat of the District Court
| caption2 = [[Darlinghurst Courthouse]], pictured in 1872, a seat of the District Court
| established = 1858
| jurisdiction = [[New South Wales]]
| location = Full time sittings are held in the [[Sydney central business district|Sydney CBD]], and at [[Parramatta]], [[Penrith, New South Wales|Penrith]], [[Campbelltown, New South Wales|Campbelltown]], [[Newcastle, New South Wales|Newcastle]], [[Gosford]], [[Wollongong]] and [[Lismore, New South Wales|Lismore]]. Part time sittings are held in a range of major regional centres.
| type = [[Governor of New South Wales|Vice-regal]] appointment upon nomination by the [[Premier of New South Wales|Premier]] following the advice of the [[Attorney General of New South Wales|Attorney General]] and [[Executive Council of New South Wales|Cabinet]]<!-- partisan election/non-partisan election/legislative selection/executive selection/co-option/etc -->
| authority = [[Parliament of New South Wales|New South Wales Parliament]] via the {{Cite Legislation AU|NSW|act||District Court Act 1973}} (formerly the {{Cite Legislation AU|NSW|act||District Courts Act 1858}})<!-- constitution/statute/monarch-->
| appealsto = [[Supreme Court of New South Wales]] <!-- appeals from this court go where -->
| appealsfrom = [[Local Court of New South Wales]]<!-- appeals from what other courts are heard by this -->
| website = [http://www.lawlink.nsw.gov.au/lawlink/district_court/ll_districtcourt.nsf/pages/dc_index www.lawlink.nsw.gov.au/dc]<!-- official website -->
| chiefjudgetitle = Chief Judge<!-- title of the top judge such as chief justice/senior judge -->
| chiefjudgename = Derek Michael Price {{post-nominals|country=AUS|AM}}<!-- current chief's name -->
| termstart = 2014<!-- year current chief became chief -->
}}
</syntaxhighlight>
{{clear}}
== Microformat ==
{{UF-hcard-org}}
== TemplateData ==
{{TemplateData header}}
<templatedata>
{
"params": {
"court_name": {},
"native_name": {},
"image": {},
"image_upright": {},
"imagesize": {},
"caption": {},
"image2": {},
"image_upright2": {},
"imagesize2": {},
"caption2": {},
"dissolved": {},
"coordinates": {},
"motto": {},
"at": {},
"appealsto": {
"aliases": [
"appeals"
]
},
"appealsfrom": {},
"terms": {},
"budget": {},
"chiefjudgetitle": {},
"chiefjudgename": {},
"termstart": {},
"termend": {},
"termend2": {},
"chiefjudgetitle2": {},
"chiefjudgename2": {},
"termstart2": {},
"termend3": {},
"termend4": {},
"alt": {},
"alt2": {},
"established": {},
"authority": {},
"positions": {},
"language": {},
"tribunal-type": {},
"website": {},
"jurisdiction": {},
"location": {},
"type": {},
"chiefjudgetitle3": {},
"chiefjudgename3": {},
"termstart3": {},
"termend5": {},
"termend6": {},
"division_map": {},
"division_map_upright": {},
"division_map_size": {},
"division_map_alt": {},
"division_caption": {}
},
"paramOrder": [
"court_name",
"native_name",
"image",
"image_upright",
"imagesize",
"alt",
"caption",
"image2",
"image_upright2",
"imagesize2",
"alt2",
"caption2",
"established",
"dissolved",
"coordinates",
"motto",
"at",
"authority",
"appealsto",
"appealsfrom",
"terms",
"positions",
"budget",
"language",
"tribunal-type",
"website",
"chiefjudgetitle",
"chiefjudgename",
"termstart",
"termend",
"termend2",
"chiefjudgetitle2",
"chiefjudgename2",
"termstart2",
"termend3",
"termend4",
"jurisdiction",
"location",
"type",
"chiefjudgetitle3",
"chiefjudgename3",
"termstart3",
"termend5",
"termend6",
"division_map",
"division_map_upright",
"division_map_size",
"division_map_alt",
"division_caption"
],
"description": "infobox template for courts",
"format": "block"
}
</templatedata>
== Tracking categories ==
* {{clc|Category:Pages using infobox court with unknown parameters}}
== See also ==
* {{tl|Infobox judge}}
* {{tl|Infobox U.S. federal court}}
{{Organization infoboxes}}
<includeonly>{{sandbox other||
<!-- Categories below this line; interwikis at Wikidata -->
[[Category:Law infobox templates|Court]]
[[Category:Politics and government infobox templates|Court]]
[[Category:Templates that add a tracking category|{{PAGENAME}}]]
}}</includeonly>
67b70e74185af1c43dcbbb33f50bdc81fe45d839
Module:If preview
828
261
515
514
2023-12-24T02:23:58Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:If_preview]]
Scribunto
text/plain
local p = {}
local cfg = mw.loadData('Module:If preview/configuration')
--[[
main
This function returns either the first argument or second argument passed to
this module, depending on whether the page is being previewed.
]]
function p.main(frame)
if cfg.preview then
return frame.args[1] or ''
else
return frame.args[2] or ''
end
end
--[[
pmain
This function returns either the first argument or second argument passed to
this module's parent (i.e. template using this module), depending on whether it
is being previewed.
]]
function p.pmain(frame)
return p.main(frame:getParent())
end
local function warning_text(warning)
return mw.ustring.format(
cfg.warning_infrastructure,
cfg.templatestyles,
warning
)
end
function p._warning(args)
local warning = args[1] and args[1]:match('^%s*(.-)%s*$') or ''
if warning == '' then
return warning_text(cfg.missing_warning)
end
if not cfg.preview then return '' end
return warning_text(warning)
end
--[[
warning
This function returns a "preview warning", which is the first argument marked
up with HTML and some supporting text, depending on whether the page is being previewed.
disabled since we'll implement the template version in general
]]
--function p.warning(frame)
-- return p._warning(frame.args)
--end
--[[
warning, but for pass-through templates like {{preview warning}}
]]
function p.pwarning(frame)
return p._warning(frame:getParent().args)
end
return p
9a92196d0001b8016f2501aedfadcc3adcb974ef
Module:If preview/configuration
828
262
517
516
2023-12-24T02:24:02Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:If_preview/configuration]]
Scribunto
text/plain
--[[
We perform the actual check for whether this is a preview here since
preprocessing is relatively expensive.
]]
local frame = mw.getCurrentFrame()
local function is_preview()
local revision_id = frame:preprocess('{{REVISIONID}}')
-- {{REVISIONID}} is usually the empty string when previewed.
-- I don't know why we're checking for nil but hey, maybe someday things
-- would have broken
return revision_id == nil or revision_id == ''
end
local function templatestyles()
return frame:extensionTag{
name = 'templatestyles', args = { src = 'Module:If preview/styles.css' }
}
end
return {
preview = is_preview(),
templatestyles = templatestyles(),
warning_infrastructure = '%s<div class="preview-warning"><strong>Preview warning:</strong> %s</div>',
missing_warning = 'The template has no warning text. Please add a warning.'
}
3edc8897c51a61b9e710b2a4d9eb657b3c2f1034
Module:If preview/styles.css
828
263
519
518
2023-12-24T02:24:03Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:If_preview/styles.css]]
sanitized-css
text/css
/* {{pp|small=yes}} */
.preview-warning {
font-style: italic;
/* @noflip */
padding-left: 1.6em;
margin-bottom: 0.5em;
color: red;
}
/* The templatestyles element inserts a link element before hatnotes.
* TODO: Remove link if/when WMF resolves T200206 */
.preview-warning + link + .preview-warning {
margin-top: -0.5em;
}
8b79ffc4853d424a805b084de00030e04bbd573e
Module:TNT
828
264
521
520
2023-12-24T02:24:06Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:TNT]]
Scribunto
text/plain
--
-- INTRO: (!!! DO NOT RENAME THIS PAGE !!!)
-- This module allows any template or module to be copy/pasted between
-- wikis without any translation changes. All translation text is stored
-- in the global Data:*.tab pages on Commons, and used everywhere.
--
-- SEE: https://www.mediawiki.org/wiki/Multilingual_Templates_and_Modules
--
-- ATTENTION:
-- Please do NOT rename this module - it has to be identical on all wikis.
-- This code is maintained at https://www.mediawiki.org/wiki/Module:TNT
-- Please do not modify it anywhere else, as it may get copied and override your changes.
-- Suggestions can be made at https://www.mediawiki.org/wiki/Module_talk:TNT
--
-- DESCRIPTION:
-- The "msg" function uses a Commons dataset to translate a message
-- with a given key (e.g. source-table), plus optional arguments
-- to the wiki markup in the current content language.
-- Use lang=xx to set language. Example:
--
-- {{#invoke:TNT | msg
-- | I18n/Template:Graphs.tab <!-- https://commons.wikimedia.org/wiki/Data:I18n/Template:Graphs.tab -->
-- | source-table <!-- uses a translation message with id = "source-table" -->
-- | param1 }} <!-- optional parameter -->
--
--
-- The "doc" function will generate the <templatedata> parameter documentation for templates.
-- This way all template parameters can be stored and localized in a single Commons dataset.
-- NOTE: "doc" assumes that all documentation is located in Data:Templatedata/* on Commons.
--
-- {{#invoke:TNT | doc | Graph:Lines }}
-- uses https://commons.wikimedia.org/wiki/Data:Templatedata/Graph:Lines.tab
-- if the current page is Template:Graph:Lines/doc
--
local p = {}
local i18nDataset = 'I18n/Module:TNT.tab'
-- Forward declaration of the local functions
local sanitizeDataset, loadData, link, formatMessage
function p.msg(frame)
local dataset, id
local params = {}
local lang = nil
for k, v in pairs(frame.args) do
if k == 1 then
dataset = mw.text.trim(v)
elseif k == 2 then
id = mw.text.trim(v)
elseif type(k) == 'number' then
table.insert(params, mw.text.trim(v))
elseif k == 'lang' and v ~= '_' then
lang = mw.text.trim(v)
end
end
return formatMessage(dataset, id, params, lang)
end
-- Identical to p.msg() above, but used from other lua modules
-- Parameters: name of dataset, message key, optional arguments
-- Example with 2 params: format('I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset')
function p.format(dataset, key, ...)
local checkType = require('libraryUtil').checkType
checkType('format', 1, dataset, 'string')
checkType('format', 2, key, 'string')
return formatMessage(dataset, key, {...})
end
-- Identical to p.msg() above, but used from other lua modules with the language param
-- Parameters: language code, name of dataset, message key, optional arguments
-- Example with 2 params: formatInLanguage('es', I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset')
function p.formatInLanguage(lang, dataset, key, ...)
local checkType = require('libraryUtil').checkType
checkType('formatInLanguage', 1, lang, 'string')
checkType('formatInLanguage', 2, dataset, 'string')
checkType('formatInLanguage', 3, key, 'string')
return formatMessage(dataset, key, {...}, lang)
end
-- Obsolete function that adds a 'c:' prefix to the first param.
-- "Sandbox/Sample.tab" -> 'c:Data:Sandbox/Sample.tab'
function p.link(frame)
return link(frame.args[1])
end
function p.doc(frame)
local dataset = 'Templatedata/' .. sanitizeDataset(frame.args[1])
return frame:extensionTag('templatedata', p.getTemplateData(dataset)) ..
formatMessage(i18nDataset, 'edit_doc', {link(dataset)})
end
function p.getTemplateData(dataset)
-- TODO: add '_' parameter once lua starts reindexing properly for "all" languages
local data = loadData(dataset)
local names = {}
for _, field in pairs(data.schema.fields) do
table.insert(names, field.name)
end
local params = {}
local paramOrder = {}
for _, row in pairs(data.data) do
local newVal = {}
local name = nil
for pos, val in pairs(row) do
local columnName = names[pos]
if columnName == 'name' then
name = val
else
newVal[columnName] = val
end
end
if name then
params[name] = newVal
table.insert(paramOrder, name)
end
end
-- Work around json encoding treating {"1":{...}} as an [{...}]
params['zzz123']=''
local json = mw.text.jsonEncode({
params=params,
paramOrder=paramOrder,
description=data.description
})
json = string.gsub(json,'"zzz123":"",?', "")
return json
end
-- Local functions
sanitizeDataset = function(dataset)
if not dataset then
return nil
end
dataset = mw.text.trim(dataset)
if dataset == '' then
return nil
elseif string.sub(dataset,-4) ~= '.tab' then
return dataset .. '.tab'
else
return dataset
end
end
loadData = function(dataset, lang)
dataset = sanitizeDataset(dataset)
if not dataset then
error(formatMessage(i18nDataset, 'error_no_dataset', {}))
end
-- Give helpful error to thirdparties who try and copy this module.
if not mw.ext or not mw.ext.data or not mw.ext.data.get then
error('Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:' .. dataset)
end
local data = mw.ext.data.get(dataset, lang)
if data == false then
if dataset == i18nDataset then
-- Prevent cyclical calls
error('Missing Commons dataset ' .. i18nDataset)
else
error(formatMessage(i18nDataset, 'error_bad_dataset', {link(dataset)}))
end
end
return data
end
-- Given a dataset name, convert it to a title with the 'commons:data:' prefix
link = function(dataset)
return 'c:Data:' .. mw.text.trim(dataset or '')
end
formatMessage = function(dataset, key, params, lang)
for _, row in pairs(loadData(dataset, lang).data) do
local id, msg = unpack(row)
if id == key then
local result = mw.message.newRawMessage(msg, unpack(params or {}))
return result:plain()
end
end
if dataset == i18nDataset then
-- Prevent cyclical calls
error('Invalid message key "' .. key .. '"')
else
error(formatMessage(i18nDataset, 'error_bad_msgkey', {key, link(dataset)}))
end
end
return p
9d0d10e54abd232c806dcabccaf03e52858634a1
Template:Module other
10
265
523
522
2023-12-24T02:24:11Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Module_other]]
wikitext
text/x-wiki
{{#switch:
<!--If no or empty "demospace" parameter then detect namespace-->
{{#if:{{{demospace|}}}
| {{lc: {{{demospace}}} }} <!--Use lower case "demospace"-->
| {{#ifeq:{{NAMESPACE}}|{{ns:Module}}
| module
| other
}}
}}
| module = {{{1|}}}
| other
| #default = {{{2|}}}
}}<!--End switch--><noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
503694836c1b07142e63fd35d8be69ec8bb9ffe7
Template:Module rating
10
266
525
524
2023-12-24T02:24:12Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Module_rating]]
wikitext
text/x-wiki
<includeonly>{{#ifeq:{{SUBPAGENAME}}|doc|<!--do not show protection level of the module on the doc page, use the second and optionally third parameter if the doc page is also protected -->{{#if:{{{2|}}}|{{Pp|{{{2}}}|action={{{3|}}}}}}}|{{Module other|{{ombox
| type = notice
| image = {{#switch: {{{1|}}}
| pre-alpha | prealpha | pa = [[File:Ambox warning blue construction.svg|40x40px|link=|alt=Pre-alpha]]
| alpha | a = [[File:Alpha lowercase.svg|26x26px|link=|alt=Alpha]]
| beta | b = [[File:Greek lc beta.svg|40x40px|link=|alt=Beta]]
| release | r | general | g = [[File:Green check.svg|40x40px|link=|alt=Ready for use]]
| protected | protect | p = [[File:{{#switch:{{#invoke:Effective protection level|edit|{{#switch:{{SUBPAGENAME}}|doc|sandbox={{FULLBASEPAGENAME}}|{{FULLPAGENAME}}}}}}|autoconfirmed=Semi|extendedconfirmed=Extended|accountcreator|templateeditor=Template|#default=Full}}-protection-shackle.svg|40x40px|link=|alt=Protected]]
| semiprotected | semiprotect | semi =[[File:Semi-protection-shackle.svg|40x40px|link=|alt=Semi-protected]]
}}
| style =
| textstyle =
| text = {{#switch: {{{1|}}}
| pre-alpha | prealpha | pa = This module is rated as [[:Category:Modules in pre-alpha development|pre-alpha]]. It is unfinished, and may or may not be in active development. It should not be used from article namespace pages. Modules remain pre-alpha until the original editor (or someone who takes one over if it is abandoned for some time) is satisfied with the basic structure.<!--
-->{{#switch: {{SUBPAGENAME}}|doc|sandbox=<!-- No category for /doc or /sandbox subpages -->
| {{#ifeq: {{{nocat|}}} | true | <!-- No category if user sets nocat=true --> | [[Category:Modules in pre-alpha development|{{PAGENAME}}]] }}
}}
| alpha | a = This module is rated as [[:Category:Modules in alpha|alpha]]. It is ready for third-party input, and may be used on a few pages to see if problems arise, but should be watched. Suggestions for new features or changes in their input and output mechanisms are welcome.<!--
-->{{#switch: {{SUBPAGENAME}}|doc|sandbox=<!-- No category for /doc or /sandbox subpages -->
| {{#ifeq: {{{nocat|}}} | true | <!-- No category if user sets nocat=true --> | [[Category:Modules in alpha|{{PAGENAME}}]] }}
}}
| beta | b = This module is rated as [[:Category:Modules in beta|beta]], and is ready for widespread use. It is still new and should be used with some caution to ensure the results are as expected.<!--
-->{{#switch: {{SUBPAGENAME}}|doc|sandbox=<!-- No category for /doc or /sandbox subpages -->
| {{#ifeq: {{{nocat|}}} | true | <!-- No category if user sets nocat=true --> | [[Category:Modules in beta|{{PAGENAME}}]] }}
}}
| release | r | general | g = This module is rated as [[:Category:Modules for general use|ready for general use]]. It has reached a mature form and is thought to be relatively bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by [[Wikipedia:Template sandbox and test cases|sandbox testing]] rather than repeated trial-and-error editing.<!--
-->{{#switch: {{SUBPAGENAME}}|doc|sandbox=<!-- No category for /doc or /sandbox subpages -->
| {{#ifeq: {{{nocat|}}} | true | <!-- No category if user sets nocat=true --> | [[Category:Modules for general use|{{PAGENAME}}]] }}
}}
| protected | protect | p = This module is [[:Category:Modules subject to page protection|subject to page protection]]. It is a [[Wikipedia:High-risk templates|highly visible module]] in use by a very large number of pages, or is [[Wikipedia:Substitution|substituted]] very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is [[Wikipedia:Protection policy|protected]] from editing.<!--
-->{{#switch: {{SUBPAGENAME}}|doc|sandbox=<!-- No category for /doc or /sandbox subpages -->
| {{#ifeq: {{{nocat|}}} | true | <!-- No category if user sets nocat=true --> | [[Category:Modules subject to page protection|{{PAGENAME}}]] }}
}}
| semiprotected | semiprotect | semi = This module is [[:Category:Modules subject to page protection|subject to page protection]]. It is a [[Wikipedia:High-risk templates|highly visible module]] in use by a very large number of pages, or is [[Wikipedia:Substitution|substituted]] very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is [[WP:SEMI|semi-protected]] from editing.<!--
-->{{#switch: {{SUBPAGENAME}}|doc|sandbox=<!-- No category for /doc or /sandbox subpages -->
| {{#ifeq: {{{nocat|}}} | true | <!-- No category if user sets nocat=true --> | [[Category:Modules subject to page protection|{{PAGENAME}}]] }}
}}
| #default = {{error|Module rating is invalid or not specified.}}
}}
}}|{{error|Error: {{tl|Module rating}} must be placed in the Module namespace.}} [[Category:Pages with templates in the wrong namespace]]|demospace={{{demospace|<noinclude>module</noinclude>}}}}}}}</includeonly><noinclude>
{{module rating|release|nocat=true|demospace=module}}
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go in Wikidata. -->
</noinclude>
bbd244b3ea2e13ec4c1c810ae44f2f3789a93efc
Template:Uses TemplateStyles
10
267
527
526
2023-12-24T02:24:12Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Uses_TemplateStyles]]
wikitext
text/x-wiki
<includeonly>{{#invoke:Uses TemplateStyles|main}}</includeonly><noinclude>{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
60f2fc73c4d69b292455879f9fcb3c68f6c63c2a
Module:Uses TemplateStyles
828
268
529
528
2023-12-24T02:24:13Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Uses_TemplateStyles]]
Scribunto
text/plain
local yesno = require('Module:Yesno')
local mList = require('Module:List')
local mTableTools = require('Module:TableTools')
local mMessageBox = require('Module:Message box')
local TNT = require('Module:TNT')
local p = {}
local function format(msg, ...)
return TNT.format('I18n/Uses TemplateStyles', msg, ...)
end
local function getConfig()
return mw.loadData('Module:Uses TemplateStyles/config')
end
local function renderBox(tStyles)
local boxArgs = {
type = 'notice',
small = true,
image = string.format('[[File:Farm-Fresh css add.svg|32px|alt=%s]]', format('logo-alt'))
}
if #tStyles < 1 then
boxArgs.text = string.format('<strong class="error">%s</strong>', format('error-emptylist'))
else
local cfg = getConfig()
local tStylesLinks = {}
for i, ts in ipairs(tStyles) do
local link = string.format('[[:%s]]', ts)
local sandboxLink = nil
local tsTitle = mw.title.new(ts)
if tsTitle and cfg['sandbox_title'] then
local tsSandboxTitle = mw.title.new(string.format(
'%s:%s/%s/%s', tsTitle.nsText, tsTitle.baseText, cfg['sandbox_title'], tsTitle.subpageText))
if tsSandboxTitle and tsSandboxTitle.exists then
sandboxLink = format('sandboxlink', link, ':' .. tsSandboxTitle.prefixedText)
end
end
tStylesLinks[i] = sandboxLink or link
end
local tStylesList = mList.makeList('bulleted', tStylesLinks)
boxArgs.text = format(
mw.title.getCurrentTitle():inNamespaces(828,829) and 'header-module' or 'header-template') ..
'\n' .. tStylesList
end
return mMessageBox.main('mbox', boxArgs)
end
local function renderTrackingCategories(args, tStyles, titleObj)
if yesno(args.nocat) then
return ''
end
local cfg = getConfig()
local cats = {}
-- Error category
if #tStyles < 1 and cfg['error_category'] then
cats[#cats + 1] = cfg['error_category']
end
-- TemplateStyles category
titleObj = titleObj or mw.title.getCurrentTitle()
if (titleObj.namespace == 10 or titleObj.namespace == 828)
and not cfg['subpage_blacklist'][titleObj.subpageText]
then
local category = args.category or cfg['default_category']
if category then
cats[#cats + 1] = category
end
if not yesno(args.noprotcat) and (cfg['protection_conflict_category'] or cfg['padlock_pattern']) then
local currentProt = titleObj.protectionLevels["edit"] and titleObj.protectionLevels["edit"][1] or nil
local addedLevelCat = false
local addedPadlockCat = false
for i, ts in ipairs(tStyles) do
local tsTitleObj = mw.title.new(ts)
local tsProt = tsTitleObj.protectionLevels["edit"] and tsTitleObj.protectionLevels["edit"][1] or nil
if cfg['padlock_pattern'] and tsProt and not addedPadlockCat then
local content = tsTitleObj:getContent()
if not content:find(cfg['padlock_pattern']) then
cats[#cats + 1] = cfg['missing_padlock_category']
addedPadlockCat = true
end
end
if cfg['protection_conflict_category'] and currentProt and tsProt ~= currentProt and not addedLevelCat then
currentProt = cfg['protection_hierarchy'][currentProt] or 0
tsProt = cfg['protection_hierarchy'][tsProt] or 0
if tsProt < currentProt then
addedLevelCat = true
cats[#cats + 1] = cfg['protection_conflict_category']
end
end
end
end
end
for i, cat in ipairs(cats) do
cats[i] = string.format('[[Category:%s]]', cat)
end
return table.concat(cats)
end
function p._main(args, cfg)
local tStyles = mTableTools.compressSparseArray(args)
local box = renderBox(tStyles)
local trackingCategories = renderTrackingCategories(args, tStyles)
return box .. trackingCategories
end
function p.main(frame)
local origArgs = frame:getParent().args
local args = {}
for k, v in pairs(origArgs) do
v = v:match('^%s*(.-)%s*$')
if v ~= '' then
args[k] = v
end
end
return p._main(args)
end
return p
71ca57c37849f38e3c5ee30061bdae730963e48e
Module:Uses TemplateStyles/config
828
269
531
530
2023-12-24T02:24:14Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Uses_TemplateStyles/config]]
Scribunto
text/plain
local cfg = {} -- Don’t touch this line.
-- Subpage blacklist: these subpages will not be categorized (except for the
-- error category, which is always added if there is an error).
-- For example “Template:Foo/doc” matches the `doc = true` rule, so it will have
-- no categories. “Template:Foo” and “Template:Foo/documentation” match no rules,
-- so they *will* have categories. All rules should be in the
-- ['<subpage name>'] = true,
-- format.
cfg['subpage_blacklist'] = {
['doc'] = true,
['sandbox'] = true,
['sandbox2'] = true,
['testcases'] = true,
}
-- Sandbox title: if the stylesheet’s title is <template>/<stylesheet>.css, the
-- stylesheet’s sandbox is expected to be at <template>/<sandbox_title>/<stylesheet>.css
-- Set to nil to disable sandbox links.
cfg['sandbox_title'] = 'sandbox'
-- Error category: this category is added if the module call contains errors
-- (e.g. no stylesheet listed). A category name without namespace, or nil
-- to disable categorization (not recommended).
cfg['error_category'] = 'Uses TemplateStyles templates with errors'
-- Default category: this category is added if no custom category is specified
-- in module/template call. A category name without namespace, or nil
-- to disable categorization.
cfg['default_category'] = 'Templates using TemplateStyles'
-- Protection conflict category: this category is added if the protection level
-- of any stylesheet is lower than the protection level of the template. A category name
-- without namespace, or nil to disable categorization (not recommended).
cfg['protection_conflict_category'] = 'Templates using TemplateStyles with a different protection level'
-- Hierarchy of protection levels, used to determine whether one protection level is lower
-- than another and thus should populate protection_conflict_category. No protection is treated as zero
cfg['protection_hierarchy'] = {
autoconfirmed = 1,
extendedconfirmed = 2,
templateeditor = 3,
sysop = 4
}
-- Padlock pattern: Lua pattern to search on protected stylesheets for, or nil
-- to disable padlock check.
cfg['padlock_pattern'] = '{{pp-'
-- Missing padlock category: this category is added if a protected stylesheet
-- doesn’t contain any padlock template (specified by the above Lua pattern).
-- A category name without namespace (no nil allowed) if the pattern is not nil,
-- unused (and thus may be nil) otherwise.
cfg['missing_padlock_category'] = 'Templates using TemplateStyles without padlocks'
return cfg -- Don’t touch this line.
58e7a37c44f6ea3f6b8af54a559d696cc7256493
Module:If preview/doc
828
270
533
532
2023-12-24T02:24:16Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:If_preview/doc]]
wikitext
text/x-wiki
{{Module rating|protected}}
{{High-use}}
{{Lua|Module:If preview/configuration}}
{{Uses TemplateStyles|Module:If preview/styles.css}}
This module implements {{Tl|If preview}} and {{Tl|Preview warning}}. It helps templates/modules determine if they are being previewed.
Prefer implementing the template versions in other templates.
In a module to use the <code>main()</code>, you need to pass a frame table with an args table.
For the preview warning, use <code>_warning()</code>.
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<!-- Please, categories below this line and interwikis at Wikidata -->
}}</includeonly><noinclude>
[[pt:Módulo:If preview/doc]]
</noinclude>
8613bb2e7c8b53a722e4eef105b36b82ab20037d
Template:Mono
10
271
535
534
2023-12-24T02:29:01Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Mono]]
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>ifsubst|1=|2=<templatestyles src="Mono/styles.css" />}}<span class="monospaced">{{{2|{{{1}}}}}}</span><noinclude>
{{Documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
800f06823c02b03f8b9cf1e245ad8c4829cfe931
Template:Ifsubst
10
272
537
536
2023-12-24T02:29:01Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Ifsubst]]
wikitext
text/x-wiki
{{ safesubst:<noinclude/>#if:{{{demo|}}}
|{{ safesubst:<noinclude/>#ifeq:{{{demo}}} |no
|{{{no|{{{2|}}}}}}
|{{{yes|{{{1|}}}}}}
}}
|{{ safesubst:<noinclude/>#ifeq:{{ safesubst:<noinclude/>NAMESPACE}}|{{NAMESPACE}}
|{{{no|{{{2|}}}}}}
|{{{yes|{{{1|}}}}}}
}}}}<noinclude>
{{Documentation}}
</noinclude>
38e667b5df326086489bf557a5f7c4e43393af78
Template:Mono/styles.css
10
273
539
538
2023-12-24T02:29:02Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Mono/styles.css]]
sanitized-css
text/css
/* {{pp-template}} */
.monospaced {
/* "monospace, monospace" per [[WP:MONO]] */
font-family: monospace, monospace;
}
cadfc2ad2e42cde230abf3e74ad418f7c4c71ab4
Template:Edit
10
274
541
540
2023-12-24T02:29:06Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Edit]]
wikitext
text/x-wiki
<span class="noprint plainlinks" title="{{#if:{{{tooltip|}}}|{{{tooltip}}}|Edit {{{1}}}}}">[{{fullurl:{{#if:{{{1|}}}|{{{1}}}|{{FULLPAGENAME}}}}|action=edit{{#if:{{{section|}}}|§ion={{{section}}}}}{{#if:{{{editintro|}}}|&editintro={{urlencode:{{{editintro}}}|wiki}}}}{{#if:{{{preload|}}}|&preload={{urlencode:{{{preload}}}|wiki}}}}{{#if:{{{preloadtitle|}}}|&preloadtitle={{urlencode:{{{preloadtitle}}}}}}}}} {{{2|edit}}}]</span><noinclude>
{{documentation}}
</noinclude>
20ae9613e64bbdd279f1d1c7a3d2ddf64d1b1b48
Template:Plainlist
10
275
543
542
2023-12-24T02:29:06Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Plainlist]]
wikitext
text/x-wiki
<templatestyles src="Plainlist/styles.css"/><div class="plainlist {{{class|}}}" {{#if:{{{style|}}}{{{indent|}}}|style="{{#if:{{{indent|}}}|margin-left: {{#expr:{{{indent}}}*1.6}}em;}} {{{style|}}}"}}>{{#if:{{{1|}}}|
{{{1}}}
</div>}}<noinclude></div>
{{documentation}}
</noinclude>
582fe7098c25c1ecfc0ad32f62ecd674ebe2bdf0
Module:Wd
828
276
545
544
2023-12-24T02:29:09Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Wd]]
Scribunto
text/plain
-- Original module located at [[:en:Module:Wd]] and [[:en:Module:Wd/i18n]].
require("strict")
local p = {}
local arg = ...
local i18n
local function loadI18n(aliasesP, frame)
local title
if frame then
-- current module invoked by page/template, get its title from frame
title = frame:getTitle()
else
-- current module included by other module, get its title from ...
title = arg
end
if not i18n then
i18n = require(title .. "/i18n").init(aliasesP)
end
end
p.claimCommands = {
property = "property",
properties = "properties",
qualifier = "qualifier",
qualifiers = "qualifiers",
reference = "reference",
references = "references"
}
p.generalCommands = {
label = "label",
title = "title",
description = "description",
alias = "alias",
aliases = "aliases",
badge = "badge",
badges = "badges"
}
p.flags = {
linked = "linked",
short = "short",
raw = "raw",
multilanguage = "multilanguage",
unit = "unit",
-------------
preferred = "preferred",
normal = "normal",
deprecated = "deprecated",
best = "best",
future = "future",
current = "current",
former = "former",
edit = "edit",
editAtEnd = "edit@end",
mdy = "mdy",
single = "single",
sourced = "sourced"
}
p.args = {
eid = "eid",
page = "page",
date = "date",
globalSiteId = "globalSiteId"
}
local aliasesP = {
coord = "P625",
-----------------------
image = "P18",
author = "P50",
authorNameString = "P2093",
publisher = "P123",
importedFrom = "P143",
wikimediaImportURL = "P4656",
statedIn = "P248",
pages = "P304",
language = "P407",
hasPart = "P527",
publicationDate = "P577",
startTime = "P580",
endTime = "P582",
chapter = "P792",
retrieved = "P813",
referenceURL = "P854",
sectionVerseOrParagraph = "P958",
archiveURL = "P1065",
title = "P1476",
formatterURL = "P1630",
quote = "P1683",
shortName = "P1813",
definingFormula = "P2534",
archiveDate = "P2960",
inferredFrom = "P3452",
typeOfReference = "P3865",
column = "P3903",
subjectNamedAs = "P1810",
wikidataProperty = "P1687",
publishedIn = "P1433"
}
local aliasesQ = {
percentage = "Q11229",
prolepticJulianCalendar = "Q1985786",
citeWeb = "Q5637226",
citeQ = "Q22321052"
}
local parameters = {
property = "%p",
qualifier = "%q",
reference = "%r",
alias = "%a",
badge = "%b",
separator = "%s",
general = "%x"
}
local formats = {
property = "%p[%s][%r]",
qualifier = "%q[%s][%r]",
reference = "%r",
propertyWithQualifier = "%p[ <span style=\"font-size:85\\%\">(%q)</span>][%s][%r]",
alias = "%a[%s]",
badge = "%b[%s]"
}
local hookNames = { -- {level_1, level_2}
[parameters.property] = {"getProperty"},
[parameters.reference] = {"getReferences", "getReference"},
[parameters.qualifier] = {"getAllQualifiers"},
[parameters.qualifier.."\\d"] = {"getQualifiers", "getQualifier"},
[parameters.alias] = {"getAlias"},
[parameters.badge] = {"getBadge"}
}
-- default value objects, should NOT be mutated but instead copied
local defaultSeparators = {
["sep"] = {" "},
["sep%s"] = {","},
["sep%q"] = {"; "},
["sep%q\\d"] = {", "},
["sep%r"] = nil, -- none
["punc"] = nil -- none
}
local rankTable = {
["preferred"] = 1,
["normal"] = 2,
["deprecated"] = 3
}
local function replaceAlias(id)
if aliasesP[id] then
id = aliasesP[id]
end
return id
end
local function errorText(code, param)
local text = i18n["errors"][code]
if param then text = mw.ustring.gsub(text, "$1", param) end
return text
end
local function throwError(errorMessage, param)
error(errorText(errorMessage, param))
end
local function replaceDecimalMark(num)
return mw.ustring.gsub(num, "[.]", i18n['numeric']['decimal-mark'], 1)
end
local function padZeros(num, numDigits)
local numZeros
local negative = false
if num < 0 then
negative = true
num = num * -1
end
num = tostring(num)
numZeros = numDigits - num:len()
for _ = 1, numZeros do
num = "0"..num
end
if negative then
num = "-"..num
end
return num
end
local function replaceSpecialChar(chr)
if chr == '_' then
-- replace underscores with spaces
return ' '
else
return chr
end
end
local function replaceSpecialChars(str)
local chr
local esc = false
local strOut = ""
for i = 1, #str do
chr = str:sub(i,i)
if not esc then
if chr == '\\' then
esc = true
else
strOut = strOut .. replaceSpecialChar(chr)
end
else
strOut = strOut .. chr
esc = false
end
end
return strOut
end
local function buildWikilink(target, label)
if not label or target == label then
return "[[" .. target .. "]]"
else
return "[[" .. target .. "|" .. label .. "]]"
end
end
-- used to make frame.args mutable, to replace #frame.args (which is always 0)
-- with the actual amount and to simply copy tables
local function copyTable(tIn)
if not tIn then
return nil
end
local tOut = {}
for i, v in pairs(tIn) do
tOut[i] = v
end
return tOut
end
-- used to merge output arrays together;
-- note that it currently mutates the first input array
local function mergeArrays(a1, a2)
for i = 1, #a2 do
a1[#a1 + 1] = a2[i]
end
return a1
end
local function split(str, del)
local out = {}
local i, j = str:find(del)
if i and j then
out[1] = str:sub(1, i - 1)
out[2] = str:sub(j + 1)
else
out[1] = str
end
return out
end
local function parseWikidataURL(url)
local id
if url:match('^http[s]?://') then
id = split(url, "Q")
if id[2] then
return "Q" .. id[2]
end
end
return nil
end
local function parseDate(dateStr, precision)
precision = precision or "d"
local i, j, index, ptr
local parts = {nil, nil, nil}
if dateStr == nil then
return parts[1], parts[2], parts[3] -- year, month, day
end
-- 'T' for snak values, '/' for outputs with '/Julian' attached
i, j = dateStr:find("[T/]")
if i then
dateStr = dateStr:sub(1, i-1)
end
local from = 1
if dateStr:sub(1,1) == "-" then
-- this is a negative number, look further ahead
from = 2
end
index = 1
ptr = 1
i, j = dateStr:find("-", from)
if i then
-- year
parts[index] = tonumber(dateStr:sub(ptr, i-1), 10) -- explicitly give base 10 to prevent error
if parts[index] == -0 then
parts[index] = tonumber("0") -- for some reason, 'parts[index] = 0' may actually store '-0', so parse from string instead
end
if precision == "y" then
-- we're done
return parts[1], parts[2], parts[3] -- year, month, day
end
index = index + 1
ptr = i + 1
i, j = dateStr:find("-", ptr)
if i then
-- month
parts[index] = tonumber(dateStr:sub(ptr, i-1), 10)
if precision == "m" then
-- we're done
return parts[1], parts[2], parts[3] -- year, month, day
end
index = index + 1
ptr = i + 1
end
end
if dateStr:sub(ptr) ~= "" then
-- day if we have month, month if we have year, or year
parts[index] = tonumber(dateStr:sub(ptr), 10)
end
return parts[1], parts[2], parts[3] -- year, month, day
end
local function datePrecedesDate(aY, aM, aD, bY, bM, bD)
if aY == nil or bY == nil then
return nil
end
aM = aM or 1
aD = aD or 1
bM = bM or 1
bD = bD or 1
if aY < bY then
return true
end
if aY > bY then
return false
end
if aM < bM then
return true
end
if aM > bM then
return false
end
if aD < bD then
return true
end
return false
end
local function getHookName(param, index)
if hookNames[param] then
return hookNames[param][index]
elseif param:len() > 2 then
return hookNames[param:sub(1, 2).."\\d"][index]
else
return nil
end
end
local function alwaysTrue()
return true
end
-- The following function parses a format string.
--
-- The example below shows how a parsed string is structured in memory.
-- Variables other than 'str' and 'child' are left out for clarity's sake.
--
-- Example:
-- "A %p B [%s[%q1]] C [%r] D"
--
-- Structure:
-- [
-- {
-- str = "A "
-- },
-- {
-- str = "%p"
-- },
-- {
-- str = " B ",
-- child =
-- [
-- {
-- str = "%s",
-- child =
-- [
-- {
-- str = "%q1"
-- }
-- ]
-- }
-- ]
-- },
-- {
-- str = " C ",
-- child =
-- [
-- {
-- str = "%r"
-- }
-- ]
-- },
-- {
-- str = " D"
-- }
-- ]
--
local function parseFormat(str)
local chr, esc, param, root, cur, prev, new
local params = {}
local function newObject(array)
local obj = {} -- new object
obj.str = ""
array[#array + 1] = obj -- array{object}
obj.parent = array
return obj
end
local function endParam()
if param > 0 then
if cur.str ~= "" then
cur.str = "%"..cur.str
cur.param = true
params[cur.str] = true
cur.parent.req[cur.str] = true
prev = cur
cur = newObject(cur.parent)
end
param = 0
end
end
root = {} -- array
root.req = {}
cur = newObject(root)
prev = nil
esc = false
param = 0
for i = 1, #str do
chr = str:sub(i,i)
if not esc then
if chr == '\\' then
endParam()
esc = true
elseif chr == '%' then
endParam()
if cur.str ~= "" then
cur = newObject(cur.parent)
end
param = 2
elseif chr == '[' then
endParam()
if prev and cur.str == "" then
table.remove(cur.parent)
cur = prev
end
cur.child = {} -- new array
cur.child.req = {}
cur.child.parent = cur
cur = newObject(cur.child)
elseif chr == ']' then
endParam()
if cur.parent.parent then
new = newObject(cur.parent.parent.parent)
if cur.str == "" then
table.remove(cur.parent)
end
cur = new
end
else
if param > 1 then
param = param - 1
elseif param == 1 then
if not chr:match('%d') then
endParam()
end
end
cur.str = cur.str .. replaceSpecialChar(chr)
end
else
cur.str = cur.str .. chr
esc = false
end
prev = nil
end
endParam()
-- make sure that at least one required parameter has been defined
if not next(root.req) then
throwError("missing-required-parameter")
end
-- make sure that the separator parameter "%s" is not amongst the required parameters
if root.req[parameters.separator] then
throwError("extra-required-parameter", parameters.separator)
end
return root, params
end
local function sortOnRank(claims)
local rankPos
local ranks = {{}, {}, {}, {}} -- preferred, normal, deprecated, (default)
local sorted = {}
for _, v in ipairs(claims) do
rankPos = rankTable[v.rank] or 4
ranks[rankPos][#ranks[rankPos] + 1] = v
end
sorted = ranks[1]
sorted = mergeArrays(sorted, ranks[2])
sorted = mergeArrays(sorted, ranks[3])
return sorted
end
local Config = {}
-- allows for recursive calls
function Config:new()
local cfg = {}
setmetatable(cfg, self)
self.__index = self
cfg.separators = {
-- single value objects wrapped in arrays so that we can pass by reference
["sep"] = {copyTable(defaultSeparators["sep"])},
["sep%s"] = {copyTable(defaultSeparators["sep%s"])},
["sep%q"] = {copyTable(defaultSeparators["sep%q"])},
["sep%r"] = {copyTable(defaultSeparators["sep%r"])},
["punc"] = {copyTable(defaultSeparators["punc"])}
}
cfg.entity = nil
cfg.entityID = nil
cfg.propertyID = nil
cfg.propertyValue = nil
cfg.qualifierIDs = {}
cfg.qualifierIDsAndValues = {}
cfg.bestRank = true
cfg.ranks = {true, true, false} -- preferred = true, normal = true, deprecated = false
cfg.foundRank = #cfg.ranks
cfg.flagBest = false
cfg.flagRank = false
cfg.periods = {true, true, true} -- future = true, current = true, former = true
cfg.flagPeriod = false
cfg.atDate = {parseDate(os.date('!%Y-%m-%d'))} -- today as {year, month, day}
cfg.mdyDate = false
cfg.singleClaim = false
cfg.sourcedOnly = false
cfg.editable = false
cfg.editAtEnd = false
cfg.inSitelinks = false
cfg.langCode = mw.language.getContentLanguage().code
cfg.langName = mw.language.fetchLanguageName(cfg.langCode, cfg.langCode)
cfg.langObj = mw.language.new(cfg.langCode)
cfg.siteID = mw.wikibase.getGlobalSiteId()
cfg.states = {}
cfg.states.qualifiersCount = 0
cfg.curState = nil
cfg.prefetchedRefs = nil
return cfg
end
local State = {}
function State:new(cfg, type)
local stt = {}
setmetatable(stt, self)
self.__index = self
stt.conf = cfg
stt.type = type
stt.results = {}
stt.parsedFormat = {}
stt.separator = {}
stt.movSeparator = {}
stt.puncMark = {}
stt.linked = false
stt.rawValue = false
stt.shortName = false
stt.anyLanguage = false
stt.unitOnly = false
stt.singleValue = false
return stt
end
-- if id == nil then item connected to current page is used
function Config:getLabel(id, raw, link, short)
local label = nil
local prefix, title= "", nil
if not id then
id = mw.wikibase.getEntityIdForCurrentPage()
if not id then
return ""
end
end
id = id:upper() -- just to be sure
if raw then
-- check if given id actually exists
if mw.wikibase.isValidEntityId(id) and mw.wikibase.entityExists(id) then
label = id
end
prefix, title = "d:Special:EntityPage/", label -- may be nil
else
-- try short name first if requested
if short then
label = p._property{aliasesP.shortName, [p.args.eid] = id} -- get short name
if label == "" then
label = nil
end
end
-- get label
if not label then
label = mw.wikibase.getLabelByLang(id, self.langCode) -- XXX: should use fallback labels?
end
end
if not label then
label = ""
elseif link then
-- build a link if requested
if not title then
if id:sub(1,1) == "Q" then
title = mw.wikibase.getSitelink(id)
elseif id:sub(1,1) == "P" then
-- properties have no sitelink, link to Wikidata instead
prefix, title = "d:Special:EntityPage/", id
end
end
label = mw.text.nowiki(label) -- escape raw label text so it cannot be wikitext markup
if title then
label = buildWikilink(prefix .. title, label)
end
end
return label
end
function Config:getEditIcon()
local value = ""
local prefix = ""
local front = " "
local back = ""
if self.entityID:sub(1,1) == "P" then
prefix = "Property:"
end
if self.editAtEnd then
front = '<span style="float:'
if self.langObj:isRTL() then
front = front .. 'left'
else
front = front .. 'right'
end
front = front .. '">'
back = '</span>'
end
value = "[[File:OOjs UI icon edit-ltr-progressive.svg|frameless|text-top|10px|alt=" .. i18n['info']['edit-on-wikidata'] .. "|link=https://www.wikidata.org/wiki/" .. prefix .. self.entityID .. "?uselang=" .. self.langCode
if self.propertyID then
value = value .. "#" .. self.propertyID
elseif self.inSitelinks then
value = value .. "#sitelinks-wikipedia"
end
value = value .. "|" .. i18n['info']['edit-on-wikidata'] .. "]]"
return front .. value .. back
end
-- used to create the final output string when it's all done, so that for references the
-- function extensionTag("ref", ...) is only called when they really ended up in the final output
function Config:concatValues(valuesArray)
local outString = ""
local j, skip
for i = 1, #valuesArray do
-- check if this is a reference
if valuesArray[i].refHash then
j = i - 1
skip = false
-- skip this reference if it is part of a continuous row of references that already contains the exact same reference
while valuesArray[j] and valuesArray[j].refHash do
if valuesArray[i].refHash == valuesArray[j].refHash then
skip = true
break
end
j = j - 1
end
if not skip then
-- add <ref> tag with the reference's hash as its name (to deduplicate references)
outString = outString .. mw.getCurrentFrame():extensionTag("ref", valuesArray[i][1], {name = valuesArray[i].refHash})
end
else
outString = outString .. valuesArray[i][1]
end
end
return outString
end
function Config:convertUnit(unit, raw, link, short, unitOnly)
local space = " "
local label = ""
local itemID
if unit == "" or unit == "1" then
return nil
end
if unitOnly then
space = ""
end
itemID = parseWikidataURL(unit)
if itemID then
if itemID == aliasesQ.percentage then
return "%"
else
label = self:getLabel(itemID, raw, link, short)
if label ~= "" then
return space .. label
end
end
end
return ""
end
function State:getValue(snak)
return self.conf:getValue(snak, self.rawValue, self.linked, self.shortName, self.anyLanguage, self.unitOnly, false, self.type:sub(1,2))
end
function Config:getValue(snak, raw, link, short, anyLang, unitOnly, noSpecial, type)
if snak.snaktype == 'value' then
local datatype = snak.datavalue.type
local subtype = snak.datatype
local datavalue = snak.datavalue.value
if datatype == 'string' then
if subtype == 'url' and link then
-- create link explicitly
if raw then
-- will render as a linked number like [1]
return "[" .. datavalue .. "]"
else
return "[" .. datavalue .. " " .. datavalue .. "]"
end
elseif subtype == 'commonsMedia' then
if link then
return buildWikilink("c:File:" .. datavalue, datavalue)
elseif not raw then
return "[[File:" .. datavalue .. "]]"
else
return datavalue
end
elseif subtype == 'geo-shape' and link then
return buildWikilink("c:" .. datavalue, datavalue)
elseif subtype == 'math' and not raw then
local attribute = nil
if (type == parameters.property or (type == parameters.qualifier and self.propertyID == aliasesP.hasPart)) and snak.property == aliasesP.definingFormula then
attribute = {qid = self.entityID}
end
return mw.getCurrentFrame():extensionTag("math", datavalue, attribute)
elseif subtype == 'external-id' and link then
local url = p._property{aliasesP.formatterURL, [p.args.eid] = snak.property} -- get formatter URL
if url ~= "" then
url = mw.ustring.gsub(url, "$1", datavalue)
return "[" .. url .. " " .. datavalue .. "]"
else
return datavalue
end
else
return datavalue
end
elseif datatype == 'monolingualtext' then
if anyLang or datavalue['language'] == self.langCode then
return datavalue['text']
else
return nil
end
elseif datatype == 'quantity' then
local value = ""
local unit
if not unitOnly then
-- get value and strip + signs from front
value = mw.ustring.gsub(datavalue['amount'], "^%+(.+)$", "%1")
if raw then
return value
end
-- replace decimal mark based on locale
value = replaceDecimalMark(value)
-- add delimiters for readability
value = i18n.addDelimiters(value)
end
unit = self:convertUnit(datavalue['unit'], raw, link, short, unitOnly)
if unit then
value = value .. unit
end
return value
elseif datatype == 'time' then
local y, m, d, p, yDiv, yRound, yFull, value, calendarID, dateStr
local yFactor = 1
local sign = 1
local prefix = ""
local suffix = ""
local mayAddCalendar = false
local calendar = ""
local precision = datavalue['precision']
if precision == 11 then
p = "d"
elseif precision == 10 then
p = "m"
else
p = "y"
yFactor = 10^(9-precision)
end
y, m, d = parseDate(datavalue['time'], p)
if y < 0 then
sign = -1
y = y * sign
end
-- if precision is tens/hundreds/thousands/millions/billions of years
if precision <= 8 then
yDiv = y / yFactor
-- if precision is tens/hundreds/thousands of years
if precision >= 6 then
mayAddCalendar = true
if precision <= 7 then
-- round centuries/millenniums up (e.g. 20th century or 3rd millennium)
yRound = math.ceil(yDiv)
if not raw then
if precision == 6 then
suffix = i18n['datetime']['suffixes']['millennium']
else
suffix = i18n['datetime']['suffixes']['century']
end
suffix = i18n.getOrdinalSuffix(yRound) .. suffix
else
-- if not verbose, take the first year of the century/millennium
-- (e.g. 1901 for 20th century or 2001 for 3rd millennium)
yRound = (yRound - 1) * yFactor + 1
end
else
-- precision == 8
-- round decades down (e.g. 2010s)
yRound = math.floor(yDiv) * yFactor
if not raw then
prefix = i18n['datetime']['prefixes']['decade-period']
suffix = i18n['datetime']['suffixes']['decade-period']
end
end
if raw and sign < 0 then
-- if BCE then compensate for "counting backwards"
-- (e.g. -2019 for 2010s BCE, -2000 for 20th century BCE or -3000 for 3rd millennium BCE)
yRound = yRound + yFactor - 1
end
else
local yReFactor, yReDiv, yReRound
-- round to nearest for tens of thousands of years or more
yRound = math.floor(yDiv + 0.5)
if yRound == 0 then
if precision <= 2 and y ~= 0 then
yReFactor = 1e6
yReDiv = y / yReFactor
yReRound = math.floor(yReDiv + 0.5)
if yReDiv == yReRound then
-- change precision to millions of years only if we have a whole number of them
precision = 3
yFactor = yReFactor
yRound = yReRound
end
end
if yRound == 0 then
-- otherwise, take the unrounded (original) number of years
precision = 5
yFactor = 1
yRound = y
mayAddCalendar = true
end
end
if precision >= 1 and y ~= 0 then
yFull = yRound * yFactor
yReFactor = 1e9
yReDiv = yFull / yReFactor
yReRound = math.floor(yReDiv + 0.5)
if yReDiv == yReRound then
-- change precision to billions of years if we're in that range
precision = 0
yFactor = yReFactor
yRound = yReRound
else
yReFactor = 1e6
yReDiv = yFull / yReFactor
yReRound = math.floor(yReDiv + 0.5)
if yReDiv == yReRound then
-- change precision to millions of years if we're in that range
precision = 3
yFactor = yReFactor
yRound = yReRound
end
end
end
if not raw then
if precision == 3 then
suffix = i18n['datetime']['suffixes']['million-years']
elseif precision == 0 then
suffix = i18n['datetime']['suffixes']['billion-years']
else
yRound = yRound * yFactor
if yRound == 1 then
suffix = i18n['datetime']['suffixes']['year']
else
suffix = i18n['datetime']['suffixes']['years']
end
end
else
yRound = yRound * yFactor
end
end
else
yRound = y
mayAddCalendar = true
end
if mayAddCalendar then
calendarID = parseWikidataURL(datavalue['calendarmodel'])
if calendarID and calendarID == aliasesQ.prolepticJulianCalendar then
if not raw then
if link then
calendar = " ("..buildWikilink(i18n['datetime']['julian-calendar'], i18n['datetime']['julian'])..")"
else
calendar = " ("..i18n['datetime']['julian']..")"
end
else
calendar = "/"..i18n['datetime']['julian']
end
end
end
if not raw then
local ce = nil
if sign < 0 then
ce = i18n['datetime']['BCE']
elseif precision <= 5 then
ce = i18n['datetime']['CE']
end
if ce then
if link then
ce = buildWikilink(i18n['datetime']['common-era'], ce)
end
suffix = suffix .. " " .. ce
end
value = tostring(yRound)
if m then
dateStr = self.langObj:formatDate("F", "1-"..m.."-1")
if d then
if self.mdyDate then
dateStr = dateStr .. " " .. d .. ","
else
dateStr = d .. " " .. dateStr
end
end
value = dateStr .. " " .. value
end
value = prefix .. value .. suffix .. calendar
else
value = padZeros(yRound * sign, 4)
if m then
value = value .. "-" .. padZeros(m, 2)
if d then
value = value .. "-" .. padZeros(d, 2)
end
end
value = value .. calendar
end
return value
elseif datatype == 'globecoordinate' then
-- logic from https://github.com/DataValues/Geo (v4.0.1)
local precision, unitsPerDegree, numDigits, strFormat, value, globe
local latitude, latConv, latValue, latLink
local longitude, lonConv, lonValue, lonLink
local latDirection, latDirectionN, latDirectionS, latDirectionEN
local lonDirection, lonDirectionE, lonDirectionW, lonDirectionEN
local degSymbol, minSymbol, secSymbol, separator
local latDegrees = nil
local latMinutes = nil
local latSeconds = nil
local lonDegrees = nil
local lonMinutes = nil
local lonSeconds = nil
local latDegSym = ""
local latMinSym = ""
local latSecSym = ""
local lonDegSym = ""
local lonMinSym = ""
local lonSecSym = ""
local latDirectionEN_N = "N"
local latDirectionEN_S = "S"
local lonDirectionEN_E = "E"
local lonDirectionEN_W = "W"
if not raw then
latDirectionN = i18n['coord']['latitude-north']
latDirectionS = i18n['coord']['latitude-south']
lonDirectionE = i18n['coord']['longitude-east']
lonDirectionW = i18n['coord']['longitude-west']
degSymbol = i18n['coord']['degrees']
minSymbol = i18n['coord']['minutes']
secSymbol = i18n['coord']['seconds']
separator = i18n['coord']['separator']
else
latDirectionN = latDirectionEN_N
latDirectionS = latDirectionEN_S
lonDirectionE = lonDirectionEN_E
lonDirectionW = lonDirectionEN_W
degSymbol = "/"
minSymbol = "/"
secSymbol = "/"
separator = "/"
end
latitude = datavalue['latitude']
longitude = datavalue['longitude']
if latitude < 0 then
latDirection = latDirectionS
latDirectionEN = latDirectionEN_S
latitude = math.abs(latitude)
else
latDirection = latDirectionN
latDirectionEN = latDirectionEN_N
end
if longitude < 0 then
lonDirection = lonDirectionW
lonDirectionEN = lonDirectionEN_W
longitude = math.abs(longitude)
else
lonDirection = lonDirectionE
lonDirectionEN = lonDirectionEN_E
end
precision = datavalue['precision']
if not precision or precision <= 0 then
precision = 1 / 3600 -- precision not set (correctly), set to arcsecond
end
-- remove insignificant detail
latitude = math.floor(latitude / precision + 0.5) * precision
longitude = math.floor(longitude / precision + 0.5) * precision
if precision >= 1 - (1 / 60) and precision < 1 then
precision = 1
elseif precision >= (1 / 60) - (1 / 3600) and precision < (1 / 60) then
precision = 1 / 60
end
if precision >= 1 then
unitsPerDegree = 1
elseif precision >= (1 / 60) then
unitsPerDegree = 60
else
unitsPerDegree = 3600
end
numDigits = math.ceil(-math.log10(unitsPerDegree * precision))
if numDigits <= 0 then
numDigits = tonumber("0") -- for some reason, 'numDigits = 0' may actually store '-0', so parse from string instead
end
strFormat = "%." .. numDigits .. "f"
if precision >= 1 then
latDegrees = strFormat:format(latitude)
lonDegrees = strFormat:format(longitude)
if not raw then
latDegSym = replaceDecimalMark(latDegrees) .. degSymbol
lonDegSym = replaceDecimalMark(lonDegrees) .. degSymbol
else
latDegSym = latDegrees .. degSymbol
lonDegSym = lonDegrees .. degSymbol
end
else
latConv = math.floor(latitude * unitsPerDegree * 10^numDigits + 0.5) / 10^numDigits
lonConv = math.floor(longitude * unitsPerDegree * 10^numDigits + 0.5) / 10^numDigits
if precision >= (1 / 60) then
latMinutes = latConv
lonMinutes = lonConv
else
latSeconds = latConv
lonSeconds = lonConv
latMinutes = math.floor(latSeconds / 60)
lonMinutes = math.floor(lonSeconds / 60)
latSeconds = strFormat:format(latSeconds - (latMinutes * 60))
lonSeconds = strFormat:format(lonSeconds - (lonMinutes * 60))
if not raw then
latSecSym = replaceDecimalMark(latSeconds) .. secSymbol
lonSecSym = replaceDecimalMark(lonSeconds) .. secSymbol
else
latSecSym = latSeconds .. secSymbol
lonSecSym = lonSeconds .. secSymbol
end
end
latDegrees = math.floor(latMinutes / 60)
lonDegrees = math.floor(lonMinutes / 60)
latDegSym = latDegrees .. degSymbol
lonDegSym = lonDegrees .. degSymbol
latMinutes = latMinutes - (latDegrees * 60)
lonMinutes = lonMinutes - (lonDegrees * 60)
if precision >= (1 / 60) then
latMinutes = strFormat:format(latMinutes)
lonMinutes = strFormat:format(lonMinutes)
if not raw then
latMinSym = replaceDecimalMark(latMinutes) .. minSymbol
lonMinSym = replaceDecimalMark(lonMinutes) .. minSymbol
else
latMinSym = latMinutes .. minSymbol
lonMinSym = lonMinutes .. minSymbol
end
else
latMinSym = latMinutes .. minSymbol
lonMinSym = lonMinutes .. minSymbol
end
end
latValue = latDegSym .. latMinSym .. latSecSym .. latDirection
lonValue = lonDegSym .. lonMinSym .. lonSecSym .. lonDirection
value = latValue .. separator .. lonValue
if link then
globe = parseWikidataURL(datavalue['globe'])
if globe then
globe = mw.wikibase.getLabelByLang(globe, "en"):lower()
else
globe = "earth"
end
latLink = table.concat({latDegrees, latMinutes, latSeconds}, "_")
lonLink = table.concat({lonDegrees, lonMinutes, lonSeconds}, "_")
value = "[https://geohack.toolforge.org/geohack.php?language="..self.langCode.."¶ms="..latLink.."_"..latDirectionEN.."_"..lonLink.."_"..lonDirectionEN.."_globe:"..globe.." "..value.."]"
end
return value
elseif datatype == 'wikibase-entityid' then
local label
local itemID = datavalue['numeric-id']
if subtype == 'wikibase-item' then
itemID = "Q" .. itemID
elseif subtype == 'wikibase-property' then
itemID = "P" .. itemID
else
return '<strong class="error">' .. errorText('unknown-data-type', subtype) .. '</strong>'
end
label = self:getLabel(itemID, raw, link, short)
if label == "" then
label = nil
end
return label
else
return '<strong class="error">' .. errorText('unknown-data-type', datatype) .. '</strong>'
end
elseif snak.snaktype == 'somevalue' and not noSpecial then
if raw then
return " " -- single space represents 'somevalue'
else
return i18n['values']['unknown']
end
elseif snak.snaktype == 'novalue' and not noSpecial then
if raw then
return "" -- empty string represents 'novalue'
else
return i18n['values']['none']
end
else
return nil
end
end
function Config:getSingleRawQualifier(claim, qualifierID)
local qualifiers
if claim.qualifiers then qualifiers = claim.qualifiers[qualifierID] end
if qualifiers and qualifiers[1] then
return self:getValue(qualifiers[1], true) -- raw = true
else
return nil
end
end
function Config:snakEqualsValue(snak, value)
local snakValue = self:getValue(snak, true) -- raw = true
if snakValue and snak.snaktype == 'value' and snak.datavalue.type == 'wikibase-entityid' then value = value:upper() end
return snakValue == value
end
function Config:setRank(rank)
local rankPos
if rank == p.flags.best then
self.bestRank = true
self.flagBest = true -- mark that 'best' flag was given
return
end
if rank:sub(1,9) == p.flags.preferred then
rankPos = 1
elseif rank:sub(1,6) == p.flags.normal then
rankPos = 2
elseif rank:sub(1,10) == p.flags.deprecated then
rankPos = 3
else
return
end
-- one of the rank flags was given, check if another one was given before
if not self.flagRank then
self.ranks = {false, false, false} -- no other rank flag given before, so unset ranks
self.bestRank = self.flagBest -- unsets bestRank only if 'best' flag was not given before
self.flagRank = true -- mark that a rank flag was given
end
if rank:sub(-1) == "+" then
for i = rankPos, 1, -1 do
self.ranks[i] = true
end
elseif rank:sub(-1) == "-" then
for i = rankPos, #self.ranks do
self.ranks[i] = true
end
else
self.ranks[rankPos] = true
end
end
function Config:setPeriod(period)
local periodPos
if period == p.flags.future then
periodPos = 1
elseif period == p.flags.current then
periodPos = 2
elseif period == p.flags.former then
periodPos = 3
else
return
end
-- one of the period flags was given, check if another one was given before
if not self.flagPeriod then
self.periods = {false, false, false} -- no other period flag given before, so unset periods
self.flagPeriod = true -- mark that a period flag was given
end
self.periods[periodPos] = true
end
function Config:qualifierMatches(claim, id, value)
local qualifiers
if claim.qualifiers then qualifiers = claim.qualifiers[id] end
if qualifiers then
for _, v in pairs(qualifiers) do
if self:snakEqualsValue(v, value) then
return true
end
end
elseif value == "" then
-- if the qualifier is not present then treat it the same as the special value 'novalue'
return true
end
return false
end
function Config:rankMatches(rankPos)
if self.bestRank then
return (self.ranks[rankPos] and self.foundRank >= rankPos)
else
return self.ranks[rankPos]
end
end
function Config:timeMatches(claim)
local startTime = nil
local startTimeY = nil
local startTimeM = nil
local startTimeD = nil
local endTime = nil
local endTimeY = nil
local endTimeM = nil
local endTimeD = nil
if self.periods[1] and self.periods[2] and self.periods[3] then
-- any time
return true
end
startTime = self:getSingleRawQualifier(claim, aliasesP.startTime)
if startTime and startTime ~= "" and startTime ~= " " then
startTimeY, startTimeM, startTimeD = parseDate(startTime)
end
endTime = self:getSingleRawQualifier(claim, aliasesP.endTime)
if endTime and endTime ~= "" and endTime ~= " " then
endTimeY, endTimeM, endTimeD = parseDate(endTime)
end
if startTimeY ~= nil and endTimeY ~= nil and datePrecedesDate(endTimeY, endTimeM, endTimeD, startTimeY, startTimeM, startTimeD) then
-- invalidate end time if it precedes start time
endTimeY = nil
endTimeM = nil
endTimeD = nil
end
if self.periods[1] then
-- future
if startTimeY and datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], startTimeY, startTimeM, startTimeD) then
return true
end
end
if self.periods[2] then
-- current
if (startTimeY == nil or not datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], startTimeY, startTimeM, startTimeD)) and
(endTimeY == nil or datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], endTimeY, endTimeM, endTimeD)) then
return true
end
end
if self.periods[3] then
-- former
if endTimeY and not datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], endTimeY, endTimeM, endTimeD) then
return true
end
end
return false
end
function Config:processFlag(flag)
if not flag then
return false
end
if flag == p.flags.linked then
self.curState.linked = true
return true
elseif flag == p.flags.raw then
self.curState.rawValue = true
if self.curState == self.states[parameters.reference] then
-- raw reference values end with periods and require a separator (other than none)
self.separators["sep%r"][1] = {" "}
end
return true
elseif flag == p.flags.short then
self.curState.shortName = true
return true
elseif flag == p.flags.multilanguage then
self.curState.anyLanguage = true
return true
elseif flag == p.flags.unit then
self.curState.unitOnly = true
return true
elseif flag == p.flags.mdy then
self.mdyDate = true
return true
elseif flag == p.flags.single then
self.singleClaim = true
return true
elseif flag == p.flags.sourced then
self.sourcedOnly = true
return true
elseif flag == p.flags.edit then
self.editable = true
return true
elseif flag == p.flags.editAtEnd then
self.editable = true
self.editAtEnd = true
return true
elseif flag == p.flags.best or flag:match('^'..p.flags.preferred..'[+-]?$') or flag:match('^'..p.flags.normal..'[+-]?$') or flag:match('^'..p.flags.deprecated..'[+-]?$') then
self:setRank(flag)
return true
elseif flag == p.flags.future or flag == p.flags.current or flag == p.flags.former then
self:setPeriod(flag)
return true
elseif flag == "" then
-- ignore empty flags and carry on
return true
else
return false
end
end
function Config:processFlagOrCommand(flag)
local param = ""
if not flag then
return false
end
if flag == p.claimCommands.property or flag == p.claimCommands.properties then
param = parameters.property
elseif flag == p.claimCommands.qualifier or flag == p.claimCommands.qualifiers then
self.states.qualifiersCount = self.states.qualifiersCount + 1
param = parameters.qualifier .. self.states.qualifiersCount
self.separators["sep"..param] = {copyTable(defaultSeparators["sep%q\\d"])}
elseif flag == p.claimCommands.reference or flag == p.claimCommands.references then
param = parameters.reference
else
return self:processFlag(flag)
end
if self.states[param] then
return false
end
-- create a new state for each command
self.states[param] = State:new(self, param)
-- use "%x" as the general parameter name
self.states[param].parsedFormat = parseFormat(parameters.general) -- will be overwritten for param=="%p"
-- set the separator
self.states[param].separator = self.separators["sep"..param] -- will be nil for param=="%p", which will be set separately
if flag == p.claimCommands.property or flag == p.claimCommands.qualifier or flag == p.claimCommands.reference then
self.states[param].singleValue = true
end
self.curState = self.states[param]
return true
end
function Config:processSeparators(args)
local sep
for i, v in pairs(self.separators) do
if args[i] then
sep = replaceSpecialChars(args[i])
if sep ~= "" then
self.separators[i][1] = {sep}
else
self.separators[i][1] = nil
end
end
end
end
function Config:setFormatAndSeparators(state, parsedFormat)
state.parsedFormat = parsedFormat
state.separator = self.separators["sep"]
state.movSeparator = self.separators["sep"..parameters.separator]
state.puncMark = self.separators["punc"]
end
-- determines if a claim has references by prefetching them from the claim using getReferences,
-- which applies some filtering that determines if a reference is actually returned,
-- and caches the references for later use
function State:isSourced(claim)
self.conf.prefetchedRefs = self:getReferences(claim)
return (#self.conf.prefetchedRefs > 0)
end
function State:resetCaches()
-- any prefetched references of the previous claim must not be used
self.conf.prefetchedRefs = nil
end
function State:claimMatches(claim)
local matches, rankPos
-- first of all, reset any cached values used for the previous claim
self:resetCaches()
-- if a property value was given, check if it matches the claim's property value
if self.conf.propertyValue then
matches = self.conf:snakEqualsValue(claim.mainsnak, self.conf.propertyValue)
else
matches = true
end
-- if any qualifier values were given, check if each matches one of the claim's qualifier values
for i, v in pairs(self.conf.qualifierIDsAndValues) do
matches = (matches and self.conf:qualifierMatches(claim, i, v))
end
-- check if the claim's rank and time period match
rankPos = rankTable[claim.rank] or 4
matches = (matches and self.conf:rankMatches(rankPos) and self.conf:timeMatches(claim))
-- if only claims with references must be returned, check if this one has any
if self.conf.sourcedOnly then
matches = (matches and self:isSourced(claim)) -- prefetches and caches references
end
return matches, rankPos
end
function State:out()
local result -- collection of arrays with value objects
local valuesArray -- array with value objects
local sep = nil -- value object
local out = {} -- array with value objects
local function walk(formatTable, result)
local valuesArray = {} -- array with value objects
for i, v in pairs(formatTable.req) do
if not result[i] or not result[i][1] then
-- we've got no result for a parameter that is required on this level,
-- so skip this level (and its children) by returning an empty result
return {}
end
end
for _, v in ipairs(formatTable) do
if v.param then
valuesArray = mergeArrays(valuesArray, result[v.str])
elseif v.str ~= "" then
valuesArray[#valuesArray + 1] = {v.str}
end
if v.child then
valuesArray = mergeArrays(valuesArray, walk(v.child, result))
end
end
return valuesArray
end
-- iterate through the results from back to front, so that we know when to add separators
for i = #self.results, 1, -1 do
result = self.results[i]
-- if there is already some output, then add the separators
if #out > 0 then
sep = self.separator[1] -- fixed separator
result[parameters.separator] = {self.movSeparator[1]} -- movable separator
else
sep = nil
result[parameters.separator] = {self.puncMark[1]} -- optional punctuation mark
end
valuesArray = walk(self.parsedFormat, result)
if #valuesArray > 0 then
if sep then
valuesArray[#valuesArray + 1] = sep
end
out = mergeArrays(valuesArray, out)
end
end
-- reset state before next iteration
self.results = {}
return out
end
-- level 1 hook
function State:getProperty(claim)
local value = {self:getValue(claim.mainsnak)} -- create one value object
if #value > 0 then
return {value} -- wrap the value object in an array and return it
else
return {} -- return empty array if there was no value
end
end
-- level 1 hook
function State:getQualifiers(claim, param)
local qualifiers
if claim.qualifiers then qualifiers = claim.qualifiers[self.conf.qualifierIDs[param]] end
if qualifiers then
-- iterate through claim's qualifier statements to collect their values;
-- return array with multiple value objects
return self.conf.states[param]:iterate(qualifiers, {[parameters.general] = hookNames[parameters.qualifier.."\\d"][2], count = 1}) -- pass qualifier state with level 2 hook
else
return {} -- return empty array
end
end
-- level 2 hook
function State:getQualifier(snak)
local value = {self:getValue(snak)} -- create one value object
if #value > 0 then
return {value} -- wrap the value object in an array and return it
else
return {} -- return empty array if there was no value
end
end
-- level 1 hook
function State:getAllQualifiers(claim, param, result, hooks)
local out = {} -- array with value objects
local sep = self.conf.separators["sep"..parameters.qualifier][1] -- value object
-- iterate through the output of the separate "qualifier(s)" commands
for i = 1, self.conf.states.qualifiersCount do
-- if a hook has not been called yet, call it now
if not result[parameters.qualifier..i] then
self:callHook(parameters.qualifier..i, hooks, claim, result)
end
-- if there is output for this particular "qualifier(s)" command, then add it
if result[parameters.qualifier..i] and result[parameters.qualifier..i][1] then
-- if there is already some output, then add the separator
if #out > 0 and sep then
out[#out + 1] = sep
end
out = mergeArrays(out, result[parameters.qualifier..i])
end
end
return out
end
-- level 1 hook
function State:getReferences(claim)
if self.conf.prefetchedRefs then
-- return references that have been prefetched by isSourced
return self.conf.prefetchedRefs
end
if claim.references then
-- iterate through claim's reference statements to collect their values;
-- return array with multiple value objects
return self.conf.states[parameters.reference]:iterate(claim.references, {[parameters.general] = hookNames[parameters.reference][2], count = 1}) -- pass reference state with level 2 hook
else
return {} -- return empty array
end
end
-- level 2 hook
function State:getReference(statement)
local key, citeWeb, citeQ, label
local params = {}
local citeParams = {['web'] = {}, ['q'] = {}}
local citeMismatch = {}
local useCite = nil
local useParams = nil
local value = ""
local ref = {}
local referenceEmpty = true -- will be set to false if at least one parameter is left unremoved
local numAuthorParameters = 0
local numAuthorNameStringParameters = 0
local tempLink
local additionalRefProperties = {} -- will hold properties of the reference which are not in statement.snaks, namely backup title from "subject named as" and URL from an external ID
local wikidataPropertiesOfSource -- will contain "Wikidata property" properties of the item in stated in, if any
local version = 5 -- increment this each time the below logic is changed to avoid conflict errors
if statement.snaks then
-- don't include "imported from", which is added by a bot
if statement.snaks[aliasesP.importedFrom] then
statement.snaks[aliasesP.importedFrom] = nil
end
-- don't include "Wikimedia import URL"
if statement.snaks[aliasesP.wikimediaImportURL] then
statement.snaks[aliasesP.wikimediaImportURL] = nil
-- don't include "retrieved" if no "referenceURL" is present,
-- as "retrieved" probably belongs to "Wikimedia import URL"
if statement.snaks[aliasesP.retrieved] and not statement.snaks[aliasesP.referenceURL] then
statement.snaks[aliasesP.retrieved] = nil
end
end
-- don't include "inferred from", which is added by a bot
if statement.snaks[aliasesP.inferredFrom] then
statement.snaks[aliasesP.inferredFrom] = nil
end
-- don't include "type of reference"
if statement.snaks[aliasesP.typeOfReference] then
statement.snaks[aliasesP.typeOfReference] = nil
end
-- don't include "image" to prevent littering
if statement.snaks[aliasesP.image] then
statement.snaks[aliasesP.image] = nil
end
-- don't include "language" if it is equal to the local one
if self:getReferenceDetail(statement.snaks, aliasesP.language) == self.conf.langName then
statement.snaks[aliasesP.language] = nil
end
if statement.snaks[aliasesP.statedIn] and not statement.snaks[aliasesP.referenceURL] then
-- "stated in" was given but "reference URL" was not.
-- get "Wikidata property" properties from the item in "stated in"
-- if any of the returned properties of the external-id datatype is in statement.snaks, generate a URL from it and use the URL in the reference
-- find the "Wikidata property" properties in the item from "stated in"
wikidataPropertiesOfSource = mw.text.split(p._properties{p.flags.raw, aliasesP.wikidataProperty, [p.args.eid] = self.conf:getValue(statement.snaks[aliasesP.statedIn][1], true, false)}, ", ", true)
for i, wikidataPropertyOfSource in pairs(wikidataPropertiesOfSource) do
if statement.snaks[wikidataPropertyOfSource] and statement.snaks[wikidataPropertyOfSource][1].datatype == "external-id" then
tempLink = self.conf:getValue(statement.snaks[wikidataPropertyOfSource][1], false, true) -- not raw, linked
if mw.ustring.match(tempLink, "^%[%Z- %Z+%]$") then -- getValue returned a URL.
additionalRefProperties[aliasesP.referenceURL] = mw.ustring.gsub(tempLink, "^%[(%Z-) %Z+%]$", "%1") -- the URL is in wiki markup, so strip the square brackets and the display text
statement.snaks[wikidataPropertyOfSource] = nil
break
end
end
end
end
-- don't include "subject named as", but use it as the title when "title" is not present but a URL is
if statement.snaks[aliasesP.subjectNamedAs] then
if not statement.snaks[aliasesP.title] and (statement.snaks[aliasesP.referenceURL] or additionalRefProperties[aliasesP.referenceURL]) then
additionalRefProperties[aliasesP.title] = statement.snaks[aliasesP.subjectNamedAs][1].datavalue.value
end
statement.snaks[aliasesP.subjectNamedAs] = nil
end
-- retrieve all the parameters
for i in pairs(statement.snaks) do
label = ""
-- multiple authors may be given
if i == aliasesP.author or i == aliasesP.authorNameString then
params[i] = self:getReferenceDetails(statement.snaks, i, false, self.linked, true) -- link = true/false, anyLang = true
else
params[i] = {self:getReferenceDetail(statement.snaks, i, false, (self.linked or (i == aliasesP.statedIn)) and (statement.snaks[i][1].datatype ~= 'url'), true)} -- link = true/false, anyLang = true
end
if #params[i] == 0 then
params[i] = nil
else
referenceEmpty = false
if statement.snaks[i][1].datatype == 'external-id' then
key = "external-id"
label = self.conf:getLabel(i)
if label ~= "" then
label = label .. " "
end
else
key = i
end
-- add the parameter to each matching type of citation
for j in pairs(citeParams) do
-- do so if there was no mismatch with a previous parameter
if not citeMismatch[j] then
-- check if this parameter is not mismatching itself
if i18n['cite'][j][key] then
-- continue if an option is available in the corresponding cite template
if i18n['cite'][j][key] ~= "" then
-- handle non-author properties (and author properties ("author" and "author name string"), if they don't use the same template parameter)
if (i ~= aliasesP.author and i ~= aliasesP.authorNameString) or (i18n['cite'][j][aliasesP.author] ~= i18n['cite'][j][aliasesP.authorNameString]) then
citeParams[j][i18n['cite'][j][key]] = label .. params[i][1]
-- to avoid problems with non-author multiple parameters (if existent), the following old code is retained
for k=2, #params[i] do
citeParams[j][i18n['cite'][j][key]..k] = label .. params[i][k]
end
-- handle "author" and "author name string" specially if they use the same template parameter
elseif i == aliasesP.author or i == aliasesP.authorNameString then
if params[aliasesP.author] ~= nil then
numAuthorParameters = #params[aliasesP.author]
else
numAuthorParameters = 0
end
if params[aliasesP.authorNameString] ~= nil then
numAuthorNameStringParameters = #params[aliasesP.authorNameString]
else
numAuthorNameStringParameters = 0
end
-- execute only if both "author" and "author name string" satisfy this condition: the property is both in params and in statement.snaks or it is neither in params nor in statement.snaks
-- reason: parameters are added to params each iteration of the loop, not before the loop
if ((statement.snaks[aliasesP.author] == nil) == (numAuthorParameters == 0)) and ((statement.snaks[aliasesP.authorNameString] == nil) == (numAuthorNameStringParameters == 0)) then
for k=1, numAuthorParameters + numAuthorNameStringParameters do
if k <= numAuthorParameters then -- now handling the authors from the "author" property
citeParams[j][i18n['cite'][j][aliasesP.author]..k] = label .. params[aliasesP.author][k]
else -- now handling the authors from "author name string"
citeParams[j][i18n['cite'][j][aliasesP.authorNameString]..k] = label .. params[aliasesP.authorNameString][k - numAuthorParameters]
end
end
end
end
end
else
citeMismatch[j] = true
end
end
end
end
end
-- use additional properties
for i in pairs(additionalRefProperties) do
for j in pairs(citeParams) do
if not citeMismatch[j] and i18n["cite"][j][i] then
citeParams[j][i18n["cite"][j][i]] = additionalRefProperties[i]
else
citeMismatch[j] = true
end
end
end
-- get title of general template for citing web references
citeWeb = split(mw.wikibase.getSitelink(aliasesQ.citeWeb) or "", ":")[2] -- split off namespace from front
-- get title of template that expands stated-in references into citations
citeQ = split(mw.wikibase.getSitelink(aliasesQ.citeQ) or "", ":")[2] -- split off namespace from front
-- (1) use the general template for citing web references if there is a match and if at least both "reference URL" and "title" are present
if citeWeb and not citeMismatch['web'] and citeParams['web'][i18n['cite']['web'][aliasesP.referenceURL]] and citeParams['web'][i18n['cite']['web'][aliasesP.title]] then
useCite = citeWeb
useParams = citeParams['web']
-- (2) use the template that expands stated-in references into citations if there is a match and if at least "stated in" is present
elseif citeQ and not citeMismatch['q'] and citeParams['q'][i18n['cite']['q'][aliasesP.statedIn]] then
-- we need the raw "stated in" Q-identifier for the this template
citeParams['q'][i18n['cite']['q'][aliasesP.statedIn]] = self:getReferenceDetail(statement.snaks, aliasesP.statedIn, true) -- raw = true
useCite = citeQ
useParams = citeParams['q']
end
if useCite and useParams then
-- if this module is being substituted then build a regular template call, otherwise expand the template
if mw.isSubsting() then
for i, v in pairs(useParams) do
value = value .. "|" .. i .. "=" .. v
end
value = "{{" .. useCite .. value .. "}}"
else
value = mw.getCurrentFrame():expandTemplate{title=useCite, args=useParams}
end
-- (3) if the citation couldn't be displayed using Cite web or Cite Q, but has properties other than the removed ones, throw an error
elseif not referenceEmpty then
value = "<span style=\"color:#dd3333\">" .. errorText("malformed-reference") .. "</span>"
end
if value ~= "" then
value = {value} -- create one value object
if not self.rawValue then
-- this should become a <ref> tag, so save the reference's hash for later
value.refHash = "wikidata-" .. statement.hash .. "-v" .. (tonumber(i18n['cite']['version']) + version)
end
ref = {value} -- wrap the value object in an array
end
end
return ref
end
-- gets a detail of one particular type for a reference
function State:getReferenceDetail(snaks, dType, raw, link, anyLang)
local switchLang = anyLang
local value = nil
if not snaks[dType] then
return nil
end
-- if anyLang, first try the local language and otherwise any language
repeat
for _, v in ipairs(snaks[dType]) do
value = self.conf:getValue(v, raw, link, false, anyLang and not switchLang, false, true) -- noSpecial = true
if value then
break
end
end
if value or not anyLang then
break
end
switchLang = not switchLang
until anyLang and switchLang
return value
end
-- gets the details of one particular type for a reference
function State:getReferenceDetails(snaks, dType, raw, link, anyLang)
local values = {}
if not snaks[dType] then
return {}
end
for _, v in ipairs(snaks[dType]) do
-- if nil is returned then it will not be added to the table
values[#values + 1] = self.conf:getValue(v, raw, link, false, anyLang, false, true) -- noSpecial = true
end
return values
end
-- level 1 hook
function State:getAlias(object)
local value = object.value
local title = nil
if value and self.linked then
if self.conf.entityID:sub(1,1) == "Q" then
title = mw.wikibase.getSitelink(self.conf.entityID)
elseif self.conf.entityID:sub(1,1) == "P" then
title = "d:Property:" .. self.conf.entityID
end
if title then
value = buildWikilink(title, value)
end
end
value = {value} -- create one value object
if #value > 0 then
return {value} -- wrap the value object in an array and return it
else
return {} -- return empty array if there was no value
end
end
-- level 1 hook
function State:getBadge(value)
value = self.conf:getLabel(value, self.rawValue, self.linked, self.shortName)
if value == "" then
value = nil
end
value = {value} -- create one value object
if #value > 0 then
return {value} -- wrap the value object in an array and return it
else
return {} -- return empty array if there was no value
end
end
function State:callHook(param, hooks, statement, result)
local valuesArray, refHash
-- call a parameter's hook if it has been defined and if it has not been called before
if not result[param] and hooks[param] then
valuesArray = self[hooks[param]](self, statement, param, result, hooks) -- array with value objects
-- add to the result
if #valuesArray > 0 then
result[param] = valuesArray
result.count = result.count + 1
else
result[param] = {} -- an empty array to indicate that we've tried this hook already
return true -- miss == true
end
end
return false
end
-- iterate through claims, claim's qualifiers or claim's references to collect values
function State:iterate(statements, hooks, matchHook)
matchHook = matchHook or alwaysTrue
local matches = false
local rankPos = nil
local result, gotRequired
for _, v in ipairs(statements) do
-- rankPos will be nil for non-claim statements (e.g. qualifiers, references, etc.)
matches, rankPos = matchHook(self, v)
if matches then
result = {count = 0} -- collection of arrays with value objects
local function walk(formatTable)
local miss
for i2, v2 in pairs(formatTable.req) do
-- call a hook, adding its return value to the result
miss = self:callHook(i2, hooks, v, result)
if miss then
-- we miss a required value for this level, so return false
return false
end
if result.count == hooks.count then
-- we're done if all hooks have been called;
-- returning at this point breaks the loop
return true
end
end
for _, v2 in ipairs(formatTable) do
if result.count == hooks.count then
-- we're done if all hooks have been called;
-- returning at this point prevents further childs from being processed
return true
end
if v2.child then
walk(v2.child)
end
end
return true
end
gotRequired = walk(self.parsedFormat)
-- only append the result if we got values for all required parameters on the root level
if gotRequired then
-- if we have a rankPos (only with matchHook() for complete claims), then update the foundRank
if rankPos and self.conf.foundRank > rankPos then
self.conf.foundRank = rankPos
end
-- append the result
self.results[#self.results + 1] = result
-- break if we only need a single value
if self.singleValue then
break
end
end
end
end
return self:out()
end
local function getEntityId(arg, eid, page, allowOmitPropPrefix, globalSiteId)
local id = nil
local prop = nil
if arg then
if arg:sub(1,1) == ":" then
page = arg
eid = nil
elseif arg:sub(1,1):upper() == "Q" or arg:sub(1,9):lower() == "property:" or allowOmitPropPrefix then
eid = arg
page = nil
else
prop = arg
end
end
if eid then
if eid:sub(1,9):lower() == "property:" then
id = replaceAlias(mw.text.trim(eid:sub(10)))
if id:sub(1,1):upper() ~= "P" then
id = ""
end
else
id = replaceAlias(eid)
end
elseif page then
if page:sub(1,1) == ":" then
page = mw.text.trim(page:sub(2))
end
id = mw.wikibase.getEntityIdForTitle(page, globalSiteId) or ""
end
if not id then
id = mw.wikibase.getEntityIdForCurrentPage() or ""
end
id = id:upper()
if not mw.wikibase.isValidEntityId(id) then
id = ""
end
return id, prop
end
local function nextArg(args)
local arg = args[args.pointer]
if arg then
args.pointer = args.pointer + 1
return mw.text.trim(arg)
else
return nil
end
end
local function claimCommand(args, funcName)
local cfg = Config:new()
cfg:processFlagOrCommand(funcName) -- process first command (== function name)
local lastArg, parsedFormat, formatParams, claims, value
local hooks = {count = 0}
-- set the date if given;
-- must come BEFORE processing the flags
if args[p.args.date] then
cfg.atDate = {parseDate(args[p.args.date])}
cfg.periods = {false, true, false} -- change default time constraint to 'current'
end
-- process flags and commands
repeat
lastArg = nextArg(args)
until not cfg:processFlagOrCommand(lastArg)
-- get the entity ID from either the positional argument, the eid argument or the page argument
cfg.entityID, cfg.propertyID = getEntityId(lastArg, args[p.args.eid], args[p.args.page], false, args[p.args.globalSiteId])
if cfg.entityID == "" then
return "" -- we cannot continue without a valid entity ID
end
cfg.entity = mw.wikibase.getEntity(cfg.entityID)
if not cfg.propertyID then
cfg.propertyID = nextArg(args)
end
cfg.propertyID = replaceAlias(cfg.propertyID)
if not cfg.entity or not cfg.propertyID then
return "" -- we cannot continue without an entity or a property ID
end
cfg.propertyID = cfg.propertyID:upper()
if not cfg.entity.claims or not cfg.entity.claims[cfg.propertyID] then
return "" -- there is no use to continue without any claims
end
claims = cfg.entity.claims[cfg.propertyID]
if cfg.states.qualifiersCount > 0 then
-- do further processing if "qualifier(s)" command was given
if #args - args.pointer + 1 > cfg.states.qualifiersCount then
-- claim ID or literal value has been given
cfg.propertyValue = nextArg(args)
end
for i = 1, cfg.states.qualifiersCount do
-- check if given qualifier ID is an alias and add it
cfg.qualifierIDs[parameters.qualifier..i] = replaceAlias(nextArg(args) or ""):upper()
end
elseif cfg.states[parameters.reference] then
-- do further processing if "reference(s)" command was given
cfg.propertyValue = nextArg(args)
end
-- check for special property value 'somevalue' or 'novalue'
if cfg.propertyValue then
cfg.propertyValue = replaceSpecialChars(cfg.propertyValue)
if cfg.propertyValue ~= "" and mw.text.trim(cfg.propertyValue) == "" then
cfg.propertyValue = " " -- single space represents 'somevalue', whereas empty string represents 'novalue'
else
cfg.propertyValue = mw.text.trim(cfg.propertyValue)
end
end
-- parse the desired format, or choose an appropriate format
if args["format"] then
parsedFormat, formatParams = parseFormat(args["format"])
elseif cfg.states.qualifiersCount > 0 then -- "qualifier(s)" command given
if cfg.states[parameters.property] then -- "propert(y|ies)" command given
parsedFormat, formatParams = parseFormat(formats.propertyWithQualifier)
else
parsedFormat, formatParams = parseFormat(formats.qualifier)
end
elseif cfg.states[parameters.property] then -- "propert(y|ies)" command given
parsedFormat, formatParams = parseFormat(formats.property)
else -- "reference(s)" command given
parsedFormat, formatParams = parseFormat(formats.reference)
end
-- if a "qualifier(s)" command and no "propert(y|ies)" command has been given, make the movable separator a semicolon
if cfg.states.qualifiersCount > 0 and not cfg.states[parameters.property] then
cfg.separators["sep"..parameters.separator][1] = {";"}
end
-- if only "reference(s)" has been given, set the default separator to none (except when raw)
if cfg.states[parameters.reference] and not cfg.states[parameters.property] and cfg.states.qualifiersCount == 0
and not cfg.states[parameters.reference].rawValue then
cfg.separators["sep"][1] = nil
end
-- if exactly one "qualifier(s)" command has been given, make "sep%q" point to "sep%q1" to make them equivalent
if cfg.states.qualifiersCount == 1 then
cfg.separators["sep"..parameters.qualifier] = cfg.separators["sep"..parameters.qualifier.."1"]
end
-- process overridden separator values;
-- must come AFTER tweaking the default separators
cfg:processSeparators(args)
-- define the hooks that should be called (getProperty, getQualifiers, getReferences);
-- only define a hook if both its command ("propert(y|ies)", "reference(s)", "qualifier(s)") and its parameter ("%p", "%r", "%q1", "%q2", "%q3") have been given
for i, v in pairs(cfg.states) do
-- e.g. 'formatParams["%q1"] or formatParams["%q"]' to define hook even if "%q1" was not defined to be able to build a complete value for "%q"
if formatParams[i] or formatParams[i:sub(1, 2)] then
hooks[i] = getHookName(i, 1)
hooks.count = hooks.count + 1
end
end
-- the "%q" parameter is not attached to a state, but is a collection of the results of multiple states (attached to "%q1", "%q2", "%q3", ...);
-- so if this parameter is given then this hook must be defined separately, but only if at least one "qualifier(s)" command has been given
if formatParams[parameters.qualifier] and cfg.states.qualifiersCount > 0 then
hooks[parameters.qualifier] = getHookName(parameters.qualifier, 1)
hooks.count = hooks.count + 1
end
-- create a state for "properties" if it doesn't exist yet, which will be used as a base configuration for each claim iteration;
-- must come AFTER defining the hooks
if not cfg.states[parameters.property] then
cfg.states[parameters.property] = State:new(cfg, parameters.property)
-- if the "single" flag has been given then this state should be equivalent to "property" (singular)
if cfg.singleClaim then
cfg.states[parameters.property].singleValue = true
end
end
-- if the "sourced" flag has been given then create a state for "reference" if it doesn't exist yet, using default values,
-- which must exist in order to be able to determine if a claim has any references;
-- must come AFTER defining the hooks
if cfg.sourcedOnly and not cfg.states[parameters.reference] then
cfg:processFlagOrCommand(p.claimCommands.reference) -- use singular "reference" to minimize overhead
end
-- set the parsed format and the separators (and optional punctuation mark);
-- must come AFTER creating the additonal states
cfg:setFormatAndSeparators(cfg.states[parameters.property], parsedFormat)
-- process qualifier matching values, analogous to cfg.propertyValue
for i, v in pairs(args) do
i = tostring(i)
if i:match('^[Pp]%d+$') or aliasesP[i] then
v = replaceSpecialChars(v)
-- check for special qualifier value 'somevalue'
if v ~= "" and mw.text.trim(v) == "" then
v = " " -- single space represents 'somevalue'
end
cfg.qualifierIDsAndValues[replaceAlias(i):upper()] = v
end
end
-- first sort the claims on rank to pre-define the order of output (preferred first, then normal, then deprecated)
claims = sortOnRank(claims)
-- then iterate through the claims to collect values
value = cfg:concatValues(cfg.states[parameters.property]:iterate(claims, hooks, State.claimMatches)) -- pass property state with level 1 hooks and matchHook
-- if desired, add a clickable icon that may be used to edit the returned values on Wikidata
if cfg.editable and value ~= "" then
value = value .. cfg:getEditIcon()
end
return value
end
local function generalCommand(args, funcName)
local cfg = Config:new()
cfg.curState = State:new(cfg)
local lastArg
local value = nil
repeat
lastArg = nextArg(args)
until not cfg:processFlag(lastArg)
-- get the entity ID from either the positional argument, the eid argument or the page argument
cfg.entityID = getEntityId(lastArg, args[p.args.eid], args[p.args.page], true, args[p.args.globalSiteId])
if cfg.entityID == "" or not mw.wikibase.entityExists(cfg.entityID) then
return "" -- we cannot continue without an entity
end
-- serve according to the given command
if funcName == p.generalCommands.label then
value = cfg:getLabel(cfg.entityID, cfg.curState.rawValue, cfg.curState.linked, cfg.curState.shortName)
elseif funcName == p.generalCommands.title then
cfg.inSitelinks = true
if cfg.entityID:sub(1,1) == "Q" then
value = mw.wikibase.getSitelink(cfg.entityID)
end
if cfg.curState.linked and value then
value = buildWikilink(value)
end
elseif funcName == p.generalCommands.description then
value = mw.wikibase.getDescription(cfg.entityID)
else
local parsedFormat, formatParams
local hooks = {count = 0}
cfg.entity = mw.wikibase.getEntity(cfg.entityID)
if funcName == p.generalCommands.alias or funcName == p.generalCommands.badge then
cfg.curState.singleValue = true
end
if funcName == p.generalCommands.alias or funcName == p.generalCommands.aliases then
if not cfg.entity.aliases or not cfg.entity.aliases[cfg.langCode] then
return "" -- there is no use to continue without any aliasses
end
local aliases = cfg.entity.aliases[cfg.langCode]
-- parse the desired format, or parse the default aliases format
if args["format"] then
parsedFormat, formatParams = parseFormat(args["format"])
else
parsedFormat, formatParams = parseFormat(formats.alias)
end
-- process overridden separator values;
-- must come AFTER tweaking the default separators
cfg:processSeparators(args)
-- define the hook that should be called (getAlias);
-- only define the hook if the parameter ("%a") has been given
if formatParams[parameters.alias] then
hooks[parameters.alias] = getHookName(parameters.alias, 1)
hooks.count = hooks.count + 1
end
-- set the parsed format and the separators (and optional punctuation mark)
cfg:setFormatAndSeparators(cfg.curState, parsedFormat)
-- iterate to collect values
value = cfg:concatValues(cfg.curState:iterate(aliases, hooks))
elseif funcName == p.generalCommands.badge or funcName == p.generalCommands.badges then
if not cfg.entity.sitelinks or not cfg.entity.sitelinks[cfg.siteID] or not cfg.entity.sitelinks[cfg.siteID].badges then
return "" -- there is no use to continue without any badges
end
local badges = cfg.entity.sitelinks[cfg.siteID].badges
cfg.inSitelinks = true
-- parse the desired format, or parse the default aliases format
if args["format"] then
parsedFormat, formatParams = parseFormat(args["format"])
else
parsedFormat, formatParams = parseFormat(formats.badge)
end
-- process overridden separator values;
-- must come AFTER tweaking the default separators
cfg:processSeparators(args)
-- define the hook that should be called (getBadge);
-- only define the hook if the parameter ("%b") has been given
if formatParams[parameters.badge] then
hooks[parameters.badge] = getHookName(parameters.badge, 1)
hooks.count = hooks.count + 1
end
-- set the parsed format and the separators (and optional punctuation mark)
cfg:setFormatAndSeparators(cfg.curState, parsedFormat)
-- iterate to collect values
value = cfg:concatValues(cfg.curState:iterate(badges, hooks))
end
end
value = value or ""
if cfg.editable and value ~= "" then
-- if desired, add a clickable icon that may be used to edit the returned value on Wikidata
value = value .. cfg:getEditIcon()
end
return value
end
-- modules that include this module should call the functions with an underscore prepended, e.g.: p._property(args)
local function establishCommands(commandList, commandFunc)
for _, commandName in pairs(commandList) do
local function wikitextWrapper(frame)
local args = copyTable(frame.args)
args.pointer = 1
loadI18n(aliasesP, frame)
return commandFunc(args, commandName)
end
p[commandName] = wikitextWrapper
local function luaWrapper(args)
args = copyTable(args)
args.pointer = 1
loadI18n(aliasesP)
return commandFunc(args, commandName)
end
p["_" .. commandName] = luaWrapper
end
end
establishCommands(p.claimCommands, claimCommand)
establishCommands(p.generalCommands, generalCommand)
-- main function that is supposed to be used by wrapper templates
function p.main(frame)
if not mw.wikibase then return nil end
local f, args
loadI18n(aliasesP, frame)
-- get the parent frame to take the arguments that were passed to the wrapper template
frame = frame:getParent() or frame
if not frame.args[1] then
throwError("no-function-specified")
end
f = mw.text.trim(frame.args[1])
if f == "main" then
throwError("main-called-twice")
end
assert(p["_"..f], errorText('no-such-function', f))
-- copy arguments from immutable to mutable table
args = copyTable(frame.args)
-- remove the function name from the list
table.remove(args, 1)
return p["_"..f](args)
end
return p
1ca0c98a70b8bfc8ac5dc6df005800c159e457e8
Module:Wd/i18n
828
277
547
546
2023-12-24T02:29:10Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Wd/i18n]]
Scribunto
text/plain
-- The values and functions in this submodule should be localized per wiki.
local p = {}
function p.init(aliasesP)
p = {
["errors"] = {
["unknown-data-type"] = "Unknown or unsupported datatype '$1'.",
["missing-required-parameter"] = "No required parameters defined, needing at least one",
["extra-required-parameter"] = "Parameter '$1' must be defined as optional",
["no-function-specified"] = "You must specify a function to call", -- equal to the standard module error message
["main-called-twice"] = 'The function "main" cannot be called twice',
["no-such-function"] = 'The function "$1" does not exist', -- equal to the standard module error message
["malformed-reference"] = "Error: Unable to display the reference properly. See [[Module:wd/doc#References|the documentation]] for details.[[Category:Module:Wd reference errors]]"
},
["info"] = {
["edit-on-wikidata"] = "Edit this on Wikidata"
},
["numeric"] = {
["decimal-mark"] = ".",
["delimiter"] = ","
},
["datetime"] = {
["prefixes"] = {
["decade-period"] = ""
},
["suffixes"] = {
["decade-period"] = "s",
["millennium"] = " millennium",
["century"] = " century",
["million-years"] = " million years",
["billion-years"] = " billion years",
["year"] = " year",
["years"] = " years"
},
["julian-calendar"] = "Julian calendar", -- linked page title
["julian"] = "Julian",
["BCE"] = "BCE",
["CE"] = "CE",
["common-era"] = "Common Era" -- linked page title
},
["coord"] = {
["latitude-north"] = "N",
["latitude-south"] = "S",
["longitude-east"] = "E",
["longitude-west"] = "W",
["degrees"] = "°",
["minutes"] = "'",
["seconds"] = '"',
["separator"] = ", "
},
["values"] = {
["unknown"] = "unknown",
["none"] = "none"
},
["cite"] = {
["version"] = "4", -- increment this each time the below parameters are changed to avoid conflict errors
["web"] = {
-- <= left side: all allowed reference properties for *web page sources* per https://www.wikidata.org/wiki/Help:Sources
-- => right side: corresponding parameter names in (equivalent of) [[:en:Template:Cite web]] (if non-existent, keep empty i.e. "")
[aliasesP.statedIn] = "website",
[aliasesP.referenceURL] = "url",
[aliasesP.publicationDate] = "date",
[aliasesP.retrieved] = "access-date",
[aliasesP.title] = "title",
[aliasesP.archiveURL] = "archive-url",
[aliasesP.archiveDate] = "archive-date",
[aliasesP.language] = "language",
[aliasesP.author] = "author", -- existence of author1, author2, author3, etc. is assumed
[aliasesP.authorNameString] = "author",
[aliasesP.publisher] = "publisher",
[aliasesP.quote] = "quote",
[aliasesP.pages] = "pages", -- extra option
[aliasesP.publishedIn] = "website"
},
["q"] = {
-- <= left side: all allowed reference properties for *sources other than web pages* per https://www.wikidata.org/wiki/Help:Sources
-- => right side: corresponding parameter names in (equivalent of) [[:en:Template:Cite Q]] (if non-existent, keep empty i.e. "")
[aliasesP.statedIn] = "1",
[aliasesP.pages] = "pages",
[aliasesP.column] = "at",
[aliasesP.chapter] = "chapter",
[aliasesP.sectionVerseOrParagraph] = "section",
["external-id"] = "id", -- used for any type of database property ID
[aliasesP.title] = "title",
[aliasesP.publicationDate] = "date",
[aliasesP.retrieved] = "access-date"
}
}
}
p.getOrdinalSuffix = function(num)
if tostring(num):sub(-2,-2) == '1' then
return "th" -- 10th, 11th, 12th, 13th, ... 19th
end
num = tostring(num):sub(-1)
if num == '1' then
return "st"
elseif num == '2' then
return "nd"
elseif num == '3' then
return "rd"
else
return "th"
end
end
p.addDelimiters = function(n)
local left, num, right = string.match(n, "^([^%d]*%d)(%d*)(.-)$")
if left and num and right then
return left .. (num:reverse():gsub("(%d%d%d)", "%1" .. p['numeric']['delimiter']):reverse()) .. right
else
return n
end
end
return p
end
return p
a860785cf3b9ad3ba0c8096d5627eae877d4e9ab
Template:Code
10
278
549
548
2023-12-24T02:29:13Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Code]]
wikitext
text/x-wiki
{{#tag:syntaxhighlight|{{{code|{{{1}}}}}}|lang={{{lang|{{{2|text}}}}}}|class={{{class|}}}|id={{{id|}}}|style={{{style|}}}|inline=1}}<noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage, interwikis to Wikidata, not here -->
</noinclude>
5d9b1a0980efe1b02eb91bc717438a5ae4a5ee04
Template:Tt
10
279
551
550
2023-12-24T02:29:14Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Tt]]
wikitext
text/x-wiki
#REDIRECT [[Template:Mono]]
a7a3647ba0499a71e399c9dd87e77998307f51bf
Template:Q
10
280
553
552
2023-12-24T02:29:14Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Q]]
wikitext
text/x-wiki
#REDIRECT [[Template:Wikidata entity link]]
[[Category:Wikidata templates]]
{{Redirect category shell|
{{R from template shortcut}}
{{R from move}}
}}
7f19fdcb2b05d966cd3f0f5f540cf8fa37935869
Template:Wikidata entity link
10
281
555
554
2023-12-24T02:29:15Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Wikidata_entity_link]]
wikitext
text/x-wiki
<includeonly>{{#if:{{{1|}}}
| {{#switch:{{padleft:|1|{{uc:{{{1}}}}}}}
| Q | P = [[d:Special:EntityPage/{{uc:{{{1}}}}}|{{#invoke:wd|label|{{uc:{{{1}}}}}}} <small>({{uc:{{{1}}}}})</small>]]
| #default = [[d:Special:EntityPage/Q{{uc:{{{1}}}}}|{{#invoke:wd|label|Q{{uc:{{{1}}}}}}} <small>(Q{{uc:{{{1|}}}}})</small>]]
}}
| {{#if:{{#invoke:wd|label|raw}}
| [[d:Special:EntityPage/{{#invoke:wd|label|raw}}|{{#invoke:wd|label}} <small>({{#invoke:wd|label|raw}})</small>]]
| <small>(no entity)</small>
}}
}}</includeonly><noinclude>{{Documentation}}</noinclude>
3eaf99f5fdf869bc08932bb8eda9eba23858c9c8
Template:Endplainlist
10
282
557
556
2023-12-24T02:29:17Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Endplainlist]]
wikitext
text/x-wiki
<includeonly></div></includeonly><noinclude>
{{documentation|Template:Plainlist/doc}}
</noinclude>
d545c41582328dd4f197e2b1848c8ad7392b92e0
Template:Cob
10
283
559
558
2023-12-24T02:29:17Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Cob]]
wikitext
text/x-wiki
#REDIRECT [[Template:Collapse bottom]]
{{Redirect category shell|
{{R from template shortcut}}
}}
1cd16c56552caeb938d794d973d1a13c885f7830
Template:Cot
10
284
561
560
2023-12-24T02:29:18Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Cot]]
wikitext
text/x-wiki
#REDIRECT [[Template:Collapse top]]
{{Redirect category shell|
{{R from template shortcut}}
}}
708f8bf79aefbfe8ee62f4fa68561059be0372d2
Template:Kbd
10
285
563
562
2023-12-24T02:29:18Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Kbd]]
wikitext
text/x-wiki
<kbd {{#if:{{{class|}}}|class="{{{class}}}"}} {{#if:{{{id|}}}|id="{{{id}}}"}} style="background:#EEEEEE; {{#if:{{{spacing|}}}| padding-left:{{{padding|0.2em}}}; padding-right:{{{padding|0.2em}}};| letter-spacing:0.05em; padding-left:0.25em; padding-right:0.2em;}}{{#if:{{{style|}}}|{{{style}}}}}" {{#if:{{{lang|}}}|lang="{{{lang}}}"}} {{#if:{{{title|}}}|title="{{{title}}}"}}>{{{1|user input}}}</kbd><noinclude>
<!--Categories go near the bottom of the /doc page.-->
{{Documentation}}
</noinclude>
4717d3a6d1c5c1b826066ac2a794cc6c92b43ac3
Template:Lua sidebar
10
286
565
564
2023-12-24T02:29:20Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Lua_sidebar]]
wikitext
text/x-wiki
{{Sidebar
| class = lua-sidebar
| templatestyles = Template:Lua sidebar/styles.css
| title = Related pages
| content1 = {{plainlist}}
* [[Template:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}|Template]] {{#if:{{#invoke:redirect|isRedirect|Template talk:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}}}||([[Template talk:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}|talk]])}}
* [[Template:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}/sandbox|Template sandbox]]
* [[Template:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}/testcases|Template testcases]]
* [[Template:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}/doc|Template doc]]
* [[Special:PrefixIndex/Template:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}/|Template subpages]]
* [[Module:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}|Module]] {{#if:{{#invoke:redirect|isRedirect|Module talk:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}}}||([[Module talk:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}|talk]])}}
* [[Module:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}/sandbox|Module sandbox]]
* [[Module talk:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}/testcases|Module testcases]]
* [[Module:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}/doc|Module doc]]
* [[Special:PrefixIndex/Module:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}/|Module subpages]]
{{endplainlist}}
| content2 = {{{1|}}}
}}<noinclude>
{{Documentation}}
</noinclude>
f11e49d67a400d29f6d73720fea7eb5a273ab663
Template:Lua sidebar/styles.css
10
287
567
566
2023-12-24T02:29:21Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Lua_sidebar/styles.css]]
sanitized-css
text/css
.lua-sidebar {
width: auto;
max-width: 22em;
}
9984d36eb49fae70dd00527c993784d775409a6b
Template:Infobox mapframe/doc/parameters
10
288
569
568
2023-12-24T02:29:23Z
Floopymichael
2
1 revision imported from [[:wikipedia:Template:Infobox_mapframe/doc/parameters]]
wikitext
text/x-wiki
<noinclude>{{Documentation}}</noinclude><includeonly>{{navbar|Template:Infobox mapframe/doc/parameters|plain=y|style=float: right;}}</includeonly><nowiki></nowiki>
*Basic parameters:{{#if:{{{noprefix|}}}||<nowiki></nowiki>
**'''mapframe''' – Specify yes or no to show or hide the map, overriding the default. ''Default:'' {{{mapframe|no}}}
**'''mapframe-caption''' – Caption for the map. ''Default'': {{{mapframe-caption|''blank'' (or if {{para|mapframe-geomask}} is set, "Location in {{kbd|geomask's label}}")}}}
**'''mapframe-custom''' – Use a custom map instead of the automatic mapframe. Specify either a {{tlx|maplink}} template, or another template that generates a mapframe map, or an image name. If used, the subsequent mapframe parameters will be ignored. ''Default'': ''not specified''}}
**{{#if:{{{noprefix|}}}|'''id'''|'''mapframe-id''' or '''id''' or '''qid'''}} – Id (Q-number) of Wikidata item to use. ''Default:'' ''item for current page''
**{{#if:{{{noprefix|}}}||'''mapframe-coordinates''' or '''mapframe-coord''' or}} '''coordinates''' or '''coord''' – Coordinates to use, instead of any on Wikidata. Use the {{tl|Coord}} template, e.g. {{para|coord|2={{tlx|Coord|12.34|N|56.78|E}}}}. ''Default:'' ''coordinates from Wikidata''
**'''{{#if:{{{noprefix|}}}||mapframe-}}wikidata''' – Set to {{code|yes}} to show shape/line features from the wikidata item, if any, when {{para|coord}} is set. ''Default:'' {{{mapframe-wikidata|''not specified''}}}
*Customise which features are displayed:
**'''{{#if:{{{noprefix|}}}||mapframe-}}shape''' – Turn off display of shape feature by setting to {{code|none}}. Use an inverse shape (geomask) instead of a regular shape by setting to {{code|inverse}}. ''Default:'' {{{mapframe-shape|''not specified''}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}point''' – Turn off display of point feature by setting to {{code|none}}. Force point marker to be displayed by setting to {{code|on}}. ''Default:'' {{{mapframe-point|''not specified''}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}line''' – Turn off display of line feature by setting to {{code|none}}. ''Default:'' {{{mapframe-line|''not specified''}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}geomask''' – Wikidata item to use as a geomask (everything outside the boundary is shaded darker). Can either be a specific Wikidata item (Q-number), or a property that specifies the item to use (e.g. <code>P17</code> for {{Q|P17}}, <code>P131</code> for {{Q|P131}}). ''Default:'' {{{mapframe-marker|''not specified''}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}switcher''' – set to {{code|auto}} or {{code|geomasks}} or {{code|zooms}} to enable [[Template:Switcher]]-style switching between multiple mapframes. ''Default:'' {{{mapframe-switcher|''not specified''}}}
***{{code|auto}} – switch geomasks found in {{Q|P276}} and {{Q|P131}} statements on the page's Wikidata item, searching recursively. E.g. an item's city, that city's state, and that state's country.
***{{code|geomasks}} – switch between the geomasks specified as a comma-separated list of Wikidata items (Q-numbers) in the '''{{#if:{{{noprefix|}}}||mapframe-}}geomask''' parameter
***{{code|zooms}} – switch between "zoomed in"/"zoomed midway"/"zoomed out", where "zoomed in" is the default zoom (with a minimum of {{code|3}}), "zoomed out" is {{code|1}}, and "zoomed midway" is the average
*Other optional parameters:
**'''{{#if:{{{noprefix|}}}||mapframe-}}frame-width''' or '''{{#if:{{{noprefix|}}}||mapframe-}}width''' – Frame width. ''Default:'' {{{mapframe-frame-width|270}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}frame-height''' or '''{{#if:{{{noprefix|}}}||mapframe-}}height''' – Frame height. ''Default:'' {{{mapframe-frame-height|200}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}shape-fill''' – Color used to fill shape features. ''Default:'' {{{mapframe-shape-fill|#606060}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}shape-fill-opacity''' – Opacity level of shape fill, a number between 0 and 1. ''Default:'' {{{mapframe-shape-fill-opacity|0.5}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}stroke-color''' or '''{{#if:{{{noprefix|}}}||mapframe-}}stroke-colour''' – Color of line features, and outlines of shape features. ''Default:'' {{{mapframe-stroke-color|{{{mapframe-stroke-colour|#ff0000}}}}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}stroke-width''' – Width of line features, and outlines of shape features; default is "5". ''Default:'' {{{mapframe-stroke-width|5}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}marker''' – Marker symbol to use for coordinates; see [[mw:Help:Extension:Kartographer/Icons]] for options. ''Default:'' {{{mapframe-marker|''not specified (i.e. blank)''}}}
***Can also be set to {{code|blank}} to override any default marker symbol
**'''{{#if:{{{noprefix|}}}||mapframe-}}marker-color''' or '''{{#if:{{{noprefix|}}}||mapframe-}}marker-colour''' – Background color for the marker. ''Default:'' {{{mapframe-marker-color|{{{mapframe-marker-colour|#5E74F3}}}}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}geomask-stroke-color''' or '''{{#if:{{{noprefix|}}}||mapframe-}}geomask-stroke-colour''' – Color of outline of geomask shape. ''Default:'' {{{mapframe-geomask-stroke-color|{{{mapframe-geomask-stroke-colour|#555555}}}}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}geomask-stroke-width''' – Width of outline of geomask shape. ''Default:'' {{{mapframe-geomask-stroke-width|2}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}geomask-fill''' – Color used to fill outside geomask features. ''Default:'' {{{mapframe-geomask-fill|#606060}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}geomask-fill-opacity''' – Opacity level of fill outside geomask features, a number between 0 and 1. ''Default:'' {{{mapframe-geomask-fill-opacity|0.5}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}zoom''' – Set the zoom level, from "1" (map of earth) to "18" (maximum zoom in), to be used if the zoom level cannot be determined automatically from object length or area. ''Default:'' {{{mapframe-zoom|10}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}length_km {{nobold|or}} {{#if:{{{noprefix|}}}||mapframe-}}length_mi {{nobold|or}} {{#if:{{{noprefix|}}}||mapframe-}}area_km2 {{nobold|or}} {{#if:{{{noprefix|}}}||mapframe-}}area_mi2''' – Determine zoom level by passing in object's length (in kilometres or miles) or area (in square kilometres or square miles). ''Default:'' ''not specified''
**'''{{#if:{{{noprefix|}}}||mapframe-}}frame-coordinates''' or '''{{#if:{{{noprefix|}}}||mapframe-}}frame-coord''' – Alternate latitude and longitude coordinates for initial placement of map, using {{tl|coord}}. ''Default:'' ''derived from item coordinates''{{#if:{{{deprecated|}}}|<nowiki></nowiki>
*Deprecated parameters
**{{gray|1='''{{#if:{{{noprefix|}}}||mapframe-}}frame-lat''' or '''{{#if:{{{noprefix|}}}||mapframe-}}frame-latitude'''}} – Alternate latitude coordinate for initial placement of map; default is derived from item coordinates
**{{gray|1='''{{#if:{{{noprefix|}}}||mapframe-}}frame-long''' or '''{{#if:{{{noprefix|}}}||mapframe-}}frame-longitude'''}} – Alternate longitude coordinate for initial placement of map; default is derived from item coordinates
}}
cff45f38e77371fef06f83bec6bdbffebc880c3f
Module:Infobox mapframe/doc
828
289
571
570
2023-12-24T02:29:24Z
Floopymichael
2
1 revision imported from [[:wikipedia:Module:Infobox_mapframe/doc]]
wikitext
text/x-wiki
{{Module rating|beta}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{High-use}}
{{Lua sidebar}}
== Usage ==
Module that automatically makes a mapframe suitable for an infobox automatically, with minimal user input.
===Generic usage===
Just use the template {{tl|Infobox mapframe}}, following the documentation there. This module may also be imported to another Lua module.
===Automatic maps in infoboxes===
:''Example edits: [https://en.wikipedia.org/w/index.php?title=Template%3AInfobox_prison&type=revision&diff=962824818&oldid=782742135 Template:Infobox prison], [https://en.wikipedia.org/w/index.php?title=Template%3AInfobox_prison%2Fdoc&type=revision&diff=962825435&oldid=768262729 Template:Infobox prison/doc]''
Edit the infobox template (or its sandbox).
Add lines like the following examples to the infobox. Replace numbers ({{kbd|4}}, or {{kbd|97}} to {{kbd|99}}), with the appropriate number based on how many other image or data parameters are already present.
{|style=width:100%
|-
! If placing near the top of infobox !! If placing at/near the bottom of the infobox
|-
|<pre>
| image4 = {{#invoke:Infobox mapframe|auto}}
| caption4 = {{#invoke:Infobox mapframe|autocaption}}
</pre>
|<pre>
| header97 = {{#if:{{{mapframe|}}}|Location}}
| data98 = {{#invoke:Infobox mapframe|auto}}
| data99 = {{#invoke:Infobox mapframe|autocaption}}
</pre>
|}
If the template has a <code><nowiki>{{#invoke:</nowiki>[[Module:Check for unknown parameters|Check for unknown parameters]]<nowiki>}}</nowiki></code>, add the following parameters:
<pre>
| mapframe | mapframe-area_km2 | mapframe-area_mi2 | mapframe-caption | mapframe-coord | mapframe-coordinates | mapframe-custom | mapframe-frame-coord | mapframe-frame-coordinates | mapframe-frame-height | mapframe-frame-width | mapframe-geomask | mapframe-geomask-fill | mapframe-geomask-fill-opacity | mapframe-geomask-stroke-color | mapframe-geomask-stroke-colour | mapframe-geomask-stroke-width | mapframe-height | mapframe-id | mapframe-length_km | mapframe-length_mi | mapframe-marker | mapframe-marker-color | mapframe-marker-colour | mapframe-point | mapframe-shape | mapframe-shape-fill | mapframe-shape-fill-opacity | mapframe-stroke-color | mapframe-stroke-colour | mapframe-stroke-width | mapframe-switcher | mapframe-width | mapframe-wikidata | mapframe-zoom
</pre>
Once this is done, the above parameters will be available to users of the template.
* Defaults values for these parameters can also be specified in the {{kbd|#invoke}} calls above, e.g. <code><nowiki>{{#invoke:Infobox mapframe|auto|mapframe-marker=library}}</nowiki></code> means that the library marker will be used, unless a different value is passed in to the template.
* The maps are off by default, which means maps will not be displayed unless {{para|mapframe|yes}} is present in the template call. To turn maps on by default, in the {{kbd|#invoke}} calls above add {{para|onByDefault|yes}} – which means maps will be displayed unless {{para|mapframe|no}} is present in the template call. {{kbd|onByDefault}} can also be set to a conditional, such as if another parameters is present, e.g. {{para|onByDefault|2=<nowiki>{{#if:{{{pushpin_map|}}}|no|yes}}</nowiki>}}
* Add the new parameters to the document. You can use {{tlx|Infobox mapframe/doc/parameters}}. Specify default values (if any are used in the {{kbd|#invoke}} calls) using by adding parameters in the form {{tt|{{!}}}}''parameter-name''{{tt|{{=}}}}''value''. The default output is shown here collapsed:
{{cot}}
{{Infobox mapframe/doc/parameters}}
{{cob}}
*Parameters can also be added to the TemplateData can also be added by copy-pasting from {{edit|Template:Infobox mapframe/doc/templatedata|Template:Infobox mapframe/doc/templatedata}}
== See also ==
* [[Wikipedia:Mapframe maps in infoboxes]]
* [[Module:Mapframe]] & [[Template:Maplink]]
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<!-- Categories below this line, please; interwikis at Wikidata -->
}}</includeonly>
51cd0f5b193959f102c4be64250d13289a60a5fa
User talk:Floopymichael
3
290
572
2023-12-24T03:15:58Z
Windfarmer
4
Created page with ""Sir, a fourth LTET has hit the capitol" ~~~~"
wikitext
text/x-wiki
"Sir, a fourth LTET has hit the capitol" [[User:Windfarmer|Windfarmer]] ([[User talk:Windfarmer|talk]]) 03:15, 24 December 2023 (UTC)
c85a140a56073874f7d79f4be6b28e00541195e7
User:Windfarmer
2
291
573
2023-12-24T05:08:02Z
Windfarmer
4
Created page with "haunting your wiki before its official release"
wikitext
text/x-wiki
haunting your wiki before its official release
28398e0390b9ead19caa1288ea0a840b780cb7fb